summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/classes/graph.inc.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-06-20 08:49:36 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-06-20 08:49:36 +0000
commit95d0aa5f5b34c37c0d0d44f869a8c4fa0068393b (patch)
tree31dc784607da0b7da8b3747b2c3361cc866fbeaa /frontends/php/include/classes/graph.inc.php
parent2ee4380facc20c50ece4625c7fea1a4a02056d8f (diff)
- merged -r4311:4312 of branches/1.4.1/ (Eugene) [fixed Dashed lines for graphs]
git-svn-id: svn://svn.zabbix.com/trunk@4313 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes/graph.inc.php')
-rw-r--r--frontends/php/include/classes/graph.inc.php32
1 files changed, 19 insertions, 13 deletions
diff --git a/frontends/php/include/classes/graph.inc.php b/frontends/php/include/classes/graph.inc.php
index 28ed0c8e..5c28c409 100644
--- a/frontends/php/include/classes/graph.inc.php
+++ b/frontends/php/include/classes/graph.inc.php
@@ -22,12 +22,6 @@
require_once "include/items.inc.php";
require_once "include/hosts.inc.php";
- define("GRAPH_DRAW_TYPE_LINE",0);
- define("GRAPH_DRAW_TYPE_FILL",1);
- define("GRAPH_DRAW_TYPE_BOLDLINE",2);
- define("GRAPH_DRAW_TYPE_DOT",3);
- define("GRAPH_DRAW_TYPE_DASHEDLINE",4);
-
define("GRAPH_YAXIS_TYPE_CALCULATED",0);
define("GRAPH_YAXIS_TYPE_FIXED",1);
@@ -246,7 +240,7 @@
$color=null, $drawtype=null, $type=null, $periods_cnt=null)
{
if($this->type == GRAPH_TYPE_STACKED /* stacked graph */)
- $drawtype = GRAPH_DRAW_TYPE_FILL;
+ $drawtype = GRAPH_ITEM_DRAWTYPE_FILLED_REGION;
$this->items[$this->num] = get_item_by_itemid($itemid);
$this->items[$this->num]["description"]=item_description($this->items[$this->num]["description"],$this->items[$this->num]["key_"]);
@@ -254,7 +248,7 @@
$this->items[$this->num]["host"] = $host["host"];
$this->items[$this->num]["color"] = is_null($color) ? "Dark Green" : $color;
- $this->items[$this->num]["drawtype"] = is_null($drawtype) ? GRAPH_DRAW_TYPE_LINE : $drawtype;
+ $this->items[$this->num]["drawtype"] = is_null($drawtype) ? GRAPH_ITEM_DRAWTYPE_LINE : $drawtype;
$this->items[$this->num]["axisside"] = is_null($axis) ? GRAPH_YAXIS_SIDE_RIGHT : $axis;
$this->items[$this->num]["calc_fnc"] = is_null($calc_fnc) ? CALC_FNC_AVG : $calc_fnc;
$this->items[$this->num]["calc_type"] = is_null($type) ? GRAPH_ITEM_SIMPLE : $type;
@@ -770,13 +764,13 @@
/* draw main line */
switch($drawtype)
{
- case GRAPH_DRAW_TYPE_BOLDLINE:
+ case GRAPH_ITEM_DRAWTYPE_BOLD_LINE:
ImageLine($this->im,$x1,$y1+1,$x2,$y2+1,$avg_color);
// break; /* don't use break, must be drawed line also */
- case GRAPH_DRAW_TYPE_LINE:
+ case GRAPH_ITEM_DRAWTYPE_LINE:
ImageLine($this->im,$x1,$y1,$x2,$y2,$avg_color);
break;
- case GRAPH_DRAW_TYPE_FILL:
+ case GRAPH_ITEM_DRAWTYPE_FILLED_REGION:
$a[0] = $x1; $a[1] = $y1;
$a[2] = $x1; $a[3] = $y1_shift;
$a[4] = $x2; $a[5] = $y2_shift;
@@ -784,10 +778,22 @@
ImageFilledPolygon($this->im,$a,4,$avg_color);
break;
- case GRAPH_DRAW_TYPE_DOT:
+ case GRAPH_ITEM_DRAWTYPE_DOT:
ImageFilledRectangle($this->im,$x1-1,$y1-1,$x1+1,$y1+1,$avg_color);
ImageFilledRectangle($this->im,$x2-1,$y2-1,$x2+1,$y2+1,$avg_color);
break;
+ case GRAPH_ITEM_DRAWTYPE_DASHED_LINE:
+ if( function_exists('imagesetstyle') )
+ { /* Use ImageSetStyle+ImageLIne instead of bugged ImageDashedLine */
+ $style = array($avg_color, $avg_color, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
+ ImageSetStyle($this->im, $style);
+ ImageLine($this->im,$x1,$y1,$x2,$y2,IMG_COLOR_STYLED);
+ }
+ else
+ {
+ ImageDashedLine($this->im,$x1,$y1,$x2,$y2,$avg_color);
+ }
+ break;
}
}
// Calculation of maximum Y axis
@@ -1252,7 +1258,7 @@
if($this->items[$item]["calc_type"] == GRAPH_ITEM_AGGREGATED)
{
- $drawtype = GRAPH_DRAW_TYPE_LINE;
+ $drawtype = GRAPH_ITEM_DRAWTYPE_LINE;
$max_color = $this->GetColor("HistoryMax");
$avg_color = $this->GetColor("HistoryAvg");