diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-01-04 11:02:35 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-01-04 11:02:35 +0000 |
commit | 097f99bcb85dc06ddd9c78b20c75cbb3363aa1a6 (patch) | |
tree | 429bace7b2b45c0dea6f044659232e2c220a51ee /src/charts/line.php | |
parent | f1983871f351d2195102760db3141ed70f8772a9 (diff) | |
download | zetacomponents-graph-097f99bcb85dc06ddd9c78b20c75cbb3363aa1a6.zip zetacomponents-graph-097f99bcb85dc06ddd9c78b20c75cbb3363aa1a6.tar.gz |
- Make renderToOutput() method available to chart
Diffstat (limited to 'src/charts/line.php')
-rw-r--r-- | src/charts/line.php | 47 |
1 files changed, 34 insertions, 13 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 ); + } } ?> |