diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-08-14 12:50:28 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-08-14 12:50:28 +0000 |
commit | 48155e33dd6901e3966d9b151d837bcbdc8e9968 (patch) | |
tree | 04fbae229bbf0a5bbea14d3e4da3f0bd976a4572 /src/datasets | |
parent | 21f7809f953a75b9e6214d0549a7f1941e3df7b9 (diff) | |
download | zetacomponents-graph-48155e33dd6901e3966d9b151d837bcbdc8e9968.zip zetacomponents-graph-48155e33dd6901e3966d9b151d837bcbdc8e9968.tar.gz |
- Changed datsets to accept instances of ezcGraphDataSet only
- Added bar charts
- Globally increase acceptable difference noise for created images in tests
Diffstat (limited to 'src/datasets')
-rw-r--r-- | src/datasets/array.php | 42 | ||||
-rw-r--r-- | src/datasets/average.php | 2 | ||||
-rw-r--r-- | src/datasets/base.php | 31 |
3 files changed, 55 insertions, 20 deletions
diff --git a/src/datasets/array.php b/src/datasets/array.php new file mode 100644 index 0000000..44aa82c --- /dev/null +++ b/src/datasets/array.php @@ -0,0 +1,42 @@ +<?php +/** + * File containing the abstract ezcGraphArrayDataSet class + * + * @package Graph + * @version //autogentag// + * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved. + * @license http://ez.no/licenses/new_bsd New BSD License + */ +/** + * Basic class to contain the charts data + * + * @package Graph + */ +class ezcGraphArrayDataSet extends ezcGraphDataSet +{ + public function __construct( $data ) + { + $this->createFromArray( $data ); + parent::__construct(); + } + + /** + * setData + * + * @param array $data + * @access public + * @return void + */ + protected function createFromArray( $data = array() ) + { + foreach ( $data as $key => $value ) + { + if ( is_numeric( $value ) ) + { + $this->data[$key] = (float) $value; + } + } + } +} + +?> diff --git a/src/datasets/average.php b/src/datasets/average.php index 7d9a662..3af2094 100644 --- a/src/datasets/average.php +++ b/src/datasets/average.php @@ -12,7 +12,7 @@ * * @package Graph */ -class ezcGraphDataSetAverage extends ezcDataSet +class ezcGraphDataSetAverage extends ezcGraphDataSet { } diff --git a/src/datasets/base.php b/src/datasets/base.php index 849f996..2f5fc92 100644 --- a/src/datasets/base.php +++ b/src/datasets/base.php @@ -12,7 +12,7 @@ * * @package Graph */ -class ezcGraphDataSet implements ArrayAccess, Iterator +abstract class ezcGraphDataSet implements ArrayAccess, Iterator { /** @@ -45,6 +45,13 @@ class ezcGraphDataSet implements ArrayAccess, Iterator protected $highlight; /** + * Display type of chart data. + * + * @var integer + */ + protected $displayType; + + /** * Array which contains the data of the dataset * * @var array @@ -72,28 +79,11 @@ class ezcGraphDataSet implements ArrayAccess, Iterator $this->color = new ezcGraphDataSetColorProperty( $this ); $this->symbol = new ezcGraphDataSetIntProperty( $this ); $this->highlight = new ezcGraphDataSetBooleanProperty( $this ); + $this->displayType = new ezcGraphDataSetIntProperty( $this ); $this->highlight->default = false; } - /** - * setData - * - * @param array $data - * @access public - * @return void - */ - public function createFromArray( $data = array() ) - { - foreach ( $data as $key => $value ) - { - if ( is_numeric( $value ) ) - { - $this->data[$key] = (float) $value; - } - } - } - public function __set( $propertyName, $propertyValue ) { switch ( $propertyName ) @@ -111,6 +101,9 @@ class ezcGraphDataSet implements ArrayAccess, Iterator case 'hilight': $this->highlight->default = $propertyValue; break; + case 'displayType': + $this->displayType->default = $propertyValue; + break; case 'palette': $this->palette = $propertyValue; $this->color->default = $this->palette->dataSetColor; |