You are here

function pChart::drawTitle in Visitors 7.0

Same name and namespace in other branches
  1. 8 pchart/pChart.inc \pChart::drawTitle()

File

pchart/pChart.inc, line 652

Class

pChart

Code

function drawTitle($XPos, $YPos, $Value, $R, $G, $B, $XPos2 = -1, $YPos2 = -1) {
  $C_TextColor = imagecolorallocate($this->Picture, $R, $G, $B);
  if ($XPos2 != -1) {
    $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value);
    $TextWidth = $Position[2] - $Position[0];
    $XPos = floor(($XPos2 - $XPos - $TextWidth) / 2) + $XPos;
  }
  if ($YPos2 != -1) {
    $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value);
    $TextHeight = $Position[5] - $Position[3];
    $YPos = floor(($YPos2 - $YPos - $TextHeight) / 2) + $YPos;
  }
  imagettftext($this->Picture, $this->FontSize, 0, $XPos, $YPos, $C_TextColor, $this->FontName, $Value);
}