| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * File containing the ezcGraphRadarChartOption class 4 * 5 * @package Graph 6 * @version 1.5 7 * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved. 8 * @license http://ez.no/licenses/new_bsd New BSD License 9 */ 10 /** 11 * Class containing the basic options for radar charts. 12 * 13 * <code> 14 * $wikidata = include 'tutorial_wikipedia_data.php'; 15 * 16 * $graph = new ezcGraphRadarChart(); 17 * $graph->title = 'Wikipedia articles'; 18 * 19 * $graph->options->fillLines = 220; 20 * 21 * // Add data 22 * foreach ( $wikidata as $language => $data ) 23 * { 24 * $graph->data[$language] = new ezcGraphArrayDataSet( $data ); 25 * $graph->data[$language][] = reset( $data ); 26 * } 27 * 28 * $graph->render( 400, 150, 'tutorial_radar_chart.svg' ); 29 * </code> 30 * 31 * @property float $lineThickness 32 * Theickness of chart lines 33 * @property mixed $fillLines 34 * Status wheather the space between line and axis should get filled. 35 * - FALSE to not fill the space at all. 36 * - (int) Opacity used to fill up the space with the lines color. 37 * @property int $symbolSize 38 * Size of symbols in line chart. 39 * @property ezcGraphFontOptions $highlightFont 40 * Font configuration for highlight tests 41 * @property int $highlightSize 42 * Size of highlight blocks 43 * @property bool $highlightRadars 44 * If true, it adds lines to highlight the values position on the 45 * axis. 46 * 47 * @version 1.5 48 * @package Graph 49 */ 50 class ezcGraphRadarChartOptions extends ezcGraphChartOptions 51 { 52 /** 53 * Constructor 54 * 55 * @param array $options Default option array 56 * @return void 57 * @ignore 58 */ 59 public function __construct( array $options = array() ) 60 { 61 $this->properties['lineThickness'] = 1; 62 $this->properties['fillLines'] = false; 63 $this->properties['symbolSize'] = 8; 64 $this->properties['highlightFont'] = new ezcGraphFontOptions(); 65 $this->properties['highlightFontCloned'] = false; 66 $this->properties['highlightSize'] = 14; 67 $this->properties['highlightRadars'] = false; 68 69 parent::__construct( $options ); 70 } 71 72 /** 73 * Set an option value 74 * 75 * @param string $propertyName 76 * @param mixed $propertyValue 77 * @throws ezcBasePropertyNotFoundException 78 * If a property is not defined in this class 79 * @return void 80 */ 81 public function __set( $propertyName, $propertyValue ) 82 { 83 switch ( $propertyName ) 84 { 85 case 'lineThickness': 86 case 'symbolSize': 87 case 'highlightSize': 88 if ( !is_numeric( $propertyValue ) || 89 ( $propertyValue < 1 ) ) 90 { 91 throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 1' ); 92 } 93 94 $this->properties[$propertyName] = (int) $propertyValue; 95 break; 96 case 'fillLines': 97 if ( ( $propertyValue !== false ) && 98 !is_numeric( $propertyValue ) || 99 ( $propertyValue < 0 ) || 100 ( $propertyValue > 255 ) ) 101 { 102 throw new ezcBaseValueException( $propertyName, $propertyValue, 'false OR 0 <= int <= 255' ); 103 } 104 105 $this->properties[$propertyName] = ( 106 $propertyValue === false 107 ? false 108 : (int) $propertyValue ); 109 break; 110 case 'highlightFont': 111 if ( $propertyValue instanceof ezcGraphFontOptions ) 112 { 113 $this->properties['highlightFont'] = $propertyValue; 114 } 115 elseif ( is_string( $propertyValue ) ) 116 { 117 if ( !$this->properties['highlightFontCloned'] ) 118 { 119 $this->properties['highlightFont'] = clone $this->font; 120 $this->properties['highlightFontCloned'] = true; 121 } 122 123 $this->properties['highlightFont']->path = $propertyValue; 124 } 125 else 126 { 127 throw new ezcBaseValueException( $propertyName, $propertyValue, 'ezcGraphFontOptions' ); 128 } 129 break; 130 $this->properties['highlightSize'] = max( 1, (int) $propertyValue ); 131 break; 132 case 'highlightRadars': 133 if ( !is_bool( $propertyValue ) ) 134 { 135 throw new ezcBaseValueException( $propertyName, $propertyValue, 'bool' ); 136 } 137 138 $this->properties['highlightRadars'] = $propertyValue; 139 break; 140 default: 141 return parent::__set( $propertyName, $propertyValue ); 142 } 143 } 144 145 /** 146 * __get 147 * 148 * @param mixed $propertyName 149 * @throws ezcBasePropertyNotFoundException 150 * If a the value for the property options is not an instance of 151 * @return mixed 152 * @ignore 153 */ 154 public function __get( $propertyName ) 155 { 156 switch ( $propertyName ) 157 { 158 case 'highlightFont': 159 // Clone font configuration when requested for this element 160 if ( !$this->properties['highlightFontCloned'] ) 161 { 162 $this->properties['highlightFont'] = clone $this->properties['font']; 163 $this->properties['highlightFontCloned'] = true; 164 } 165 return $this->properties['highlightFont']; 166 default: 167 return parent::__get( $propertyName ); 168 } 169 } 170 } 171 172 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |