72 $t = $thick / 2 - 0.5;
76 $Image , round( min( $x1 , $x2 ) - $t ) , round( min( $y1 , $y2 ) - $t ) ,
77 round( max( $x1 , $x2 ) + $t ) , round( max( $y1 , $y2 ) + $t ) , $color
124 private function commonimagelinethick( $Image , $x1 , $y1 , $x2 , $y2 , $Color , $Thick = 1 )
126 $t = $Thick / 2 - 0.5;
127 $k = ( $y2 - $y1 ) / ( $x2 - $x1 );
128 $a = $t / sqrt( 1 + pow( $k , 2 ) );
130 round( $x1 - ( 1 + $k ) * $a ) , round( $y1 + ( 1 - $k ) * $a ) , round( $x1 - ( 1 - $k ) * $a ) ,
131 round( $y1 - ( 1 + $k ) * $a ) , round( $x2 + ( 1 + $k ) * $a ) , round( $y2 - ( 1 - $k ) * $a ) ,
132 round( $x2 + ( 1 - $k ) * $a ) , round( $y2 + ( 1 + $k ) * $a ) ,
135 imagefilledpolygon( $Image , $points , 4 , $Color );
136 return( imagepolygon( $Image , $points , 4 , $Color ) );
185 return( imageline( $Image , $x1 , $y1 , $x2 , $y2 , $color ) );
187 elseif( $x1 == $x2 || $y1 == $y2 )
189 return( $this->
filledrectangle( $Image , $x1 , $y1 , $x2 , $y2 , $color , $thick ) );
192 return( $this->commonimagelinethick( $Image , $x1 , $y1 , $x2 , $y2 , $color , $thick ) );
223 $Color = intval( $Color );
225 $ColorObject = imagecolorallocate(
226 $Image , ( $Color & ( 255 << 16 ) ) >> 16 ,
227 ( $Color & ( 255 << 8 ) ) >> 8 , $Color & 255
230 return( $ColorObject );
259 $BackgroundColor = intval( $BackgroundColor );
263 $Res = imagefill( $Img , 0 , 0 , $BackgroundColor );
267 throw(
new Exception(
'An error occured while setting graph background' ) );
270 catch( Exception $e )
310 $Box = imagettfbbox( $Size , 0 , $FontFile , $String );
312 return( $Box[ 2 ] - $Box[ 0 ] );
314 catch( Exception $e )
354 $Box = imagettfbbox( $Size , 0 , $FontFile , $String );
356 return( abs( $Box[ 5 ] - $Box[ 1 ] ) );
358 catch( Exception $e )
398 $Box = imagettfbbox( $Size , 0 , $FontFile , $String );
400 return( array( $Box[ 2 ] - $Box[ 0 ] , abs( $Box[ 5 ] - $Box[ 1 ] ) ) );
402 catch( Exception $e )
440 $MaxY = max( $DataY );
441 $MinY = min( $DataY );
442 $dY = ( $MaxY - $MinY ) / $StepsY;
444 for( $i = 0 ; $i <= $StepsY ; $i++ )
446 $Labels [] = sprintf(
'%.2f' , $MinY + $i * $dY );
451 catch( Exception $e )
483 header(
'Content-type: image/png' );
485 imagedestroy( $Img );
488 catch( Exception $e )