Is there a way to sort the legends in a chart for a Dashboard?

Ja'van Kinghorn shared this question 4 years ago
Answered

Hi,

I was wondering if there is a way to sort the legend in a chart to appear alphabetically?


Example: If I wanted to measure different fruits in a shop and I have Bananas, Strawberries and Oranges, is there a way so that when I add them to a chart, I can sort it alphabetically so that Bananas would come first, etc.


Thanks in advance!

Replies (1)

photo
1

Hi Ja'van,

Thanks for reaching out. This is indeed possible, although it does matter what chart type you're attempting this with. For example, an Auto-Chart that defaults to a Vertical Column chart will not have the option I'm about to show, but if you go to create an actual Vertical Column Chart, and click the arrow next to your field under Color, you'll see a Sort option:

/aa59f6bc98839db099bd01d2fe7526fb

For either Ascending or Descending (alphanumerically). As you can see in my example, after choosing Descending, you can see my legend is now the reverse from my data set in the actual chart, which is Ascending.

There may be some minor variations on this depending on the chart type chosen, but if you have a particular chart in mind and this isn't enough info to get you pointed in the right direction with said chart, please let me know and I can assist further.

Regards,

Mike

photo
1

Hi Mike,


This is great, thanks for the assist, I appreciate the work.


Just one last one regarding this, what about if I wanted to sort in terms of the highest number.


Weird example again: We sold 8 Bananas and 3 Strawberries and 5 Orange for the day, is it possible to sort data just from the sales of fruits for that day, so again if I hover over a Stacked Vertical Column chart for that day, the box would show Bananas first, then Oranges and then Strawberries as the last one.


Regards,

Ja'van

photo
1

Hi Ja'van,

I'm afraid that this will generally not be possible. Technically, since one of the Sort Options is Data Order, if you change the order using Reference Codes and each value for your Dimension values in the Color section are in the same order as your Horizontal axis, you'd be able to achieve this, but this would be specific to the result set of the current report.

To use an example with our tutorial data, for this to work, basically each Region would need to have each Demographic's value in the same order, i.e. Adventure most, Relaxation 2nd most, etc., then you can manually order by Demographic, but this is highly unlikely:

/5116749befa401764e0874652e651f0a

In short, there's no way to dynamically sort a dimension by descending sort of the linked metric at the Chart level - unless, depending on your data set, you're able to make it work manually as per the Reference Codes option. You can reference the Wiki entry that I linked above if you think this may be a possibility in your use case.

Please let me know if you have any further questions on this.

Regards,

Mike

photo
1

No Problem,


Thanks for your help!


Regards,

Ja'van

photo
1

Hi Ja'van,

You're welcome! This considered, I'll go ahead and close this case out, but if you have further questions or concerns on this, if you respond, it will re-open the case and put it back in my queue and I'll be happy to help.

Regards,

Mike

photo
Leave a Comment
 
Attach a file