Skip to content Skip to sidebar Skip to footer

Set Second Axis In Proportion Of First Axis

I have a chart which contains two series, and each of them has its own yAxis. I need to automatically set the second axis maximum to 13.5% of the first axis maximum. For example, i

Solution 1:

There is no default API function in Highcharts that would allow that.

If you want to get percentage of max of created axis, then you can get it in load event of chart (API: http://api.highcharts.com/highcharts#chart.events.load )or in callback (as in demo below). Next you will need to update second axis' max.

Example: http://jsfiddle.net/cg0c5tkd/

function(chart){
        chart.yAxis[1].update({max: chart.yAxis[0].getExtremes().max * 0.135});
    }

Post a Comment for "Set Second Axis In Proportion Of First Axis"