summaryrefslogtreecommitdiffstats
path: root/src/interfaces
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2008-06-18 09:48:07 +0000
committerKore Nordmann <github@kore-nordmann.de>2008-06-18 09:48:07 +0000
commit56e1ea6d93e5a9327b1d14890e61c3d210cd2381 (patch)
treebcfd093ae07b0b3ce1c14a17dbe5ff1e2958bece /src/interfaces
parent3f1e0ff648e5f70b90d2c2b0fbdb26ea6eafde1f (diff)
downloadzetacomponents-graph-56e1ea6d93e5a9327b1d14890e61c3d210cd2381.zip
zetacomponents-graph-56e1ea6d93e5a9327b1d14890e61c3d210cd2381.tar.gz
- Implemented feature #13103: Different axes end styles
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/renderer.php78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/interfaces/renderer.php b/src/interfaces/renderer.php
index 85f7d66..33c8bb1 100644
--- a/src/interfaces/renderer.php
+++ b/src/interfaces/renderer.php
@@ -322,6 +322,84 @@ abstract class ezcGraphRenderer
);
/**
+ * Draw axis arrow head
+ *
+ * Draw an arrow head at the specified position using specified size
+ * and direction of the error head. Repsects the axisEndStyle option in
+ * the base renderer options class.
+ *
+ * @param ezcGraphCoordinate $position
+ * @param ezcGraphVector $direction
+ * @param float $size
+ * @param ezcGraphColor $color
+ * @return void
+ */
+ protected function drawAxisArrowHead( ezcGraphCoordinate $position, ezcGraphVector $direction, $size, ezcGraphColor $color )
+ {
+ $orthogonalDirection = clone $direction;
+ $orthogonalDirection->rotateClockwise();
+
+ if ( $this->options->axisEndStyle === ezcGraph::ARROW )
+ {
+ $this->driver->drawPolygon(
+ array(
+ new ezcGraphCoordinate(
+ $position->x,
+ $position->y
+ ),
+ new ezcGraphCoordinate(
+ $position->x
+ - $orthogonalDirection->x * $size / 2
+ + $direction->x * $size,
+ $position->y
+ - $orthogonalDirection->y * $size / 2
+ + $direction->y * $size
+ ),
+ new ezcGraphCoordinate(
+ $position->x
+ + $orthogonalDirection->x * $size / 2
+ + $direction->x * $size,
+ $position->y
+ + $orthogonalDirection->y * $size / 2
+ + $direction->y * $size
+ ),
+ ),
+ $color,
+ true
+ );
+ }
+ elseif ( $this->options->axisEndStyle !== ezcGraph::NO_SYMBOL )
+ {
+ $topLeft = new ezcGraphCoordinate(
+ $position->x
+ + $orthogonalDirection->x * $size / 2
+ + $direction->x * $size,
+ $position->y
+ + $orthogonalDirection->y * $size / 2
+ + $direction->y * $size
+ );
+
+ $bottomRight = new ezcGraphCoordinate(
+ $position->x
+ - $orthogonalDirection->x * $size / 2,
+ $position->y
+ - $orthogonalDirection->y * $size / 2
+ );
+
+ $this->drawSymbol(
+ $boundings = new ezcGraphBoundings(
+ min( $topLeft->x, $bottomRight->x ),
+ min( $topLeft->y, $bottomRight->y ),
+ max( $topLeft->x, $bottomRight->x ),
+ max( $topLeft->y, $bottomRight->y )
+ ),
+ $color,
+ $this->options->axisEndStyle
+ );
+ }
+ }
+
+ /**
* Draw background image
*
* Draws a background image at the defined position. If repeat is set the
OpenPOWER on IntegriCloud