summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/classes.inc.php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2004-08-25 19:12:58 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2004-08-25 19:12:58 +0000
commitafd9f9f5ef1d002ac92f3cc8e2a733fac69c2c20 (patch)
tree84aa824aedb5e1bfa0ca7a451699387f4685f0ff /frontends/php/include/classes.inc.php
parent93248e9b70106966ef70e752a32d2528e46435b3 (diff)
downloadzabbix-afd9f9f5ef1d002ac92f3cc8e2a733fac69c2c20.tar.gz
zabbix-afd9f9f5ef1d002ac92f3cc8e2a733fac69c2c20.tar.xz
zabbix-afd9f9f5ef1d002ac92f3cc8e2a733fac69c2c20.zip
- added support for customised Y axis for graphs (Alexei)
- added columns graphs.(yaxistype|yaxismin|yaxismax) (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@1405 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes.inc.php')
-rw-r--r--frontends/php/include/classes.inc.php136
1 files changed, 88 insertions, 48 deletions
diff --git a/frontends/php/include/classes.inc.php b/frontends/php/include/classes.inc.php
index 1ecc3af4..28fa4287 100644
--- a/frontends/php/include/classes.inc.php
+++ b/frontends/php/include/classes.inc.php
@@ -30,6 +30,10 @@
var $shiftY;
var $border;
+ var $yaxistype;
+ var $yaxismin;
+ var $yaxismax;
+
// items[num].data.min[max|avg]
var $items;
// $idnum[$num] is itemid
@@ -103,6 +107,7 @@
$this->border=1;
$this->num=0;
$this->nodata=1;
+ $this->yaxistype=GRAPH_YAXIS_TYPE_CALCULATED;
$this->count=array();
$this->min=array();
@@ -149,6 +154,21 @@
$this->period=$period;
}
+ function setYAxisMin($yaxismin)
+ {
+ $this->yaxismin=$yaxismin;
+ }
+
+ function setYAxisMax($yaxismax)
+ {
+ $this->yaxismax=$yaxismax;
+ }
+
+ function setYAxisType($yaxistype)
+ {
+ $this->yaxistype=$yaxistype;
+ }
+
function setSTime($stime)
{
if($stime>200000000000 && $stime<220000000000)
@@ -390,65 +410,85 @@
}
// Calculation of maximum Y
- function calculateMaxY()
+ function calculateMinY()
{
- unset($maxY);
- for($i=0;$i<$this->num;$i++)
+ if($this->yaxistype==GRAPH_YAXIS_TYPE_FIXED)
{
- if(!isset($maxY))
- {
- if(count($this->max[$i])>0)
- {
- $maxY=max($this->max[$i]);
- }
- }
- else
- {
- $maxY=@iif($maxY<max($this->max[$i]),max($this->max[$i]),$maxY);
- }
- }
-
- if($maxY>0)
- {
- $exp = floor(log10($maxY));
- $mant = $maxY/pow(10,$exp);
+ return $this->yaxismin;
}
else
{
- $exp=0;
- $mant=0;
+ return 0;
}
+ }
- $mant=(floor($mant*1.1*10/6)+1)*6/10;
-
-/* if($mant<1.5)
- {
- $mant=1.5;
- }
- elseif($mant<2)
- {
- $mant=2;
- }
- elseif($mant<3)
- {
- $mant=3;
- }
- elseif($mant<5)
- {
- $mant=5;
- }
- elseif($mant<8)
+// Calculation of maximum Y
+ function calculateMaxY()
+ {
+ if($this->yaxistype==GRAPH_YAXIS_TYPE_FIXED)
{
- $mant=8;
+ return $this->yaxismax;
}
else
{
- $mant=10;
+ unset($maxY);
+ for($i=0;$i<$this->num;$i++)
+ {
+ if(!isset($maxY))
+ {
+ if(count($this->max[$i])>0)
+ {
+ $maxY=max($this->max[$i]);
+ }
+ }
+ else
+ {
+ $maxY=@iif($maxY<max($this->max[$i]),max($this->max[$i]),$maxY);
+ }
+ }
+
+ if($maxY>0)
+ {
+ $exp = floor(log10($maxY));
+ $mant = $maxY/pow(10,$exp);
+ }
+ else
+ {
+ $exp=0;
+ $mant=0;
+ }
+
+ $mant=(floor($mant*1.1*10/6)+1)*6/10;
+
+ /* if($mant<1.5)
+ {
+ $mant=1.5;
+ }
+ elseif($mant<2)
+ {
+ $mant=2;
+ }
+ elseif($mant<3)
+ {
+ $mant=3;
+ }
+ elseif($mant<5)
+ {
+ $mant=5;
+ }
+ elseif($mant<8)
+ {
+ $mant=8;
+ }
+ else
+ {
+ $mant=10;
+ }
+ */
+ $maxY = $mant*pow(10,$exp);
+
+ return $maxY;
}
-*/
- $maxY = $mant*pow(10,$exp);
-
- return $maxY;
}
function selectData()
@@ -539,7 +579,7 @@
$maxX=900;
$minX=0;
- $minY=0;
+ $minY=$this->calculateMinY();
$maxY=$this->calculateMaxY();
for($item=0;$item<$this->num;$item++)