0
如果我們拿這個例子:http://www.highcharts.com/demo/combo鏈接/共享圖例與餅圖和列?
如何在餅圖和列之間共享圖例?我想在同一時間點擊列和AND派的傳說時,可以使/禁用一個serie!
如果我們拿這個例子:http://www.highcharts.com/demo/combo鏈接/共享圖例與餅圖和列?
如何在餅圖和列之間共享圖例?我想在同一時間點擊列和AND派的傳說時,可以使/禁用一個serie!
綁定legendItemClick
事件並在餅圖中隱藏連接的切片。演示:http://jsfiddle.net/x8ygvwbx/1/
plotOptions: {
series: {
events: {
legendItemClick: function(e) {
var vis = this.visibility,
name = this.name,
pie = this.chart.get("my-pie"), // set pie's ID
index = pie.options.legendNames.indexOf(name); // get index of names
pie.points[index].setVisible(vis); //change visibility
}
}
}
},
和舉例餡餅選項:
{
id: "my-pie", // ID
type: 'pie',
name: 'Total consumption',
legendNames: ["Jane", "John", "Joe"], //NAMES
data: [{
name: 'Jane',
y: 13,
color: Highcharts.getOptions().colors[0] // Jane's color
}, {
name: 'John',
y: 23,
color: Highcharts.getOptions().colors[1] // John's color
}, {
name: 'Joe',
y: 19,
color: Highcharts.getOptions().colors[2] // Joe's color
}]
}