刚开始使用Excel和图表....
当前代码:
With excel_Chart.Chart
.ChartType = xlColumnClustered
.SeriesCollection.NewSeries
.SeriesCollection(1).Values = _
Array(numOfSmallHits, numOfAllHits, numOfTallHits) 'array_value
End With
生成这两个图表。当两个值均为1时,Y轴显示0,0.5,1,1.5
当一个值为1而另一个值为2时,Y轴显示0,1,2,3
我不想使用硬编码标签,因为这是一个动态图表,但我确实只想使用整数。我尝试这样做是通过在上面的代码片段中添加以下代码行。
.Axes(xlValue).TickLabels.NumberFormat = "0"
首先,当值为1和2时,似乎没有任何变化。
但是当两个值碰巧都是1时,我在Y轴(0,1,1,2)上得到一个重复值。
对于动态图表,需要设置什么属性才能使整数以1为增量显示。例如,0,1,2,3,4,5 ....