From 3a056bde1875cd76e6cb5d9c366136bafc5751b8 Mon Sep 17 00:00:00 2001 From: Ovilia Date: Tue, 16 Jan 2024 16:40:31 +0800 Subject: [PATCH] fix(markArea): fix markArea position when axis is with alignWithLabel Partially fix #18499 . The case when some ticks are skipped due to overlapping is not fully fixed. --- src/chart/bar/BaseBarSeries.ts | 3 +- test/markArea.html | 308 ++++++++++++++++++++++++++++++++- 2 files changed, 309 insertions(+), 2 deletions(-) diff --git a/src/chart/bar/BaseBarSeries.ts b/src/chart/bar/BaseBarSeries.ts index 0fe8944e62..caebce271e 100644 --- a/src/chart/bar/BaseBarSeries.ts +++ b/src/chart/bar/BaseBarSeries.ts @@ -101,11 +101,12 @@ class BaseBarSeriesModel = BaseBarSeri // If axis type is category, use tick coords instead if (axis.type === 'category' && dims != null) { const tickCoords = axis.getTicksCoords(); + const alignTicksWithLabel = axis.getTickModel().get('alignWithLabel'); let targetTickId = clampData[idx]; // The index of rightmost tick of markArea is 1 larger than x1/y1 index const isEnd = dims[idx] === 'x1' || dims[idx] === 'y1'; - if (isEnd) { + if (isEnd && !alignTicksWithLabel) { targetTickId += 1; } diff --git a/test/markArea.html b/test/markArea.html index d19744c8e7..0c26bccec7 100644 --- a/test/markArea.html +++ b/test/markArea.html @@ -28,6 +28,8 @@
+
+
+ +