Here is a little bit of code that I've been using so that I don't have to take a WAG at what is the best maximum
A little bit (the minimum stuff) was written and never tested so use at your risk
<code>
$data = Set of data to be dealing with as a simple indexed array
//Calculate the maximum
$max = 0;
$min = $data[0]; //Set the minimum to the first value just in case
foreach ($data as $count) {
if ($count > $max) {
$max = $count;
}
if ($cont < $min) {
$min = $count;
}
}
// Do a little math to figure out the nearest .5 increment
// sprintf is used to convert an integer into a string so that strlen will count this is done instead of typecasting because that wasn't returning anything for me (go figure)
$increment = ((pow(10, strlen(sprintf("%d", $max)) - 1)) * .5);
// Count up to the increment right after the maximum
$yMax = 0;
$yMin = 0;
while ($yMax < $max) {
$yMax += $increment;
}
while ($yMin < $min) {
$yMin -= $increment;
}
$graph->set_y_max( $yMax );
$graph->set_y_min( $yMin );
</code>
This code will take a dataset in and manipulate
23,053 => 25,000
113 => 150
7,272 => 7,500
88 => 90 (Maybe not the best but I don't know how else to deal with it)
All I ask is that you keep it open source and keep my name in there
Sincerely,
~Andrew Allen