summaryrefslogtreecommitdiffstats
path: root/src/charts
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-01-04 11:02:35 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-01-04 11:02:35 +0000
commit097f99bcb85dc06ddd9c78b20c75cbb3363aa1a6 (patch)
tree429bace7b2b45c0dea6f044659232e2c220a51ee /src/charts
parentf1983871f351d2195102760db3141ed70f8772a9 (diff)
downloadzetacomponents-graph-097f99bcb85dc06ddd9c78b20c75cbb3363aa1a6.zip
zetacomponents-graph-097f99bcb85dc06ddd9c78b20c75cbb3363aa1a6.tar.gz
- Make renderToOutput() method available to chart
Diffstat (limited to 'src/charts')
-rw-r--r--src/charts/line.php47
-rw-r--r--src/charts/pie.php47
2 files changed, 68 insertions, 26 deletions
diff --git a/src/charts/line.php b/src/charts/line.php
index 8d2c0ad..83d2c62 100644
--- a/src/charts/line.php
+++ b/src/charts/line.php
@@ -283,19 +283,7 @@ class ezcGraphLineChart extends ezcGraphChart
return ezcGraph::LINE;
}
- /**
- * Render the line chart
- *
- * Renders the chart into a file or stream. The width and height are
- * needed to specify the dimensions of the resulting image. For direct
- * output use 'php://stdout' as output file.
- *
- * @param int $width Image width
- * @param int $height Image height
- * @param string $file Output file
- * @return void
- */
- public function render( $width, $height, $file = null )
+ protected function renderElements( $width, $height )
{
if ( !count( $this->data ) )
{
@@ -370,11 +358,44 @@ class ezcGraphLineChart extends ezcGraphChart
// Render graph
$this->renderData( $this->renderer, $boundings );
+ }
+
+ /**
+ * Render the line chart
+ *
+ * Renders the chart into a file or stream. The width and height are
+ * needed to specify the dimensions of the resulting image. For direct
+ * output use 'php://stdout' as output file.
+ *
+ * @param int $width Image width
+ * @param int $height Image height
+ * @param string $file Output file
+ * @return void
+ */
+ public function render( $width, $height, $file = null )
+ {
+ $this->renderElements( $width, $height );
if ( !empty( $file ) )
{
$this->renderer->render( $file );
}
}
+
+ /**
+ * Renders this chart to direct output
+ *
+ * Does the same as ezcGraphChart::render(), but renders directly to
+ * output and not into a file.
+ *
+ * @return void
+ */
+ public function renderToOutput( $widht, $height )
+ {
+ // @TODO: merge this function with render an deprecate ommit of third
+ // argument in render() when API break is possible
+ $this->renderElements( $widht, $height );
+ $this->renderer->render( null );
+ }
}
?>
diff --git a/src/charts/pie.php b/src/charts/pie.php
index 371f8dc..12bcc63 100644
--- a/src/charts/pie.php
+++ b/src/charts/pie.php
@@ -174,19 +174,7 @@ class ezcGraphPieChart extends ezcGraphChart
}
}
- /**
- * Render the pie chart
- *
- * Renders the chart into a file or stream. The width and height are
- * needed to specify the dimensions of the resulting image. For direct
- * output use 'php://stdout' as output file.
- *
- * @param int $width Image width
- * @param int $height Image height
- * @param string $file Output file
- * @return void
- */
- public function render( $width, $height, $file = null )
+ protected function renderElements( $width, $height )
{
if ( !count( $this->data ) )
{
@@ -226,12 +214,45 @@ class ezcGraphPieChart extends ezcGraphChart
// Render graph
$this->renderData( $this->renderer, $boundings );
+ }
+
+ /**
+ * Render the pie chart
+ *
+ * Renders the chart into a file or stream. The width and height are
+ * needed to specify the dimensions of the resulting image. For direct
+ * output use 'php://stdout' as output file.
+ *
+ * @param int $width Image width
+ * @param int $height Image height
+ * @param string $file Output file
+ * @return void
+ */
+ public function render( $width, $height, $file = null )
+ {
+ $this->renderElements( $width, $height );
if ( !empty( $file ) )
{
$this->renderer->render( $file );
}
}
+
+ /**
+ * Renders this chart to direct output
+ *
+ * Does the same as ezcGraphChart::render(), but renders directly to
+ * output and not into a file.
+ *
+ * @return void
+ */
+ public function renderToOutput( $widht, $height )
+ {
+ // @TODO: merge this function with render an deprecate ommit of third
+ // argument in render() when API break is possible
+ $this->renderElements( $widht, $height );
+ $this->renderer->render( null );
+ }
}
?>
OpenPOWER on IntegriCloud