1

I have an event handler declared as:

.on('jqplotMouseMove', function (e, gridpos, datapos, neighbor, plot)

If neighbor is true I need to find the color of the datapoint they clicked on. Is there some method I can call that will give me that?

4

1 回答 1

1

You can get the seriesIndex from the neighbor variable, which you can use to get the color.

$('#chart1').bind('jqplotMouseMove',
   function (e, gridpos, datapos, neighbor, plot) {                
     if (neighbor != null){
        alert(plot1.series[neighbor.seriesIndex].color);
     }
  }
);

Fiddle here.

于 2013-01-14T00:48:51.150 回答