How can I force multiple y-axis in Highcharts to h

2019-09-02 20:14发布

问题:

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