Rel = file-list href = "./ aa.files / filelist.xml"> rel = edit-time-data href = "./ aa.files / editdata.mso">
Chart control useway Chart V1
How to establish a chart of VB applications
During the production of application software, you need to establish a module of statistical analysis. Existing Windows provides controls, it is not particular to use.
Later, a such control was used, combined with the experience of many years of software development, and also clear the operating habits of the majority of programmers.
This control is very convenient, and it can be said that the function is relatively powerful. Below we will explain this control.
The download address is: http://www.useway.com/USEwayChart/USEWAYCHARTV1.RAR
First, introduction
This control is an ActiveX OCX control that you can easily build a chart. This control is the following features compared to other similar controls:
1,
3 charts can be established;
This control can be built to establish three charts:
Bar chart, line graph, pie chart.
Figure:
2,
Multi-data can be supported in the chart, and the number of data is flexible;
3,
Specifies that the way to display data is very simple, just need to assign a value of the comma-separated string to Data;
4,
Each type of graphical assignment method is the same;
5,
Support for asymmetric display (see below).
Second, how to use
The property is as follows:
Data: Data, with "," separates the number.
RowText: The text that is displayed below, "," separates the text.
Column: Number of data per column
Header: The title of the column, with "," separated the text.
Borderstyle: Border pattern, 1 with borders, 0 no borders
CAPTION: Title text for the chart
DrawType: Type of chart, 1 line, 2 strip, 3 pie chart
Backcolor: Background Color
Note:
Other properties are consistent with the use of standard controls in VB.
method:
DRAW: Call this method drawing after each attribute setting is completed.
Programming thinking:
First, imagine the data to be displayed into a form:
Therefore, each attribute should set this:
Header = "Yes (billion), sales (billion), Mao profit (100 million)"
RowText = "January, February, March, April, May, June, July, August, September, October, November, December"
Data = "22, 24, 26, 28, 32, 35, 32, 32, 31, 28, 29, 30, 11, 12, 12, 12, 12, 25, 22, 22, 21, 18, 19, 20 , 6, 5, 8, 9, 10, 7, 5, 8, 9, 11, 12, 13 "
COLUMN = 12
Second, we determine how this control is displayed:
1,
Determine whether there is a border: borderstyle = 0
2,
Determine the chart type, line graph: DRAWTYPE = 1
3,
Determine line width: DrawWidth = 2
4, determine the display title: annual output value analysis table
Third, call the drawing method to draw.
Insert this control post-code input in VB is as follows:
Private submmand1_click ()
UsePhart1.Header = "Yes (billion), sales (billion), Mao profit (100 million)"
Usedaychart1.rowtext = "January, February, March, April, May, June, July, August, September, October, November, December" usewaychart1.data = "22, 24, 26, 28, 32, 35, 32, 32, 31, 28, 29, 30, 11, 12, 16, 18, 22, 25, 22, 22, 21,
18, 19, 20, 6, 5, 8, 9, 10, 7, 5, 8, 9, 11, 12, 13 "
UsePhart1.column = 12
UsePhart1.Borderstyle = 0
UsePECHART1.DRAWTYPE = 1
UsePhart1.drawWidth = 2
UsePhart1.caption = "Annual Yield Analysis Table"
UsePhart1.draw
End Sub
The display effect is as follows:
Modify an attribute when we set the DrawType's property set to 2, display:
If the property drawtype is changed to 3 display pie charts as follows:
If you use asymmetric display, the code is as follows:
Private submmand1_click ()
UsePhart1.Header = "Yes (billion), sales (billion), Mao profit (100 million)"
UsePhart1.RowText = "1 quarter, 2 quarter, 3 quarter, 4 quarter"
UsePhart1.Data = "22, 24, 26, 28, 32, 35, 32, 32, 31, 28, 29, 30, 11, 12, 12, 11, 12, 25, 22, 22, 21, 18, 19 20, 6, 5, 8, 9, 10, 7, 5, 8, 9, 11, 12, 13 "
UsePhart1.column = 12
UsePhart1.Borderstyle = 0
UsePECHART1.DRAWTYPE = 1
UsePhart1.drawWidth = 2
UsePhart1.caption = "Annual Yield Analysis Table"
UsePhart1.draw
End Sub
effect:
Third, let's take another example.
Other Example 1, only one pie chart showing:
Private submmand1_click ()
UsePECHART1.DRAWTYPE = 3
UsePhart1.drawWidth = 2
UserChart1.column = 8
UsePhart1.Data = "35, 13, 34, 34, 11, 52, 73, 14"
UsePhart1.Header = "h1"
UsePhart1.RowText = "D1, D2, D3, D4, D5, D6, D7, D8"
UsePhart1.draw
End Sub
effect:
Other Example 2, only one set of bar charts:
Private submmand1_click ()
UsePECHART1.DRAWTYPE = 2
UsePhart1.drawWidth = 2
UserChart1.column = 8
UsePhart1.Data = "35, 13, 34, 34, 11, 52, 73, 14"
UsePhart1.Header = "h1"
UsePhart1.RowText = "D1, D2, D3, D4, D5, D6, D7, D8"
UsePhart1.draw
End Sub
effect: