How to disable legend click to stop pie slice from

2019-01-11 17:20发布

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??

3条回答
▲ chillily
2楼-- · 2019-01-11 17:33
pie: {
   showInLegend: true,
   allowPointSelect: false,
   point:{
       events : {
        legendItemClick: function(e){
            e.preventDefault();
        }
       }
   }
 }
查看更多
走好不送
3楼-- · 2019-01-11 17:44

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/

查看更多
何必那么认真
4楼-- · 2019-01-11 17:46
pie: {
   showInLegend: true,
   allowPointSelect: false,  // disable selected
}
查看更多
登录 后发表回答