top of page

Sort bar/columns/breakby manually

This script is to sort items in X-axis manually. Widget will display bar/columns in the order you specified in 'categories' list

var categories= ['Jan','Feb','Mar','Apr','May','Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
	ev.rawResult.values.sort(function(a, b){
		var aIndex = categories.indexOf(a[0].data);
		var bIndex = categories.indexOf(b[0].data);
		if (aIndex < bIndex)
			return -1;
		if (aIndex > bIndex)
			return 1;
		return 0;

If you need to sort items in 'Break by', use below script

breakby = ['West', 'Midwest', 'South', 'Northeast', 'Unknown']
		if (breakby.indexOf( < breakby.indexOf( {
			return -1
		else if (breakby.indexOf(>breakby.indexOf( {
			return 1
		return 0;

427 views0 comments

Recent Posts

See All


bottom of page