Mschart control properties and Properties dialog box

Source: Internet
Author: User

1. mschart control attributes
(1) charttype attribute: Used to set or return the chart type. The value of the chart type and corresponding charttype attribute of the mschart control is shown in Table 8.7. For example, charttype = 1 shows a two-dimensional histogram, and charttype = 14 shows a pie chart.

 
   

Table 8.7 mschart chart type

(2) Row (GRID) attributes
① Rowcount attribute: used to indicate the total number of cells (rows) in the chart. For example:
If the mschart control displays the two-dimensional array array_2 (m, n), the total number of cells (rows) rowcount = m.
For example, rowcount = 5 indicates that there are 5 rows of data.
If the mschart control displays the element value of the one-dimensional array array_1 (n), the total number of rows is rowcount = 1.
② Row attribute: indicates the sequence number of a grid (ROW) in the chart.
If the mschart control displays a two-dimensional array, array_2 (m, n), the sequence number of the I grid in the chart is ROW = I. When ROW = 1, it indicates the data of the 1st grid (ROW.
③ Rowlabel attribute: used to indicate the label name of a grid (ROW). The default value is Ri. You can change the value to Wuxi or Nanjing.
④ Rowlabelcount attribute: used to indicate the number of grid (ROW) Labels. The mschart control allows you to set multiple grid (ROW) labels. Generally, the value is 1. This attribute is modified only when more than 2 rows of labels are required.
⑤ Rowlabelindex attribute: used to represent the tag sequence number of a grid (ROW). You can select a tag of a different grid (ROW) by setting the tag sequence number of a different grid (ROW) for editing.
(3) column attributes
① Columncount attribute: used to indicate the number of columns in each grid (ROW) in the chart, that is, N in the array. If columncount = 3 is set, there are three columns in each grid (ROW). Each data grid of the chart is represented by three rectangles or three slices.
② Column attribute: indicates the sequence number of a column in a grid (ROW) in the chart. For example:
Row = 1, column = 1, indicating 1st columns in the 1st grid (ROW) chart.
③ Columnlabel attribute: used to indicate the label name of the chart column. The default value is CI.
④ Columnlabelcount attribute: used to indicate the number of column labels in a certain grid of the chart.
⑤ Columnlabelindex attribute: used to represent the column label sequence number in a certain grid of the chart.
(4) data attributes
The data attribute is used to indicate the value indicated by the row and column numbers column in the chart, that is, the value of the array array_2 (row, column. You can modify the value. For example, in the mschart1 attribute box:
Set ROW = 1, column = 1, data = 60 to change the height of the rectangle in the 1st columns (rows) in the chart to 60.
(5) legend properties: a chart set by the mschart control to describe the meaning of column values in the chart. Generally, the legend contains the color icon and label name of the column. This allows you to understand the meaning of each column in the chart. The main attributes of the legend are as follows.
① Showlegend attribute: if it is true, the legend is displayed. If it is false, the legend is not displayed.
② Legend attribute: used to set the legend font and other content.
(6) titletext attribute: used to represent the chart title, such as titletext = "one-dimensional array chart example ".
(7) chartdata attribute: Used to set or return an array that contains the data values to be displayed in the chart.
For example, chartdata = array_2 indicates that mschart displays the element values of two-dimensional arrays.
Note:
If it is a multi-dimensional array or data table, and its first column (or the first field) is a string, the first column (or the first field) is used as the row label of the chart.
[Example 8.7] use the mschart control to display chart examples of one-dimensional arrays.
Defines the one-dimensional integer array array_1 (1 to 10), and displays the data charts in array_1 in two ways: histogram and pie chart, as shown in 8.13 (a) and 8.13 (B.
Create a project (ex8_8.vbp) named form_ex88.frm. In the part, select Microsoft chart controls 6.0 (oledb), add the data chart control mschart1 to the form, and then add the control array command1 (2) consisting of two command buttons ), used to display the histogram and pie chart respectively. Double-click the command button and enter the following event for processing. Program .
Private sub commandateclick (index as integer)
With mschart1
Dim I as integer
Dim array_1 (1 to 10) as integer
For I = 1 to 10
Array_1 (I) = I
Next I
. Chartdata = array_1 'assigns a one-dimensional array to the mschart control.
. Titletext = "one-dimensional array chart example"
. Showlegend = true' display legend
If Index = 0 then
. Charttype = 1' displays the values of one-dimensional array elements in a histogram.
Elseif Index = 1 then
. Charttype = 14' displays the element values of one-dimensional arrays in a pie chart.
End if
For I = 1 to 10
. Plot. seriescollection (I). legendtext = "Y" & I'
Next I
End
End sub
After the program runs, click the histogram button and Pie Chart Button respectively. The screen displays 8.13 (a) and (B.

   
Figure 8.13 (a) one-dimensional array histogram display figure 8.13 (B) one-dimensional array Pie Chart Display

[Example 8.8] use the mschart control to display chart examples of two-dimensional arrays.
Defines the two-dimensional variant array array_2 (1 to 5, 1 to 5) of five rows and five columns, and displays the data charts in array_2 in two ways: histogram and pie chart.
Create a project (ex8_9.vbp) named form_ex89.frm. In the widget, select Microsoft chart controls 6.0 (oledb), add the data chart control mschart1 to the form, and then add the control array command1 (3) consisting of three command buttons ), used to display the histogram, pie chart, and line chart respectively. Double-click the command button and enter the following event handler.
Private sub commandateclick (index as integer)
With mschart1
Dim I as integer
Dim array_2 (1 to 5, 1 to 5) as Variant
For I = 1 to 5
Array_2 (I, 1) = "A (" & I & ")" 'When array 1st is a string, it is used as a row label
Array_2 (I, 2) = I
Array_2 (I, 3) = I * 2
Array_2 (I, 4) = I * 3
Array_2 (I, 5) = I * 4
Next I
. Chartdata = array_2 'assigns a two-dimensional array to the mschart control.
. Titletext = "two-dimensional array chart example" 'mschart control title assignment
. Showlegend = true' display legend
If Index = 0 then
. Charttype = 1' display two-dimensional array element values in a Histogram
Elseif Index = 1 then
. Charttype = 14' display two-dimensional array element values in a pie chart
Else
. Charttype = 3' display two-dimensional array element values in line chart form
End if
For I = 1 to 5-1 'except for the first column of the tag, there are also 5-1 = 4 columns
. Plot. seriescollection (I). legendtext = "Y" & I'
Next I
End
End sub
After the program runs, click the histogram button, Pie Chart Button, and line chart button. The screen displays 8.14 (a), (B), and (c.

   
Figure 8.14 (a) two-dimensional array histogram representation fig 8.14 (B) two-dimensional array pie chart Representation
 

 

Figure 8.14 (c) two-dimensional array line chart

2,MschartControl Properties dialog box
The attributes of the mschart control can also be set in the Properties dialog box. Right-click mschart1 and click Properties in the pop-up menu. The Properties dialog box is displayed, as shown in Figure 8.15. The following describes the properties of the tabs in the dialog box.
1. Chart Tab
(1) chart type
In the chart type box, you can select different graphs, such as bars (histograms), lines (curves), areas, steps, combinations, pie charts, and x y scatter charts. You can also select a two-dimensional plane or three-dimensional image.
(2) Chart options
In the chart option box, you can select the following four check boxes to be valid or invalid.

  • Display Legend: The Legend describes the meaning of each color in the chart;
  • Display Tag: The display tag is the tag of each graph;
  • Stacked series: stacked series overlays each type of chart;
  • Line Series: interchange rows and columns of two-dimensional arrays, that is, using column CI as the data lattice and row ri as the data value in each data lattice.
       

    Figure 8.15mschart property Setting Dialog Box

    2. Axis Tab
    (1) select the X axis
    display scale: the check box is valid and the line labels (such as R1 and R2) are displayed ). The check box is invalid and the row label is not displayed.
    auto Scaling: the check box is valid and the image scales with the control. The check box is invalid. manually set the label interval and scale interval.
    (2) Select Y axis
    display scale: the check box is valid. The Y axis scale value (such as 0, 20, and 40) is displayed ).
    auto Scaling: the check box is valid and the image scales with the control. The check box is invalid. manually set the minimum value, maximum value, primary interval, and secondary interval value of the Y axis.
    3. Axis grid tab
    This tab is used to set the style, width, and color of the primary and secondary grid rows on the X and Y axes.
    4. Sequence tab
    On the sequence tab, you can hide sequences, exclude sequences, and display tags.
    5. sequence color tab
    On the sequence color tab, you can select the sequence color, style, and pattern.
    6. Text tab
    you can enter the chart title, footer, X axis, and Y axis, for example, in the chart title, description on the X axis, and description on the Y axis, enter "class student Statistical Chart", "X axis", and "Y axis ". Change the Y axis direction to the horizontal direction.
    7. Font tab
    you can set the font, size, and color of the chart title, footer, X axis, and Y axis labels. The font of the table title is bold and green on the 14th.

    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.