How to sort stacked bar chart in descending order? #3388
Answered
by
d-trigo
levinaanora
asked this question in
Q&A
-
Hi all, currently I am creating a stacked bar chart and I don't have any idea why my chart cannot be sorted in descending order eventhough I already use the .sort(-x).
|
Beta Was this translation helpful? Give feedback.
Answered by
d-trigo
Mar 28, 2024
Replies: 1 comment 4 replies
-
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
levinaanora
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So not entirely sure about the underlying causes of how it occurred, but I think there was a conflict between the two datasets created (the first one being the per-variant sales per-country and the other being the all-variant sales per country) where Altair got confused when merging them for the image output in terms of getting the sorting; running the chart and text graphs separately the countries do appear in descending order in either case, but the incorrect sorting order only occurs when you combine the graph and text elements into one. Assuming I'm interpreting your request to get the countries sorted by their Total Units in descending order, I used this in order to see if I could ge…