I am creating line charts with dynamic data using highcharts.js API. I need to change the title of y-axis depending upon the visible series using button. Currently I am doing this which is working fine.
$('#button1').click(function() {
//alert("buton clicked");
series1.hide();
series3.show();
chart.yAxis[0].axisTitle.attr({
text: 'Volts (V)'
});
$('#button0').removeAttr('disabled');
});
Now when I download the chart ,It always shows the first y axis title I have set in the chart options, not the one i explicitly change upon click function. Is there any formtter function I can use to set title text of y-axis in charts options. I have tried doing the following
yAxis: {
labels: {
text:{
formatter: function () {
if(this.series=="Series 1")
return 'Power kW';
else
return 'Voltage kW';
}
}
}
}
But It is not working.