VB中如何MSCHART控件
VB中如何用MSCHART控件画折线图。可以做个简单例子吗?X轴为时间(24小时)如何连接有关数据画图。如何设置X轴Y轴。...
VB中如何用MSCHART控件画折线图。可以做个简单例子吗?X轴为时间(24小时)如何连接有关数据画图。如何设置X轴Y轴。
展开
2013-07-12
展开全部
Dim testdata(1 To 24, 1 To 5) '职称数
Private Sub Form_Load()
Dim srow, scol As Integer
testdata(1, 1) = "A" ' 在第一列设置标签。
testdata(2, 1) = "B"
testdata(3, 1) = "C"
testdata(4, 1) = "D"
testdata(5, 1) = "E"
For srow = 1 To 24
For scol = 1 To 5
testdata(srow, scol) = testdata(srow, scol)
Next scol
Next srow
MSChart1.Legend.Location.LocationType = VtChLocationTypeBottom '图例在图表下方
With MSChart1
.ColumnCount = 4
.ChartData = testdata
.DataGrid.ColumnLabel(1, 1) = "tushi"
.DataGrid.ColumnLabel(2, 1) = "2C"
.DataGrid.ColumnLabel(3, 1) = "3D"
.DataGrid.ColumnLabel(4, 1) = "4E"
'.DataGrid.ColumnLabel(5, 1) = "5"
'.DataGrid.ColumnLabel(6, 1) = "6"
.TitleText = "折线图图示"
.ToolTipText = "折线图图示"
.ChartType = VtChChartType2dLine '折线图
End With
End Sub
Private Sub Form_Load()
Dim srow, scol As Integer
testdata(1, 1) = "A" ' 在第一列设置标签。
testdata(2, 1) = "B"
testdata(3, 1) = "C"
testdata(4, 1) = "D"
testdata(5, 1) = "E"
For srow = 1 To 24
For scol = 1 To 5
testdata(srow, scol) = testdata(srow, scol)
Next scol
Next srow
MSChart1.Legend.Location.LocationType = VtChLocationTypeBottom '图例在图表下方
With MSChart1
.ColumnCount = 4
.ChartData = testdata
.DataGrid.ColumnLabel(1, 1) = "tushi"
.DataGrid.ColumnLabel(2, 1) = "2C"
.DataGrid.ColumnLabel(3, 1) = "3D"
.DataGrid.ColumnLabel(4, 1) = "4E"
'.DataGrid.ColumnLabel(5, 1) = "5"
'.DataGrid.ColumnLabel(6, 1) = "6"
.TitleText = "折线图图示"
.ToolTipText = "折线图图示"
.ChartType = VtChChartType2dLine '折线图
End With
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询