Justin-ZS opened a new pull request, #20998: URL: https://github.com/apache/echarts/pull/20998
<!-- Please fill in the following information to help us review your PR more efficiently. --> ## Brief Information This pull request is in the type of: - [ ] bug fixing - [x] new feature - [ ] others ### What does this PR do? <!-- USE ONE SENTENCE TO DESCRIBE WHAT THIS PR DOES. --> Add support for reversing stack order in stacked charts through a new `stackOrder` option. ### Fixed issues <!-- - #xxxx: ... --> https://github.com/apache/echarts/issues/20983 ## Details ### Before: What was the problem? <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. --> Previously, stacked charts (bar, line, area) only supported the default stacking order where series are stacked in the order they are defined. Users had no way to reverse the visual stacking order without manually reordering their series data, which could be inconvenient. <!-- ADD SCREENSHOT HERE IF APPLICABLE. --> ### After: How does it behave after the fixing? <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. --> Now users can set `stackOrder: 'reverse'` on any series in a stack group to reverse the visual stacking order. The feature works by: 1. Adding a new `stackOrder` option to `SeriesStackOptionMixin` with values `'normal'` (default) or `'reverse'` 2. Modifying the data stack processor to check for the `stackOrder` setting and reverse the stack info list when needed 3. Properly updating the `stackedOnSeries` calculation to maintain correct stacking relationships The feature supports all chart types that use stacking (bar, line, area charts). Note that polar coordinate systems are not yet supported, and documentation will be updated in a future release. Future enhancements may include value-based ascending/descending stack ordering. <!-- ADD SCREENSHOT HERE IF APPLICABLE. --> ## Document Info One of the following should be checked. - [ ] This PR doesn't relate to document changes - [x] The document should be updated later - [ ] The document changes have been made in apache/echarts-doc#xxx ## Misc ### ZRender Changes - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx). ### Related test cases or examples to use the new APIs - `test/bar-stack-reverse.html` - Comprehensive test cases demonstrating the new `stackOrder` functionality with vertical bars, horizontal bars, and stacked line charts <img width="443" alt="截屏2025-05-27 16 18 52" src="https://github.com/user-attachments/assets/38a97f75-db85-4656-8d9d-4f9edbbd6fd7" /> ## Others ### Merging options - [x] Please squash the commits into a single one when merging. ### Other information **Limitations:** - Polar coordinate systems are not yet supported - Currently only supports 'normal' and 'reverse' order (value-based sorting may be added in future versions) **Future Enhancements:** - Support for polar coordinate systems - Potential support for value-based ascending/descending stack ordering -- 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]
