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
- HIGHCHARTS - Jquery/Ajax access php variables from the php file called by ajax
- Highcharts 5 tooltip colour with custom css class
- How to update Highcharts data dynamically over a period of time
- Show plotlines in highcharts with hidden axis?
- highcharts draggable-points conflict between drag and click
- highcharts hover.state.halo color malfunction?
- How to change names of menuItems in R highcharter when exporting
- Bug with highcharts pie-basic percent
- Dynamically create highcharts with bootstrap carousel
- Highcharts - PieChart refreshes on click event that calls this.setState
- Load chart with some series/legend items hidden by default
- Show some data in tabular format in high chart's pie chart drill down
- dash_styles in Highcharts
- Highcharts tooltips with all items in category listed
- Higchahrts click entire column to trigger point click event
- HighCharts synchronisation tooltip effect other chart
- Highcharts TypeScript Boost module
- Passing JSON in variable to HighCharts
- Highcharts doesn't show all contents of x-axis
- Issue with last column width in Highcharts
- Referencing a JSON object created in Java through javascript in the one JSP page
- Highcharts Y-Axis Limits
- Highcharts JSON load issue
- set minimum and maximum values for axis' data in highchart
- Highcharts : How to align column chart and bubble chart vertically in the same series
- Add different colour in X-range bar based on percentage
- Turning HighChart into a stacked Bar Graph with Title
- Is it possible to create a Word Cloud with highcharter?
- Redirecting to a URL on Highcharts marker click
- highcharts : set title on exporting