/** * Create the SVG representation from this Drawable * * @param RenderContext $ctx The context to use for rendering * * @return DOMElement The SVG Element */ public function toSvg(RenderContext $ctx) { $doc = $ctx->getDocument(); $group = $doc->createElement('g'); $r = ($ctx->xToAbsolute($this->radius) + $ctx->yToAbsolute($this->radius)) / 2; list($x, $y) = $ctx->toAbsolute($this->x, $this->y); $slicePath = $doc->createElement('path'); $slicePath->setAttribute('d', $this->getPieSlicePath($x, $y, $r)); $slicePath->setAttribute('style', $this->getStyle()); $slicePath->setAttribute('data-icinga-graph-type', 'pieslice'); $this->applyAttributes($slicePath); $group->appendChild($slicePath); if ($this->caption != "") { $lblGroup = $this->labelGroup ? $this->labelGroup : $group; $lblGroup->appendChild($this->drawDescriptionLabel($ctx, $r)); } return $group; }