You can create Page and RDL reports with composite charts using the ActiveReports Chart data region. A composite chart consists of two or more series plotted along the Y-axis, where each series can display a different chart type. In ActiveReports, a composite chart may have up to six Y-axis series. You can combine the following chart types:
- Column: Plain, Stacked, Percent Stacked
- Area: Plain, Stacked, Percent Stacked
- Line: Plain, Smooth
This walkthrough illustrates a step-by-step implementation for creating a composite chart with three Y-axis series. The walkthrough is split into the following activities:
- Creating an ActiveReports project in Visual Studio
- Connecting the report to a data source
- Adding a dataset
- Adding a chart data region with data to the report
- Configuring the appearance of the chart
- Viewing the report
Note:
- This walkthrough uses the StoreSummary table from the Reels database. By default, in ActiveReports, the Reels.mdb file is located in the [User Documents folder]\GrapeCity Samples\ActiveReports 12\Data folder.
- Although this walkthrough uses Page reports, you can also implement this using RDL reports.
When you complete this walkthrough you get a layout that looks similar to the following at design time and at run time.
Design-Time Layout
Run-Time Layout
To create an ActiveReports project in Visual Studio
- Create a new Visual Studio project.
- In the New Project dialog that appears, select ActiveReports 12 Page Report Application and in the Name field, rename the file as rptCompositeChart.
- Click OK to create a new ActiveReports 12 Page Report Application. By default a Page report is added to the project.
See Adding an ActiveReport to a Project for information on adding different report layouts.
To connect the report to a data source
- In the Report Explorer, right-click the Data Sources node and select the Add Data Source option or select Data Source from the Add button.
- In the Report Data Source Dialog that appears, select the General page and in the Name field, enter a name like ChartData.
- On this page, create a connection to the Reels database. See Connect to a Data Source for information on connecting to a data source.
To add a dataset
- In the Report Explorer, right-click the ChartData data source node and select the Add Data Set option or select Data Set from the Add button.
- In the DataSet Dialog that appears, select the General page and enter the name of the dataset as StoreSummaryData.
- On the Query page of this dialog, in the Query field enter the following SQL query.
SQL Query |
Copy Code
|
SELECT * from StoreSummary
|
- Click the Validate DataSet icon at the top right hand corner above the Query box to validate the query.
- Click OK to close the dialog. Your data set and queried fields appear as child nodes to the data source in the Report Explorer.
To add the chart data region with data to the report
- In the Report Explorer, select Report and in the Properties Window, set the PaperOrientation property to Landscape.
- From the toolbox, drag a Chart data region onto the of the report.
- In the Select a Chart Type wizard that appears, select the chart type as Column and go to the Properties Window to set the following properties.
Property Name |
Property Value |
Location |
0in, 0in |
Size |
7.5in, 4.5in |
- Double-click inside the chart area to display the chart panes along the top, right, and bottom of the chart to drop fields in.
- From the Report Explorer, drag the StoreName field into the area below the chart labeled "Drop category fields here." This automatically binds the StoreName field to the X-axis.
- Select the chart and at the bottom of Properties Window, select the Chart Y-Axis command.
- In the Y-axis dialog that appears, under the Title tab, set the Y-Axis title property to Gross Sales.
- Click Add to add the second Y-Axis. Set the Y-Axis title property to Gross Profit and the Margin property to 0.8in.
- Click Add to add the third Y-Axis. Set the Y-Axis title property to Total Items and the Position property to Right.
- Click OK to close the dialog.
- Select the chart and from the bottom of the Properties Window, select the Chart data command.
- Select the Series Values page. Click Add to add the first Y-axis series and set the properties as follows.
Property Name |
Property Value |
Series label |
Gross Sales |
Value |
=[GrossSales] |
Chart Type |
Area Plain |
Y-Axis |
Y1 |
- Click Add to add the second Y-axis series and set the properties as follows.
Property Name |
Property Value |
Series label |
Gross Profit |
Value |
=[GrossProfit] |
Chart Type |
Line Plain |
Y-Axis |
Y2 |
- Click Add to add the third Y-axis series and set the properties as follows.
Property Name |
Property Value |
Series label |
Total Items |
Value |
=[TotalItems] |
Chart Type |
Column Plain |
Y-Axis |
Y3 |
- Click OK to close the dialog.
To configure the appearance of the chart
- Select the chart and at the bottom of Properties Window, select the Chart appearance command.
- In the Chart Appearance dialog that appears, on the Title page enter Store Summary in the Chart title field.
- In the Palette page, open the Palette drop-down, and select Pastel.
- Click OK to close the dialog.
- Select the chart and at the bottom of the Properties Window, select the Chart X-Axis command.
- In the Chart X-Axis - Title dialog that appears set the properties as follows.
Property Name |
Property Value |
X-Axis title |
Store Name |
Size |
6pt |
- Click OK to close the dialog.
- Select the chart and at the bottom of the Properties Window, select the Chart Y-Axis command.
- Select Y1 from the list of Y-axes and under the Labels tab, select the Show y-axis labels check box. Also, select Currency from the Format code drop-down.
- Repeat the above step for Y2.
- Select Y3 from the list of Y-axes and under the Labels tab, select the Show y-axis labels check box.
- Click OK to close the dialog.
To view the report
- Click the to view the report at design time.
OR