summaryrefslogtreecommitdiffstats
path: root/src/datasets
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-03-05 11:43:00 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-03-05 11:43:00 +0000
commit13e25053bf3b1583cebac63e072135ee017cfd67 (patch)
treef5ba14edc61cb22791d03f64300bb62994971d81 /src/datasets
parentc47be4e29322e2319f33229dd054fb0c24c6b44f (diff)
downloadzetacomponents-graph-13e25053bf3b1583cebac63e072135ee017cfd67.zip
zetacomponents-graph-13e25053bf3b1583cebac63e072135ee017cfd67.tar.gz
- Use properties array for dataset properties
- Documented dataset properties
Diffstat (limited to 'src/datasets')
-rw-r--r--src/datasets/base.php80
1 files changed, 30 insertions, 50 deletions
diff --git a/src/datasets/base.php b/src/datasets/base.php
index a0f96a5..7810c4d 100644
--- a/src/datasets/base.php
+++ b/src/datasets/base.php
@@ -11,6 +11,17 @@
/**
* Basic class to contain the charts data
*
+ * @property string $label
+ * Labels for datapoint and datapoint elements
+ * @property ezcGraphColor $color
+ * Colors for datapoint elements
+ * @property int $symbol
+ * Symbols for datapoint elements
+ * @property bool $highlight
+ * Status if datapoint element is hilighted
+ * @property int $displayType
+ * Display type of chart data
+ *
* @package Graph
* @access private
*/
@@ -18,40 +29,11 @@ abstract class ezcGraphDataSet implements ArrayAccess, Iterator, Countable
{
/**
- * labels for datapoint and datapoint elements
- *
- * @var ezcGraphDataSetStringProperty
- */
- protected $label;
-
- /**
- * Colors for datapoint elements
- *
- * @var ezcGraphDataSetColorProperty
- */
- protected $color;
-
- /**
- * Symbols for datapoint elements
+ * Property array
*
- * @var ezcGraphDataSetIntProperty
- */
- protected $symbol;
-
- /**
- * Status if datapoint element is hilighted
- *
- * @var ezcGraphDataSetBooleanProperty
- * @access protected
- */
- protected $highlight;
-
- /**
- * Display type of chart data.
- *
- * @var integer
+ * @var array
*/
- protected $displayType;
+ protected $properties;
/**
* Array which contains the data of the datapoint
@@ -84,13 +66,13 @@ abstract class ezcGraphDataSet implements ArrayAccess, Iterator, Countable
*/
public function __construct()
{
- $this->label = new ezcGraphDataSetStringProperty( $this );
- $this->color = new ezcGraphDataSetColorProperty( $this );
- $this->symbol = new ezcGraphDataSetIntProperty( $this );
- $this->highlight = new ezcGraphDataSetBooleanProperty( $this );
- $this->displayType = new ezcGraphDataSetIntProperty( $this );
+ $this->properties['label'] = new ezcGraphDataSetStringProperty( $this );
+ $this->properties['color'] = new ezcGraphDataSetColorProperty( $this );
+ $this->properties['symbol'] = new ezcGraphDataSetIntProperty( $this );
+ $this->properties['highlight'] = new ezcGraphDataSetBooleanProperty( $this );
+ $this->properties['displayType'] = new ezcGraphDataSetIntProperty( $this );
- $this->highlight->default = false;
+ $this->properties['highlight']->default = false;
}
/**
@@ -109,27 +91,25 @@ abstract class ezcGraphDataSet implements ArrayAccess, Iterator, Countable
{
switch ( $propertyName )
{
+ case 'hilight':
+ $propertyName = 'highlight';
case 'label':
- $this->label->default = $propertyValue;
- break;
case 'color':
- $this->color->default = $propertyValue;
- break;
case 'symbol':
- $this->symbol->default = $propertyValue;
- break;
case 'highlight':
- case 'hilight':
- $this->highlight->default = $propertyValue;
- break;
case 'displayType':
- $this->displayType->default = $propertyValue;
+ $this->properties[$propertyName]->default = $propertyValue;
break;
+
case 'palette':
$this->palette = $propertyValue;
$this->color->default = $this->palette->dataSetColor;
$this->symbol->default = $this->palette->dataSetSymbol;
break;
+
+ default:
+ throw new ezcBasePropertyNotFoundException( $propertyName );
+ break;
}
}
@@ -145,9 +125,9 @@ abstract class ezcGraphDataSet implements ArrayAccess, Iterator, Countable
*/
public function __get( $propertyName )
{
- if ( isset( $this->$propertyName ) )
+ if ( array_key_exists( $propertyName, $this->properties ) )
{
- return $this->$propertyName;
+ return $this->properties[$propertyName];
}
else
{
OpenPOWER on IntegriCloud