Enzo
Enzo

Reputation: 952

Highcharts hide series without change legend color

I need to hide serie, but i need to remove hide effect on legend. (turns color to gray)

I tried,

serie.setVisible(false, false);

or

serie.hide();

both changes legend color to gray. Probably, I need to use serie.update() to do that. What properties will change in update?

Upvotes: 3

Views: 512

Answers (1)

Paweł Fus
Paweł Fus

Reputation: 45079

You can set fixed color for texts using itemHiddenStyle.

However, if you want to achieve the same effect on the shape/item, then the easiest would be to wrap method which sets color, to always render color like for visible series:

(function(H) {
    H.wrap(H.Legend.prototype, 'colorizeItem', function(p, item) {
       p.call(this, item, true);  // second param, "visible" = true
    });
})(Highcharts)

Demo: http://jsfiddle.net/6Lftuhzk/1/

Upvotes: 3

Related Questions