function pChart::drawTreshold in Visitors 7.0
Same name and namespace in other branches
- 8 pchart/pChart.inc \pChart::drawTreshold()
File
- pchart/
pChart.inc, line 674
Class
Code
function drawTreshold($Value, $R, $G, $B, $ShowLabel = FALSE, $ShowOnRight = FALSE, $TickWidth = 4) {
if ($R < 0) {
$R = 0;
}
if ($R > 255) {
$R = 255;
}
if ($G < 0) {
$G = 0;
}
if ($G > 255) {
$G = 255;
}
if ($B < 0) {
$B = 0;
}
if ($B > 255) {
$B = 255;
}
$C_TextColor = imagecolorallocate($this->Picture, $R, $G, $B);
$Y = $this->GArea_Y2 - ($Value - $this->VMin) * $this->DivisionRatio;
if ($Y <= $this->GArea_Y1 || $Y >= $this->GArea_Y2) {
return -1;
}
if ($TickWidth == 0) {
$this
->drawLine($this->GArea_X1, $Y, $this->GArea_X2, $Y, $R, $G, $B);
}
else {
$this
->drawDottedLine($this->GArea_X1, $Y, $this->GArea_X2, $Y, $TickWidth, $R, $G, $B);
}
if ($ShowLabel) {
if ($ShowOnRight) {
imagettftext($this->Picture, $this->FontSize, 0, $this->GArea_X2 + 2, $Y + $this->FontSize / 2, $C_TextColor, $this->FontName, $Value);
}
else {
imagettftext($this->Picture, $this->FontSize, 0, $this->GArea_X1 + 2, $Y - $this->FontSize / 2, $C_TextColor, $this->FontName, $Value);
}
}
}