Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I hide specific legend items?

Tags:

highcharts

I am trying to hide specific legend items on my graph (http://api.highcharts.com/highcharts/legend). If I loop through the chart.legend.allItems and try to change a specific items visible property it does not effect the legend at all.

$.each(chart.legend.allItems, function() {
    this.visible = false;
});

How can I hide a specific legend item on my graph ?

like image 440
Tawriq Avatar asked Mar 05 '26 00:03

Tawriq


1 Answers

I think this is being made out to be more complex than it needs to be.

You can set showInLegend to false in your config options for the series.

If you need to do it programmatically, you can use series.update() to accomplish it dynamically.

Reference:

  • http://api.highcharts.com/highcharts/plotOptions.series.showInLegend

  • http://api.highcharts.com/highcharts/Series.update

like image 123
jlbriggs Avatar answered Mar 07 '26 20:03

jlbriggs