You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "Yahiro025 (via GitHub)" <gi...@apache.org> on 2026/09/24 07:32:21 UTC
[PR] fix(pie): clear selectedOffset translation after data replace [echarts]
Yahiro025 opened a new pull request, #21763:
URL: https://github.com/apache/echarts/pull/21763
<!-- Please fill in the following information to help us review your PR more efficiently. -->
## Brief Information
This pull request is in the type of:
- [x] bug fixing
- [ ] new feature
- [ ] others
### What does this PR do?
Clear leftover `selectedOffset` x/y translation on pie sectors after `setOption` replaces data so layout stays centered.
### Fixed issues
- #21756: Pie selected slice x/y offset persists after setOption with fewer data items
## Details
### Before: What was the problem?
With `selectedMode: 'multiple'` and `selectedOffset`, selecting pie slices applies a graphic translation. After `setOption` replaces `series[0].data` with fewer items (`notMerge: true`) and `resize()`, those x/y offsets can remain on sector (and labelLine) elements even when the item is no longer selected. `dispatchAction({ type: 'unselect' })` alone does not clear them, so the pie can look shifted or misaligned relative to the series layout box.
Repro: https://jsfiddle.net/ma_ss_ai/0kozdxfy/5/
### After: How does it behave after the fixing?
In `PieView` / `PiePiece`, when updating select-state geometry, if the series item is not selected, reset the sector (and labelLine) translation to `{ x: 0, y: 0 }` before applying select offset. That drops stale select-state translation left from a previous selection when data is replaced, so a following `resize()` no longer leaves slices shifted.
Added:
- unit test `test/ut/spec/series/pie-selectedOffset.test.ts`
- manual HTML case `test/pie-selectedOffset-setOption.html`
## 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
See `test/ut/spec/series/pie-selectedOffset.test.ts` and `test/pie-selectedOffset-setOption.html`.
### Merging options
- [x] Please squash the commits into a single one when merging.
### Other information
AI assistance was used while preparing this change; the commit is authored solely as Yahiro025 (Bennett Payoyo).
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(pie): clear selectedOffset translation after data replace [echarts]
Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on PR #21763:
URL: https://github.com/apache/echarts/pull/21763#issuecomment-5809814357
Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/echarts/wiki/How-to-make-a-pull-request).
Please **DO NOT** commit the files in [dist](https://github.com/apache/echarts/tree/master/dist), [i18n](https://github.com/apache/echarts/tree/master/i18n), and [ssr/client/dist](https://github.com/apache/echarts/tree/master/ssr/client/dist) folders in a non-release pull request. These folders are for release use only.
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org