Set custom color legend sort order when using stacked bars #9482
|
hi team, new to this, may need some help with stacked bar chart, using the example below:
my question is how do I sort the bars in the same order as legend? https://vega.github.io/vega-lite/examples/stacked_bar_weather.html thanks! |
Answered by
hydrosquall
May 1, 2025
Replies: 1 comment
|
Hi @r00tnpm , you can sort the entries based on how you define the legend domain order (example )
In the more general case where you didn't set a custom scale, see @PBI-David 's answer. This works when you don't have a custom domain and range: https://stackoverflow.com/a/76158192/5129731 |
0 replies
Answer selected by
hydrosquall
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Hi @r00tnpm , you can sort the entries based on how you define the legend domain order (example )
In the more general case where you didn't set a custom scale, see @PBI-David 's answer. This works when you don't have a custom domain and range: https://stackoverflow.com/a/76158192/5129731