问题
my requirement is to get the selected colour of the pie slice when the user clicks on it. It would be good if I can do it within the following function:
$('#chart1').bind('jqplotDataClick',
function (ev, seriesIndex, pointIndex, data) {
alert("ev = " + ev + " seriesIndex = " + seriesIndex + "pointIndex = " + pointIndex + "data = " + data);
});
Any ideas? Thanks.
回答1:
Yes you can get the color :
plot.series[seriesIndex].seriesColors[pointIndex]
where plot
is the var in which you store your jqPlot
Working Example here
来源:https://stackoverflow.com/questions/10701321/jqplot-pie-chart-get-the-clicked-slice-colour