Highcharts: How to rename series
18,825
Solution 1
There is no method for doing this in the API. You could remove the series and add it again with another name, but that will make the animations run a second time and I think it will be colored with a new color as well.
Solution 2
actually, there's a way now. In highchars 3.0 series added a new api, called update:
chart.series[0].update({name:"name u want to change"}, false);
chart.redraw();
it will not only update the series name below the chart, but the name in tooltip as well.
Cheers!
Solution 3
This seems to work :
chart.series[1].name="Renamed";
chart.redraw();
Related videos on Youtube
Author by
Chris
Updated on June 24, 2022Comments
-
Chris almost 2 years
I'm using highcharts in my web application and I was wondering if there's any way to rename a series after the chart hast been created??
Thanks in advance!!
-
Chris over 12 yearsThanks, works pretty well, making the animations run a second time actually looks good, if you take the default settings the color will change, yes, but since you can set the color yourself it's not a problem, either.
-
projeqht almost 11 yearsThis method works and is recommended over the eolsson's accepted answer.
-
Jon Wood about 7 yearsSeems like adding the false flag doesnt do much though. I took it out and no longer had to call chart.redraw()
-
Dan Dascalescu over 6 yearsSorry for the downvote, but the question was about how to rename a series, not how to set its name when instantiating the chart. Also, most of the code in the example is irrelevant anyway.
-
envynoiz over 5 yearsAccording to the documentation provided by Highcharts, the last flag is provided to indicate whether redraw or not the chart.