Implementation of a data cross tabulation control (opening)

Source: Internet
Author: User

Because many of the projects are related to data statistics, many reports have been made, and a large part of the reports are of the data cross tabulation type, and are being revised recently. net's custom advanced analysis function, so it suddenly needs to write a control once and for all. I will share with you the inspiration and gains I have gained in the coding design process.

1: Purpose
Enable any cross-statistics and front-end display of data;
2: Functions
You can bind a datasource, able, or any data source in dataview. (In fact, there is nothing big about this, and it is converted into a datatable)
Specify which latitudes 1 are placed on the horizontal axis and which latitudes are placed on the vertical axis (that is, the column name of the specified latitude data of the datatable), and set the value column (only one numeric column is supported, the display of multiple numeric columns is complex and will be studied later)
Custom display format and style
Custom single-member click Function
CATEGORY aggregate function;
3: Thinking
The difficulty of designing such a control lies not in the statistical function, but in how to display it, and how to draw a cross data table and build a table based on the provided attributes. Therefore, although the control supports the statistics function, it is recommended that you use the statistics function of SQL itself. The group is better before the control is displayed (the efficiency can be increased by N times ).
How can I bind a able to make it a cross data column? Assuming that the table in Figure 1 is a data column of the datatable, how can we display the following table in the format shown in 2-Figure 5?


Figure 1

Figure 2

Figure 3

Figure 4

Figure 5

The above is the simplest requirement. Of course, the series of horizontal and vertical axes should be infinitely in theory, so far I am stuck in the annoyance of how to calculate rowspan and colspan.
It is too complicated to use the column attribute of the existing datatable to calculate, so I want to build a class to simulate the horizontal and vertical axes, and also facilitate future extension.
The simple class diagram is as follows:

Figure 6

Next content: Create an axes axis and a cell array to create a data cross-table model.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.