1. Problem description

In using a chart, it is able to display by data size. Take a column chart as an example, how to allow all columns to be sorted by data size from high to low or vice versa for better data analysis, as shown below?

2. Realization ideas

The chart, a good reporting tool and business intelligence tool, is sorted and displayed based on series by default.
If the chart data source comes from a single dataset, it is possible to sort directly using Sort In The Data Set, and set the chart data source as dataset data; if the chart data source is calculated by cell, it is possible to sort by using Sort After Extension and set the chart data source as cell data.

3. Example

Here is a simple example to show how to realize the effect as shown above so as to achieve data visualization.

3.1 Dataset data as chart data source

3.1.1 Open template
Open template:%FR_HOME%\WebReport\WEB-INF\reportlets\doc\Advanced\Chart\Logchart.cpt

3.1.2 Change data set
Change the original data set to descending sort by cost price, with SQL statement of SELECT * FROM [product] where category ID= 1order by cost price desc

3.1.3 View effect
View the effect in which columns are sorted descending from high to low by clicking Page Break Preview as shown above.

3.2 Cell data as chart data source

3.2.1 Open template
Open template:%FR_HOME%\WebReport\WEB-INF\reportlets\doc\Advanced\Chart\Logchart.cpt

3.2.1 Change template
Drag corresponding data columns to the cell as shown below.

3.2.3 Set sorting
Right click the cell of A2 to select Extension Attributes, set the sorting after extension to Descending in the Cell Attribute panel, and type B2 in the formula.

3.2.4 Set dataset
Set dataset as shown below:

3.2.5 Hide cells
Hide the data in cells by selecting the first and second lines and right clicking to select Hide Lines.

3.2.6 View effect
View the effect in which columns are sorted descending from high to low by clicking Page Break Preview as shown above.
Note: Bar charts and pie charts are set in the same way.

3.3 Template saving
Chart sorting template of dataset data source is saved in:%FR_HOME%\WebReport\WEB-INF\reportlets\doc\Advanced\Chart\Logchart_3.cpt

[AuthorRecommendedPosts post-id="4354"]