. */ /** * For more information, please contact */ namespace Goat1000\SVGGraph; class ExplodedSemiDonutGraph extends SemiDonutGraph { use ExplodedPieGraphTrait { dataLabelPosition as protected traitDLP; } /** * 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') { if($this->getOption('flipped')) $y_offset = new Number($label_h / 2); else $y_offset = new Number($label_h / -2); return ['centre middle 0 ' . $y_offset, [$x, $y] ]; } return $this->traitDLP($dataset, $index, $item, $x, $y, $w, $h, $label_w, $label_h); } }