cancel
Showing results for 
Search instead for 
Did you mean: 

Order Months in Column chart by logical order

amelia
9 - Travel Pro
9 - Travel Pro

Hi Sisense community, I would like to order the months in my column chart according to the logical order, but right now it's mainly showing alphabetical order. Would anyone be able to assist on this? Ideally I would like to achieve it on the frontend without any change on EC, but open to any solution 🙂

1 ACCEPTED SOLUTION

harikm007
12 - Data Integration
12 - Data Integration

@amelia ,

Try this script - https://www.binextlevel.com/post/sort-bar-columns-breakby-manually

Here, update the list 'breakby' with list of months in order

breakby = ['West', 'Midwest', 'South', 'Northeast', 'Unknown']
widget.on('processresult',function(se,ev){
	ev.result.series.sort(function(a,b){
		if (breakby.indexOf(a.name) < breakby.indexOf(b.name)) {
			return -1
		}
		else if (breakby.indexOf(a.name)>breakby.indexOf(b.name)) {
			return 1
		}
		return 0;
	});
})

-Hari

 

View solution in original post

2 REPLIES 2

harikm007
12 - Data Integration
12 - Data Integration

@amelia ,

Try this script - https://www.binextlevel.com/post/sort-bar-columns-breakby-manually

Here, update the list 'breakby' with list of months in order

breakby = ['West', 'Midwest', 'South', 'Northeast', 'Unknown']
widget.on('processresult',function(se,ev){
	ev.result.series.sort(function(a,b){
		if (breakby.indexOf(a.name) < breakby.indexOf(b.name)) {
			return -1
		}
		else if (breakby.indexOf(a.name)>breakby.indexOf(b.name)) {
			return 1
		}
		return 0;
	});
})

-Hari

 

That worked, thank you !