summaryrefslogtreecommitdiffstats
path: root/src/renderer
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-06-12 07:16:35 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-06-12 07:16:35 +0000
commite8ef1f3c3429317ef3aaee3dffbb4a6636191554 (patch)
tree5de8fc5de984182a6f156a9b06e062991f554a78 /src/renderer
parent586b46467247a2fdeb2707ef2f654e0825da2924 (diff)
downloadzetacomponents-graph-e8ef1f3c3429317ef3aaee3dffbb4a6636191554.zip
zetacomponents-graph-e8ef1f3c3429317ef3aaee3dffbb4a6636191554.tar.gz
- Added tests and implementation for pie segments and rects to the 2d renderer
Diffstat (limited to 'src/renderer')
-rw-r--r--src/renderer/2d.php32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/renderer/2d.php b/src/renderer/2d.php
index 770040b..7bd1dda 100644
--- a/src/renderer/2d.php
+++ b/src/renderer/2d.php
@@ -27,7 +27,25 @@ class ezcGraphRenderer2D extends ezcGraphRenderer
*/
public function drawPieSegment( ezcGraphColor $color, ezcGraphCoordinate $position, $radius, $startAngle = .0, $endAngle = 360., $moveOut = .0 )
{
-
+ $direction = $startAngle + ( $endAngle - $startAngle ) / 2;
+
+ if ( $moveOut > 0 )
+ {
+ $position = new ezcGraphCoordinate(
+ $position->x + $moveOut * cos( deg2rad( $direction ) ),
+ $position->y + $moveOut * sin( deg2rad( $direction ) )
+ );
+
+ }
+
+ $this->driver->drawCircleSector(
+ $position,
+ $radius * 2,
+ $radius * 2,
+ $startAngle,
+ $endAngle,
+ $color
+ );
}
/**
@@ -83,7 +101,17 @@ class ezcGraphRenderer2D extends ezcGraphRenderer
*/
public function drawRect( ezcGraphColor $color, ezcGraphCoordinate $position = null, $width = null, $height = null, $borderWidth = 1 )
{
-
+ $this->driver->drawPolygon(
+ array(
+ new ezcGraphCoordinate( $position->x, $position->y ),
+ new ezcGraphCoordinate( $position->x + $width, $position->y ),
+ new ezcGraphCoordinate( $position->x + $width, $position->y + $height ),
+ new ezcGraphCoordinate( $position->x, $position->y + $height ),
+ ),
+ $color,
+ false,
+ $borderWidth
+ );
}
/**
OpenPOWER on IntegriCloud