Sorting the data in the diagram

In this tutorial, you will learn how to bind a diagram with a list and sort the data in it.

1. List

Create a list called SALE and add three columns to it named: Month, Month_No, and Sales. Change the Sales column type to Number. Copy the data from the bottom of the page and import it into the list.


2. Binding a diagram with the list

Create a new app and add a diagram widget in it. Title the axes: 'Months' and 'Product Sale'. Add a new serie named 'Sale', and enter in the formula: =LOOKUP(SALE,MONTH,SALES).


Save the app and run preview.


Notice that the data on the X-axis is sorted alphabetically, which is not a good thing for this diagram. In this case we want the months to appear in the calendar order.

3. Sorting data by category

You can sort the data in the diagram in two ways. The first is listing the data array in the correct order in Categories. Expand the X-axis options and in the categories type array with all the months in the correct order.


Save and go to preview.


Now the data is properly sorted in the diagram.

4. Sort using table

The second way is to bind the data in the list to a table where the sort can be set. Add a table widget to the app designer. Bind the table with the SALE list and the appropriate columns as shown below. In the column with the month number, set the sort to ascending.



In the diagram options in categories of the X axis, provide the data from the column with months. In the series, provide the data from the sales column as the data formula.


Save and preview the effect.


The data in the table is sorted by the month number, thanks to which the data in the diagram is sorted correctly.


Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk