Sunny
Sunny

Reputation: 6063

Change HighCharts axis title in 2.1.4

I'd like to change the axis label (like Change HighCharts axis title) but :

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

This works in HighCharts 2.0.5 but doesn't work anymore in 2.1.4…

Is this still possible?

Upvotes: 5

Views: 2413

Answers (3)

Daffy
Daffy

Reputation: 1

// this works as correct implementation and not a fix.

chart.yAxis[0].setTitle({'text':'My text'});

// highcharts forums

Upvotes: -2

Sunny
Sunny

Reputation: 6063

Via @hfrntt, this works as a temporary fix :

 $(chart.yAxis[0].axisTitle.element).text('New Label');

Upvotes: 4

NT3RP
NT3RP

Reputation: 15370

What you've described should be correct. I've experimented with something just as simple: setting the chart title.

var chart = //... Simple chart definition

$button = $('#button');
$button.click(function() {
    chart.setTitle("Garbage");
    chart.redraw();
});

This simple example should also work, so I suspect you may have found a bug.

Upvotes: 1

Related Questions