Sorting labels/legend

Hello,

I want to know if there is a simple way of sorting/ordering legend / data labels in histograms?

For Pie Chart I have just used alphabetical order: I have put a letter before the label and then I have used a “sort by” in the query and it seems to work. But for histograms it does not.

Thank you

1 Like

Hi @Yacine
You can order the entire result by using sorting under Additional Options:
https://metabase.com/docs/latest/users-guide/04-asking-questions.html#additional-options
But you would have to change “X-axis scale” to “Ordinal” in the Visualization settings :gear:

Thanks for the reply but what I want to order is the display of the legend. Look at the picture below :

The items in the legend are not in alphabetical order. I guess that if I was able to change the stacking order it would change the order in the legend but I don't know how to do it.

Ahh, okay, you’re talking about Stacked sorting - there’s a long thread with links and work-around: Sorting of histograms

@flamber thanks for the pointer. However @Yacine is asking after the ordering of the legend, not the ordering of the bar chart.

Have got the same issue here in trying to sort the legend, no luck so far.

@lvdv You can change the order of the legend by sorting that column. Example with Sample Dataset, I have sorted Category descending order: