/** * Draws a bar with a circular ground shape. * * @param ezcGraphContext $context * @param ezcGraphColor $color * @param ezcGraphCoordinate $position * @param float $barWidth * @param float $offset * @param float $axisPosition * @param float $startDepth * @param float $midDepth * @param float $endDepth * @param int $symbol * @return void */ protected function drawCircularBar(ezcGraphContext $context, ezcGraphColor $color, ezcGraphCoordinate $position, $barWidth, $offset, $axisPosition, $startDepth, $midDepth, $endDepth, $symbol) { $barCenterTop = new ezcGraphCoordinate($this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ($this->dataBoundings->x1 - ($this->dataBoundings->x0 + 2 * $this->xAxisSpace)) + $offset + $barWidth / 2, $this->dataBoundings->y0 + $this->yAxisSpace + $position->y * ($this->dataBoundings->y1 - ($this->dataBoundings->y0 + 2 * $this->yAxisSpace))); $barCenterBottom = new ezcGraphCoordinate($this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ($this->dataBoundings->x1 - ($this->dataBoundings->x0 + 2 * $this->xAxisSpace)) + $offset + $barWidth / 2, $this->dataBoundings->y0 + $this->yAxisSpace + $axisPosition * ($this->dataBoundings->y1 - ($this->dataBoundings->y0 + 2 * $this->yAxisSpace))); if ($barCenterTop->y > $barCenterBottom->y) { $tmp = $barCenterTop; $barCenterTop = $barCenterBottom; $barCenterBottom = $tmp; } $this->barPostProcessing[] = array('index' => $barCenterBottom->x, 'method' => 'drawCircularArc', 'context' => $context, 'parameters' => array($this->get3dCoordinate($barCenterTop, $midDepth), $barWidth, $barWidth / 2, ($barCenterBottom->y - $barCenterTop->y) * $this->yDepthFactor, 0, 180, $color)); $this->barPostProcessing[] = array('index' => $barCenterBottom->x + 1, 'method' => 'drawCircle', 'context' => $context, 'parameters' => array($top = $this->get3dCoordinate($barCenterTop, $midDepth), $barWidth, $barWidth / 2, $symbol === ezcGraph::CIRCLE ? new ezcGraphLinearGradient(new ezcGraphCoordinate($top->x - $barWidth / 2, $top->y), new ezcGraphCoordinate($top->x + $barWidth / 2, $top->y), $color->darken($this->options->barDarkenTop), $color) : $color)); }
/** * Draws a single element of a circular arc * * ext/gd itself does not support something like circular arcs, so that * this functions draws rectangular polygons as a part of circular arcs * to interpolate them. This way it is possible to apply a linear gradient * to the circular arc, because we draw single steps anyway. * * @param ezcGraphCoordinate $center Center of ellipse * @param integer $width Width of ellipse * @param integer $height Height of ellipse * @param integer $size Height of border * @param float $startAngle Starting angle of circle sector * @param float $endAngle Ending angle of circle sector * @param ezcGraphColor $color Color of Border * @return void */ protected function drawCircularArcStep(ezcGraphCoordinate $center, $width, $height, $size, $startAngle, $endAngle, ezcGraphColor $color) { $this->drawPolygon(array(new ezcGraphCoordinate($center->x + cos(deg2rad($startAngle)) * $width / 2, $center->y + sin(deg2rad($startAngle)) * $height / 2), new ezcGraphCoordinate($center->x + cos(deg2rad($startAngle)) * $width / 2, $center->y + sin(deg2rad($startAngle)) * $height / 2 + $size), new ezcGraphCoordinate($center->x + cos(deg2rad($endAngle)) * $width / 2, $center->y + sin(deg2rad($endAngle)) * $height / 2 + $size), new ezcGraphCoordinate($center->x + cos(deg2rad($endAngle)) * $width / 2, $center->y + sin(deg2rad($endAngle)) * $height / 2)), $color->darken($this->options->shadeCircularArc * (1 + cos(deg2rad($startAngle))) / 2), true); }