From 915997ce23f9a905a9eaf538af3da5645ba24c26 Mon Sep 17 00:00:00 2001 From: Ross Johnson <159597299+rosco54@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:24:19 +1000 Subject: [PATCH] Compute a yLowestValue and yHighestValue for each configured yaxis. --- src/modules/ZoomPanSelection.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/modules/ZoomPanSelection.js b/src/modules/ZoomPanSelection.js index 89d80578e..652846e6b 100644 --- a/src/modules/ZoomPanSelection.js +++ b/src/modules/ZoomPanSelection.js @@ -559,16 +559,14 @@ export default class ZoomPanSelection extends Toolbar { w.config.yaxis.forEach((yaxe, index) => { // We can use the index of any series referenced by the Yaxis - // because they will all return the same value. - if (w.globals.seriesYAxisMap[index].length > 0) { - let seriesIndex = w.globals.seriesYAxisMap[index][0] - yHighestValue.push( - w.globals.yAxisScale[index].niceMax - xyRatios.yRatio[seriesIndex] * me.startY - ) - yLowestValue.push( - w.globals.yAxisScale[index].niceMax - xyRatios.yRatio[seriesIndex] * me.endY - ) - } + // because they will all return the same value, so we choose the first. + let seriesIndex = w.globals.seriesYAxisMap[index][0] + yHighestValue.push( + w.globals.yAxisScale[index].niceMax - xyRatios.yRatio[seriesIndex] * me.startY + ) + yLowestValue.push( + w.globals.yAxisScale[index].niceMax - xyRatios.yRatio[seriesIndex] * me.endY + ) }) if (