Graph
[ ]
[ ]
[ ]
[ ]
[ ]
Source for file renderer.php
Documentation is available at renderer.php
1. <?php
2. /**
3. * File containing the ezcGraphRenderer2dOptions class
4. *
5. * @package Graph
6. * @version 1.1
7. * @copyright Copyright (C) 2005-2007 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 pie charts
12. *
13. * @property float $maxLabelHeight
14. * Percent of chart height used as maximum height for pie chart
15. * labels.
16. * @property bool $showSymbol
17. * Indicates wheather to show the line between pie elements and
18. * labels.
19. * @property float $symbolSize
20. * Size of symbols used to connect a label with a pie.
21. * @property float $moveOut
22. * Percent to move pie chart elements out of the middle on highlight.
23. * @property int $titlePosition
24. * Position of title in a box.
25. * @property int $titleAlignement
26. * Alignement of box titles.
27. * @property float $dataBorder
28. * Factor to darken border of data elements, like lines, bars and
29. * pie segments.
30. * @property float $barMargin
31. * Procentual distance between bar blocks.
32. * @property float $barPadding
33. * Procentual distance between bars.
34. * @property float $pieChartOffset
35. * Offset for starting with first pie chart segment in degrees.
36. * @property float $legendSymbolGleam
37. * Opacity of gleam in legend symbols
38. * @property float $legendSymbolGleamSize
39. * Size of gleam in legend symbols
40. * @property float $legendSymbolGleamColor
41. * Color of gleam in legend symbols
42. * @property float $pieVerticalSize
43. * Percent of vertical space used for maximum pie chart size.
44. * @property float $pieHorizontalSize
45. * Percent of horizontal space used for maximum pie chart size.
46. * @property float $pieChartSymbolColor
47. * Color of pie chart symbols
48. * @property float $pieChartGleam
49. * Enhance pie chart with gleam on top.
50. * @property float $pieChartGleamColor
51. * Color used for gleam on pie charts.
52. * @property float $pieChartGleamBorder
53. * Do not draw gleam on an outer border of this size.
54. *
55. * @version 1.1
56. * @package Graph
57. */
58. class ezcGraphRendererOptions extends ezcGraphChartOptions
59. {
60. /**
61. * Constructor
62. *
63. * @param array $options Default option array
64. * @return void
65. * @ignore
66. */
67. public function __construct( array $options = array() )
68. {
69. $this->properties['maxLabelHeight'] = .10;
70. $this->properties['showSymbol'] = true;
71. $this->properties['symbolSize'] = 6;
72. $this->properties['moveOut'] = .1;
73. $this->properties['titlePosition'] = ezcGraph::TOP;
74. $this->properties['titleAlignement'] = ezcGraph::MIDDLE | ezcGraph::CENTER;
75. $this->properties['dataBorder'] = .5;
76. $this->properties['barMargin'] = .1;
77. $this->properties['barPadding'] = .05;
78. $this->properties['pieChartOffset'] = 0;
79. $this->properties['pieChartSymbolColor'] = ezcGraphColor::fromHex( '#000000' );
80. $this->properties['pieChartGleam'] = false;
81. $this->properties['pieChartGleamColor'] = ezcGraphColor::fromHex( '#FFFFFF' );
82. $this->properties['pieChartGleamBorder'] = 0;
83. $this->properties['legendSymbolGleam'] = false;
84. $this->properties['legendSymbolGleamSize'] = .9;
85. $this->properties['legendSymbolGleamColor'] = ezcGraphColor::fromHex( '#FFFFFF' );
86. $this->properties['pieVerticalSize'] = .5;
87. $this->properties['pieHorizontalSize'] = .25;
88.
89. parent::__construct( $options );
90. }
91.
92.
93. /**
94. * Set an option value
95. *
96. * @param string $propertyName
97. * @param mixed $propertyValue
98. * @throws ezcBasePropertyNotFoundException
99. * If a property is not defined in this class
100. * @return void
101. * @ignore
102. */
103. public function __set( $propertyName, $propertyValue )
104. {
105. switch ( $propertyName )
106. {
107. case 'dataBorder':
108. case 'pieChartGleam':
109. case 'legendSymbolGleam':
110. if ( $propertyValue !== false &&
111. !is_numeric( $propertyValue ) ||
112. ( $propertyValue < 0 ) ||
113. ( $propertyValue > 1 ) )
114. {
115. throw new ezcBaseValueException( $propertyName, $propertyValue, 'false OR 0 <= float <= 1' );
116. }
117.
118. $this->properties[$propertyName] = (
119. $propertyValue === false
120. ? false
121. : (float) $propertyValue );
122. break;
123.
124. case 'maxLabelHeight':
125. case 'moveOut':
126. case 'barMargin':
127. case 'barPadding':
128. case 'legendSymbolGleamSize':
129. case 'pieVerticalSize':
130. case 'pieHorizontalSize':
131. if ( !is_numeric( $propertyValue ) ||
132. ( $propertyValue < 0 ) ||
133. ( $propertyValue > 1 ) )
134. {
135. throw new ezcBaseValueException( $propertyName, $propertyValue, '0 <= float <= 1' );
136. }
137.
138. $this->properties[$propertyName] = (float) $propertyValue;
139. break;
140.
141. case 'symbolSize':
142. case 'titlePosition':
143. case 'titleAlignement':
144. case 'pieChartGleamBorder':
145. if ( !is_numeric( $propertyValue ) ||
146. ( $propertyValue < 0 ) )
147. {
148. throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 0' );
149. }
150.
151. $this->properties[$propertyName] = (int) $propertyValue;
152. break;
153.
154. case 'showSymbol':
155. if ( !is_bool( $propertyValue ) )
156. {
157. throw new ezcBaseValueException( $propertyName, $propertyValue, 'bool' );
158. }
159. $this->properties['showSymbol'] = (bool) $propertyValue;
160. break;
161.
162. case 'pieChartOffset':
163. if ( !is_numeric( $propertyValue ) ||
164. ( $propertyValue < 0 ) ||
165. ( $propertyValue > 360 ) )
166. {
167. throw new ezcBaseValueException( $propertyName, $propertyValue, '0 <= float <= 360' );
168. }
169.
170. $this->properties[$propertyName] = (float) $propertyValue;
171. break;
172.
173. case 'pieChartSymbolColor':
174. case 'pieChartGleamColor':
175. case 'legendSymbolGleamColor':
176. $this->properties[$propertyName] = ezcGraphColor::create( $propertyValue );
177. break;
178.
179. default:
180. return parent::__set( $propertyName, $propertyValue );
181. }
182. }
183. }
184.
185. ?>
Last updated: Wed, 28 Nov 2007