If you have ever tried to use phplot library to make dynamically generated graphs i.e. from database, for sure you had find that the alghoritm of making Y tick inrement is not to clever.
This code helps You make it more like Excel/OOSpreadsheet does.
// $max = is the maximum value from data range
$mn = array(2,5,10);
$dm = pow(10, floor(log10(abs($max))-1));
$range = 0;
foreach ($mn AS $v) {
$range = $v * $dm;
if ($range == 0) continue;
$r = $max / $range;
if ($r >= 5 AND $r <= 10) {
$interval = $range;
}
}
if (empty($interval)) {
$interval = $mn[0] * $dm;
}
$plot->SetPlotAreaWorld(NULL,0);
$plot->SetYTickIncrement($interval);