[英]Verify if Pie in Highcharts Pie charts is selected or deselected
I have to show a popup whenever a pie is selected and do nothing when it is deselected. I have to show a popup whenever a pie is selected and do nothing when it is deselected. I am not able to figure out on a click event how to figure out if the Pie is selected by user or deleted.
我无法弄清楚点击事件如何确定派是被用户选择还是被删除。 I tried to do Palin JS Logic there but it is a little buggy.
我试图在那里做Palin JS Logic,但它有点小错误。 Any solution that Highcharts provide?
Highcharts 提供的任何解决方案?
chart: {
type: 'pie',
marginLeft: 0,
options3d: {
enabled: false,
alpha: 45,
beta: 0
}
},
tooltip: {
formatter: function(){
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
depth: 35,
dataLabels: {
enabled: true,
formatter: function(){
}
},
showInLegend: true,
point: {
events: {
click: function(){
var selectedPieSliceIndex;
if(!this.selected) {
selectedPieSliceIndex = this.x;
}
else {
selectedPieSliceIndex = null;
}
chartComponent.trigger("onPieSliceClick", selectedPieSliceIndex);
var that = this;
if (this.pieSelected && clickedSliced.length > 0){
that.pieSelected = false;
clickedSliced = [];
} else {
that.pieSelected = true;
clickedSliced.push(that.name)
}
if(this.pieSelected && clickedSliced.length){
uiDialogue.loadDialog('Chart Initiatives', jsonData);
}
}
}
}
}
},
series: [
{
type: 'pie',
innerSize: 100 ,
depth: 45 ,
name: '',
data: pieChartSeries
}
],
title: {
text: "",
verticalAlign: 'middle',
x: -3,
y: -4,
floating: true,
},
exporting: {
chartOptions: {
plotOptions: {
pie: {
dataLabels: {
}
}
}
}
}
}
}
Any suggestion or any inbuilt solution that Highchart has? Highchart 有任何建议或任何内置解决方案吗?
Have you tried to do something like this?你试过做这样的事情吗?
Demo: https://jsfiddle.net/BlackLabel/3qxL5r7f/演示: https://jsfiddle.net/BlackLabel/3qxL5r7f/
point: {
events: {
click: function() {
if (!this.selected) {
console.log('show popup')
} else {
console.log('hide popup')
}
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.