b84330808 opened a new pull request, #21799: URL: https://github.com/apache/echarts/pull/21799
<!-- 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? Make the magicType `stack` button recognize series that are already stacked by `series.stack`, and restore those stack groups when switching back from tiled. ### Fixed issues - #15571: MagicType 'stack' does not recognize bars being stacked upon chart initialization, fails to change to tiled on first click. ## Details ### Before: What was the problem? The stack button only treated a series as stacked when its `stack` was the inner keyword set by the button itself (`__ec_magicType_stack__`). For series stacked by users (e.g. `stack: 'cars'`): - The first click "stacked" them again, so nothing visibly changed, and it only took effect on the second click. - Separate user stack groups (e.g. `groupA` and `groupB`) were merged into one single stack, and the original groups were never restored. ### After: How does it behave after the fixing? - Whether the chart is currently stacked is decided once per click over all target line/bar series: it is stacked if any series uses the magicType inner stack, or if any `series.stack` value is shared by more than one series. So user-stacked charts switch to tiled on the first click. - When switching to tiled, the user-defined `stack` values are remembered per series id on the global model (like the dataZoom history) and restored when switching back. Series without a user-defined stack still use the inner magicType stack as before. - Existing behaviors are kept: charts without stacks, a single series, and a `stack` name used by only one series (as in `test/toolbox-stack.html`) toggle the same way as before. Added unit tests in `test/ut/spec/component/toolbox/magicType.test.ts`. They click the actual toolbox icon, and 3 of them fail without this change. The full unit test suite, `tsc --noEmit` and eslint pass. I used Claude Code to write this change. ## 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 `test/ut/spec/component/toolbox/magicType.test.ts` ### Merging options - [x] Please squash the commits into a single one when merging. ### Other information Related reports: #16473, #20371, #20031, #13103. -- 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]
