Sebass van Boxel
Sebass van Boxel

Reputation: 2602

Rename legend on export in highchart

I know highcharts makes it possible to update a legend by using the following function:

chart.legend.allItems[0].update({name:'aaa'});

Also the possibility to hide or show the legends on export are working.

 exporting:{
   chartOptions:{
            legend:{
                enabled:true
            }
        }
  }

But now, I like to rename a specific legend during export. Is there any way to bind the update code to the export-function in Highcharts?

Upvotes: 0

Views: 175

Answers (1)

Paweł Fus
Paweł Fus

Reputation: 45079

Update series in the chart.events.load event, for example:

exporting: {
  chartOptions: {
    chart: {
      events: {
        load: function (e) { 
           this.series[0].update({ name: "New name." });
        }
      }
    }
  }
} 

Upvotes: 1

Related Questions