Jay_VtM
Posts: 27
Joined: Fri Jan 20, 2017 8:16 pm

Series Not Ignored When Hidden

Hi,

I have a chart with a legend outside the chart area, and I would like to replicate the functionality found it standard Highcharts legends in which a series disappears when the legend item is clicked. I was able to make it work by looping through and hiding each series, but it was very slow. I found I can assign a class to each series and hide it much faster that way, but then the series is not ignored in the chart: there is a space left behind where the series was.

I created the following fiddle to show the two approaches. I'm hoping you can help me figure out how to use the class-based approach and have it ignore the hidden series, or give me an idea of how to speed up the other approach.

https://jsfiddle.net/3jzctkhf/

Thank you,
Jay
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Series Not Ignored When Hidden

Hi Jay_VtM,

Thanks for contacting us with your question.

In this case you should use either series.hide or series.setVisible method.
Demo:https://jsfiddle.net/BlackLabel/8go6nd1b/
API reference:https://api.highcharts.com/class-refere ... setVisible,
https://api.highcharts.com/class-refere ... eries#hide

Let me know if it was what you were looking for.
Regards!
Mateusz Bernacik
Highcharts Developer
Jay_VtM
Posts: 27
Joined: Fri Jan 20, 2017 8:16 pm

Re: Series Not Ignored When Hidden

Thank you Mateusz - that was what I needed - the ability to avoid the redraw until all of the relevant series had been hidden.

Best,
Jay
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Series Not Ignored When Hidden

You're welcome! In case of any further questions, feel free to contact us again.
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”