i'm switching flot graphs towards using bootstrap tooltips. i've encountered bug if 2 items close tooltip doesn't follow.

as can see in image above, i'm hovering lower datapoint while bootstrap tooltip still stuck on datapoint above.
i'm using following code. guess problem situated @ if(item) stays true while hovering down. thinking of working global variable seems messy solution. ideas?
placeholder.bind('plothover', function (event, pos, item) { if (item) { var x = item.datapoint[0], y = item.datapoint[1], label = item.series.label; box.css({ top: item.pagey - 2, left: item.pagex + 1 }); if ($('.tooltip').length === 0) { box.tooltip({ placement: 'top', title: label + ': ' + y }).tooltip('show'); } } else { box.tooltip('destroy'); } });
the global variable store item tooltip shown default solution in flot this, here:
previtem = null; placeholder.bind('plothover', function (event, pos, item) { if (item) { if (previtem != item.dataindex + item.seriesindex / 100) { previtem = item.dataindex + item.seriesindex / 100; // show / update tooltip } } else { previtem = null; box.tooltip('destroy'); } }); i tried working in fiddle , worked of time. there issues bootstrap tooltip not updates text properly. destroying , recreating tooltip solves brings flicker.
Comments
Post a Comment