Data Ranking is a new feature introduced in ChartsPLUS 3.0. This enables us to rank and display data in our Analysis Application based on specific criteria we assign during creating of the Application.

In the following blog we will rank Country Population data to display the Highest and Least populated countries in our output. You can watch an online demo of this functionality at the below.

 

The blog below provides the detailed steps on working with Ranking in ChartsPLUS.

Lets start by creating a new Analysis Application and adding a ChartsPLUS 3.0 chart to the Layout. Add the following population data to the application. Note that our Country population data is already sorted in Descending order from the Country with the largest popularity to the country with the lowest.

ranking-data-source

 

Under the Chart selector option click on Bar and set the chart to Clustered Bar.

ranking-chart-type

 

Under the Additional Properties of the Chart, go to Config>>Graphing>>Graphs>>General and enable the Show Value Labels option of the Column 0 graph.

ranking-show-value-labels

 

Now, to set the Rank values at design time we go to Data>>Data>>Ranking and set the Ranking Mode to Bottom. Set the Top/Bottom Amount to 5. Under Ranking Field set the Field Type to By Position and Field Position to 0.

ranking-configuration-2

 

Execute the application by clicking on the Execute Locally button. The resulting application displays only the Bottom 5 least populated countries in descending order in the form of a Bar chart.

ranking-bottom-ranks

 

Similarly, the Ranking Mode property can be modified to filter data based on Top values as well, as demonstrated below. (Note: These values will be set as the default values for the purposes of this blog):

ranking-configuration-1ranking-bar-initial

 

USING BIAL SCRIPTS TO CHANGE RANKING VALUE DURING RUN TIME


From the Basic Components panel add a Dropdown Box to the analysis application. Under Properties View go to Display>>Items and add the following items to the Dropdown box. Click OK. (Note: Setting value Top 10 as Default ensures that by default the display text in the dropdown will be Top 10. This corresponds to our default Rank value set up in the Additional Properties while creating the application)

ranking-dropdown-items-1

 

Similarly, under Events>>On Select click the Edit the script button and in the Script Editor popup add the following:

ranking-bial-top(Note: The script above sets the Ranking Mode to ‘Top’. It then gets the value selected by the user from the Dropdown Box and sets it as the Ranking Amount for the Chart. The Dropdown box configured above allows users to display the Top-ranking Countries by Population. Let us configure a second Dropdown to display the Bottom-ranking Countries.)

Drag and drop a second Dropdown Box and under Display>>Items add the following values. Click OK.

ranking-dropdown-items-2

 

Under Events>>On Select of this second Dropdown click the Edit the script button and in the Script Editor popup add the following:

ranking-bial-bottom

 

Testing the application


Let us test the Application by Executing it locally. Initially our Chart displays the default values we have set as shown below:

ranking-bar-final-default

 

Let us demonstrate the ability to change the Top Ranking value at run-time by changing the option in the leftmost Dropdown to Top 20.

ranking-bar-final-top

 

Similarly, lets change the option in the rightmost Dropdown to Bottom 10.

ranking-bar-final-bottom

 

In the future release of ChartsPLUS we will be adding the option to changing ranking at runtime to the toolbar of the chart.

You can request a trial version of ChartsPLUS from here.