use*_*413 3 javascript highcharts
我想在饼图中选择多个部分。如果已选择,则应在单击时取消选择该部分。
我在这里找到了一个例子。但是在这种情况下,只能选择一个部分,而单击任何其他部分,则将选定的部分取消选择。
同样,我找到了另一个示例[
$(function(){var chart = new Highcharts.Chart({chart:{renderTo:'container',type:'pie'
Run Code Online (Sandbox Code Playgroud)}, plotOptions: { series: { states: { hover: { enabled: false } }, point: { events: { click: function () { this.graphic.attr({ fill: 'yellow' }); } } } } }, tooltip: { enabled: false }, series: [{ data: [{ name: 'test', y: 29.9, color: "#CCCCCC", active: false }, { name: 'test2', y: 71.5, color: "#CCCCCC", active: false }, { name: 'test3', y: 106.4, color: "#CCCCCC", active: false }] }] }); });
] 2。在这种情况下,可以选择多个部分,但是在再次单击时不会取消选择它们。
请帮忙 !!
尝试以下解决方案:http : //jsfiddle.net/3zy8p/13/
plotOptions: {
series: {
point: {
events: {
click: function(event){
this.slice(null);
this.select(null, true);
console.log(this.series.chart.getSelectedPoints());
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2081 次 |
| 最近记录: |