0

Is there an optimized way to add multiple series dynamically to an already rendered line chart with existing series?

So far I can think of two options:

1)Calling Chart.addSeries(graphSeries) n times.

I am currently using this approach, but it's slow for multiple series

2)Reinitialize the chart from the JSON object after adding the new series to the JSON object

Chart = new Highcharts.Chart(graphData);

This however means that the entire chart has to be regenerated every time.

Is there another way to bulk add new series to a chart?

1 Answer 1

1

I would use chart.addSeries with the redraw parameter set to false. Once you are done adding series, you can call chart.redraw to display the series. This will only cost you one redraw for any number of series and won't be as expensive as recreating the chart from the config.

chart.addSeries(series1, false);
chart.addSeries(series2, false);
...
chart.addSeries(seriesN, false);

chart.redraw();

http://api.highcharts.com/highcharts#Chart.addSeries()

Sign up to request clarification or add additional context in comments.

1 Comment

Instead of chart.redraw() you can use chart.addSeries(seriesN, true); for last addSeries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.