Forum Discussion

NeilHEvotix's avatar
NeilHEvotix
Data Storage
11-02-2023
Solved

Polar Chart: order categories

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?

  • 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

     

2 Replies

Replies have been turned off for this discussion
  • 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

     

    • NeilHEvotix's avatar
      NeilHEvotix
      Data Storage

      Fantastic Benji - worked perfectly - much appreciated ğŸŒŸ