Unfortunately, the core Highcharts JS library does not currently support an API method to change the name of a series dynamically after it has been rendered. So, currently (at least AFAIK), the only way to do this would either be by removing the series and then re-adding a new series with the update name or via native DOM manipulation. You could also consider reaching out to the Highsoft team directly to see if they have any other options they'd recommend.
Very nice! Looks like they just added that new "Series.update()" method in the 3.0 release. That will provide a lot of new power to the API, so we'll get that into our backlog to get implemented (if anyone would be will to contribute this feature in the meantime, please let me know!)
Regarding why the update doesn't work correctly for larger series, I'm not sure, but I noticed the following statement in their docs: "For a clean and precise handling of new options, all methods and elements from the series is removed, and it is initiated from scratch. Therefore, this method is more performance expensive than some other utility methods like setData or setVisible". So, you may want to try monkeying with a jsfiddle case to see if the problem you're seeing is an issue with the core library or not...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have chart with serveral series. Now I have an async callback, which shall now change the name of the series.
I do:
chart.getSeries()[0].setName("new name");
However, the name in the chart does not change. Is there a way to change the name?
Thanks
Unfortunately, the core Highcharts JS library does not currently support an API method to change the name of a series dynamically after it has been rendered. So, currently (at least AFAIK), the only way to do this would either be by removing the series and then re-adding a new series with the update name or via native DOM manipulation. You could also consider reaching out to the Highsoft team directly to see if they have any other options they'd recommend.
http://api.highcharts.com/highcharts#Series
http://www.highcharts.com/support
From: http://stackoverflow.com/questions/12419758/changing-series-color-in-highcharts-dynamically
There does seem to be a way via update function:
chart.series[0].update(chart.series[0].options);
PLEASE could you add this as well as the ability to edit chart.counters.color ?
Thanks very much.
private static native void nativeSeriesUpdateOptions(JavaScriptObject series, String newname) /-{
series.update({ name: newname });
}-/;
Last edit: Michael Evans 2013-10-04
Very nice! Looks like they just added that new "Series.update()" method in the 3.0 release. That will provide a lot of new power to the API, so we'll get that into our backlog to get implemented (if anyone would be will to contribute this feature in the meantime, please let me know!)
Regarding why the update doesn't work correctly for larger series, I'm not sure, but I noticed the following statement in their docs: "For a clean and precise handling of new options, all methods and elements from the series is removed, and it is initiated from scratch. Therefore, this method is more performance expensive than some other utility methods like setData or setVisible". So, you may want to try monkeying with a jsfiddle case to see if the problem you're seeing is an issue with the core library or not...