Replies: 1 comment 1 reply
-
If I may add, this is a much needed feature not only for bar charts, but rather for each and every chart type where categorical data is supported. Some native control over ordering would be really nice. Playing with Unicode escape sequences just to achieve that looks like a forbidden magic as it renders the data dirty. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
PROBLEM
Users need to be able to sort categorical x-axis variables by something other than alphabetical or total/max/min/avg. For instance Sun-Mon-Tue-Wed-Thu-Fri-Sat order, or Jan-Feb-Mar-Apr, or Bad-Fair-Good-Great, etc. But Bar Chart v2 does not support this.
Take this chart (from master branch as of Sep 2024):
The x-axis is alphabetically sorted and there is no way currently to make it the desired order Sun-Mon-Tue ...
PROPOSED SOLUTION
Allow the x-axis sort by to use another metric, like what
Query sort by
already does:Then users can create a numeric variable corresponding to their arbitrary desired order (in my case
Day_Numeric
) and control ordering that way.WORKAROUNDS IN THE MEANTIME
Community members suggest appending whitespace or numerals to the beginning of the categorical variable and then using alphabetical order. The cleanest version of this I've seen is from @marianysilva who shows how to append invisible whitespace characters to the beginning.
RELATED
This emerges from #21425 (comment), which is originally an issue about Bar Chart v1 (legacy). But the best solution is to support this sorting in Bar Chart v2.
Another user asks for the same thing for the Heatmap chart in #30371. I suspect the bar chart gets higher use and should be the priority but maybe the same fix could apply to all relevant ECharts.
Beta Was this translation helpful? Give feedback.
All reactions