1
votes

I have a highcharts with multiple y axes. Each y axis has multiple series associated to it based on the measurement unit. For instance if we have 3 series with measurement unit "W", they will be associated to the same y Axis.

Users have the option to remove series at button click. Series are removed in the following way:

chart.series[channelIndex].remove(false);

After a series is removed we update the y axis limits as follows. If a axis has series with no values, Y axis will have limits set to (0, 10). I add default limits in the following way:

 // If there are no data in the series and if no limit was previously set we update the limits to (0, 10)
        if (yAxis.dataMax == null && limits.max == null) {
            limits.max = 10;
        }

        yAxis.update({
            min: limits.min,
            max: limits.max
        }, false);

The problem is, that yAxis.datamax is not updated after a series is removed. So even if the yAxis has no series, dataMax and dataMin still have the same values before the series was removed.

I don't understand why y dataMin and dataMax are not updated after a series is removed . So any suggestions why this behavior is present would be very useful.

1

1 Answers

0
votes

It's caused by disabling redraw:

chart.series[channelIndex].remove(false);

If you would replace false<=>redraw or just remove false it would work properly. Chart's redraw will recalculate datamin and datamax.