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

📄 dataaware.frm

📁 Delphi Component - Chart Fx
💻 FRM
字号:
VERSION 5.00
Object = "{8996B0A4-D7BE-101B-8650-00AA003A5593}#4.0#0"; "CFX4032.OCX"
Begin VB.Form Form1 
   Caption         =   "Chart FX. Data Aware Capabilities"
   ClientHeight    =   5340
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7530
   LinkTopic       =   "Form1"
   ScaleHeight     =   5340
   ScaleWidth      =   7530
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Collection 
      Caption         =   "Read from COLLECTIONS"
      Height          =   375
      Left            =   2760
      TabIndex        =   1
      Top             =   4440
      Width           =   2535
   End
   Begin ChartfxLibCtl.ChartFX ChartFX1 
      Height          =   4095
      Left            =   120
      TabIndex        =   5
      Top             =   120
      Width           =   7335
      _cx             =   1710371466
      _cy             =   1710365751
      _Version        =   262144
      Axis(0).Max     =   90
   End
   Begin VB.TextBox eFile 
      Height          =   375
      Left            =   1200
      TabIndex        =   4
      Text            =   "D:\Temp\Txt\Data0.txt"
      Top             =   120
      Width           =   5415
   End
   Begin VB.CommandButton TxtFile 
      Caption         =   "Read from TEXT FILE"
      Height          =   375
      Left            =   2760
      TabIndex        =   3
      Top             =   4920
      Width           =   2535
   End
   Begin VB.CommandButton Array 
      Caption         =   "Read from ARRAYS"
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   4440
      Width           =   2535
   End
   Begin VB.CommandButton ADORS 
      Caption         =   "Read from ADO RESULTSET"
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   4920
      Width           =   2535
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

End Sub

Private Sub ADORS_Click()
     Dim Conn As New ADODB.Connection
     Dim RS As ADODB.Recordset
     Dim CfxData As New CfxDataAdo
     
     ' Read from sample database
     Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & App.Path & "\CfxSamp.mdb"
     Conn.Open
     Set RS = Conn.Execute("SELECT * FROM Sales")
    
    'define data types for each field in the sales table
    'label type will be taken as text for the x-axis labels
    'each value type will be taken as series
    'not used type will not be used as data for the chart
    
    ChartFX1.DataType(0) = CDT_LABEL 'saledate
    ChartFX1.DataType(1) = CDT_NOTUSED 'saleterm
    ChartFX1.DataType(2) = CDT_VALUE 'total amount
    ChartFX1.DataType(3) = CDT_NOTUSED 'total discount
    ChartFX1.DataType(4) = CDT_VALUE 'total projected
    ChartFX1.DataType(5) = CDT_NOTUSED 'prodid
    
    ' Send data to chart
    CfxData.ResultSet = RS
    ChartFX1.GetExternalData CfxData
    
    ' reset column types for future connections
    ChartFX1.DataType(-1) = 0
    
    ' Init chart style
    ChartFX1.Gallery = AREA
    ChartFX1.MultipleColors = False
    
    ' Release
    RS.Close
    Conn.Close
End Sub

Private Sub Array_Click()
    Dim CfxArray As New CfxDataArray
    Dim X(3) As Double
    Dim Lab(3) As String
    
    ' Init data arrays
    X(0) = 12
    X(1) = 15.5
    X(2) = 10
    Lab(0) = "Yes"
    Lab(1) = "No"
    Lab(2) = "Don't know"
    
    ' Add arrays
    CfxArray.AddArray X
    CfxArray.AddArray Lab
    
    ' read into chart
    ChartFX1.GetExternalData CfxArray
    
    ' Init chart style
    ChartFX1.Gallery = BAR
    ChartFX1.MultipleColors = True
End Sub

Private Sub Command1_Click()
End Sub

Private Sub Collection_Click()
    Dim CfxArray As New CfxDataArray
    Dim Coll As New Collection
    Dim Coll2 As New Collection
    
    ' Init data collections
    Coll.Add 10.5
    Coll.Add 12.4
    Coll2.Add "Male"
    Coll2.Add "Female"
    
    ' Add collections
    CfxArray.AddArray Coll
    CfxArray.AddArray Coll2
    
    ' read into chart
    ChartFX1.GetExternalData CfxArray

    ' Init chart style
    ChartFX1.Gallery = BAR
    ChartFX1.MultipleColors = True
End Sub

Private Sub TxtFile_Click()
    Dim CfxFile As New CfxDataFile
    
    CfxFile.FileName = App.Path & "\CFXDATA.TXT"
    
    ChartFX1.GetExternalData CfxFile
    
    ' Init chart style
    ChartFX1.Gallery = BAR
    ChartFX1.MultipleColors = False
End Sub

⌨️ 快捷键说明

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