You need to enable JavaScript to run this app.
Intelligent Data Insight

Intelligent Data Insight

Copy page
Download PDF
Analysis Configuration
Sorting
Copy page
Download PDF
Sorting

1. Overview

The sorting component supports sorting the horizontal axis, vertical axis, and dimension fields within charts. DataWind provides components with sorting functionality, offering three sorting methods: ascending, descending, and manual sorting. Date fields only support ascending and descending order, while other fields allow custom ordering of field values.
Example:
Image

2. Quick start

2.1 Table sorting

Step 1: Use the dropdown to select the field to sort by, and choose the sorting method.
Image
Step 2: Click "Apply."
Image

2.2 Chart sorting

Step 1: Use the dropdown to select the field to sort by, and select the sorting method.
Image
Step 2: Click "Apply."
Image

3. Feature introduction

3.1 Table sorting

3.1.1 Header sorting

The table provides header sorting for single-condition sorting. Hover the mouse over the header field and click the sorting button to easily configure sorting.
Image

3.1.2 Sorting configuration

Header sorting acts as a quick sorting configuration. Clicking the sorting button in the header will automatically generate a sorting rule in "Sorting." Meanwhile, "Sorting" supports multi-condition sorting, allowing multiple sorting rules to take effect simultaneously. Example: Sort order types in ascending order, and within the same order type, sort payment dates in descending order. Then modify to sort first by payment date in descending order, then by order type in ascending order.
Step 1: Sort order types in descending order.
Image
Step 2: Add a sorting rule to sort payment dates in descending order.
Image
Step 3: Use the sorting adjustment button to change the order of the above sorting rules. Move "Order type ascending" down or "Payment date descending" up; in this case, use the first method.
Image
Step 4: Click "Apply."
Image

3.2 Chart sorting

3.2.1 Numeric sorting

For charts with X and Y axes, when there is only one dimension field in the data panel, numeric sorting can be performed. The sorting basis can be the axis dimension field itself or any metric field in the data panel.
Image

3.2.2 Dimension axis sorting

For XY-axis charts, when there are multiple dimension fields in the data panel, dimension axis sorting can be performed. The sorting basis can be either the axis dimension field itself or any indicator field in the data panel.
Image

3.2.3 Legend sorting

For XY-axis charts with multiple dimension fields in the data panel, or for charts without axis dimensions such as pie charts and scatter plots, legend sorting can be performed. The sorting basis can be "dimension-legend" or any indicator field in the data panel. Each data point in a dimension will be sorted according to the unified order of the legend.
Image
Legend sorting calculation logic: The calculation is performed based on the legend's dimension according to the indicator calculation logic, and after calculation, sorting is performed directly, as shown in the figure below:

Horizontal axis dimension

BU name

Legend

Product name

Metric calculation

sum (revenue)

Legend sorting calculation logic

Product name is sorted in ascending order based on the sum of revenue

Image

Example

The product names in the chart below are sorted as described above. For each dimension (BU name), multiple product names are displayed on a single bar, following the order in the table above, that is, arranged from top to bottom according to the order of the legend on the right.

Image

3.3 Pivot table sorting

By default, pivot table sorting requires selecting two items: the first is the sorting field, and the second is the sorting basis.
The sorting field determines the calculation scope for sorting, while the sorting basis determines which field's result is used for sorting. Only the currently selected sorting field will be sorted, and the order of other dimensions will not be affected.

Scenario 1: Sorting by row dimension

Example 1: If the sorting field is set to "Primary Channel" and the sorting basis is set to "Payment Amount", the sorting will first calculate the sum of payment amounts for each "Primary Channel" enumeration value, and then sort the "Primary Channel" accordingly.
For example, the sum of "Payment Amount" for all "Marketing Activities" and the sum of "Payment Amount" for all "Official Website and App Store"; the sorting will only affect the order of "Primary Channel" enumeration values, not other dimensions, so after sorting, the "Payment Amount" for each "Primary Channel" will still be unordered.
Example 2: When the sorting field is set to "Secondary Channel" and the sorting criterion is set to "Payment Amount", the sorting process will first calculate the sum of the "Payment Amount" for each "Secondary Channel", and then sort the "Secondary Channels" under each "Primary Channel" accordingly.
In this case, the sorting only adjusts the order of the "Secondary Channels" under each "Primary Channel". Therefore, whether ascending or descending order is selected, the order of the "Primary Channels" will not be affected.
Example 3: When the sorting field is set to "Payment Method" and the sorting criterion is set to "Payment Amount", the process will first calculate the sum of the "Payment Amount" for each "Payment Method", and then sort the "Payment Methods" under each "Secondary Channel" accordingly (since "Payment Method" does not have a lower-level dimension, the sum of the "Payment Amount" corresponds to its own value).
At the same time, the sorting only affects the order of the "Payment Methods" under each "Secondary Channel" and does not affect the order of the enumeration values for "Primary Channel" and "Secondary Channel".
Summary: Based on the three examples above, the logic of pivot table sorting can be summarized as follows: Pivot table sorting calculates the sum of the sorting criterion field at the enumeration value granularity of the sorting field, and then sorts the enumeration values of the sorting field within the scope of the upper-level dimension of the sorting field.

Scenario 2: Sorting column dimensions

When a column dimension is added to the pivot table, you can select the column dimension field as the sorting field. The sorting rules for column dimension fields are the same as those for row dimensions.
For example, if the sorting field is set to "Payment Method" and the sorting criterion is set to "Payment Amount", the process will first calculate the sum of the "Payment Amount" for each "Payment Method", and then sort based on this sum. This can be observed by adding a column total: first calculate the total for each column, and then sort according to the total.

Scenario 3: Quick sorting

The quick sort feature in pivot tables differs from sorting in regular tables. Once quick sort is applied, a sorting configuration is automatically added in the "Analysis - Sort" feature, where you can view the status of the applied sort:
Quick sort when there are only row dimensions
When sorting by a metric or the last row dimension, the sorting result is based on sorting the last row dimension. For reference, see Example 3 in Scenario 1 above.
When sorting by other dimensions, the sorting result can be referenced in Example 1 and Example 2 in Scenario 1 above.
Quick sort when there are column dimensions
When column dimensions are added to the pivot table, multiple columns may be generated. When using quick sort, sorting is performed based on the currently selected column. Therefore, the sorting generated by quick sort in "Analysis - Sort" will include an additional filter criterion column, indicating which column the sorting is based on.
When the selected sorting field is a metric, as shown in the figure below where the "Alipay APP" column under "Payment Method" is selected for quick sort, the generated sorting configuration will include a filter criterion for "Alipay APP", and the final sorting result will also be based on this column.
The sorting method can be referenced in Example 3 in Scenario 1 above, that is, for each "Primary Channel", the "Secondary Channel" is sorted by the "Payment Amount" in the "Alipay APP" column.
When the selected sorting field is a dimension, the sorting result is the same as in Example 1 and Example 2 in Scenario 1 above, sorted by the total result of the selected dimension's corresponding row.

Last updated: 2026.06.11 17:45:45