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

📄 chartdata.ctl

📁 随着计算机信息技术的飞速发展
💻 CTL
字号:
VERSION 5.00
Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"
Begin VB.UserControl ChartData 
   BackColor       =   &H00FFFFFF&
   ClientHeight    =   4575
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   7845
   ScaleHeight     =   4575
   ScaleWidth      =   7845
   Begin MSChart20Lib.MSChart ChartView 
      Height          =   4215
      Left            =   0
      OleObjectBlob   =   "ChartData.ctx":0000
      TabIndex        =   0
      Top             =   0
      Width           =   7815
   End
End
Attribute VB_Name = "ChartData"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Private Title As String
Private Data(1 To 5) As Integer
Private DTitle(1 To 5) As String
Private DCount As Integer

Public Event AlertError(Msg As String)

Public Property Get ChartTitle() As String

  ChartTitle = Title

End Property

Public Property Let ChartTitle(ByVal vNewValue As String)

  ChartView.TitleText = vNewValue
  Title = vNewValue

End Property

Public Property Get DataValue1() As Integer

  DataValue1 = Data(1)

End Property

Public Property Let DataValue1(ByVal vNewValue As Integer)

  Data(1) = vNewValue

End Property

Public Property Get DataValue2() As Integer

  DataValue2 = Data(2)

End Property

Public Property Let DataValue2(ByVal vNewValue As Integer)

  Data(2) = vNewValue

End Property

Public Property Get DataValue3() As Integer

  DataValue3 = Data(3)

End Property

Public Property Let DataValue3(ByVal vNewValue As Integer)

  Data(3) = vNewValue

End Property

Public Property Get DataValue4() As Integer

  DataValue4 = Data(4)

End Property

Public Property Let DataValue4(ByVal vNewValue As Integer)

  Data(4) = vNewValue

End Property

Public Property Get DataValue5() As Integer

  DataValue5 = Data(5)

End Property

Public Property Let DataValue5(ByVal vNewValue As Integer)

  Data(5) = vNewValue

End Property

Public Property Get DataTitle1() As String

DataTitle1 = DTitle(1)

End Property

Public Property Let DataTitle1(ByVal vNewValue As String)

DTitle(1) = vNewValue

End Property

Public Property Get DataTitle2() As String

DataTitle2 = DTitle(2)

End Property

Public Property Let DataTitle2(ByVal vNewValue As String)

DTitle(2) = vNewValue

End Property

Public Property Get DataTitle3() As String

DataTitle3 = DTitle(3)

End Property

Public Property Let DataTitle3(ByVal vNewValue As String)

DTitle(3) = vNewValue

End Property

Public Property Get DataTitle4() As String

DataTitle4 = DTitle(4)

End Property

Public Property Let DataTitle4(ByVal vNewValue As String)

DTitle(4) = vNewValue

End Property

Public Property Get DataTitle5() As String

DataTitle5 = DTitle(5)

End Property

Public Property Let DataTitle5(ByVal vNewValue As String)

DTitle(5) = vNewValue

End Property

Public Property Get DataCount() As Integer

DataCount = DCount

End Property

Public Property Let DataCount(ByVal vNewValue As Integer)

If vNewValue > 5 Then
  RaiseEvent AlertError("数据不能大于5")
Else
  DCount = vNewValue
End If

End Property


Public Sub DrawChartData()

Dim i As Integer, j As Integer

With ChartView
    .TitleText = Title
    .ShowLegend = True
    .ColumnCount = 2
    .RowCount = DataCount
    
    For i = 0 To DataCount - 1
      For j = 0 To 1
        .Row = i + 1
        .Column = j + 1
        
        .ColumnLabel = "col" + Str(j)
        
        .Data = Data(i + 1) * Rnd() * 2
        .RowLabel = DTitle(i + 1)
      Next
    Next
End With

End Sub

Private Sub UserControl_Initialize()
  DrawChartData
End Sub

Public Function SetChartStyle(style As Integer) As Integer

SetChartStyle = ChartView.chartType
ChartView.chartType = style

End Function

⌨️ 快捷键说明

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