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();
Share:
18,825

Related videos on Youtube

Chris
Author by

Chris

Updated on June 24, 2022

Comments

  • Chris
    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
    Chris over 12 years
    Thanks, 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
    projeqht almost 11 years
    This method works and is recommended over the eolsson's accepted answer.
  • Jon Wood
    Jon Wood about 7 years
    Seems like adding the false flag doesnt do much though. I took it out and no longer had to call chart.redraw()
  • Dan Dascalescu
    Dan Dascalescu over 6 years
    Sorry 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
    envynoiz over 5 years
    According to the documentation provided by Highcharts, the last flag is provided to indicate whether redraw or not the chart.