summaryrefslogtreecommitdiffstats
path: root/src/axis
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-06-13 16:27:22 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-06-13 16:27:22 +0000
commit1dd98606db7d94b1cfb09a1711848b4d2945bb2a (patch)
tree74b635308abab6a3bda1f24de76b7e9b0e546911 /src/axis
parent4c71c431a983f0c1216981e2011e823d303848d7 (diff)
downloadzetacomponents-graph-1dd98606db7d94b1cfb09a1711848b4d2945bb2a.zip
zetacomponents-graph-1dd98606db7d94b1cfb09a1711848b4d2945bb2a.tar.gz
- Fixed division by zero caused by no amplitude in data
# Thanks to Benoit for reporting this
Diffstat (limited to 'src/axis')
-rw-r--r--src/axis/numeric.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/axis/numeric.php b/src/axis/numeric.php
index 755e858..b660337 100644
--- a/src/axis/numeric.php
+++ b/src/axis/numeric.php
@@ -210,6 +210,13 @@ class ezcGraphChartElementNumericAxis extends ezcGraphChartElementAxis
*/
public function calculateAxisBoundings()
{
+ // Prevent division by zero, when min == max
+ if ( $this->minValue == $this->maxValue )
+ {
+ $this->minValue -= ( $this->minValue / 10 );
+ $this->maxValue += ( $this->maxValue / 10 );
+ }
+
// Calculate "nice" values for scaling parameters
if ( $this->majorStep === false )
{
OpenPOWER on IntegriCloud