我编写了此方法来创建2个图表:
Dim rng As Range
Dim cht As ChartObject
Dim pos As Range
Set rng = ActiveSheet.Range(data_range)
Set pos = Range(position)
Set cht = ActiveSheet.ChartObjects.Add( _
Left:=pos.Left, _
Width:=breite, _
Top:=pos.Top, _
Height:=hohe)
cht.Chart.HasTitle = True
cht.Chart.ChartTitle.Text = "Statistik"
cht.Chart.ChartTitle.Characters.Font.size = 11
cht.Chart.Legend.Delete
cht.Chart.SetSourceData Source:=rng
问题是,当我使用此方法创建两个图表时,我有一个不同的Y-Scale值(可能是由于自动缩放),使得比较变得困难:
因此,我需要为Y轴设置相同的值,以获得更好的结果。
答案 0 :(得分:0)
您可以尝试
cht.Axes(xlValue, xlPrimary).MinimumScale = 0
cht.Axes(xlValue, xlPrimary).MaximumScale = 70
答案 1 :(得分:0)
我应该在我的代码中添加以下行:
Dim yax As Axis
Set yax = cht.Chart.Axes(xlValue)
yax.Minimumscale = 100
现在一切正常。