javascript - disabling events in hightcharts js -


i need disable events on legends in high charts stacked area chart. here code:

chart: {       type: 'area',     },     point: {       events: {         legenditemclick: function () {           return false; // <== returning false cancel default action         },       },     },     title: {       text: title,     },     xaxis: {       type: 'datetime',       min: startdateinms,       max: enddateinms,     },     yaxis: {       title: {         text: ylabel,       },     },     series: data,     plotoptions: {       series: {         stacking: 'normal',       },     },     credits: {       enabled: false,     },   }; 

it seems ok according documentation can still click in legend remove items chart don't want. lovely!!

your issue coming fact assigning click event point, looks of chart area , applying click event wrong property.

you putting under lines meanwhile, needs nested - plotoptions -> area -> events -> legenditemclick

instead, make sure event nested this:

chart: {       type: 'area',     },     plotoptions: {       area: {         events: {           legenditemclick: function () {             return false; // <== returning false cancel default action           }         }       }     },     title: {       text: title,     },     xaxis: {       type: 'datetime',       min: startdateinms,       max: enddateinms,     },     yaxis: {       title: {         text: ylabel,       },     },     series: data,     plotoptions: {       series: {         stacking: 'normal',       },     },     credits: {       enabled: false,     }, }; 

Comments