开发者

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 le开发者_运维技巧gend 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!


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');
                }
            }
        }
    },

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜