Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 964
highchartsdude Avatar asked Oct 20 '11 08:10

highchartsdude


2 Answers

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/

like image 196
eolsson Avatar answered Sep 20 '22 11:09

eolsson


pie: {    showInLegend: true,    allowPointSelect: false,    point:{        events : {         legendItemClick: function(e){             e.preventDefault();         }        }    }  } 
like image 42
Joseph Lim Shuo Yan Avatar answered Sep 21 '22 11:09

Joseph Lim Shuo Yan