M.App Enterprise Discussions

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Occasional Contributor
Posts: 20
Registered: ‎12-04-2018
Accepted Solution

How to arrange legends in ascending order in Analyzer View

Hi, I wanted to create charts in the analyzer view and when I added chart like pie chart, the legends are not in order. Is there a way to customize it personally so the legends will be in order ascending accordingly? 

 

Thanks

 

pie chart.PNG 

Technical Evangelist
Posts: 660
Registered: ‎11-12-2015

Re: How to arrange legends in ascending order in Analyzer View

Hi jovlinda,

 

There is option to 'Enable Sorting' in Row Charts and Data Table charts.

Either ascending or descending by Alpha or Numeric

Here is example of Row Chart sorted ascending Numeric

EnableSorting.JPG

 

Let me check if there is possibility to sort specifically in the pie chart type you reference here.

 

Technical Evangelist
Posts: 660
Registered: ‎11-12-2015

Re: How to arrange legends in ascending order in Analyzer View

This should get a published tutorial for better documentation and I will get to that in near future. For now I will explain here:

Ordering of legend can be accomplished with Pie Charts by leveraging Functional Attributes and the Logical Switch Statement (Ordered List) Example

OrderedList.JPG

 

In this example dataset there are 5 values for attribute RUCR_EXT_D and I display them as theme in the pie chart. As you can see, it is not ordered by default

unorderedpie.JPG

Using the Functional Attributes I create an OrderedList attribute based on the order I wish. In the case I will choose Descending in count of Crime Types

switch (currentRecord["RUCR_EXT_D"]) {
    case "ASSAULT":
        return "0|||Assault";
        break;
    case "BREAK AND ENTER":
        return "1|||B and E";
        break;
    case "THEFT FROM VEHICLE":
        return "2|||Theft from vehicle";
        break;
    case "THEFT OF VEHICLE":
        return "3|||Theft of Vehicle";
        break;
    case "ROBBERRY":
        return "4|||Robbery";
        break;
        default:
        return "Not a valid Crime Type";
}

Then I use that 'OrderedList' functional attribute for the Theme and Pie Chart. The result is Pie Chart sorted legend in the way I desire. There are notes with the Switch Statement example that explain that code in particular.

results.JPG

 

HTH

 

 

Occasional Contributor
Posts: 20
Registered: ‎12-04-2018

Re: How to arrange legends in ascending order in Analyzer View

Thank you sclow, this is what I want and I manage to do it