diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-08-15 09:37:47 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-08-15 09:37:47 +0000 |
commit | 04e2d9db41d47bc0364261a1cb30fe502409c339 (patch) | |
tree | 5d67ca1c0433d8521671fcf3364e2f4030f0fdad /src/interfaces/chart.php | |
parent | 58808385c0739092503c32c35e9365335040d5d0 (diff) | |
download | zetacomponents-graph-04e2d9db41d47bc0364261a1cb30fe502409c339.zip zetacomponents-graph-04e2d9db41d47bc0364261a1cb30fe502409c339.tar.gz |
- Changed access to datasets from $chart['dataset'] to $chart->data['dataset']
Diffstat (limited to 'src/interfaces/chart.php')
-rw-r--r-- | src/interfaces/chart.php | 65 |
1 files changed, 7 insertions, 58 deletions
diff --git a/src/interfaces/chart.php b/src/interfaces/chart.php index d87ad37..828a77b 100644 --- a/src/interfaces/chart.php +++ b/src/interfaces/chart.php @@ -12,7 +12,7 @@ * * @package Graph */ -abstract class ezcGraphChart implements ArrayAccess +abstract class ezcGraphChart { /** @@ -32,9 +32,9 @@ abstract class ezcGraphChart implements ArrayAccess /** * Contains the data of the chart * - * @var array( ezcGraphDataSet ) + * @var ezcGraphChartDataContainer */ - protected $data = array(); + protected $data; /** * Renderer for the chart @@ -68,6 +68,8 @@ abstract class ezcGraphChart implements ArrayAccess { $this->__set( 'palette', new ezcGraphPaletteTango() ); + $this->data = new ezcGraphChartDataContainer( $this ); + // Add standard elements $this->addElement( 'background', new ezcGraphChartElementBackground() ); $this->elements['background']->position = ezcGraph::CENTER | ezcGraph::MIDDLE; @@ -186,24 +188,6 @@ abstract class ezcGraphChart implements ArrayAccess } /** - * Adds a dataset to the charts data - * - * @param string $name Name of dataset - * @param mixed $values Values to create dataset with - * @throws ezcGraphTooManyDataSetExceptions - * If too many datasets are created - * @return ezcGraphDataSet - */ - protected function addDataSet( $name, ezcGraphDataSet $dataSet ) - { - $this->data[$name] = $dataSet; - - $this->data[$name]->label = $name; - $this->data[$name]->palette = $this->palette; - $this->data[$name]->displayType = $this->getDefaultDisplayType(); - } - - /** * Returns the requested property * * @param mixed $propertyName @@ -221,7 +205,7 @@ abstract class ezcGraphChart implements ArrayAccess return $this->elements[$propertyName]; } - if ( $propertyName === "options" ) + if ( $propertyName === 'options' ) { return $this->options; } @@ -231,41 +215,6 @@ abstract class ezcGraphChart implements ArrayAccess } } - 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 ) - { - if ( !$value instanceof ezcGraphDataSet ) - { - throw new ezcGraphUnknownDataSetSourceException( $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 ) { if ( is_array( $options ) ) @@ -287,7 +236,7 @@ abstract class ezcGraphChart implements ArrayAccess * * @return int Display type */ - abstract protected function getDefaultDisplayType(); + abstract public function getDefaultDisplayType(); /** * Renders this chart |