= 20){ for ($n = $x+$s/5; $n < $x+$s; $n += $s/5) imageline($image, $n, 0, $n, $h, $color_grid); for ($n = $x2-$s/5; $n > $x2-$s; $n -= $s/5) imageline($image, $n, 0, $n, $h, $color_grid); } } for ($i = 0, $j=1; $i < $y0; $i+=$s, $j++){ $y = -$i + $y0; $y2 = $i + $y0; imageline($image, 0, $y, $w, $y, $color_grid); imageline($image, 0, $y2, $w, $y2, $color_grid); if ($small_grid && $s >= 20){ for ($n = $y-$s/5; $n > $y-$s; $n -= $s/5) imageline($image, 0, $n, $w, $n, $color_grid); for ($n = $y2+$s/5; $n < $y2+$s; $n += $s/5) imageline($image, 0, $n, $w, $n, $color_grid); } } } for ($i = $s, $j=1; $i < $x0; $i+=$s, $j++){ $x = $i + $x0; $x2 = -$i + $x0; imageline($image, $x, $y0-$s/2, $x, $y0+$s/2, $color_line); imageline($image, $x2, $y0-$s/2, $x2, $y0+$s/2, $color_line); $font_size = $s/3; if ($font_size < 5 && $s >= 6) $font_size = 5; $font = imagettfbbox($font_size, 0, $graph_font, $j); imagettftext($image, $font_size, 0, $x+2, $h/2+($font[0]-$font[7])+2, $color_line, $graph_font, $j); imagettftext($image, $font_size, 0, $x2+2, $h/2+($font[0]-$font[7])+2, $color_line, $graph_font, '-'.$j); } for ($i = $s, $j=1; $i < $y0; $i+=$s, $j++){ $y = -$i + $y0; $y2 = $i + $y0; imageline($image, $x0-$s/2, $y, $x0+$s/2, $y, $color_line); imageline($image, $x0-$s/2, $y2, $x0+$s/2, $y2, $color_line); imagettftext($image, $font_size, 0, $w/2+3, $y-3, $color_line, $graph_font, $j); imagettftext($image, $font_size, 0, $w/2+3, $y2-3, $color_line, $graph_font, '-'.$j); } imageline($image, $w/2, 0, $w/2, $h, $color_line); imageline($image, 0, $h/2, $w, $h/2, $color_line); imageline($image, ($w-$s)/2, $s/2, $w/2, 0, $color_line); imageline($image, $w/2, 0, ($w+$s)/2, $s/2, $color_line); imageline($image, $w-$s/2, ($h-$s)/2, $w, $h/2, $color_line); imageline($image, $w-$s/2, ($h+$s)/2, $w, $h/2, $color_line); $font_size = $s*0.75; if ($font_size < 6) $font_size = 6; imagettftext($image, $font_size, 0, $w/2+$s+3, 2+$s*0.75, $color_line, $graph_font, 'y'); $font = imagettfbbox($font_size, 0, $graph_font, 'x'); imagettftext($image, $font_size, 0, $w-3-($font[2]-$font[0]), ($h+$s)/2+($font[0]-$font[7])+3, $color_line, $graph_font, 'x'); $x_last = $pts[0]*$s + $x0; $y_last = -$pts[1]*$s + $y0; for ($i=1; $i <= count($pts); $i+=2){ $x = $pts[$i-1]*$s + $x0; $y = -$pts[$i]*$s + $y0; imageline($image, $x_last, $y_last, $x, $y, $color_graph); if ($point) imagefilledrectangle($image, $x-ceil($s/10), $y-ceil($s/10), $x+ceil($s/10), $y+ceil($s/10), $color_graph); if ($point_info){ $font_size = $s/4; if ($font_size < 5) $font_size = 5; $text = '('.bcdiv($pts[$i-1], 1, 2).'; '.bcdiv($pts[$i], 1, 2).')'; $font = imagettfbbox($font_size, 0, $graph_font, $text); imagettftext($image, $font_size, 0, $x+ceil($s/10)-1, $y+ceil($s/10)+($font[0]-$font[7]), $color_body, $graph_font, $text); imagettftext($image, $font_size, 0, $x+ceil($s/10)+1, $y+ceil($s/10)+($font[0]-$font[7]), $color_body, $graph_font, $text); imagettftext($image, $font_size, 0, $x+ceil($s/10), $y+ceil($s/10)+($font[0]-$font[7])+1, $color_body, $graph_font, $text); imagettftext($image, $font_size, 0, $x+ceil($s/10), $y+ceil($s/10)+($font[0]-$font[7])-1, $color_body, $graph_font, $text); imagettftext($image, $font_size, 0, $x+ceil($s/10), $y+ceil($s/10)+($font[0]-$font[7]), $color_text, $graph_font, $text); } $x_last = $x; $y_last = $y; } header("Content-type: image/gif"); imagegif($image); imagedestroy($image); } ?>