cancel
Showing results for 
Search instead for 
Did you mean: 

Issue In Sorting X-axis Labels

Chandra
8 - Cloud Apps
8 - Cloud Apps

Hi Sisense Community..

I am having an issue in arranging the x-axis labels in Heat Map. In this first we have chosen scatter chart and  then converted in to heat map using the below code

widget.on('beforeviewloaded',function(se,ev){
ev.options.chart.type='heatmap'
})

For this we have tried with some scripts in order to sort X-axis values but no change .Can anyone help in this?

 

Heatmap.png

 

2 REPLIES 2

harikm007
13 - Data Warehouse
13 - Data Warehouse

@Chandra ,

Try this script to sort X-axis (update the array 'categories' with list of X-axis items in order) : 

var categories= ['South','West','Midwest','Northeast','Unknown'];

widget.on('queryend',function(se,ev){
	ev.rawResult.values.sort(function(a, b){
		var aIndex = categories.indexOf(a[0].data.trim());
		var bIndex = categories.indexOf(b[0].data.trim());

		if (aIndex < bIndex)
			return -1;
		if (aIndex > bIndex)
			return 1;

		return 0;
	})
})

-Hari

zohebakber
9 - Travel Pro
9 - Travel Pro

How to sort the y axis like this?