Highcharts: Set y Axis Max and Min dynamically, and not at creation

Highcharts

Highcharts Problem Overview


Short question : Is there a way to set min/max in Highcharts AFTER the chart has been created. I am aware of intial setup like y: {min: 100,max: 200} at the chart initialization but I want to change max/min later on dynamically.

Highcharts Solutions


Solution 1 - Highcharts

I guess setExtremes is the best way to go about it. Syntax should be: chart.yAxis[0].setExtremes(100,300);

If one wants to just set minimum then chart.yAxis[0].setExtremes(100,null); worked for me.

Solution 2 - Highcharts

we can also use update method

chart.yAxis[0].update({
    max: 100
});	

chart.xAxis[0].update({
    max: 150
});	

Solution 3 - Highcharts

Also you can use tickPositioner http://api.highcharts.com/highcharts#yAxis.tickPositioner to define min/max values and ticks between these values.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1517108View Question on Stackoverflow
Solution 1 - Highchartsuser1517108View Answer on Stackoverflow
Solution 2 - Highchartsuser1653907View Answer on Stackoverflow
Solution 3 - HighchartsSebastian BochanView Answer on Stackoverflow