biger Text for the y-axis-texts, transparent background and other cosmetics

This commit is contained in:
Ralf Becker 2003-10-04 15:31:31 +00:00
parent 878f345099
commit 30bdbd48a9
2 changed files with 22 additions and 16 deletions

View File

@ -101,10 +101,10 @@
$this->img->width = $this->graph_width; $this->img->width = $this->graph_width;
$this->img->height = $this->graph_height; $this->img->height = $this->graph_height;
$this->img->Init(); $this->img->Init();
$this->img->SetColor(255, 255, 255); $this->img->SetColor(255, 255, 255, True);
// Draw the captions // Draw the captions
$this->img->SetFont(2); $this->img->SetFont(3);
$this->img->SetColor(0, 0, 0); $this->img->SetColor(0, 0, 0);
$this->img->MoveTo($this->graph_width / 2, 2); $this->img->MoveTo($this->graph_width / 2, 2);
$this->img->DrawText(array('text' => $this->title)); $this->img->DrawText(array('text' => $this->title));
@ -162,7 +162,7 @@
// Draw the x axis text // Draw the x axis text
$this->img->SetColor(0, 0, 0); $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); $linespace = ($this->graph_width - $this->margin_left - $this->margin_right) / ($this->num_lines_x - 1);
reset($this->line_captions_x); reset($this->line_captions_x);
$i = 0; $i = 0;
@ -173,17 +173,6 @@
$i++; $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;$i<count($this->data);$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 // Draw the lines for the data
$this->img->SetColor(255, 0, 0); $this->img->SetColor(255, 0, 0);
@ -269,13 +258,26 @@
$x2 = $largest * $linespace + $this->margin_left; $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); $this->img->Line(1+$x1,$y1+$w,$x2,$y2+$w);
} }
$color_index++; $color_index++;
$i++; $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;$i<count($this->data);$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->ToBrowser();
$this->img->Done(); $this->img->Done();
} }

View File

@ -147,7 +147,7 @@
return false; return false;
} }
function SetColor($r, $g, $b) function SetColor($r, $g, $b, $set_transparent=False)
{ {
$key = "$r,$g,$b"; $key = "$r,$g,$b";
if (!IsSet($this->colormap[$key])) if (!IsSet($this->colormap[$key]))
@ -159,6 +159,10 @@
{ {
$this->hColor = $this->colormap[$key]; $this->hColor = $this->colormap[$key];
} }
if ($set_transparent)
{
ImageColorTransparent($this->hImage,$this->hColor);
}
return true; return true;
} }