Here is example code behind a report in my db setting y axis scale and units for a line graph:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'Plot Vibratory graph
Dim MinDD As Double
Dim MaxDD As Double
MinDD = DMin("Den", "GraphVibratory")
MaxDD = DMax("Den", "GraphVibratory")
With Me.gphDensity
If MinDD > 0 Then
.Axes(xlValue).MinimumScale = MinDD
If Me!Metric = True Then
MaxDD = Int(MaxDD / 100) * 100 + 100
MinDD = MaxDD - 1000
.Axes(xlValue).MaximumScale = MinDD
.Axes(xlValue).MinimumScale = MinDD
.Axes(xlValue).MajorUnit = 200
.Axes(xlValue).MinorUnit = 40
Else
MaxDD = Int(MaxDD / 5) * 5 + 5
MinDD = MaxDD - 50
.Axes(xlValue).MaximumScale = MaxDD
.Axes(xlValue).MinimumScale = MinDD
.Axes(xlValue).MajorUnit = 10
.Axes(xlValue).MinorUnit = 2
End If
.Axes(xlValue, xlPrimary).HasTitle = True
If Me!Metric = True Then
.Axes(xlValue, xlPrimary).AxisTitle.Text = "Max. Dry Density, Kg/cu.m"
End If
.Axes(xlCategory, xlPrimary).HasTitle = True
If Me!Metric = True Then
.Axes(xlCategory, xlPrimary).AxisTitle.Text = "Percent Passing 4.75 mm Sieve"
End If
End If
End With
End Sub