Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic update of multiple series in highcharts

Tags:

highcharts

I have a highcharts-chart with four lines (series). I would like to update each series with one point (value) and shift these four lines dynamically (1 in - 1 out) at the same time. This works with one series in the chart perfectly:

chart.series[0].addPoint([x, 5], true, true);

Is there a fast way to add the point to all four lines at once?

Hanspeter

like image 513
Hanspeter Avatar asked Mar 11 '13 19:03

Hanspeter


People also ask

Is it possible to pass multiple series in a chart in Highcharts?

Yes, you can.

What is the difference between Highcharts and Highstock?

Exactly Highstock is much better for big data sets than Highcharts. It's because it was designed for this purpose. It has built-in data grouping facility, data is blazingly fast grouped into optional groups, which fastens the process a lot. Feel free to ask any further questions!

Which config can be used to update the chart properties after the chart has been rendered?

Highcharts - Updating a chart's option after initial render.

How do I delete a series in Highcharts?

You could probably just iterate through the series and check the . name against your "passed in name" instead of scanning the document for "series_name". There really should be a chart. remove(series) (not just index, because the indices remap after you remove one).


1 Answers

You can can update each series on one line, but only make the last one redraw the chart like so:

chart.series[0].addPoint([x, 5], false, true);
chart.series[1].addPoint([x, 5], false, true);
chart.series[2].addPoint([x, 5], false, true);
chart.series[3].addPoint([x, 5], true, true);

Here is a JSFiddle illustrating the concept: http://jsfiddle.net/mkremer90/yZSzZ/

like image 80
MatthewKremer Avatar answered Oct 19 '22 00:10

MatthewKremer