Categories
JavaScript Answers

How to remove all series data from a HighCharts chart with JavaScript?

Spread the love

Sometimes, we want to remove all series data from a HighCharts chart with JavaScript.

In this article, we’ll look at how to remove all series data from a HighCharts chart with JavaScript.

How to remove all series data from a HighCharts chart with JavaScript?

To remove all series data from a HighCharts chart with JavaScript, we call the remove method.

For instance, we write

while (chart.series.length > 0) {
  chart.series[0].remove(true);
}

to loop through the chart series with a while loop.

Then we get the first one with chart.series[0].

And we call remove with true to remove it.

Conclusion

To remove all series data from a HighCharts chart with JavaScript, we call the remove method.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.