cancel
Showing results for 
Search instead for 
Did you mean: 

Polar Chart: order categories

NeilHEvotix
7 - Data Storage
7 - Data Storage

For a Polar Chart Type I need to specify the order for the category values - there is no facility in the design panel to do this. I am not able to change the data to add numbers at the start of the categories.

Is there a way to order the category values via script?

1 ACCEPTED SOLUTION

Benji_PaldiTeam
11 - Data Pipeline
11 - Data Pipeline

Hi @NeilHEvotix ,

If you're searching for a method to arrange category items in a polar widget, consider using this script:

var categories= ['New','Used','Refurbished','Unspecified'];

widget.on('queryend',(sender,args) => {
	args.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;
	})
})

In above script, update the 'categories' array with your category items in required sort order.


Additionally, check out the Advanced Radial Infographics plugin, offering a broader range of options to enhance user insights.

Feel free to reach out if you have further questions, we're always happy to help 🙂

[email protected]
Paldi Solutions

 

View solution in original post

2 REPLIES 2

Benji_PaldiTeam
11 - Data Pipeline
11 - Data Pipeline

Hi @NeilHEvotix ,

If you're searching for a method to arrange category items in a polar widget, consider using this script:

var categories= ['New','Used','Refurbished','Unspecified'];

widget.on('queryend',(sender,args) => {
	args.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;
	})
})

In above script, update the 'categories' array with your category items in required sort order.


Additionally, check out the Advanced Radial Infographics plugin, offering a broader range of options to enhance user insights.

Feel free to reach out if you have further questions, we're always happy to help 🙂

[email protected]
Paldi Solutions

 

Fantastic Benji - worked perfectly - much appreciated 🌟