How to Make a Functional Dynamic Chart Data?
1. Function description
Sometimes, the user wants to display different charts based on different conditions, as shown below. Select Year and Month condition, and the chart, as a great reporting tool, will display data meeting certain conditions so as to realize dynamic chart:
2. Realization ideasEdit
Dynamically change chart data source based on parameter conditions.
If the chart data is from dataset, you can dynamically change chart data through data source parameters.
If the chart data is from cell, you can change chart data through report parameter and filter setting, which will serve as an example in this section.
3.1 Prepare data
Create a new workbook and add dataset ds1, with SQL statement of SELECT strftime(‘%Y’, ordering date) as year, strftime(‘%m’, ordering date) as month, shipper’s province, payable FROM [order].
3.2 Define parameters
We will dynamically change the chart based on selected year and month. Define the 3 report parameters below:
Report parameter Year: year. Default value: 2010;
Report parameter Start: start month. Default value: 1;
Report parameter End: end month. Default value: 6.
The Parameter Interface is designed as follows:
3.3 Make a sample table
In the cell, calculate and summarize the sales volumes of several months in a year for different provinces, as shown below:
Set the data column as below:
Based on parameter values, the data calculated in the cell are different. When cell is used as the data source, the chart also displays different data so as to realize dynamic chart, a good business intelligence tool, and help data analysis and data visualization.
3.4 Insert chart
Merge a group of cells, as shown above. Right click Cell Element > Insert Chart. Select Column Chart and click OK.
3.5 Set chart type
Set Column Chart Type to 3D Column Chart, as shown below:
3.6 Set chart data
The chart data is from the cell. The data category axis is Region; Series name is Month; and Series Value is Sales Volume, as shown below:
Click Save to complete a dynamic chart that can be changed with parameter change.
3.7 Set dynamic title
Set a dynamic title for the chart. Select Chart and select Chart Attribute Table – Style> Title. Click formula button, where the formula is =$Year+” year “+$Start+”—”+$End+” “. Display dynamic title based on different parameters.
Final template style in the main body of report is as shown below:
3.8 Save and preview
Save template and click Page-breaking Preview to see the effect as shown above.
For completed templates, see:%FR_HOME%\WebReport\WEB-INF\reportlets\doc\Advanced\Chart\Dynamic.cpt。