VB mschart 画图的一些问题

2025-02-25 00:26:10
推荐回答(1个)
回答1:

这是一段MCchart初始化的代码,设置最大值最小值就可以解决你的第一小问。
With MSChart1
'设置XY轴
.Plot.Axis(VtChAxisIdX).ValueScale.Auto = False
.Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
'// 设置最大值
.Plot.Axis(VtChAxisIdX).ValueScale.Maximum = 1
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 30
'// 设置最小值
.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = 0
.Plot.Axis(VtChAxisIdX).ValueScale.Minimum = 0
'//
.Plot.Axis(VtChAxisIdX).ValueScale.MajorDivision = 10 'X轴主要网格数量
.Plot.Axis(VtChAxisIdY).ValueScale.MajorDivision = 6 '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 = VtChChartType2dXY '设置图形为二维散点图
MSChart1.ChartData = MyData '数据
End With