diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-04-26 08:37:59 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-04-26 08:37:59 +0000 |
commit | 76285842b1610e26e7d99dbc02e8edf90549861b (patch) | |
tree | d7e7b5c3c7480d988a4fa9f5251ba7229f8d50d8 /src/options | |
parent | 8637b8b5ef26a8c7c2203e485784bfecd7e269b5 (diff) | |
download | zetacomponents-graph-76285842b1610e26e7d99dbc02e8edf90549861b.zip zetacomponents-graph-76285842b1610e26e7d99dbc02e8edf90549861b.tar.gz |
- First working version of radar charts
# Still marked private because of:
# - Slightly wrong axis arrows
# - Axis grid needs some love
- Some fixes for axis label renderers to work with random directions
# Results in some non visual changes in comparision files
Diffstat (limited to 'src/options')
-rw-r--r-- | src/options/radar_chart.php | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/src/options/radar_chart.php b/src/options/radar_chart.php new file mode 100644 index 0000000..a163035 --- /dev/null +++ b/src/options/radar_chart.php @@ -0,0 +1,153 @@ +<?php +/** + * File containing the ezcGraphRadarChartOption class + * + * @package Graph + * @version //autogentag// + * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved. + * @license http://ez.no/licenses/new_bsd New BSD License + */ +/** + * Class containing the basic options for line charts + * + * @property float $lineThickness + * Theickness of chart lines + * @property mixed $fillLines + * Status wheather the space between line and axis should get filled. + * - FALSE to not fill the space at all. + * - (int) Opacity used to fill up the space with the lines color. + * @property int $symbolSize + * Size of symbols in line chart. + * @property ezcGraphFontOptions $highlightFont + * Font configuration for highlight tests + * @property int $highlightSize + * Size of highlight blocks + * @property bool $highlightRadars + * If true, it adds lines to highlight the values position on the + * axis. + * + * @package Graph + */ +class ezcGraphRadarChartOptions extends ezcGraphChartOptions +{ + /** + * Constructor + * + * @param array $options Default option array + * @return void + * @ignore + */ + public function __construct( array $options = array() ) + { + $this->properties['lineThickness'] = 1; + $this->properties['fillLines'] = false; + $this->properties['symbolSize'] = 8; + $this->properties['highlightFont'] = new ezcGraphFontOptions(); + $this->properties['highlightFontCloned'] = false; + $this->properties['highlightSize'] = 14; + $this->properties['highlightRadars'] = false; + + parent::__construct( $options ); + } + + /** + * Set an option value + * + * @param string $propertyName + * @param mixed $propertyValue + * @throws ezcBasePropertyNotFoundException + * If a property is not defined in this class + * @return void + */ + public function __set( $propertyName, $propertyValue ) + { + switch ( $propertyName ) + { + case 'lineThickness': + case 'symbolSize': + case 'highlightSize': + if ( !is_numeric( $propertyValue ) || + ( $propertyValue < 1 ) ) + { + throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 1' ); + } + + $this->properties[$propertyName] = (int) $propertyValue; + break; + case 'fillLines': + if ( ( $propertyValue !== false ) && + !is_numeric( $propertyValue ) || + ( $propertyValue < 0 ) || + ( $propertyValue > 255 ) ) + { + throw new ezcBaseValueException( $propertyName, $propertyValue, 'false OR 0 <= int <= 255' ); + } + + $this->properties[$propertyName] = ( + $propertyValue === false + ? false + : (int) $propertyValue ); + break; + case 'highlightFont': + if ( $propertyValue instanceof ezcGraphFontOptions ) + { + $this->properties['highlightFont'] = $propertyValue; + } + elseif ( is_string( $propertyValue ) ) + { + if ( !$this->properties['highlightFontCloned'] ) + { + $this->properties['highlightFont'] = clone $this->font; + $this->properties['highlightFontCloned'] = true; + } + + $this->properties['highlightFont']->path = $propertyValue; + } + else + { + throw new ezcBaseValueException( $propertyName, $propertyValue, 'ezcGraphFontOptions' ); + } + break; + $this->properties['highlightSize'] = max( 1, (int) $propertyValue ); + break; + case 'highlightRadars': + if ( !is_bool( $propertyValue ) ) + { + throw new ezcBaseValueException( $propertyName, $propertyValue, 'bool' ); + } + + $this->properties['highlightRadars'] = $propertyValue; + break; + default: + return parent::__set( $propertyName, $propertyValue ); + } + } + + /** + * __get + * + * @param mixed $propertyName + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + * @return mixed + * @ignore + */ + public function __get( $propertyName ) + { + switch ( $propertyName ) + { + case 'highlightFont': + // Clone font configuration when requested for this element + if ( !$this->properties['highlightFontCloned'] ) + { + $this->properties['highlightFont'] = clone $this->properties['font']; + $this->properties['highlightFontCloned'] = true; + } + return $this->properties['highlightFont']; + default: + return parent::__get( $propertyName ); + } + } +} + +?> |