1,453
社区成员
发帖
与我相关
我的任务
分享
Str = "D:\Program Files\光伏逆变器监控系统\date\"
pstr = "Provider=Microsoft.Jet.OLEDB.4.0;"
pstr = pstr & "Persist Security Info=False;"
pstr = pstr & "Data Source=" & Str & "历史数据库.mdb"
connb.Open pstr
Rsb.CursorLocation = adUseClient
Rsb.Open "MyTable", connb, adOpenKeyset, adLockPessimistic
'---------------------------------------------------------------------------
Dim iValue(), i As Integer, j As Integer, iRow As Long, iCol As Integer
iRow = Rsb.RecordCount - 1
icow = Rsb.Fields.Count - 1
Rsb.MoveFirst
ReDim iValue(iRow, icow)
For i = 0 To iRow
For j = 0 To iCol
iValue(i, j) = Rsb.Fields(j)
Next
Rsb.MoveNext
Next
MSChart1.chartType = VtChChartType2dLine
MSChart1.ColumnCount = 2
MSChart1.ChartData = iValue
Str = "D:\Program Files\光伏逆变器监控系统\date\"
pstr = "Provider=Microsoft.Jet.OLEDB.4.0;"
pstr = pstr & "Persist Security Info=False;"
pstr = pstr & "Data Source=" & Str & "历史数据库.mdb"
connb.Open pstr
Rsb.CursorLocation = adUseClient
Rsb.Open "MyTable", connb, adOpenKeyset, adLockPessimistic
'---------------------------------------------------------------------------
Dim iValue(), i As Integer, j As Integer, iRow As Long, iCol As Integer
iRow = Rsb.RecordCount - 1
icow = Rsb.Fields.Count - 1
Rsb.MoveFirst
ReDim iValue(iRow, icow)
For i = 0 To iRow
For j = 0 To iCol
iValue(i, j) = Rsb.Fields(j)
Next
Rsb.MoveNext
Next
MSChart1.chartType = VtChChartType2dLine
MSChart1.ColumnCount = 2
MSChart1.ChartData = Values
Private Sub Command1_Click()
MSChart1.Backdrop.Fill.Brush.Style = VtBrushStyleNull '底背景背景透明
MSChart1.Legend.Backdrop.Fill.Brush.Style = VtBrushStyleNull '图列背景透明
MSChart1.Legend.Location.LocationType = VtChLocationTypeBottom '改变图列位置
MSChart1.ShowLegend = True '显示图列
MSChart1.Plot.SeriesCollection(1).LegendText = rsd(1).Name '系列一(C1)的名称
MSChart1.Plot.SeriesCollection(2).LegendText = rsd(2).Name '系列二(C2)的名称
'LocationType 常数
'
'常数 示例
'VtChLocationTypeTop 顶部
'VtChLocationTypeTopLeft 左上角
'VtChLocationTypeTopRight 右上角
'VtChLocationTypeLeft 左边
'VtChLocationTypeRight 右边
'VtChLocationTypeBottom 底部
'VtChLocationTypeBottomLeft 左下角
'VtChLocationTypeBottomRight 右下角
'VtChLocationTypeCustom
End Sub