summaryrefslogtreecommitdiffstats
path: root/src/renderer
diff options
context:
space:
mode:
authorTimothy Pearson <tpearson@raptorengineeringinc.com>2015-12-11 16:17:39 -0600
committerTimothy Pearson <tpearson@raptorengineeringinc.com>2015-12-11 16:17:39 -0600
commit825295b8ae3979aff902f485edf00e8e513fb067 (patch)
treea98f438fcfee9b83e4694818384aa34fdc6fe1a2 /src/renderer
parent551ab952471befef109c76177ebc0ffa76dbed5e (diff)
downloadzetacomponents-graph-825295b8ae3979aff902f485edf00e8e513fb067.zip
zetacomponents-graph-825295b8ae3979aff902f485edf00e8e513fb067.tar.gz
Enable stacked rendering for horizontal bar chartshoriz-stacked-render
Diffstat (limited to 'src/renderer')
-rw-r--r--src/renderer/horizontal_bar.php70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/renderer/horizontal_bar.php b/src/renderer/horizontal_bar.php
index d8c143e..c851188 100644
--- a/src/renderer/horizontal_bar.php
+++ b/src/renderer/horizontal_bar.php
@@ -118,6 +118,76 @@ class ezcGraphHorizontalRenderer
}
/**
+ * Draw horizontal stacked bar
+ *
+ * Draws a horizontal stacked bar part as a data element in a line chart
+ *
+ * @param ezcGraphBoundings $boundings Chart boundings
+ * @param ezcGraphContext $context Context of call
+ * @param ezcGraphColor $color Color of line
+ * @param ezcGraphCoordinate $start
+ * @param ezcGraphCoordinate $position
+ * @param float $stepSize Space which can be used for bars
+ * @param int $symbol Symbol to draw for line
+ * @param float $axisPosition Position of axis for drawing filled lines
+ * @return void
+ */
+ public function drawHorizontalStackedBar(
+ ezcGraphBoundings $boundings,
+ ezcGraphContext $context,
+ ezcGraphColor $color,
+ ezcGraphCoordinate $start,
+ ezcGraphCoordinate $position,
+ $stepSize,
+ $symbol = ezcGraph::NO_SYMBOL,
+ $axisPosition = 0. )
+ {
+ // Apply margin
+ $margin = $stepSize * $this->options->barMargin;
+ $barHeight = $stepSize - $margin;
+ $offset = - $stepSize / 2 + $margin / 2;
+
+ $barPointArray = array(
+ new ezcGraphCoordinate(
+ $boundings->x0 + ( $boundings->width ) * $start->x,
+ $boundings->y0 + ( $boundings->height ) * $position->y + $offset
+ ),
+ new ezcGraphCoordinate(
+ $boundings->x0 + ( $boundings->width ) * $position->x,
+ $boundings->y0 + ( $boundings->height ) * $position->y + $offset
+ ),
+ new ezcGraphCoordinate(
+ $boundings->x0 + ( $boundings->width ) * $position->x,
+ $boundings->y0 + ( $boundings->height ) * $position->y + $offset + $barHeight
+ ),
+ new ezcGraphCoordinate(
+ $boundings->x0 + ( $boundings->width ) * $start->x,
+ $boundings->y0 + ( $boundings->height ) * $position->y + $offset + $barHeight
+ ),
+ );
+
+ $this->addElementReference(
+ $context,
+ $this->driver->drawPolygon(
+ $barPointArray,
+ $color,
+ true
+ )
+ );
+
+ if ( $this->options->dataBorder > 0 )
+ {
+ $darkened = $color->darken( $this->options->dataBorder );
+ $this->driver->drawPolygon(
+ $barPointArray,
+ $darkened,
+ false,
+ 1
+ );
+ }
+ }
+
+ /**
* Draw bar
*
* Draws a bar as a data element in a line chart
OpenPOWER on IntegriCloud