-
Notifications
You must be signed in to change notification settings - Fork 19.8k
feat(stack): able to reverse the stack order #20998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(stack): able to reverse the stack order #20998
Conversation
Thanks for your contribution! Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the |
🙌 and really love the future enhancement idea for "value-based ascending/descending stack ordering" |
test/bar-stack-reverse.html is a demonstration of expected results, with data order and colors predefined in data. |
new test case added. |
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-20998@dcebabd |
@Justin-ZS, the latest test/bar-stack-reverse.html still has plenty of itemStyle.color defined.
Unfortunately, this convenient way of testing PRs does not seem to work anymore. If someone could fix it, that would be fantastic; if not, please disable the confusing message from the github-actions bot. |
The |
@helgasoft Thanks for reporting. The service we're using for the bot is going to shut down. I should look for another one when I have time. Currently working towards v6 is the highest priority. |
Brief Information
This pull request is in the type of:
What does this PR do?
Add support for reversing stack order in stacked charts through a new
stackOrder
option.Fixed issues
#20983
Details
Before: What was the problem?
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.
After: How does it behave after the fixing?
Now users can set
stackOrder: 'seriesDesc'
on any series in a stack group to reverse the visual stacking order. The feature works by:stackOrder
option toSeriesStackOptionMixin
with values'seriesAsc'
(default) or'seriesDesc'
stackOrder
setting and reverse the stack info list when neededstackedOnSeries
calculation to maintain correct stacking relationshipsThe 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 accordingly.
Future enhancements may include value-based ascending/descending stack ordering.
Document Info
One of the following should be checked.
Misc
ZRender Changes
Related test cases or examples to use the new APIs
test/bar-stack-reverse.html
- Comprehensive test cases demonstrating the newstackOrder
functionality with vertical bars, horizontal bars, and stacked line chartsOthers
Merging options
Other information
Limitations:
Future Enhancements: