luftikus143 luftikus143 - 2 years ago 229
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
Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download