How can I force multiple y-axis in Highcharts to have a common zero when min/max values are not in same ratio above 0 and below 0 for all the y-axis

帅比萌擦擦* 提交于 2019-12-13 05:58:03

问题


The link mentioned below and the posted code helped me to fix this issue partially but I do see issues when min/max values are not in same ratio above 0 and below 0 for all the y-axis(see the scenario# 2 values).

Scenario# 1: Working when values are something like below

Y-Axis 1 - Min/MAX: -750/+750,
Y-Axis 2 - Min/MAX: -10/+10,
Y-Axis 3 - Min/MAX: -1/+1

Scenario# 2: See 0's aren't aligned correctly when values are like below

Y-Axis 1 - Min/MAX: -1000/+750,
Y-Axis 2 - Min/MAX: -15/+15,
Y-Axis 3 - Min/MAX: -2/+2 

Can someone please suggest how to fix this issue?

yAxis0Extremes = chart.yAxis[0].getExtremes();
yAxisMaxMinRatio = yAxis0Extremes.max / yAxis0Extremes.min;
yAxis1Extremes = chart.yAxis[1].getExtremes();
yAxis1Min = (yAxis1Extremes.max / yAxisMaxMinRatio).toFixed(0);
chart.yAxis[1].setExtremes(yAxis1Min, yAxis1Extremes.max);

How can I force multiple y-axis in Highcharts to have a common zero

来源:https://stackoverflow.com/questions/31275518/how-can-i-force-multiple-y-axis-in-highcharts-to-have-a-common-zero-when-min-max

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!