cancel
Showing results for 
Search instead for 
Did you mean: 

How to sort legends in pie chart Manually

rameshp0233
7 - Data Storage
7 - Data Storage

I wanted to sort Legends in Pie Chart  Manually according to  my wish. Any information or code  related to it will appreciated.

 

rameshp0233_0-1647943276732.png

 

1 REPLY 1

harikm007
12 - Data Integration
12 - Data Integration

@rameshp0233 ,

Please try the script mentioned here

 

var categories= ['Jan','Feb','Mar','Apr','May','Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
widget.on('queryend',function(se,ev){
	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;
	})
})

-Hari

Voice of Customer
Impact Business Intelligence (BI) and Analytics Market Research

Click Here & Complete Dresner's Wisdom of Crowds® Market Study Survey Today!

Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Need additional support?:

Community Support Request

Don't miss out:

Earn a BETA Launch Challenge Badge!