From 30bdbd48a919c33859706ad6d378602d63a6ff8a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 4 Oct 2003 15:31:31 +0000 Subject: [PATCH] biger Text for the y-axis-texts, transparent background and other cosmetics --- phpgwapi/inc/class.gdgraph.inc.php | 32 ++++++++++++++++-------------- phpgwapi/inc/class.gdimage.inc.php | 6 +++++- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/phpgwapi/inc/class.gdgraph.inc.php b/phpgwapi/inc/class.gdgraph.inc.php index 0773bbacfb..5b6a5d1434 100644 --- a/phpgwapi/inc/class.gdgraph.inc.php +++ b/phpgwapi/inc/class.gdgraph.inc.php @@ -101,10 +101,10 @@ $this->img->width = $this->graph_width; $this->img->height = $this->graph_height; $this->img->Init(); - $this->img->SetColor(255, 255, 255); + $this->img->SetColor(255, 255, 255, True); // Draw the captions - $this->img->SetFont(2); + $this->img->SetFont(3); $this->img->SetColor(0, 0, 0); $this->img->MoveTo($this->graph_width / 2, 2); $this->img->DrawText(array('text' => $this->title)); @@ -162,7 +162,7 @@ // Draw the x axis text $this->img->SetColor(0, 0, 0); - $this->img->SetFont(1); + $this->img->SetFont(2); $linespace = ($this->graph_width - $this->margin_left - $this->margin_right) / ($this->num_lines_x - 1); reset($this->line_captions_x); $i = 0; @@ -173,17 +173,6 @@ $i++; } - // Draw the y axis text - $linespace = ($this->graph_height - $this->margin_top - $this->margin_bottom) / ($this->num_lines_y - 1); - $space = 1; - for ($i = 0;$idata);$i++) - { - $y = $this->graph_height - $this->margin_bottom - ($space * $linespace); - $this->img->MoveTo($this->margin_left - 6, $y); - $this->img->DrawText(array('text' => $this->data[$i]['title'],'justification' => 'right','margin_left' => $this->margin_left)); - $space++; - } - // Draw the lines for the data $this->img->SetColor(255, 0, 0); @@ -269,13 +258,26 @@ $x2 = $largest * $linespace + $this->margin_left; } - for ($w = 0; $w < 7; $w++) + for ($w = -3; $w < 4; $w++) { $this->img->Line(1+$x1,$y1+$w,$x2,$y2+$w); } $color_index++; $i++; } + // Draw the y axis text + $this->img->SetColor(0, 0, 0); + $this->img->SetFont(2); + $linespace = ($this->graph_height - $this->margin_top - $this->margin_bottom) / ($this->num_lines_y - 1); + $space = 1; + for ($i = 0;$idata);$i++) + { + $y = $this->graph_height - $this->margin_bottom - ($space * $linespace) - 7; + $this->img->MoveTo($this->margin_left - 6, $y); + $this->img->DrawText(array('text' => $this->data[$i]['title'],'justification' => 'right','margin_left' => $this->margin_left)); + $space++; + } + $this->img->ToBrowser(); $this->img->Done(); } diff --git a/phpgwapi/inc/class.gdimage.inc.php b/phpgwapi/inc/class.gdimage.inc.php index 356967c82c..d64eae4486 100644 --- a/phpgwapi/inc/class.gdimage.inc.php +++ b/phpgwapi/inc/class.gdimage.inc.php @@ -147,7 +147,7 @@ return false; } - function SetColor($r, $g, $b) + function SetColor($r, $g, $b, $set_transparent=False) { $key = "$r,$g,$b"; if (!IsSet($this->colormap[$key])) @@ -159,6 +159,10 @@ { $this->hColor = $this->colormap[$key]; } + if ($set_transparent) + { + ImageColorTransparent($this->hImage,$this->hColor); + } return true; }