Skip to content

fix(marker): respect markLine z2 when computing label z2 in traverseUpdateZ (Fixes #21650) - #21721

Open
waterWang wants to merge 1 commit into
apache:masterfrom
waterWang:fix/markline-z2-label
Open

fix(marker): respect markLine z2 when computing label z2 in traverseUpdateZ (Fixes #21650)#21721
waterWang wants to merge 1 commit into
apache:masterfrom
waterWang:fix/markline-z2-label

Conversation

@waterWang

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing

What does this PR do?

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.

Root cause

traverseUpdateZ uses -Infinity as the initial maxZ2 value, and the label's z2 is computed as maxZ2 + 2 from child elements. If the child elements' z2 is not set (or set to 0) before traverseUpdateZ runs, the label gets a default z2 of 2, regardless of the markLine's z2 setting.

Fix

  1. src/util/graphic.ts: Added an optional modelZ2 parameter to traverseUpdateZ(). When provided, it seeds the maxZ2 starting value, ensuring the label's z2 is at least modelZ2 + 2.

  2. src/component/marker/MarkerView.ts: The updateZ function now reads the marker model's z2 value and passes it to traverseUpdateZ().

Fixed issues

Before: What was the problem?

Setting markLine.z2 had no effect on the label's z-order. The label would always render at a default z2 level regardless of the markLine's z2 configuration.

After: How does it fix the problem?

The label's z2 now respects the markLine's z2 setting. The label's z2 is computed as max(modelZ2, childZ2) + 2, ensuring the label is always above the markLine elements and respects the user's z2 configuration.

Other information

This is a minimal fix that only affects the marker (markLine/markPoint/markArea) components. The traverseUpdateZ function's existing behavior is preserved for all other callers (the modelZ2 parameter is optional).

…pdateZ

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 apache#21650
@echarts-bot

echarts-bot Bot commented Aug 9, 2026

Copy link
Copy Markdown

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only.

To reviewers: If this PR is going to be described in the changelog in the future release, please make sure this PR has one of the following labels: PR: doc ready, PR: awaiting doc, PR: doc unchanged

This message is shown because the PR description doesn't contain the document related template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Markline z2 is not effect on label

1 participant