Change HighCharts axis title

Tomba picture Tomba · May 4, 2011 · Viewed 29k times · Source

Is it possible to change the axis title of a HighCharts chart programatically?

I'm trying to do something like this:

charts.series[0].yAxis.title.text = 'new title';

or

charts.yAxis[0].title.text = 'new title';

(having already set a title when the chart was initialized).

Answer

escouser picture escouser · May 4, 2011

Yes you can do this by using the following:

chart.yAxis[0].axisTitle.attr({
        text: 'new title'
    });