There are two ways to insert a chart when you use FineReport: insert as a cell element or insert as a float element. In this article, we will introduce the chart function of the reporting tool in detail.

First, what’s the difference between the two insertion methods?

Cell chart

Advantages: Corresponding chart will be generated thorough the parent-child relationship automatically. The report designer need not to make a chart for each group of data.

Disadvantages: You need to cancel the parent-child relationship if you don’t want to extend follow parent cell.

Float chart

Advantages: Charts inserted as a float element has no limitation of cell, and you can fix the position of the chart or drag it to anywhere you want. The size of the float chart will not change after set. Also, it will not be affected by parent cell.

Disadvantages: Float element is not supported if you want to export report in word format. And it is also not supported in mobile terminal.

Next, I will use specific examples to teach you how to make these two charts.

1. Cell Chart

As shown in the figure below, each group is followed by a chart to view the data. You can use cell charts to achieve such scalable effects.

Now I introduce detailed steps of making a cell chart like the above figure.

1.1 Prepare data

Open the report %FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\Primary\GroupReport\Group_Report.cpt.

Add a chart based on the regional sales group report and realize that every region has a sales chart of their own.

Each chart expanded here only displays the data of the current region, so you cannot directly use the dataset as the source of the chart data (the dataset is all the data in the sales table). You can only use the cell data in the report.

Note: Cell element chart and cell data source chart are not the same. Cell element chart means that the chart is inserted as a cell, can follow the cell expansion, and has some attributes of a cell, while the cell data source chart refers to data bound to chart is cell data rather than dataset data.  

1.2 Insert a cell chart

Merge the right area of the second line, then right-click the cell, Cell element > Insert Chart > Column Chart. Then click OK.

1.3 Set chart data

Set the chart data as shown below, each salesperson’s sales chart, select cell data in data source check box, and input =B2 in classification. Select sales in the series name and input =C2 in a box of value as shown below.

Note: You can modify the chart style yourself to make it looks more beautiful.

1.4 Set the parent cell of the chart

According to the parent-child concept, the cell where the chart was locating defaults to the salesperson data column as the parent, and each salesperson that is expanded will have its own chart.

Here we only need to generate a chart in each region, so we need to set the parent cell of the chart to be region cell A2.

1.5 Save and preview

Save the template and preview to see the effect as shown above.

For completed template, see: %FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\Primary\Chart\Cell_Chart.cpt.

2. Float Chart

Charts can also be inserted into reports as float elements.

The setting method of the float chart is the same as the cell chart. The only difference is that you need to choose to insert a float element at the first step. As you can see, you can drag and drop the chart and change the size of the chart. It is easy to operate, as shown below.

Note: The chart made by the float element is different from the cell chart, which can be filtered according to the parent cell and expanded to display the corresponding column chart according to the region in cell chart, while the float element has no parent cell concept. So data cannot be filtered by setting a parent cell. If you have added some float charts in the designer, you will see the same number of tables on the web side, that is, it will not expand.

You cannot use float chart if you want to export a report in word format. And the float chart is not supported on the mobile terminal.

For completed template, you can see:

%FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\Primary\Chart\Float_Chart.cpt.