⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 示范(示范饼子图)请察看
💻 FRM
字号:
VERSION 5.00
Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "微软的MSChart演示"
   ClientHeight    =   7275
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   9405
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   7275
   ScaleWidth      =   9405
   StartUpPosition =   3  '窗口缺省
   Begin MSChart20Lib.MSChart MSChart1 
      Height          =   6375
      Left            =   60
      OleObjectBlob   =   "Form1.frx":0000
      TabIndex        =   1
      Top             =   120
      Width           =   8775
   End
   Begin VB.CommandButton Command1 
      Caption         =   "显示(&S)"
      Height          =   495
      Left            =   7680
      TabIndex        =   0
      Top             =   6660
      Width           =   1455
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居
'发布日期:05/05/05
'描  述:微软MsChart示例
'网  站:http://www.mndsoft.com/
'e-mail:mnd@mndsoft.com
'OICQ  : 88382850
'****************************************************************************
Option Explicit


Private Sub Command1_Click()
    Dim nYear As Variant
    Dim nMonth As Integer
    Dim nRowCnt As Integer
    Dim index1 As Integer
    Dim index2 As Integer
    Dim index3 As Integer
    Dim index4 As Integer
    Dim index5 As Integer
    Dim nYearArray(50)
    Dim nDataArray(2, 12)
    Dim nYrscnt As Integer
    Dim bFirstTime As Boolean
    
    nYrscnt = 2
    
    
    MSChart1.Visible = True
    bFirstTime = True
    
    
    nYearArray(1) = 1998
    nYearArray(2) = 2000
    
    nDataArray(1, 1) = 0
    nDataArray(1, 2) = 80
    nDataArray(1, 3) = 0
    nDataArray(1, 4) = 0
    nDataArray(1, 5) = 0
    nDataArray(1, 6) = 0
    nDataArray(1, 7) = 182.45
    nDataArray(1, 8) = 0
    nDataArray(1, 9) = 0
    nDataArray(1, 10) = 95.99
    nDataArray(1, 11) = 64.32
    nDataArray(1, 12) = 0
    
    nDataArray(2, 1) = 45.63
    nDataArray(2, 2) = 124.66
    nDataArray(2, 3) = 0
    nDataArray(2, 4) = 0
    nDataArray(2, 5) = 0
    nDataArray(2, 6) = 88.2
    nDataArray(2, 7) = 0
    nDataArray(2, 8) = 0
    nDataArray(2, 9) = 0
    nDataArray(2, 10) = 175.22
    nDataArray(2, 11) = 0
    nDataArray(2, 12) = 0
    


    With MSChart1
        .chartType = VtChChartType2dBar
        .ColumnCount = 12


        For nYear = 1 To nYrscnt
            .RowCount = nYear


            For nMonth = 1 To 12
                .Column = nMonth
                .Row = nYear
                .Data = nDataArray(nYear, nMonth)
                .RowLabel = nYearArray(nYear)
                


                If bFirstTime = True Then
                    .ColumnLabelIndex = nYear
                    .Column = nMonth


                    Select Case nMonth
                        Case 1
                        .ColumnLabel = "一月"
                        Case 2
                        .ColumnLabel = "二月"
                        Case 3
                        .ColumnLabel = "三月"
                        Case 4
                        .ColumnLabel = "四月"
                        Case 5
                        .ColumnLabel = "五月"
                        Case 6
                        .ColumnLabel = "六月"
                        Case 7
                        .ColumnLabel = "七月"
                        Case 8
                        .ColumnLabel = "八月"
                        Case 9
                        .ColumnLabel = "九月"
                        Case 10
                        .ColumnLabel = "十月"
                        Case 11
                        .ColumnLabel = "十一月"
                        Case 12
                        .ColumnLabel = "十二月"
                    End Select
            End If
        Next nMonth
        bFirstTime = False
    Next nYear
    
    '显示图例
    .ShowLegend = True
    
End With
End Sub


Private Sub Form_Load()
    MSChart1.Visible = False
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -