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/numeric.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/numeric.php')
-rw-r--r-- | src/axis/numeric.php | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/src/axis/numeric.php b/src/axis/numeric.php index 1128134..f0cfc24 100644 --- a/src/axis/numeric.php +++ b/src/axis/numeric.php @@ -264,49 +264,34 @@ class ezcGraphChartElementNumericAxis extends ezcGraphChartElementAxis * @param float $value Value to determine position for * @return float Position on chart */ - public function getCoordinate( ezcGraphBoundings $boundings, $value ) + public function getCoordinate( $value ) { // Force typecast, because ( false < -100 ) results in (bool) true $floatValue = (float) $value; + if ( ( $value === false ) && ( ( $floatValue < $this->min ) || ( $floatValue > $this->max ) ) ) { 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::TOP: - return $boundings->y0 + - ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ) + - ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->y1 - $boundings-> y0 ) * ( 1 - $this->axisSpace ); - case ezcGraph::BOTTOM: - return $boundings->y1 - - ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ) - - ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->y1 - $boundings-> y0 ) * ( 1 - $this->axisSpace ); case ezcGraph::LEFT: - return $boundings->x0 + - ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ) + - ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->x1 - $boundings-> x0 ) * ( 1 - $this->axisSpace ); + case ezcGraph::TOP: + return ( $value - $this->min ) / ( $this->max - $this->min ); case ezcGraph::RIGHT: - return $boundings->x1 - - ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ) - - ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->x1 - $boundings-> x0 ) * ( 1 - $this->axisSpace ); + case ezcGraph::BOTTOM: + return 1 - ( $value - $this->min ) / ( $this->max - $this->min ); } } } |