7,763
社区成员
发帖
与我相关
我的任务
分享
Dim MyData() As Single
ReDim MyData(Size - 1, 20) As Single '定义了20条曲线
For i = 0 To Size - 1
Sum = 0
For j = 0 To 19
Sum = Sum + Val(Data_Year(MinYear).Data_Month(MinMonth).Month_People(j).Lab)
MyData(i, j) = Sum '为每条曲线赋值
Next j
If MinMonth = 11 Then
MinYear = MinYear + 1
MinMonth = 0
Else
MinMonth = MinMonth + 1
End If
Next i
'波形图外观设置
With MSChart1
.Backdrop.Fill.Brush.FillColor.Set 255, 255, 255
.TitleText = "人员SE图"
' '设置图线的外观
' '设置XY轴
.Plot.Axis(VtChAxisIdX).ValueScale.Auto = False
.Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
'// 设置最大值
'.Plot.Axis(VtChAxisIdX).ValueScale.Maximum = 10000 '设置横轴标注最大值
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 10 '设置纵轴标注最大值
'// 设置最小值
.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = 0
.Plot.Axis(VtChAxisIdX).ValueScale.Minimum = 0
'//
.Plot.Axis(VtChAxisIdX).ValueScale.MajorDivision = 20 'X轴主要网格数量
.Plot.Axis(VtChAxisIdY).ValueScale.MajorDivision = 10 'Y轴主要网格数量
.Plot.Axis(VtChAxisIdX).ValueScale.MinorDivision = 0 'X轴次要网格数量
.Plot.Axis(VtChAxisIdY).ValueScale.MinorDivision = 0 'Y轴次要网格数量
.Plot.Axis(VtChAxisIdX).AxisGrid.MajorPen.Style = VtPenStyleDotted
.Plot.Axis(VtChAxisIdY).AxisGrid.MajorPen.Style = VtPenStyleDotted
MSChart1.Plot.AutoLayout = False
MSChart1.Plot.UniformAxis = False
MSChart1.chartType = VtChChartType2dLine '设置图形为二维散点图
MSChart1.ChartData = MyData '数据
For i = 1 To 20
.Plot.SeriesCollection(i).LegendText = Data_Year(0).Data_Month(0).Month_People(i - 1).Name
Next i
For i = 1 To 20
.Plot.SeriesCollection(i).Pen.Width = 10
.Plot.SeriesCollection(i).Pen.Style = VtPenStyleSolid
Next i
For i = 1 To 20
.Plot.SeriesCollection(i).DataPoints(-1). _
DataPointLabel.LocationType = VtChLabelLocationTypeBelowPoint
Next i
.ColumnCount = Size ''删除或修改都无法显示曲线
For k = 1 To Size
.Row = k
.RowLabel = Data_Year(kcountyear).date_year & "/" & Data_Year(kcountyear).Data_Month(kcountmonth).date_month
If kcountmonth = 11 Then
kcountyear = kcountyear + 1
kcountmonth = 0
Else
kcountmonth = kcountmonth + 1
End If
Next k
End With