Skip to content

fix(line): keep endLabel when series.step is changed by setOption - #21835

Open
JazibAli360 wants to merge 1 commit into
apache:masterfrom
JazibAli360:donate/21833-bug-line-endlabel-lost-when-setoption-ch
Open

JazibAli360 wants to merge 1 commit into
apache:masterfrom
JazibAli360:donate/21833-bug-line-endlabel-lost-when-setoption-ch

Conversation

@JazibAli360

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

LineView._newPolyline now detaches the end label from the polyline it replaces and resets _endLabel, so _initOrUpdateEndLabel creates a new label and attaches it to the new polyline. Added a Jest test that switches step back and forth with setOption.

Root cause: Changing series.step (or the coordinate system type) makes LineView build a new polyline, but this._endLabel still pointed to the label on the old polyline, which had been removed. _initOrUpdateEndLabel saw that the label already existed and skipped setTextContent, so the new polyline had no end label.

Fixes #21833

Fixed issues

Details

Before: What was the problem?

After setOption changes series.step on a line series with endLabel.show: true, the end label is no longer shown.

After: How does it behave after the fixing?

The end label is recreated on the new polyline and stays visible when step changes, in either direction.

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Merging options

  • Please squash the commits into a single one when merging.

Other information

How it was verified

  • npm test --silent passes
  • npx jest --config test/ut/jest.config.cjs passes
  • npm run lint passes
  • npm run checktype passes
  • npm run lint --silent passes
  • added/updated test: test/ut/spec/series/line.test.ts::line should keep endLabel when step is changed by setOption

Notes for reviewers

The new test fails before the fix and passes after it, and it checks that the label is attached to the current polyline and has the right text. All 195 unit tests pass, and lint and checktype pass. This is the same cleanup that remove() and the no-endLabel branch already do. I did not check it visually in a browser, including the labelLayout moveOverlap case or the animated update path.


🤖 Generated with Claude Code by the token-tithe engine, an AI contribution donated from
leftover agent tokens. Model: claude-opus-5-5 · tokens: 457,419 (~$0.40) · second
review: none available. Happy to change anything, or to close this if it isn't a fit. To opt
this repository out of all future donations, add a file named .github/token-tithe-ignore.

@echarts-bot

echarts-bot Bot commented Nov 11, 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.

This branch has not been deployed

No deployments
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] Line endLabel lost when setOption changes series.step (6.1.0)

1 participant