diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-07-11 08:49:26 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-07-11 08:49:26 +0000 |
commit | 6f359d97e38932b0da23abb0940f32bf5380c0d8 (patch) | |
tree | bc6221534bf65aa6777245e7f555e943cdd2bbc6 /src/axis/labeled.php | |
parent | 663493a7224dc7869c6c63d770016f9fd8850e2a (diff) | |
download | zetacomponents-graph-6f359d97e38932b0da23abb0940f32bf5380c0d8.zip zetacomponents-graph-6f359d97e38932b0da23abb0940f32bf5380c0d8.tar.gz |
- Refactored ezcGraphRenderer
# Most test run again, but complete result is still errnous
Diffstat (limited to 'src/axis/labeled.php')
-rw-r--r-- | src/axis/labeled.php | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/src/axis/labeled.php b/src/axis/labeled.php index fa18ecd..132200f 100644 --- a/src/axis/labeled.php +++ b/src/axis/labeled.php @@ -130,7 +130,7 @@ class ezcGraphChartElementLabeledAxis extends ezcGraphChartElementAxis * @param string $value Value to determine position for * @return float Position on chart */ - public function getCoordinate( ezcGraphBoundings $boundings, $value ) + public function getCoordinate( $value ) { if ( $value === false || $value === null || @@ -138,40 +138,24 @@ class ezcGraphChartElementLabeledAxis extends ezcGraphChartElementAxis { switch ( $this->position ) { - case ezcGraph::TOP: - return $boundings->y0 + - ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ); - case ezcGraph::BOTTOM: - return $boundings->y1 - - ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ); case ezcGraph::LEFT: - return $boundings->x0 + - ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ); + case ezcGraph::TOP: + return 0.; case ezcGraph::RIGHT: - return $boundings->x1 - - ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ); + case ezcGraph::BOTTOM: + return 1.; } } else { switch ( $this->position ) { + case ezcGraph::LEFT: case ezcGraph::TOP: - return $boundings->y0 + - ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ) + - ( $boundings->y1 - $boundings->y0 ) * ( 1 - $this->axisSpace ) / ( count ( $this->labels ) - 1 ) * $key; + return (float) $key / ( count ( $this->labels ) - 1 ); case ezcGraph::BOTTOM: - return $boundings->y1 - - ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ) - - ( $boundings->y1 - $boundings->y0 ) * ( 1 - $this->axisSpace ) / ( count ( $this->labels ) - 1 ) * $key; - case ezcGraph::LEFT: - return $boundings->x0 + - ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ) + - ( $boundings->x1 - $boundings->x0 ) * ( 1 - $this->axisSpace ) / ( count ( $this->labels ) - 1 ) * $key; case ezcGraph::RIGHT: - return $boundings->x1 - - ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ) - - ( $boundings->x1 - $boundings->x0 ) * ( 1 - $this->axisSpace ) / ( count ( $this->labels ) - 1 ) * $key; + return (float) 1 - $key / ( count ( $this->labels ) - 1 ); } } } |