Example #1
0
 function __construct($aTxt = '')
 {
     parent::__construct($aTxt);
 }
 function TextPropertyBelow($aTxt = '')
 {
     parent::TextProperty($aTxt);
 }
 public function Stroke($aImg, $aXLeft, $aYTop, $aXRight, $aYBottom, $aUseTextHeight = false)
 {
     if (!$this->iShow) {
         return;
     }
     $txt = new TextProperty();
     $txt->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
     $txt->SetColor($this->iFontColor);
     $txt->SetAlign($this->iHeaderAlign, 'top');
     $n = count($this->iTitles);
     if ($n == 0) {
         return;
     }
     $x = $aXLeft;
     $h = $this->iHeight;
     $yTop = $aUseTextHeight ? $aYBottom - $h - $this->iTopColMargin - $this->iBottomColMargin : $aYTop;
     if ($h < 0) {
         Util\JpGraphError::RaiseL(6001);
         //('Internal error. Height for ActivityTitles is < 0');
     }
     $aImg->SetLineWeight(1);
     // Set background color
     $aImg->SetColor($this->iBackgroundColor);
     $aImg->FilledRectangle($aXLeft, $yTop, $aXRight, $aYBottom - 1);
     if ($this->iStyle == 1) {
         // Make a 3D effect
         $aImg->SetColor('white');
         $aImg->Line($aXLeft, $yTop + 1, $aXRight, $yTop + 1);
     }
     for ($i = 0; $i < $n; ++$i) {
         if ($this->iStyle == 1) {
             // Make a 3D effect
             $aImg->SetColor('white');
             $aImg->Line($x + 1, $yTop, $x + 1, $aYBottom);
         }
         $x += $this->iLeftColMargin;
         $txt->Set($this->iTitles[$i]);
         // Adjust the text anchor position according to the choosen alignment
         $xp = $x;
         if ($this->iHeaderAlign == 'center') {
             $xp = ($x - $this->iLeftColMargin + ($x + $this->iWidth[$i])) / 2;
         } elseif ($this->iHeaderAlign == 'right') {
             $xp = $x + $this->iWidth[$i] - $this->iRightColMargin;
         }
         $txt->Stroke($aImg, $xp, $yTop + $this->iTopHeaderMargin);
         $x += $this->iWidth[$i];
         if ($i < $n - 1) {
             $aImg->SetColor($this->iColor);
             $aImg->Line($x, $yTop, $x, $aYBottom);
         }
     }
     $aImg->SetColor($this->iColor);
     $aImg->Line($aXLeft, $yTop, $aXRight, $yTop);
     // Stroke vertical column dividers
     $cols = array();
     $this->GetColStart($aImg, $cols);
     $n = count($cols);
     for ($i = 1; $i < $n; ++$i) {
         $this->vgrid->Stroke($aImg, $cols[$i], $aYBottom, $cols[$i], $aImg->height - $aImg->bottom_margin);
     }
 }