FlexReport allows using FlexChart field to render a FlexChart in FlexReport and perform grouping and aggregation in it. Let us create a report to show grouping and aggregation of data.
The image below shows FlexReport containing FlexChart field where grouping and aggregation is performed on data.
To create a report showing grouping and aggregation of data in FlexChart, follow these steps.
- In the C1FlexReportDesigner application, create a new report by navigating through the Report Wizard.
- Bind the report to the Main data source, by specifying the following Sql Statement.
SELECT Categories.*, Categories.CategoryID as CategoryID, Products.* FROM Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID
- Add a SubSection to the Header section and add FlexChart field to it.
- In the Properties window, expand AxisX and set the value of LabelAngle property to -10.
- Navigate to AxisX|Style and set Font properties to Arial, 9pt, Regular, StrokeColor to Olive, and StrokeWidth to 30.
- Navigate to AxisY and set Font properties to Arial, 9pt, Regular, StrokeColor to Olive, and StrokeWidth to 15.
- Set the Border Color to Black, Style to Solid and Width to 10.
- Navigate to CategoryGroups and click ellipsis button next to it.
The DataGroup Collection Editor opens.
- In the DataGroup Collection Editor, click Add button to add a data group and set it's GroupExpression to CategoryID.
- Close the Editor.
- Navigate to Footer|Content and set it to Group By Category and Series.
- Navigate to Header|Content and set it to Count of products per Category.
- Navigate to Legend|Title and set it to Reorder Level.
- Navigate to Series and click the ellipsis button next to it.
- In the Series Collection Editor, click Add button to add a series.
- Navigate to Data|YExpression and set it's value to Count(*).
With Count(*), we are setting aggregate data to the FlexChartField.
- Close the Editor.
- Navigate to SeriesGroups and click the ellipsis button next to it.
- In the Data Group Collection Editor, click Add button to add a series and set it's GroupExpression to RecordLevel.
- Close the Editor.
- Navigate to XLabelExpression and set it to CategoryName.
- Click Preview button to switch to Preview mode to view the report.