From 635bfd99177b54ddc1a152f3a2303e9aaf1403af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D0=B5=D0=B4=D0=BE=D1=82=D0=BE=D0=B2=20=D0=98=D0=BB?= =?UTF-8?q?=D1=8C=D1=8F=20=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B5=D0=B2=D0=B8?= =?UTF-8?q?=D1=87?= Date: Fri, 10 May 2024 18:18:55 +0400 Subject: [PATCH 1/2] Reopen PR, and fix the problem with dist deleting --- src/component/dataZoom/AxisProxy.ts | 8 +- test/axis-weak-filter.html | 141 ++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+), 2 deletions(-) create mode 100644 test/axis-weak-filter.html diff --git a/src/component/dataZoom/AxisProxy.ts b/src/component/dataZoom/AxisProxy.ts index 8c05f8cea7..9b7303bd48 100644 --- a/src/component/dataZoom/AxisProxy.ts +++ b/src/component/dataZoom/AxisProxy.ts @@ -315,8 +315,12 @@ class AxisProxy { for (let i = 0; i < dataDims.length; i++) { const value = store.get(dataDimIndices[i], dataIndex) as number; const thisHasValue = !isNaN(value); - const thisLeftOut = value < valueWindow[0]; - const thisRightOut = value > valueWindow[1]; + let thisRightOut = value > valueWindow[1]; + let thisLeftOut = value < valueWindow[0]; + if (seriesModel.subType !== 'bar') { + thisLeftOut = thisLeftOut && seriesData.get(dataDims[i], dataIndex + 1) < valueWindow[0]; + thisRightOut = thisRightOut && seriesData.get(dataDims[i], dataIndex - 1) > valueWindow[1]; + } if (thisHasValue && !thisLeftOut && !thisRightOut) { return true; } diff --git a/test/axis-weak-filter.html b/test/axis-weak-filter.html new file mode 100644 index 0000000000..33c2d9dbd4 --- /dev/null +++ b/test/axis-weak-filter.html @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + +
+
+ + + + + + + From 1c264e5669733520607f193477163e31291c36b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D0=B5=D0=B4=D0=BE=D1=82=D0=BE=D0=B2=20=D0=98=D0=BB?= =?UTF-8?q?=D1=8C=D1=8F=20=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B5=D0=B2=D0=B8?= =?UTF-8?q?=D1=87?= Date: Sat, 7 Sep 2024 10:38:49 +0400 Subject: [PATCH 2/2] Fix linter error, like in @nick-true-dev advice --- src/component/dataZoom/AxisProxy.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/component/dataZoom/AxisProxy.ts b/src/component/dataZoom/AxisProxy.ts index 9b7303bd48..9fd48044f4 100644 --- a/src/component/dataZoom/AxisProxy.ts +++ b/src/component/dataZoom/AxisProxy.ts @@ -318,8 +318,12 @@ class AxisProxy { let thisRightOut = value > valueWindow[1]; let thisLeftOut = value < valueWindow[0]; if (seriesModel.subType !== 'bar') { - thisLeftOut = thisLeftOut && seriesData.get(dataDims[i], dataIndex + 1) < valueWindow[0]; - thisRightOut = thisRightOut && seriesData.get(dataDims[i], dataIndex - 1) > valueWindow[1]; + const parsedRightValue = seriesData.get(dataDims[i], dataIndex + 1); + const parsedLeftValue = seriesData.get(dataDims[i], dataIndex - 1); + const leftValue = (typeof parsedLeftValue === 'number') ? parsedLeftValue : NaN; + const rightValue = (typeof parsedRightValue === 'number') ? parsedRightValue : NaN; + thisLeftOut = thisLeftOut && leftValue < valueWindow[0]; + thisRightOut = thisRightOut && rightValue > valueWindow[1]; } if (thisHasValue && !thisLeftOut && !thisRightOut) { return true;