Highcharts - Programmatically "flip" (reverse) Y Axis
All, I'm using Highcharts in a web app I'm working on. One of the requirements is that users should be able to click a button and 'flip' or reverse the Y axis. In other words - whe
Solution 1:
You can use the Axis.update() method:
$(function () {
var chart = newHighcharts.Chart({
chart: {
renderTo: 'container'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
reversed: false
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
var reversed = chart.options.yAxis.reversed;
// the button action
$('#button').click(function () {
chart.yAxis[0].update({
reversed: !reversed
});
reversed = !reversed;
});
});
Here's the updated JSFiddle: http://jsfiddle.net/4JZxS/15/
Solution 2:
I don't think it's possible.
My advice is to destroy the chart using chart.destroy()
and create the new one with the reversed property, like in this fiddle
Post a Comment for "Highcharts - Programmatically "flip" (reverse) Y Axis"