diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-12-23 12:39:45 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-12-23 12:39:45 +0000 |
| commit | 83e9a5903bdf244e3bf5f22620d97095525cda22 (patch) | |
| tree | 68f364433e19b0990cd99856745d20143001553f /frontends/php/include/classes/graph.inc.php | |
| parent | bc180f9ce4913b77029b6c98ac5247553bfa2a73 (diff) | |
| download | zabbix-83e9a5903bdf244e3bf5f22620d97095525cda22.tar.gz zabbix-83e9a5903bdf244e3bf5f22620d97095525cda22.tar.xz zabbix-83e9a5903bdf244e3bf5f22620d97095525cda22.zip | |
- calculated minimum Y in graphs (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2421 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes/graph.inc.php')
| -rw-r--r-- | frontends/php/include/classes/graph.inc.php | 62 |
1 files changed, 44 insertions, 18 deletions
diff --git a/frontends/php/include/classes/graph.inc.php b/frontends/php/include/classes/graph.inc.php index 3cbc8df5..b2460441 100644 --- a/frontends/php/include/classes/graph.inc.php +++ b/frontends/php/include/classes/graph.inc.php @@ -424,29 +424,55 @@ } } -// Calculation of maximum Y left axis side - function calculateMinYleft() +// Calculation of maximum Y axis + function calculateMinY($side) { - if($this->yaxistype==GRAPH_YAXIS_TYPE_FIXED) - { - return $this->yaxismin; - } - else - { - return 0; - } - } +// return 0; -// Calculation of maximum Y right axis side - function calculateMinYright() - { if($this->yaxistype==GRAPH_YAXIS_TYPE_FIXED) { return $this->yaxismin; } else { - return 0; + unset($minY); + for($i=0;$i<$this->num;$i++) + { + if($this->items[$i]["axisside"] != $side) continue; + if(!isset($minY)&&(isset($this->min[$i]))) + { + if(count($this->max[$i])>0) + { + $minY=min($this->avg[$i]); + } + } + else + { + $minY=@iif($minY>min($this->avg[$i]),min($this->avg[$i]),$minY); + } + } + + if(isset($minY)&&($minY>0)) + { + $exp = floor(log10($minY)); + $mant = $minY/pow(10,$exp); + } + else + { + $exp=0; + $mant=0; + } + + $mant=(floor($mant*1.1*10/6)-1)*6/10; +// $mant=(floor($mant*1.1*10/6)+1)*6/10; + + $minY = $mant*pow(10,$exp); + + // Do not allow <0. However we may allow it, no problem. + $minY = max(0,$minY); + + return $minY; +// return 0; } } @@ -552,7 +578,7 @@ // $this->im = imagecreate($this->sizeX+$this->shiftX+61,$this->sizeY+2*$this->shiftY+40); -// Header( "Content-type: text/html"); +// Header( "Content-type: text/html"); Header( "Content-type: image/png"); Header( "Expires: Mon, 17 Aug 1998 12:51:50 GMT"); @@ -590,8 +616,8 @@ $maxX=900; $minX=0; - $minYleft=$this->calculateMinYleft(); - $minYright=$this->calculateMinYright(); + $minYleft=$this->calculateMinY(GRAPH_YAXIS_SIDE_LEFT); + $minYright=$this->calculateMinY(GRAPH_YAXIS_SIDE_RIGHT); $maxYleft=$this->calculateMaxY(GRAPH_YAXIS_SIDE_LEFT); $maxYright=$this->calculateMaxY(GRAPH_YAXIS_SIDE_RIGHT); |
