Forum Discussion
sorting legend based on two criteria
I have a simple dataset that contains each supplier's sale in each year. I made a bar chart with years in the x axis and suppliers' sale on the y axis and used supplier company as legend.
I want to sort the legend (suppliers) in each bar (year) based on the total sales of that supplier in that specific year.
I can sort them by all-time total sales of suppliers, but I dont know how to do this sorting in each year.
6 Replies
- josef78Memorable Member
Try Ribbon chart, and set transparency on connectors....
- lbendlinSuper User
mojganmeibodi19 I think josef78 's proposal is the best answer.
- dm-pSuper User
Vega and Vega-Lite don't have sorting capabilities for more than one field using standard language constructs, but you can use transforms and window functions to create fields that dictate a sort order that you can then sort by.
- lbendlinSuper User
Could you layer the individual columns as separate marks with their own sort order? Or would you have to know the number of columns/marks beforehand?