javascript - Highcharts Pie Chart: How to ignore disabled legend items -


please see jsfiddle.

in example, can see sum of values @ top left corner.

if click on legend item, disabled, total value doesn't reflect it. text should updated not include disabled item. how can this?

you can use legenditemclick event update rendered text keeping reference element. example:

var totaltext;  var chart = new highcharts.chart({     chart: {         events: {             load: function(event) {                 totaltext = this.renderer.text(                     'total: ' + total,                     this.plotleft,                     this.plottop - 20                 ).attr({                     zindex: 5                 }).add()             }         }     }      //...      plotoptions: {         pie: {             point: {                 events: {                     legenditemclick: function(e) {                         var newtotal = this.series.total + (this.visible ? -this.y : this.y);                         totaltext.attr({ text: 'total: '+newtotal });                     }                 }             }         }     } }); 

see this updated jsfiddle demonstration.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -