Source: http://www.cnblogs.com/babyt/archive/2008/05/06/1184249.html
A crosstab chart, as its name implies, is used to present data on rows as column indicators.
The following figure shows the data style in Figure 1.
The final result is 2.
In actual use, we can achieve this effect in two ways
First, data is organized into a cross-tabulation using SQL on the database end, and then presented as a normal report.
Here, I have excerpted a straightforward article written on the Internet. Please refer to this link.
Http://server.chinabyte.com/474/2591974.shtml
Based on the data, the column after crossover may be fixed or not fixed.
Note the writing method, and note that the SQL statements of different databases are also different. For example, SQL Server and Oracle are different.
Here we will provide an idea.
Second, it relies on Crystal Reports for direct implementation. At the end of the article, I provided an operation video. You can refer to the actual operation steps.
It should be noted that not all data is so standard, so some correction is required.
Crystal Reports not only support retrieving data from tables, but also support View and SQL commands, stored procedures, etc.
Therefore, you can use View or SQL commands. In the video example, I used this example.
The raw data is like this (figure 3 ),
To apply the crosstab chart, modify it as shown in Figure 1.
I made a View to simplify subsequent operations. For subsequent operations, the effects of using tables and views are the same.
View Script:
Select Year, region, indicator, 'maxim' as value category, maximum value as value from test_4
UNION
Select Year, region, indicator, 'minimal' as value category, minimum value as value from test_4;
At the end of the video, I performed some operations on the cross tabulation settings. For details, refer. For example:
How to remove the total fields of rows and columns
How to remove the corners in the upper left corner of the crosstab chart and other basic operations
It is particularly difficult to export a perfect Excel file from a cross table.
If this is necessary, we recommend that you use the SQL crossover method and the general report method.
Download the operation video here. Unzip it with the password babyt.
/Files/babyt/CR20080505.rar
(This video is animated)