diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-06-02 08:07:37 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-06-02 08:07:37 +0000 |
commit | f33ce6cab843a93c227464915d00e0580768d9d6 (patch) | |
tree | 28e801f9e390cd2625288b64ef0b5255af04300d /src/charts/line.php | |
parent | ed1c86d6e19c1ec2255d0e76e914de035a961cae (diff) | |
download | zetacomponents-graph-f33ce6cab843a93c227464915d00e0580768d9d6.zip zetacomponents-graph-f33ce6cab843a93c227464915d00e0580768d9d6.tar.gz |
- Added tests for axis labels
- Implemented axis labels
Diffstat (limited to 'src/charts/line.php')
-rw-r--r-- | src/charts/line.php | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/charts/line.php b/src/charts/line.php index 132b090..e17ef2d 100644 --- a/src/charts/line.php +++ b/src/charts/line.php @@ -25,6 +25,54 @@ class ezcGraphLineChart extends ezcGraphChart $this->elements['Y_axis']->position = ezcGraph::BOTTOM; } + protected function renderData( $renderer, $boundings ) + { + foreach ( $this->data as $data ) + { + $lastPoint = false; + foreach ( $data as $key => $value ) + { + $point = new ezcGraphCoordinate( + $this->elements['X_axis']->getCoordinate( $boundings, $key ), + $this->elements['Y_axis']->getCoordinate( $boundings, $value ) + ); + + // Draw line + if ( $lastPoint !== false ) + { + $renderer->drawLine( + $data->color->default, + $lastPoint, + $point, + true + ); + } + + // Draw Symbol + $symbol = $data->symbol[$key]; + // @TODO: Make config option + $symbolSize = 8; + $symbolPosition = new ezcGraphCoordinate( + $point->x - $symbolSize / 2, + $point->y - $symbolSize / 2 + ); + + if ( $symbol != ezcGraph::NO_SYMBOL ) + { + $renderer->drawSymbol( + $data->color[$key], + $symbolPosition, + $symbolSize, + $symbolSize, + $symbol + ); + } + + $lastPoint = $point; + } + } + } + /** * Render a line chart * @@ -72,7 +120,7 @@ class ezcGraphLineChart extends ezcGraphChart } // Render graph - //$this->renderData( $this->renderer, $boundings ); + $this->renderData( $this->renderer, $boundings ); if ( !empty( $file ) ) { |