JazibAli360 opened a new pull request, #21835: URL: https://github.com/apache/echarts/pull/21835
## Brief Information This pull request is in the type of: - [x] 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 - #21833 ## 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. - [x] 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. --- <sub>🤖 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`.</sub> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
