Author: Kore Nordmann Date: 2007-03-05 12:43:00 +0100 (Mon, 05 Mar 2007) New Revision: 4712
Log: - Use properties array for dataset properties - Documented dataset properties Modified: trunk/Graph/src/datasets/base.php Modified: trunk/Graph/src/datasets/base.php =================================================================== --- trunk/Graph/src/datasets/base.php 2007-03-05 11:03:43 UTC (rev 4711) +++ trunk/Graph/src/datasets/base.php 2007-03-05 11:43:00 UTC (rev 4712) @@ -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,42 +29,13 @@ { /** - * labels for datapoint and datapoint elements + * Property array * - * @var ezcGraphDataSetStringProperty + * @var array */ - protected $label; + protected $properties; /** - * Colors for datapoint elements - * - * @var ezcGraphDataSetColorProperty - */ - protected $color; - - /** - * Symbols for datapoint elements - * - * @var ezcGraphDataSetIntProperty - */ - protected $symbol; - - /** - * Status if datapoint element is hilighted - * - * @var ezcGraphDataSetBooleanProperty - * @access protected - */ - protected $highlight; - - /** - * Display type of chart data. - * - * @var integer - */ - protected $displayType; - - /** * Array which contains the data of the datapoint * * @var array @@ -84,13 +66,13 @@ */ 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 @@ { 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 @@ */ public function __get( $propertyName ) { - if ( isset( $this->$propertyName ) ) + if ( array_key_exists( $propertyName, $this->properties ) ) { - return $this->$propertyName; + return $this->properties[$propertyName]; } else { -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components