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