Chart Scale

kiplook

Registered User.
Local time
Yesterday, 22:24
Joined
Jun 28, 2002
Messages
18
I am trying to create a chart in access. The chart will contain anywhere from 5 to 5,000 points out of around 428,000 depending on the query.

I’m having problems with the scale - I’d like the chart to automatically use the minimum value charted as the min Y scale and the maximum value charted as the max Y scale. For example, one chart may have data ranging from 22 to 28 but the chart min is 0 and the max is 35. I can go in and change the scale but it’s a pain and the user may not know how.

I can’t use permanent settings because the next chart may range from 11 to 15.

Can’t access do this automatically?
 
I suggest you to write some code for this.

1) Try to find the max and the min of all your data.

MaximumValueOfData = 0
If ValueOfData > MaximumValueOfData then
MaximumValueOfData = ValueOfData
endif

MinimumValueOfData = 10000000000...
If ValueOfData < MinimumValueOfData then
MinimumValueOfData = ValueOfData
endif

2) Then change your scale to those values. Here is a sample code for that:

With ActiveChart.Axes(xlValue)
.MinimumScale = MinimumValueOfData - SomeValue
.MaximumScale = MaximumValueOfData + SomeValue
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
End With


Maybe you will need an OLE Excel for that since MS Chart is not quite as powerfull as Excel is...

Hope it will help

Mario
 

Users who are viewing this thread

Back
Top Bottom