I.Overview
1. Application scenarios
Pie chart support each category to generate a pie chart, and these multi-category pie charts share legends, as shown in the following figure:
2.Implementation
After adding the chart, set the category field to generate multiple pie charts based on the category.
Note: This method supports both cell element charts and floating element charts.
II. Example
1. Data preparation
Create a new general report, create a new data set ds1, the database query statement is: SELECT * FROM Sales_Volume
2.Table design
1) Design the cell table as shown in the figure below, and drag the corresponding fields into the cells, where the B2 cell needs to be summary>sum.
2) Double-click cell A2, click Advanced, and set the result set filter to 3, the purpose is to only fetch the data of the first 3 salespersons in the data set, as shown in the figure below:
3) Select cells A1 and A2, add a condition attribute, set the row height to 0, the purpose is to hide the content of the table when displayed on the front end, as shown in the following figure:
3. Insert chart
In the designer menu bar, click Insert>Floating Element>Insert Chart to insert the pie chart into the general report, as shown in the figure below:
4. Binding data
Select the pie chart and set the pie chart category name to cell A2, the series name to cell B1, and the value to cell B2, as shown in the following figure:
5. Effect preview
1) PC terminal
Save the report, click the Pagination Preview, the effect is as shown in the figure below:
2) Mobile
The example used is that the floating chart does not support mobile preview, but the cell element chart does.
6.Application expansion
If you want to achieve it through the cell element chart, you only need to change the data binding settings based on the above floating element chart settings, as shown in the following figure:
III. Template download
The completed template can refer to:
%FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc_EN\Chart\PieChart\Pie_Chart_Legend_sharing.cpt
Click to download template: