Firstly, I have some diagrams on my page. To make it easier to compare data in different charts, I set the maximum yAxis to the highest available.
Question How to return the maximum that I just set without reassigning the data? I am looking for something like "autoscale" since it works if I add the maximum value of 11245, the maximum value of yAxis is something like 12500. I would like to restore all my diagrams.
Demo: http://jsfiddle.net/wiesson/0p4z1mfj
$('#setMax').click(function (ev) { var yAxisMax = 0; $('[data-chart]').each(function (item) { var c = $(this).highcharts(); if (c.yAxis[0].max > yAxisMax) { yAxisMax = c.yAxis[0].max; } }); $('[data-chart]').each(function (item) { c = $(this).highcharts(); if (c.yAxis[0].max < yAxisMax) { c.yAxis[0].update({ max: yAxisMax }); } }); });
source share