Skip to content
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

[Feature] Be able to reverse legend order (stacked bar charts) #20779

Open
jpike88 opened this issue Feb 21, 2025 · 1 comment
Open

[Feature] Be able to reverse legend order (stacked bar charts) #20779

jpike88 opened this issue Feb 21, 2025 · 1 comment
Labels
en This issue is in English new-feature pending We are not sure about whether this is a bug/new feature.

Comments

@jpike88
Copy link

jpike88 commented Feb 21, 2025

What problem does this feature solve?

I am replacing dashboard paid for by companies in maintenance and oil/gas industries, who would have charts like below. See how the legend shows lowest to highest values (or increasing severity). The stacked bar shows the highest values at the bottom, as they tend to be more important and fluctuate less.

This is what I am aiming to achieve.

Image

But I can't find a way to do this in echarts. See below for what I've managed to get done. You can see how bad it looks, having the legend ordered that way is counter intuitive.

Image

What does the proposed API look like?

I think a simple

order: null | 'reversed' property on the legend property would be enough.

@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels Feb 21, 2025
@helgasoft
Copy link

A workaround using visualMap instead of legend - Demo.
Disadvantage: bars not auto-rearranging after visibility toggle.
Advantage: bars auto-sorting by piece-types, ex: black bars always on bottom.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
en This issue is in English new-feature pending We are not sure about whether this is a bug/new feature.
Projects
None yet
Development

No branches or pull requests

2 participants