luftikus143 luftikus143 - 4 months ago 47x
Javascript Question

How to remove a series in Highcharts by name

I'd like to remove certain series from my Highcharts graph when a user clicks on a button. But I'd like to delete these by using a name or id of the series, and not the item in an array.

So, instead of doing this:


I'd like to use:


However, I don't succeed in this. Anything wrong with this here:

name: "Volcanic",
id: "Volcanic",
data: [xxxx]

Or how do I access the series by name? Here is a fiddle.

Thanks for any hint!

hsh hsh

In order to get a seri by ID you should use chart.get("SeriId") and to remove it use below code:


I edited your sample with this approach Here