diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2008-02-05 10:25:23 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2008-02-05 10:25:23 +0000 |
commit | 32504bf13da10bbda578708e8842a9a29fc21163 (patch) | |
tree | 0ef01c08197afe0be435761123d5729d97e03d8b /src/datasets | |
parent | 11eb99389f0de210139e9282b7bbfd067e91ed74 (diff) | |
download | zetacomponents-graph-32504bf13da10bbda578708e8842a9a29fc21163.zip zetacomponents-graph-32504bf13da10bbda578708e8842a9a29fc21163.tar.gz |
- Fixed issue #12483: Average dataset does not work with a single value.
Diffstat (limited to 'src/datasets')
-rw-r--r-- | src/datasets/average.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/datasets/average.php b/src/datasets/average.php index a9ff722..2444a96 100644 --- a/src/datasets/average.php +++ b/src/datasets/average.php @@ -152,6 +152,11 @@ class ezcGraphDataSetAveragePolynom extends ezcGraphDataSet foreach ( $this->source as $key => $value ) { + if ( !is_numeric( $key ) ) + { + throw new ezcGraphDatasetAverageInvalidKeysException(); + } + if ( ( $this->min === false ) || ( $this->min > $key ) ) { $this->min = (float) $key; @@ -283,11 +288,6 @@ class ezcGraphDataSetAveragePolynom extends ezcGraphDataSet */ final public function next() { - if ( $this->min === $this->max ) - { - throw new ezcGraphDatasetAverageInvalidKeysException(); - } - if ( ++$this->position >= $this->resolution ) { return false; @@ -324,6 +324,12 @@ class ezcGraphDataSetAveragePolynom extends ezcGraphDataSet final public function valid() { $polynom = $this->getPolynom(); + + if ( $this->min >= $this->max ) + { + return false; + } + return ( ( $this->getKey() >= $this->min ) && ( $this->getKey() <= $this->max ) ); } |