diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2001-07-08 15:44:10 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2001-07-08 15:44:10 +0000 |
| commit | 06b0209984cd7d65fdd4ed5ffeb965f7e894f6c7 (patch) | |
| tree | 39449be83e3fb3b99f81897e2478a1857427dd96 /frontends/php/chart2.html | |
| parent | ade87bab8d26dd4a23a1e96e9e13ae3158999696 (diff) | |
| download | zabbix-06b0209984cd7d65fdd4ed5ffeb965f7e894f6c7.tar.gz zabbix-06b0209984cd7d65fdd4ed5ffeb965f7e894f6c7.tar.xz zabbix-06b0209984cd7d65fdd4ed5ffeb965f7e894f6c7.zip | |
Color attribute added to each parameter of graph.
git-svn-id: svn://svn.zabbix.com/trunk@132 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/chart2.html')
| -rw-r--r-- | frontends/php/chart2.html | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/frontends/php/chart2.html b/frontends/php/chart2.html index b704faac..6ee202c2 100644 --- a/frontends/php/chart2.html +++ b/frontends/php/chart2.html @@ -33,16 +33,18 @@ $nodata=1; -// Header( "Content-type: text/html"); - Header( "Content-type: image/png"); + Header( "Content-type: text/html"); +// Header( "Content-type: image/png"); Header( "Expires: Mon, 17 Aug 1998 12:51:50 GMT"); $im = imagecreate($sizeX+$shiftX+61,$sizeY+$shiftYup+$shiftYdown+10); $red=ImageColorAllocate($im,255,0,0); + $darkred=ImageColorAllocate($im,150,0,0); $green=ImageColorAllocate($im,0,255,0); $darkgreen=ImageColorAllocate($im,0,150,0); $blue=ImageColorAllocate($im,0,0,255); + $darkblue=ImageColorAllocate($im,0,0,150); $yellow=ImageColorAllocate($im,255,255,0); $cyan=ImageColorAllocate($im,0,255,255); $black=ImageColorAllocate($im,0,0,0); @@ -51,11 +53,15 @@ $colors=array(); - $color[0]=$green; - $color[1]=$yellow; - $color[2]=$blue; - $color[3]=$white; - $color[4]=$cyan; + $colors["Green"]=$green; + $colors["Dark Green"]=$darkgreen; + $colors["Yellow"]=$yellow; + $colors["Blue"]=$blue; + $colors["Dark Blue"]=$blue; + $colors["White"]=$white; + $colors["Cyan"]=$cyan; + $colors["Red"]=$red; + $colors["Dark Red"]=$darkred; $x=imagesx($im); $y=imagesy($im); @@ -74,12 +80,13 @@ $from_time = time(NULL)-$period-3600*$from; $to_time = time(NULL)-3600*$from; - $result2=DBselect("select gi.itemid,i.description from graphs_items gi,items i where gi.itemid=i.itemid and gi.graphid=$graphid order by gi.gitemid"); + $result2=DBselect("select gi.itemid,i.description,gi.color from graphs_items gi,items i where gi.itemid=i.itemid and gi.graphid=$graphid order by gi.gitemid"); $len=array(); $x=array(); $y=array(); $desc=array(); + $color=array(); $maxX=-1000000000; $maxY=-1000000000; @@ -90,6 +97,7 @@ { $itemid=DBget_field($result2,$item,0); $desc[$item]=DBget_field($result2,$item,1); + $color[$item]=DBget_field($result2,$item,2); $result=DBselect("select clock,value from history where itemid=$itemid and clock>$from_time and clock<$to_time order by clock"); $len[$item]=0; @@ -127,14 +135,14 @@ $y2=$sizeY-$y2; // echo $x1," - ",$x2," - ",$y1," - ",$y2,"<Br>"; - ImageLine($im,$x1+$shiftX,$y1+$shiftYup,$x2+$shiftX,$y2+$shiftYup,$color[$item]); + ImageLine($im,$x1+$shiftX,$y1+$shiftYup,$x2+$shiftX,$y2+$shiftYup,$colors[$color[$item]]); } } else { - ImageLine($im,$shiftX,$shiftYup+$sizeY/2,$sizeX+$shiftX,$shiftYup+$sizeY/2,$color[$item]); + ImageLine($im,$shiftX,$shiftYup+$sizeY/2,$sizeX+$shiftX,$shiftYup+$sizeY/2,$colors[$color[$item]]); } - ImageFilledRectangle($im,$shiftX+150*$item,$sizeY+$shiftYup+19,$shiftX+150*$item+5,$sizeY+$shiftYup+15+9,$color[$item]); + ImageFilledRectangle($im,$shiftX+150*$item,$sizeY+$shiftYup+19,$shiftX+150*$item+5,$sizeY+$shiftYup+15+9,$colors[$color[$item]]); ImageString($im, 2,$shiftX+150*$item+9,$sizeY+$shiftYup+15, $desc[$item], $gray); } |
