当滚动到边缘时,wrap函数错误地计算轴的极值。您应该使用以下计算:
if (chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) {
extr = axis.getExtremes();
step = (extr.max - extr.min) / 5 * delta;
if ((extr.min + step) <= dataMin) {
newExtrMin = dataMin;
newExtrMax = dataMin + (extr.max - extr.min);
} else if ((extr.max + step) >= dataMax) {
newExtrMin = dataMax - (extr.max - extr.min);
newExtrMax = dataMax;
} else {
newExtrMin = extr.min + step;
newExtrMax = extr.max + step;
}
axis.setExtremes(newExtrMin, newExtrMax, true, false);
}
现场演示:
http://jsfiddle.net/BlackLabel/9mbycpqu/