summaryrefslogtreecommitdiffstats
path: root/src/axis/labeled.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-12-15 10:03:14 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-12-15 10:03:14 +0000
commit608e7e2984878c368127f41bb722c416e533c646 (patch)
treee21798ee9144799d4943328419dc965ca95b0624 /src/axis/labeled.php
parent2de1a60acb861441417cb3a228091260b5cf0faa (diff)
downloadzetacomponents-graph-608e7e2984878c368127f41bb722c416e533c646.zip
zetacomponents-graph-608e7e2984878c368127f41bb722c416e533c646.tar.gz
- Fixed: Bug #9827 (auto scaling on numeric axes inconsistent)
Diffstat (limited to 'src/axis/labeled.php')
-rw-r--r--src/axis/labeled.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/axis/labeled.php b/src/axis/labeled.php
index 5fe5c1f..4463c91 100644
--- a/src/axis/labeled.php
+++ b/src/axis/labeled.php
@@ -176,10 +176,24 @@ class ezcGraphChartElementLabeledAxis extends ezcGraphChartElementAxis
{
case ezcGraph::LEFT:
case ezcGraph::TOP:
- return (float) $key / ( count ( $this->labels ) - 1 );
+ if ( count( $this->labels ) > 1 )
+ {
+ return (float) $key / ( count ( $this->labels ) - 1 );
+ }
+ else
+ {
+ return 0;
+ }
case ezcGraph::BOTTOM:
case ezcGraph::RIGHT:
- return (float) 1 - $key / ( count ( $this->labels ) - 1 );
+ if ( count( $this->labels ) > 1 )
+ {
+ return (float) 1 - $key / ( count ( $this->labels ) - 1 );
+ }
+ else
+ {
+ return 1;
+ }
}
}
}
@@ -201,7 +215,7 @@ class ezcGraphChartElementLabeledAxis extends ezcGraphChartElementAxis
*/
public function getMajorStepCount()
{
- return count( $this->displayedLabels ) - 1;
+ return max( count( $this->displayedLabels ) - 1, 1 );
}
/**
OpenPOWER on IntegriCloud