Example #1
0
 /**
  * Overridden to keep inner text in the middle
  */
 public function DataLabelPosition($dataset, $index, &$item, $x, $y, $w, $h, $label_w, $label_h)
 {
     if ($dataset === 'innertext') {
         return 'centre middle';
     }
     return parent::DataLabelPosition($dataset, $index, $item, $x, $y, $w, $h, $label_w, $label_h);
 }
 /**
  * Returns the position for the label
  */
 public function DataLabelPosition($dataset, $index, &$item, $x, $y, $w, $h, $label_w, $label_h)
 {
     $pos = parent::DataLabelPosition($dataset, $index, $item, $x, $y, $w, $h, $label_w, $label_h);
     if (isset($this->slice_info[$index])) {
         list($xo, $yo) = $this->GetExplode($item, $this->slice_info[$index]->start_angle + $this->s_angle, $this->slice_info[$index]->end_angle + $this->s_angle);
         list($x1, $y1) = explode(' ', $pos);
         if (is_numeric($x1) && is_numeric($y1)) {
             $x1 += $xo;
             $y1 += $yo;
         } else {
             // this shouldn't happen, but just in case
             $x1 = $this->centre_x + $xo;
             $y1 = $this->centre_y + $yo;
         }
         $pos = "{$x1} {$y1}";
     } else {
         $pos = 'middle centre';
     }
     return $pos;
 }