score:34
Yes you can do this by using the following:
chart.yAxis[0].axisTitle.attr({
text: 'new title'
});
score:1
I have created a demo fiddle to dynamically change y-axis title. Refer this JSFIDDLE
HTML:
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<input type="button" value="Change Y-axis Title to 'My text'" id="my_btn">
JS (part of thec code to update the y-axis title on a button click):
var chart = $('#container').highcharts();
$('#my_btn').click(function(){
//alert('hey');
chart.yAxis[0].update({
title:{
text:"My text"
}
});
alert('Y-axis title changed to "My text" !');
});
Refer Highcharts 'update' function documentation for further details.
score:6
The above answer has still one problem. Images created from the plot using the export module will show the original title, not the changed one. Add the following line to fix:
chart.options.yAxis[0].title.text = 'new title';
score:15
I couldn't get either of the above to work, perhaps things have changed since last year... I ended up using:
chart.yAxis[0].update({
title:{
text: "new title"
}
});
and it worked nicely...
score:27
This can be done directly on the Axis
object using setTitle
now. For example:
chart.yAxis[0].setTitle({ text: "Bananas" });
See this JSFiddle demonstration. The method signature is:
setTitle(Object title, [Boolean redraw])
So you could optionally pass a boolean to wait with redrawing. The title
object takes the same parameters as xAxis.title
meaning you could pass in styles and several other options as well as the text itself. The API documentation has the complete information.
Source: stackoverflow.com
Related Query
- Change HighCharts axis title
- Change HighCharts axis title in 2.1.4
- HighCharts - Dynamically Change Axis Title Color
- Programmatically change a chart title in highcharts
- Change title when drilldown in Highcharts
- Javascript Highcharts v3.0.5 - How to hide Y Axis Title when using multiple Y Axis
- Highcharts how to change x axis options
- Change Y Axis vertical line color in Highcharts
- How to change axis label size when exporting in Highcharts / Highstock
- Highcharts exporting.js change menu hover title text
- Highcharts - stop Y axis value change on redraw
- highcharts change rendered image source on click
- Change Style of Title in HighCharts in ActionResult
- Display percentage change in the title of Highcharts timeseries
- How to change highcharts graph axis colors on export?
- How to add title of axis in Highcharts
- Highcharts Spider Chart, change axis ranges
- Highcharts - change group padding and column width on category axis
- highcharts y axis label with offset is hidden when chart has no title
- how to change the title in highcharts
- Highcharts / highstock how to change title of chart in IE?
- How to change the color of a custom renderer text to the title color in Highcharts
- Highcharts Highmaps How to change value for color axis in map bubble
- Change X axis label on Drill Down using HighCharts
- Change the series title in a Highcharts drill down legend
- Highcharts how to use column title as X axis and not as Legend
- build a "double divergent" axis title in HighCharts
- Change highcharts axis value based on User Selection
- Can we show the title hover over x axis/y axis text in highcharts dumbbell chart?
- How to change code in "Pie Chart" in HighCharts
More Query from same tag
- Open Highcharts xAxis link in new window
- HighCharts one y axis automatic for each serie
- Highcharts data will not load using angular directive
- Highcharts: Implement a second y-axis related to the first y-axis
- Store Highcharts in Javascript Function - How to?
- How to add flags to countinuous update angular highcharts
- Highchart/Highstock OHLC not showing previous Candlestick with live data
- Adjust datalabel to specific position (HIGHCHARTS)
- Highcharts static line with background color below it
- highstock ie8 error
- Missing series name as label in highcharts heatmaps
- Apply Background Image to A Column
- rChart, for loop
- How to make x-axis tickmarks span the entire bar chart?
- Highcharts: only show part of a map
- How to make this as a HighChart (picture attached)
- 'G_vmlCanvasManager' is undefined
- Highchart is not showing in heroku, but works in local environment
- Highcharts change look of tooltip
- Parsing ALL Highcharts Options from JSON
- HighChart And R weird Column chart breaks
- Negative color with area color fill and yAxis
- Override auto generated Y axis plot area values in Highcharts
- PHP array reformat to highchart json ob
- Restrict mouseover area for a column to its own shape vs. surrounding area
- Highmaps: legendItemClick doesn't work when there are dataClasses in colorAxis, anyone have a workaround?
- highcharts - create a total sumline of an existing serie
- Highcharts datalables enabled for one series and one point on the chart via chart function
- Highcharts: Marker radius does not seem to work
- Hightcharts Display Date month on X-Axis