Esempio n. 1
0
 public function getHeight($aImg)
 {
     $scaling = 1;
     //$this->iAntiAlias ? 2 : 1 ;
     if ($this->iSize > 0 && $this->iSize < 1) {
         $this->iSize *= min($aImg->width, $aImg->height);
     }
     $value = new Text\Text();
     $value->SetFont($this->iFontFamily, $this->iFontStyle, $this->iFontSize * $scaling);
     $value->SetColor($this->iFontColor);
     // Setup extra size around the graph needed so that the labels
     // doesn't get cut. For this we need to find the largest label.
     // The code below gives a possible a little to large margin. The
     // really, really proper way would be to account for what angle
     // the label are at
     $n = count($this->iLabels);
     if ($n > 0) {
         $maxh = 0;
         $maxw = 0;
         foreach ($this->iLabels as $key => $lbl) {
             $value->Set($lbl);
             $maxh = max($maxh, $value->GetHeight($aImg));
         }
     } else {
         $value->Set('180.8');
         // Dummy value to get width/height
         $maxh = $value->GetHeight($aImg);
     }
     // Add an extra margin of 50% the font size
     //$maxh += round($this->iFontSize*$scaling * 0.5) ;
     $valymarg = 2 * $maxh + 2 * $this->iLabelMargin * $scaling;
     $legendheight = round($this->legend->iShow ? 1 : 0);
     $legendheight *= max($this->legend->iCircleRadius * 2, $this->legend->iTxtFontSize * 2) + $this->legend->iMargin + $this->legend->iBottomMargin + 2;
     $legendheight *= $scaling;
     $h = round($this->iSize * $scaling + $valymarg) + $legendheight;
     return $h;
 }