summaryrefslogtreecommitdiffstats
path: root/src/interfaces/chart.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/chart.php')
-rw-r--r--src/interfaces/chart.php41
1 files changed, 33 insertions, 8 deletions
diff --git a/src/interfaces/chart.php b/src/interfaces/chart.php
index de990bd..6cc1e8c 100644
--- a/src/interfaces/chart.php
+++ b/src/interfaces/chart.php
@@ -12,7 +12,7 @@
*
* @package Graph
*/
-abstract class ezcGraphChart
+abstract class ezcGraphChart implements ArrayAccess
{
/**
@@ -161,7 +161,7 @@ abstract class ezcGraphChart
throw new ezcBaseValueException( "options", $propertyValue, "instanceof ezcGraphOptions" );
}
default:
- return $this->addDataSet($propertyName, $propertyValue);
+ throw new ezcBasePropertyNotFoundException( $propertyName );
break;
}
}
@@ -235,19 +235,44 @@ abstract class ezcGraphChart
return $this->elements[$propertyName];
}
- if ( isset( $this->data[$propertyName] ) )
- {
- return $this->data[$propertyName];
- }
-
if ( $propertyName === "options" )
{
return $this->options;
}
else
{
- throw new ezcGraphNoSuchDatasetException( $propertyName );
+ throw new ezcGraphNoSuchElementException( $propertyName );
+ }
+ }
+
+ public function offsetExists( $key )
+ {
+ return isset( $this->data[$key] );
+ }
+
+ public function offsetGet( $key )
+ {
+ if ( !isset( $key ) )
+ {
+ throw new ezcGraphNoSuchDatasetException( $key );
}
+
+ return $this->data[$key];
+ }
+
+ public function offsetSet( $key, $value )
+ {
+ return $this->addDataset( $key, $value );
+ }
+
+ public function offsetUnset( $key )
+ {
+ if ( !isset( $key ) )
+ {
+ throw new ezcGraphNoSuchDatasetException( $key );
+ }
+
+ unset( $this->data[$key] );
}
public function setOptions( $options )
OpenPOWER on IntegriCloud