Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Karahs
Partner - Creator
Partner - Creator

Sort legend in stacked bar chart

Hello Community,

How to sort the values in the legend in a stacked bar chart in Qlik Sense.


Ageing.PNG

Kind Regards,

10 Replies
ahaahaaha
Partner - Master
Partner - Master

Hi,

May be define the sorting of function CLASS() (see attached file).

Regards,

Andrey

Karahs
Partner - Creator
Partner - Creator
Author

Hi Andrey,

Thanks for the response, i tried using Class() but it is not working. Even the legends disappear.

afgefkln.PNG

Regards,

ogster1974
Partner - Master II
Partner - Master II

Sort by valuelist() ?

Karahs
Partner - Creator
Partner - Creator
Author

Hi Andy ,

Thanks for the response, tried using valuelist(), but its not working!

Thanks & Regards,

mdmukramali
Specialist III
Specialist III

Dear  kshitijas‌,

can you share Qvf with your sample data , so that we can help you in better way,

Thanks,

Mukram.

Anonymous
Not applicable

Hi all,  has anyone found a resolution or a workaround for the legend sorting issue that works?  I am running into the same exact issue.  I am also using the Limitation property to get the top 10 dimension values and the sorting between the stacked bar chart and legend is not working or matching.

Best,

MB

MK9885
Master II
Master II

Try this in your script

Sorting:

LOAD * INLINE [

    SortDaysBucket, DaysBucket

    1, 0-30

    2, 30-60

    3, 60-90

    4, >90

    ];


DaysBucket is your Field in Data which would map automatically.

And use SortDaysBucket in frontend in your Sorting options for BarChart. Adjust it Ascending or Descending as per you required.



Anonymous
Not applicable

This logic won't work in my case as my field (i.e. your DaysBucket) values is dynamic values and will constantly change and cannot be hard coded.