Original: ActiveReports Report application Tutorial (3)---Chart report
The ActiveReports Chart control supports most commonly used two-and three-dimensional chart types, including XY charts and financial charts. By using the custom features of the chart control, such as modifying axes, notes, legends, and so on, users can create any chart effects they want. The user can also export the defined chart to a variety of image formats through code. This article demonstrates how to implement a graphical obfuscation report in Activreports.
What we are going to achieve is the 2011 annual sales statistics of various products, in which charts are sold according to category and month.
1. Create a report file
In ASP. ENT application, add a page report (pagereport) file named RPTSALESBYCATEGORY.RDLX, use the report template for the "ActiveReports 7 page report", and complete the report conversion operation with the following menu of VS after creation:
2. Add a data source for the Rptsalesbycategory report
Open ActiveReports Report Explorer by VS2010 menu –> Other Windows –> Report Explorer V7, right-click on the Data Source node and select Add Data source. In the Report Data Source dialog box that appears, enter the information that is shown:
2.1. Right-click on the newly created NWIND_CHS Data source node and select Add DataSet to enter the information in the DataSet dialog box that appears:
General tab –> Name: Sales
Query Tab –> query:
SELECT category. Category name, t.* from (
INNER JOIN Order Details on order. Order ID = Order Details. Order ID)
INNER JOIN product on Order details. Product ID = product. Product ID)
INNER JOIN category on products. Category ID = category. Category ID
where DATEDIFF ("yyyy", order. Order date, ' 2011-01-01 ') = 0
Group by category. Category ID, category. Category name
ORDER by category. Category ID, category. Category name) as T
INNER JOIN category on T. Category ID = category. Category ID
2.2. Right-click on the Nwind_chs Data source node and select Add DataSet to enter the information in the DataSet dialog box that appears:
General tab –> Name: saledetails
Query Tab –> query:
SELECT category. Category name, t.* from (
INNER JOIN Order Details on order. Order ID = Order Details. Order ID)
INNER JOIN product on Order details. Product ID = product. Product ID)
INNER JOIN category on products. Category ID = category. Category ID
where DATEDIFF ("yyyy", order. Order date, ' 2011-01-01 ') = 0
GROUP by DATEPART ("M", order. Order date), category. Category ID, category. Category name
ORDER by DATEPART ("M", orders. Order date), category. Category ID, category. Category name) as T
INNER JOIN category on T. Category ID = category. Category ID
3. Create a Chart object
Add the chart control to the report design interface from the VS Toolbox, check the command area in the Properties window to display the chart-related action command when the chart is selected, and click the "chart data ..." link, which displays the Graph Data dialog box, as follows to complete chart setup:
3.1 Chart data-general settings
Name:
Chart1
Tool Tip:
2011 Annual Sales Statistics of various products
Data set Name:
Sales
3.2. Chart data-series values
Series Label:
Sales
Value:
=sum ([Sales])
3.3. Chart data-category grouping
Grouping-Expressions:
=[category name]
4. Create a data schedule
We will use matrix control matrix to display monthly sales of each category of product, add matrix control matrix from the VS Toolbox to the report design interface, and select the Matrix control, at which point the command area in the Properties window displays the "Properties dialog box ..." Command link, click the link.
4.1. Matrix-General Settings
Data set Name:
Saledetails
4.2. Matrix-row Grouping
General-Group-expression:
=[Order Month]
Sort-expression:
=[Order Month]
4.3. Matrix-Column Grouping
General-Group-expression:
=[category name]
4.4, we get the final design effect and operation effect as shown:
5. Running the program
Source: http://www.gcpowertools.com.cn/products/activereports_demo.htm
ActiveReports Report Application Tutorial (3)---Chart report