Reputation: 1044
Is there a way to make an item in a Highcharts legend inactive (i.e. greyed out) at runtime? The item needs to be greyed out independently of whether the the series on the chart is visible or not. The pseudo code would look something like item[0].inactive
.
I have found options to destroy the item on the legend, but that is not what I am trying to do.
Upvotes: 0
Views: 970
Reputation: 7453
If you knew the element (let's call it div#legend
), then you could create custom CSS classes for it. For instance:
.legendDisabled {
background-color: #FFFFFF
}
.legendEnabled {
background-color: #00FF00
}
Then you could use jQuery selectors to toggle between these classes when you need to grey out the legend or "enable" the legend, using .toggleClass():
$("div#legend").toggleClass("legendDisabled");
$("div#legend").toggleClass("legendEnabled");
Upvotes: 1