Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting in Line Charts

Hi

I have a line chart with the following labels at the axis.

S L M 45 60 70 80 90 100 110 216

its currently sorted Numerically & Alphabetically but i want it specifically like this

The L must go to the front, then the numerical numbers in order then the S must be at the back after the 216 or 234

How on earth can i do this?

12 Replies
Not applicable
Author

Hi Ruan,

Here is another approach.

Autonumber function will assign unique numeric value for each Dim.

Mapping Load will enable you to define which 'charater sring' value should fit within any possible 'numeric' possible value.

Use the sequence key generated based on the mapping load to sort your Dim in the Line Chart!

Hope this helps. Sample attached.

Please Note: Mapping load is a manual assignnment of numeric values to the Dim, so L gets the lowest value, S the hight value and other text char as per your choice to fit between other numeric Dim values.

sort_map:
Mapping LOAD * Inline [
a, b
S,235
L,0.5
M,101
];

MAP DimSort using sort_map;

Test:
LOAD *, Dim as DimSort;
LOAD * INLINE [
Dim, Value
S, 98
L, 100
M, 67
45, 34
110, 66
60, 44
70, 90
80, 32
100, 11
216, 34
];

TestKey:
NoConcatenate Load Dim, Value, DimSort, autonumber(DimSort) as DimSeqKey resident Test order by DimSort asc;

Drop table Test;

johnw
Champion III
Champion III


Manesh wrote:Simply u can use the wildmatch function in ur chart.


Or just match() in this case. Good solution for when you can't or don't want to modify script, or when different charts need different sort orders.

Not applicable
Author

Thanx Manesh.

This is perfect thanx, does exactly what i need and easy to implement