JQPlot - Pie chart - get the clicked slice colour

你。 提交于 2019-12-10 16:26:57

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!