主题:[讨论]用OWC画图之平行于轴的区间线段
添加部件Microsoft Web Component 9.0,把ChartSpace加到窗体上.
Option Explicit
Private Sub Command1_Click()
Dim cates(4)
Dim values(4)
Dim i As Integer
For i = 0 To 4
cates(i) = i
If i = 0 Then
values(i) = 0
Else
values(i) = i / 10 + values(i - 1)
End If
Next
With ChartSpace1
.Clear
.Charts.Add
.HasChartSpaceLegend = True
.HasChartSpaceTitle = True
.ChartSpaceTitle.Caption = "OWC使用示例"
End With
With ChartSpace1.Charts(0)
.Axes(0).Scaling.Maximum = 1
.Axes(0).Scaling.Minimum = 0.1
.Axes(0).HasAutoMajorUnit = False
.Axes(0).MajorUnit = 0.1
.Axes(0).NumberFormat = "0%"
.SeriesCollection.Add
.SeriesCollection(0).Caption = "示例1"
.SeriesCollection(0).SetData chDimCategories, chDataLiteral, cates
.SeriesCollection(0).SetData chDimValues, chDataLiteral, values
.SeriesCollection(0).Type = chChartTypeLine
.SeriesCollection(0).Marker.Style = chMarkerStyleX
End With
End Sub
我想生成像图片上红色线条的那种图表.用OWC可以做到吗?
Option Explicit
Private Sub Command1_Click()
Dim cates(4)
Dim values(4)
Dim i As Integer
For i = 0 To 4
cates(i) = i
If i = 0 Then
values(i) = 0
Else
values(i) = i / 10 + values(i - 1)
End If
Next
With ChartSpace1
.Clear
.Charts.Add
.HasChartSpaceLegend = True
.HasChartSpaceTitle = True
.ChartSpaceTitle.Caption = "OWC使用示例"
End With
With ChartSpace1.Charts(0)
.Axes(0).Scaling.Maximum = 1
.Axes(0).Scaling.Minimum = 0.1
.Axes(0).HasAutoMajorUnit = False
.Axes(0).MajorUnit = 0.1
.Axes(0).NumberFormat = "0%"
.SeriesCollection.Add
.SeriesCollection(0).Caption = "示例1"
.SeriesCollection(0).SetData chDimCategories, chDataLiteral, cates
.SeriesCollection(0).SetData chDimValues, chDataLiteral, values
.SeriesCollection(0).Type = chChartTypeLine
.SeriesCollection(0).Marker.Style = chMarkerStyleX
End With
End Sub
我想生成像图片上红色线条的那种图表.用OWC可以做到吗?