From afe0bc38c293a3b763a1020bf96da743ad6b5e93 Mon Sep 17 00:00:00 2001 From: alesmit Date: Mon, 11 Aug 2025 16:09:18 +0200 Subject: [PATCH 1/2] fix(dataZoom): handle NaN rect coords in positionGroup. close #21195 --- src/component/dataZoom/SliderZoomView.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/component/dataZoom/SliderZoomView.ts b/src/component/dataZoom/SliderZoomView.ts index b542817ed8..30422c9c52 100644 --- a/src/component/dataZoom/SliderZoomView.ts +++ b/src/component/dataZoom/SliderZoomView.ts @@ -294,8 +294,11 @@ class SliderZoomView extends DataZoomView { // Position barGroup const rect = thisGroup.getBoundingRect([sliderGroup]); - thisGroup.x = location.x - rect.x; - thisGroup.y = location.y - rect.y; + const rectX = isNaN(rect.x) ? 0 : rect.x; + const rectY = isNaN(rect.y) ? 0 : rect.y; + + thisGroup.x = location.x - rectX; + thisGroup.y = location.y - rectY; thisGroup.markRedraw(); } From 369d3b601d8dd483e96c63e99d95eee0277d93a0 Mon Sep 17 00:00:00 2001 From: alesmit Date: Sat, 30 Aug 2025 13:25:46 +0200 Subject: [PATCH 2/2] test: add visual test case --- test/dataZoom-single-datapoint.html | 93 +++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 test/dataZoom-single-datapoint.html diff --git a/test/dataZoom-single-datapoint.html b/test/dataZoom-single-datapoint.html new file mode 100644 index 0000000000..bd78b45554 --- /dev/null +++ b/test/dataZoom-single-datapoint.html @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + +
+ + + +