How to disable legend click to stop pie slice from disappearing in Highcharts?

我们两清 提交于 2019-12-17 11:27:12

问题


How to disable legend click to stop pie slice from disappearing in Highcharts??

See example here:

http://www.highcharts.com/demo/pie-legend

Can anyone help??


回答1:


You do this by attaching a handler to the legendItemClick event and just returning false. This will prevent the default action which is to toggle the pie sector.

point: {
    events: {
        legendItemClick: function () {
            return false; // <== returning false will cancel the default action
        }
    }
}

See this example http://jsfiddle.net/mfras3r/3vVGB/1/




回答2:


pie: {
   showInLegend: true,
   allowPointSelect: false,
   point:{
       events : {
        legendItemClick: function(e){
            e.preventDefault();
        }
       }
   }
 }



回答3:


pie: {
   showInLegend: true,
   allowPointSelect: false,  // disable selected
}


来源:https://stackoverflow.com/questions/7833385/how-to-disable-legend-click-to-stop-pie-slice-from-disappearing-in-highcharts

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