From 2931659543b54549a9ca3ae16af4d252fd996b89 Mon Sep 17 00:00:00 2001 From: hugetoad Date: Tue, 14 May 2002 10:53:48 +0000 Subject: Added chart_diff.php git-svn-id: svn://svn.zabbix.com/trunk@365 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- frontends/php/chart_diff.php | 159 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 frontends/php/chart_diff.php (limited to 'frontends/php/chart_diff.php') diff --git a/frontends/php/chart_diff.php b/frontends/php/chart_diff.php new file mode 100644 index 00000000..8074afda --- /dev/null +++ b/frontends/php/chart_diff.php @@ -0,0 +1,159 @@ +$from_time and clock<$to_time "); + $count=DBget_field($result,0,0); + if($count>0) + { + $nodata=0; + $minX=DBget_field($result,0,1); + $maxX=DBget_field($result,0,2); + $minY=DBget_field($result,0,3); + $maxY=DBget_field($result,0,4); + + } + else + { + unset($maxX); + unset($maxY); + unset($minX); + unset($minY); + } + + $minY=0; + $maxY=0.0001; +// $minX=0; +// $maxX=1000; + + +// echo "MIN/MAX:",$minX," - ",$maxX," - ",$minY," - ",$maxY,"
"; + + $result=DBselect("select clock,value from history where itemid=$itemid and clock>$from_time and clock<$to_time order by clock"); + if(isset($minX)&&($minX!=$maxX)&&($minY!=$maxY)) + { + for($i=0;$i$maxY)) + { + $maxY=$y_next-$y; + } + } + $y1=$sizeY*(-$minY)/($maxY-$minY); + $y1=$sizeY-$y1; + ImageDashedLine($im,$shiftX,$y1+$shiftY,$sizeX+$shiftX,$y1+$shiftY,$yellow); + for($i=0;$i"; + ImageLine($im,$x1+$shiftX,$y1+$shiftY,$x2+$shiftX,$y2+$shiftY,$green); + } + } + else + { + if(isset($minX)) + { + ImageLine($im,$shiftX,$shiftY+$sizeY/2,$sizeX+$shiftX,$shiftY+$sizeY/2,$green); + } + } + + if($nodata == 0) + { + for($i=0;$i<=$sizeY;$i+=50) + { + ImageString($im, 1, $sizeX+5+$shiftX, $sizeY-$i-4+$shiftY, $i*($maxY-$minY)/$sizeY+$minY , $red); + } + + ImageString($im, 1,10, $sizeY+$shiftY+5, date("dS of F Y h:i:s A",$minX) , $red); + ImageString($im, 1,$sizeX+$shiftX-168,$sizeY+$shiftY+5, date("dS of F Y h:i:s A",$maxX) , $red); + } + else + { + ImageString($im, 2,$sizeX/2-50, $sizeY+$shiftY+3, "NO DATA FOUND FOR THIS PERIOD" , $red); + } + + ImageStringUp($im,0,2*$shiftX+$sizeX+40,$sizeY+2*$shiftY, "http://zabbix.sourceforge.net", $gray); + + ImagePng($im); + ImageDestroy($im); +?> -- cgit