summaryrefslogtreecommitdiffstats
path: root/src/element
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-02-26 10:18:00 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-02-26 10:18:00 +0000
commit15e0162c83faa211ea4e4e6cae7faf70e10e9a9c (patch)
tree972999d0443918acf78454610bb8cd9c32955753 /src/element
parente9d7bc2afe91b3aa6633cfc987ffe29b0206fa89 (diff)
downloadzetacomponents-graph-15e0162c83faa211ea4e4e6cae7faf70e10e9a9c.zip
zetacomponents-graph-15e0162c83faa211ea4e4e6cae7faf70e10e9a9c.tar.gz
- Implemented #20276 for centered axis label renderer
Diffstat (limited to 'src/element')
-rw-r--r--src/element/axis.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/element/axis.php b/src/element/axis.php
index 2dd9202..f355fcf 100644
--- a/src/element/axis.php
+++ b/src/element/axis.php
@@ -243,6 +243,49 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement
abstract public function getLabel( $step );
/**
+ * Return array of steps on this axis
+ *
+ * @return array( ezcGraphAxisStep )
+ */
+ public function getSteps()
+ {
+ $majorSteps = $this->getMajorStepCount();
+ $minorStepsPerMajorStepCount = ( $this->getMinorStepCount() / $majorSteps );
+
+ $majorStepSize = 1 / $majorSteps;
+ $minorStepSize = ( $minorStepsPerMajorStepCount > 0 ? $majorStepSize / $minorStepsPerMajorStepCount : 0 );
+
+ $steps = array();
+ for ( $major = 0; $major <= $majorSteps; ++$major )
+ {
+ $majorStep = new ezcGraphAxisStep(
+ $majorStepSize * $major,
+ $majorStepSize,
+ $this->getLabel( $major ),
+ array(),
+ $this->isZeroStep( $major ),
+ ( $major !== $majorSteps )
+ );
+
+ // Do not add minor steps at major steps positions
+ if ( $minorStepsPerMajorStepCount > 0 )
+ {
+ for( $minor = 1; $minor < $minorStepsPerMajorStepCount; ++$minor )
+ {
+ $majorStep->childs[] = new ezcGraphAxisStep(
+ ( $majorStepSize * $major ) + ( $minorStepSize * $minor ),
+ $minorStepSize
+ );
+ }
+ }
+
+ $steps[] = $majorStep;
+ }
+
+ return $steps;
+ }
+
+ /**
* Is zero step
*
* Returns true if the given step is the one on the initial axis position
OpenPOWER on IntegriCloud