请问怎样设置MSCHART控件?
mschart的属性有那些?怎样和数据连上?3U 问题点数:0、回复次数:3Top
1 楼stonegoldaustin(特醇中南海)回复于 2003-08-01 11:58:15 得分 0
自己参考MS的资料吧.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mschrt/html/vbobjvtchartobject.aspTop
2 楼victorycyz(--)回复于 2003-08-02 14:33:14 得分 0
MSDN上的一个参考例子:
下面的示例显示一个具有 8 行 8 列数据的三维图表,并设置了图例的参数。
Private Sub Command1_Click()
With MSChart1
'显示一个具有 8 行 8 列数据的三维图表。
.ChartType = VtChChartType3dBar
.ColumnCount = 8
.RowCount = 8
For column = 1 To 8
For row = 1 To 8
.Column = column
.Row = row
.Data = row * 10
Next row
Next column
'将图表作为图例的背景。
.ShowLegend = True
.SelectPart VtChPartTypePlot, index1, index2, _
index3, index4
.EditCopy
.SelectPart VtChPartTypeLegend, index1, _
index2, index3, index4
.EditPaste
End With
End Sub
Top
3 楼lihonggen0(李洪根,MS MVP,标准答案来了)回复于 2003-08-02 14:43:11 得分 0
Private Sub Command1_Click()
If MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2) <> "" And IsNull(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2)) = False Then '该表格有数据
With MSChart1
.ChartType = VtChChartType2dPie
.ColumnCount = 2
.RowCount = 1
Dim XXX As Double
XXX = Val(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2))
.TitleText = "饼图示例 完成百分比"
.Column = 1
.Row = 1
.Data = XXX
.ColumnLabel = "完成百分比" & str(XXX) & "%"
.Column = 2
.Row = 1
.Data = 100 - XXX
.ColumnLabel = "剩余百分比" & str(100 - XXX) & "%"
End With
' With MSChart1
' .ChartType = VtChChartType2dPie
' .ColumnCount = 2
' .RowCount = 1
' Dim XXX As Double
' XXX = Val(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2))
' .TitleText = "饼图示例 完成百分比"
' .Column = 1
' .Row = 1
' .Data = XXX
' .ColumnLabel = "完成百分比" & Str(XXX) & "%"
' .Column = 2
' .Row = 1
' .Data = 100 - XXX
' .ColumnLabel = "剩余百分比" & Str(100 - XXX) & "%"
' End With
End If
End Sub
Private Sub Command2_Click()
If MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2) <> "" And IsNull(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2)) = False Then '该表格有数据
With MSChart1
.ChartType = VtChChartType2dBar
.ColumnCount = 2
.RowCount = MSHFlexGrid1.Rows - 1
.RowCount = 1
.TitleText = "直方图示例 本旬出口数量与去年同期对比值"
Dim XXX, XXXX As Double
For I = 1 To MSHFlexGrid1.Rows - 1
XXX = Val(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2))
XXXX = Val(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2))
.Column = 1
.Row = 1
.Data = XXX
.Column = 2
.Row = 1
.Data = XXXX
.RowLabel = MSHFlexGrid1.TextMatrix(I, 1)
.RowLabel = ""
Next I
.Column = 1
.ColumnLabel = "本旬出口数量"
.Column = 2
.ColumnLabel = "去年同期对比百分数"
End With
End If
End Sub
Top




