summaryrefslogtreecommitdiffstats
path: root/src/interfaces/chart.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-06-06 15:36:18 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-06-06 15:36:18 +0000
commit20973d01d5039a28bcf2c3ee790e1bf521965016 (patch)
tree23b5d1ebde5d9b2cf685ff773718cd0b51f009b8 /src/interfaces/chart.php
parent4bb4e17c7bf4a45898c9c822be710891a452bd50 (diff)
downloadzetacomponents-graph-20973d01d5039a28bcf2c3ee790e1bf521965016.zip
zetacomponents-graph-20973d01d5039a28bcf2c3ee790e1bf521965016.tar.gz
- Draw background and border for charts
- Added padding for charts
Diffstat (limited to 'src/interfaces/chart.php')
-rw-r--r--src/interfaces/chart.php60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/interfaces/chart.php b/src/interfaces/chart.php
index 209942d..19317f5 100644
--- a/src/interfaces/chart.php
+++ b/src/interfaces/chart.php
@@ -253,6 +253,66 @@ abstract class ezcGraphChart
}
/**
+ * Render chart border
+ *
+ * @param ezcGraphBoundings $boundings Boundings
+ * @return ezcGraphBoundings
+ */
+ protected function renderBorder( ezcGraphBoundings $boundings )
+ {
+ if ( ( $this->options->border instanceof ezcGraphColor ) &&
+ ( $this->options->borderWidth > 0 ) )
+ {
+ // Default bordervalue to 1
+ $this->options->borderWidth = max( 1, $this->options->borderWidth );
+
+ // Draw border
+ $this->renderer->drawRect(
+ $this->options->border,
+ new ezcGraphCoordinate( $boundings->x0, $boundings->y0 ),
+ $boundings->x1 - $boundings->x0,
+ $boundings->y1 - $boundings->y0,
+ $this->options->borderWidth
+ );
+
+ // Reduce local boundings by borderWidth
+ $boundings->x0 += $this->options->borderWidth;
+ $boundings->y0 += $this->options->borderWidth;
+ $boundings->x1 -= $this->options->borderWidth;
+ $boundings->y1 -= $this->options->borderWidth;
+ }
+
+ return $boundings;
+ }
+
+ /**
+ * Render chart background
+ *
+ * @param ezcGraphBoundings $boundings Boundings
+ * @return ezcGraphBoundings
+ */
+ protected function renderBackground( ezcGraphBoundings $boundings )
+ {
+ if ( $this->options->background instanceof ezcGraphColor )
+ {
+ $this->renderer->drawBackground(
+ $this->options->background,
+ new ezcGraphCoordinate( $boundings->x0, $boundings->y0 ),
+ $boundings->x1 - $boundings->x0,
+ $boundings->y1 - $boundings->y0
+ );
+ }
+
+ // Apply padding
+ $boundings->x0 += $this->options->padding;
+ $boundings->y0 += $this->options->padding;
+ $boundings->x1 -= $this->options->padding;
+ $boundings->y1 -= $this->options->padding;
+
+ return $boundings;
+ }
+
+ /**
* Renders this chart
*
* Creates basic visual chart elements from the chart to be processed by
OpenPOWER on IntegriCloud