summaryrefslogtreecommitdiffstats
path: root/src/datasets
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-05-16 08:39:55 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-05-16 08:39:55 +0000
commitb502e943cbdc85b1489e933c434f4eade04ec6ab (patch)
treef4d1409af35a0364561f5400026ea07a995d652e /src/datasets
parent87c1ed6ce0813da4eafbd26a422846ab8b2ac808 (diff)
downloadzetacomponents-graph-b502e943cbdc85b1489e933c434f4eade04ec6ab.zip
zetacomponents-graph-b502e943cbdc85b1489e933c434f4eade04ec6ab.tar.gz
- Implemented automatic label setting from datasets for labeled_axis
Diffstat (limited to 'src/datasets')
-rw-r--r--src/datasets/base.php45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/datasets/base.php b/src/datasets/base.php
index 2a28116..7cda08d 100644
--- a/src/datasets/base.php
+++ b/src/datasets/base.php
@@ -12,7 +12,7 @@
*
* @package Graph
*/
-class ezcGraphDataset implements ArrayAccess
+class ezcGraphDataset implements ArrayAccess, Iterator
{
protected $label;
@@ -23,6 +23,8 @@ class ezcGraphDataset implements ArrayAccess
protected $data;
+ protected $current;
+
public function __construct()
{
$this->label = new ezcGraphDatasetStringProperty( $this );
@@ -136,6 +138,47 @@ class ezcGraphDataset implements ArrayAccess
{
unset( $this->data[$key] );
}
+
+ final public function current()
+ {
+ $keys = array_keys( $this->data );
+ if ( !isset( $this->current ) )
+ {
+ $this->current = 0;
+ }
+
+ return $this->data[$keys[$this->current]];
+ }
+
+ final public function next()
+ {
+ $keys = array_keys( $this->data );
+ if ( ++$this->current >= count( $keys ) )
+ {
+ return false;
+ }
+ else
+ {
+ return $this->data[$keys[$this->current]];
+ }
+ }
+
+ final public function key()
+ {
+ $keys = array_keys( $this->data );
+ return $keys[$this->current];
+ }
+
+ final public function valid()
+ {
+ $keys = array_keys( $this->data );
+ return isset( $keys[$this->current] );
+ }
+
+ final public function rewind()
+ {
+ $this->current = 0;
+ }
}
?>
OpenPOWER on IntegriCloud