s_sherly
s_sherly

Reputation: 2367

highcharts: disable only a single element in legend so it cannot be clicked

I was wondering is it possible to prevent only a one element in plot legend from disabling/enabling. Let's say I have three categories in my legend: 'car1', 'car2', 'car3'. I would like to show/hide only 'car2' and 'car3', while 'car1' is shown all the time.

Thank you!

Upvotes: 3

Views: 3622

Answers (1)

escouser
escouser

Reputation: 1943

If it's always a certain series that you want to disable show/hide, then within the legendItemClick return false for that series.

For example:


plotOptions: {
        series: {
            events: {
                legendItemClick: function(event) {
                    return !(this.name == 'car1');
                }
            }
        }
    },

Upvotes: 5

Related Questions