本文介绍了JQPlot - 饼图 - 获取单击的切片颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的要求是在用户点击时获取饼图切片的选定颜色。
如果我能在以下函数中执行此操作会很好:
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.
推荐答案
是的,你可以得到颜色:
Yes you can get the color :
plot.series[seriesIndex].seriesColors[pointIndex]
其中 plot
是存储jqPlot的var
where plot
is the var in which you store your jqPlot
这篇关于JQPlot - 饼图 - 获取单击的切片颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!