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

后端 未结 3 758
不知归路
不知归路 2020-12-03 10:09

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

See example here:

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

Can anyon

相关标签:
3条回答
  • 2020-12-03 10:46
    pie: {
       showInLegend: true,
       allowPointSelect: false,  // disable selected
    }
    
    0 讨论(0)
  • 2020-12-03 10:53
    pie: {
       showInLegend: true,
       allowPointSelect: false,
       point:{
           events : {
            legendItemClick: function(e){
                e.preventDefault();
            }
           }
       }
     }
    
    0 讨论(0)
  • 2020-12-03 10:58

    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/

    0 讨论(0)
提交回复
热议问题