From 2e1166d4230d532b02b75a753ff4f7b61c594c85 Mon Sep 17 00:00:00 2001 From: water <672684719@qq.com> Date: Sun, 9 Aug 2026 22:16:58 +0800 Subject: [PATCH] fix(marker): respect markLine z2 when computing label z2 in traverseUpdateZ When the user sets a `z2` value on a markLine, the label's `z2` should reflect this value so the label stacks correctly relative to other series elements. Currently, `traverseUpdateZ` only uses `-Infinity` as the initial `maxZ2`, and the label's `z2` is computed as `maxZ2 + 2` from child elements. If the child elements' z2 is not set before `traverseUpdateZ` runs, the label gets a default z2 of 2. This fix adds an optional `modelZ2` parameter to `traverseUpdateZ` that seeds the `maxZ2` starting value, ensuring the label's z2 is at least the model's z2 + 2. The marker `updateZ` function now passes the marker model's `z2` to `traverseUpdateZ`. Fixes #21650 --- src/component/marker/MarkerView.ts | 3 ++- src/util/graphic.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/component/marker/MarkerView.ts b/src/component/marker/MarkerView.ts index 51d4c2986a..c876e116c8 100644 --- a/src/component/marker/MarkerView.ts +++ b/src/component/marker/MarkerView.ts @@ -115,7 +115,8 @@ function updateZ( if (markerModel && markerDraw && markerDraw.group) { const { z, zlevel } = retrieveZInfo(markerModel); - traverseUpdateZ(markerDraw.group, z, zlevel); + const z2 = markerModel.get('z2'); + traverseUpdateZ(markerDraw.group, z, zlevel, z2); } }); } diff --git a/src/util/graphic.ts b/src/util/graphic.ts index 384c8394c6..3439a55bab 100644 --- a/src/util/graphic.ts +++ b/src/util/graphic.ts @@ -843,8 +843,9 @@ export function traverseUpdateZ( el: Element, z: number, zlevel: number, + modelZ2?: number, ): void { - doUpdateZ(el, z, zlevel, -Infinity); + doUpdateZ(el, z, zlevel, modelZ2 != null ? modelZ2 : -Infinity); } function doUpdateZ(