If you want to know the gory details it is to calculate the order of magnitude of a cost (so this will always be positive as in business there is no such thing as a negative cost and the system does not allow negative values via the data entry validation).
The plan is to figure out the order of magnitude of the maximum value of a data point plotted on the axis of a bar chart. And this needs to be a round figures to look nice. eg
max x value = 965 -> x-axis range = 1000
max x value = 6713 -> x-axis range = 6800
i.e. 965.
Math.Ceiling(Math.log10(965)) = 3
Minus 1 from [order of magnitude] (if greater than 1)
This would be 2.
Back again
Math.Pow(10, 2) = 100.
Calculate the max figure to the nearest 100 = 900
Add the interval to this figure = 900 + 100
Max x-axis value = 1000
Voila
But Crystal Report 2008 does not allow one to programmatically set the x-axis max range (you can only do this via the designer).
So its all been for nowt, ah well that’s dev for you. Back to my cup of coffee and the next bug…