给你个例子
'用到Microsoft Chart Control 这个控件
'下面代码放到类模块中
'********************
Option Explicit
Public intRows              ' 列数,用于设置图表中显示的列数。
Public arrMPGandTank()      ' MPG 和每桶升数
Dim txtsql As String
Dim MsgText As String
Dim mrc As ADODB.Recordset
Dim msg As String                   '信息Public Sub SetupChart()
    txtsql = "select * from ZHFXSJB1 where XMXX_ID= " & XMID
    Set mrc = ExecuteSQL(txtsql, MsgText)
    Do While Not mrc.EOF
       mrc.MoveNext
       intRows = intRows + 1
    Loop
    ' 配置图表。
    With frmFhstt.chtSample
        .RowCount = intRows ' 在设置图表数据之前,必须设置行数。
        .ColumnCount = 2    ' 两列。第一列显示“每升公里数”,第二列显示使用的升数。
        .ColumnLabelCount = 2  'ColumnLabelCount返回或设置与图表关联的数据网格中的列的标签级别数
        ' 在右上角为这个图设置图例。
        ' 然后为图例设置坐标。
        .Legend.Location.LocationType = VtChLocationTypeRight
        'Legend它包含有关小图标的外观及其描述图表系列的伴随文字的信息。
        'Location该对象描述文本图表元素的位置
        'LocationType返回或设置显示图表元素的标准位置
        'VtChLocationTypeTop为图表元素提供了以下位置选项(顶部)
        .Legend.VtFont.Style = VtFontStyleBold
        'VtFont该对象描述用于显示图表文本的字体
        'VtFontStyleBold字体应用粗体属性
        .Legend.Location.Rect.Max.Set 7560, 5132
        .Legend.Location.Rect.MIN.Set 3004, 4864
        'Rect该对象定义坐标点
    End With
End SubPublic Sub PopTwoArray(ByRef thisarray)
    ' 用两个序列组织成任意的数组。第三个元素用于获得日期值。
    ReDim thisarray(1 To intRows, 1 To 3)
    Dim i As Integer
    'ReDim'ReDim用于为动态数组变量重新分配存储空间
   
        txtsql = "select * from ZHFXSJB1 WHERE XMXX_ID=" & XMID
        Set mrc = ExecuteSQL(txtsql, MsgText)
        i = 1
        If mrc.RecordCount > 0 Then
        Do While Not mrc.EOF
            ' 获得 Date 值。
            'thisarray(i, 1) = CStr(mrc.Fields(6))
            'thisarray(i, 1) = Format(mrc.Fields(2), "##.##")
            ' 获得值。
            thisarray(i, 2) = Format(mrc.Fields(60), "##.##")  '自然电位曲线
            thisarray(i, 1) = Format(mrc.Fields(62), "##.##")  '阴极保护电位曲线
            
            'Format返回 Variant (String),其中含有一个表达式,它是根据格式表达式中的指令来格式化的
            mrc.MoveNext
            i = i + 1
            If i > intRows Then
              Exit Do
            End If
        Loop
        Set mrc = Nothing
       End If
End SubPublic Sub twoColChart()
    ' 使用 arrMPGandTank 数组来创建一个两行的图表。
    With frmFhstt.chtSample
        .ChartData = arrMPGandTank
        'ChartData绘制图表最简单的方法就是创建数字型的数组,然后将 ChartData 属性设为该数组
'        .Title = "防护势态图"
        .ColumnLabelCount = 1
        'ColumnLabelCount返回或设置与图表关联的数据网格中的列的标签级别数
        .ColumnCount = 2
        'ColumnCount返回或设置与图表关联的当前数据网格中的列数
        .Column = 1
'        .ColumnLabel = "阴极保护电位"
        'ColumnLabel返回或设置与图表数据网格中的列关联的标签文本
        .Column = 2
'       .ColumnLabel = "自然电位"
        .Refresh
    End With
End Sub
'************************