4

I have implemented a simple bar chart,

ive added tooltip feature using highlighter but i am facing an issue with the same.

When i move the mouse down and exit the chart canvas the tooltip doesnt dismiss

enter image description here

I have tried adding

 $.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMove]);
 $.jqplot.eventListenerHooks.push(['jqplotMouseLeave', handleMove]);

But it doesnt work , i get the error handleMove is not defined

Here is the code fiddle for the same

https://jsfiddle.net/9j2na3L7/

usr30911
  • 2,731
  • 7
  • 26
  • 56
  • 1
    solved below :) please mark as solved and +1 the answer if it was helpful. And thank you for jsfiddle, it was very helpful. – Piotr Dajlido Mar 17 '15 at 07:36

1 Answers1

4

I finally got this working :)

-- PROBLEM:

  • Mouse cursor escaping too fast from canvas, prevents event form fireing

-- SOLUTION:

First of all grab a handle of jplot object

var plotBar = $.jqplot('task_brk_bar_chart', [...

So we can use it to manipulate it on run-time.

Then we will use jqplotDataHighlight and jqplotDataUnHighlight events to change the graph properties and replot() function to apply them on fly.

$('#task_brk_bar_chart').bind('jqplotDataHighlight', function () {
    plotBar.showTooltip = true;
    plotBar.replot();
});
$('#task_brk_bar_chart').bind('jqplotDataUnhighlight', function () {
    plotBar.showTooltip = false;
    plotBar.repolot();
});

Working fiddle : https://jsfiddle.net/urahara/9j2na3L7/1/

Note: Copy your old css to override my setting, it was for testing purposes only.

Cheers!

Piotr Dajlido
  • 1,982
  • 15
  • 28