Forum Discussion

amelia's avatar
03-30-2022
Solved

Order Months in Column chart by logical order

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 🙂

  • 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

     

2 Replies

Replies have been turned off for this discussion
  • harikm007's avatar
    harikm007
    Data Warehouse

    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