$value) { $max[] = $value + $standard_deviation[$key]; } } else { $max = $values; } $y_scale = _graphstat_y_scale(max($max)); $x_offset_bar = 70; $y_offset_bar = 90; $t1 = '0'; foreach ($values as $key => $value) { $height = 199 - ($value / $y_scale * 200); $coords[$t1] = $x_offset_bar .','. $height .' '. $y_offset_bar .',199'; $x_offset_bar = $x_offset_bar + 30; $y_offset_bar = $y_offset_bar + 30; $t1 = $t1 + 2; } return $coords; } /** * Determine maximum y-axis value */ function _graphstat_y_scale($max) { $y_scale = 1; $odd = 1; while ($y_scale <= ($max + (0.1 * $max))) { if ($odd % 2) { $y_scale = $y_scale * 5; } else { $y_scale = $y_scale * 2; } $odd++; } return $y_scale; }