summaryrefslogtreecommitdiffstats
path: root/src/axis/numeric.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-05-26 09:50:50 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-05-26 09:50:50 +0000
commit89a8010b0b0869d07cb1d433351a1334bf232c57 (patch)
tree599f48a7030ba23dcb7e92f36cbcf082272dd681 /src/axis/numeric.php
parentf13db279e32e2a4c323f5edeec486463e29fefc8 (diff)
downloadzetacomponents-graph-89a8010b0b0869d07cb1d433351a1334bf232c57.zip
zetacomponents-graph-89a8010b0b0869d07cb1d433351a1334bf232c57.tar.gz
- Moved axis renderer method to abstract ezcGraphElementAxis class
- Added coordinate calculation tests for both axis types - Implemented coordinate calculation
Diffstat (limited to 'src/axis/numeric.php')
-rw-r--r--src/axis/numeric.php56
1 files changed, 42 insertions, 14 deletions
diff --git a/src/axis/numeric.php b/src/axis/numeric.php
index a34fe5b..4b2916a 100644
--- a/src/axis/numeric.php
+++ b/src/axis/numeric.php
@@ -254,19 +254,47 @@ class ezcGraphChartElementNumericAxis extends ezcGraphChartElementAxis
*/
public function getCoordinate( ezcGraphBoundings $boundings, $value )
{
-
- }
-
- /**
- * Render an axe
- *
- * @param ezcGraphRenderer $renderer
- * @access public
- * @return void
- */
- public function render( ezcGraphRenderer $renderer, ezcGraphBoundings $boundings )
- {
- return $boundings;
+ if ( ( $value === false ) || ( $value === null ) )
+ {
+ switch ( $this->position )
+ {
+ case ezcGraph::TOP:
+ return $boundings->y0 +
+ ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 );
+ case ezcGraph::BOTTOM:
+ return $boundings->y1 -
+ ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 );
+ case ezcGraph::LEFT:
+ return $boundings->x0 +
+ ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 );
+ case ezcGraph::RIGHT:
+ return $boundings->x1 -
+ ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 );
+ }
+ }
+ else
+ {
+ switch ( $this->position )
+ {
+ case ezcGraph::TOP:
+ return $boundings->y0 +
+ ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ) +
+ ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->y1 - $boundings-> y0 ) * ( 1 - $this->padding );
+ case ezcGraph::BOTTOM:
+ return $boundings->y1 -
+ ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ) -
+ ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->y1 - $boundings-> y0 ) * ( 1 - $this->padding );
+ case ezcGraph::LEFT:
+ return $boundings->x0 +
+ ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ) +
+ ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->x1 - $boundings-> x0 ) * ( 1 - $this->padding );
+ case ezcGraph::RIGHT:
+ return $boundings->x1 -
+ ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ) -
+ ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->x1 - $boundings-> x0 ) * ( 1 - $this->padding );
+ }
+ }
}
-
}
+
+?>
OpenPOWER on IntegriCloud