PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.0.3
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.0.3
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / phpoffice / phpexcel / Classes / PHPExcel / Chart / GridLines.php

GridLines.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.0.3, at vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/GridLines.php

458 lines 11.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 require_once 'Properties.php';
3 /**
4 * Created by PhpStorm.
5 * User: Wiktor Trzonkowski
6 * Date: 7/2/14
7 * Time: 2:36 PM
8 */
9
10 class PHPExcel_Chart_GridLines extends
11 PHPExcel_Properties {
12
13 /**
14 * Properties of Class:
15 * Object State (State for Minor Tick Mark) @var bool
16 * Line Properties @var array of mixed
17 * Shadow Properties @var array of mixed
18 * Glow Properties @var array of mixed
19 * Soft Properties @var array of mixed
20 *
21 */
22
23 private
24 $_object_state = FALSE,
25 $_line_properties = array(
26 'color' => array(
27 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
28 'value' => NULL,
29 'alpha' => 0
30 ),
31 'style' => array(
32 'width' => '9525',
33 'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
34 'dash' => self::LINE_STYLE_DASH_SOLID,
35 'cap' => self::LINE_STYLE_CAP_FLAT,
36 'join' => self::LINE_STYLE_JOIN_BEVEL,
37 'arrow' => array(
38 'head' => array(
39 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
40 'size' => self::LINE_STYLE_ARROW_SIZE_5
41 ),
42 'end' => array(
43 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
44 'size' => self::LINE_STYLE_ARROW_SIZE_8
45 ),
46 )
47 )
48 ),
49 $_shadow_properties = array(
50 'presets' => self::SHADOW_PRESETS_NOSHADOW,
51 'effect' => NULL,
52 'color' => array(
53 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
54 'value' => 'black',
55 'alpha' => 85,
56 ),
57 'size' => array(
58 'sx' => NULL,
59 'sy' => NULL,
60 'kx' => NULL
61 ),
62 'blur' => NULL,
63 'direction' => NULL,
64 'distance' => NULL,
65 'algn' => NULL,
66 'rotWithShape' => NULL
67 ),
68 $_glow_properties = array(
69 'size' => NULL,
70 'color' => array(
71 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
72 'value' => 'black',
73 'alpha' => 40
74 )
75 ),
76 $_soft_edges = array(
77 'size' => NULL
78 );
79
80 /**
81 * Get Object State
82 *
83 * @return bool
84 */
85
86 public function getObjectState() {
87 return $this->_object_state;
88 }
89
90 /**
91 * Change Object State to True
92 *
93 * @return PHPExcel_Chart_GridLines
94 */
95
96 private function _activateObject() {
97 $this->_object_state = TRUE;
98
99 return $this;
100 }
101
102 /**
103 * Set Line Color Properties
104 *
105 * @param string $value
106 * @param int $alpha
107 * @param string $type
108 */
109
110 public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD) {
111 $this
112 ->_activateObject()
113 ->_line_properties['color'] = $this->setColorProperties(
114 $value,
115 $alpha,
116 $type);
117 }
118
119 /**
120 * Set Line Color Properties
121 *
122 * @param float $line_width
123 * @param string $compound_type
124 * @param string $dash_type
125 * @param string $cap_type
126 * @param string $join_type
127 * @param string $head_arrow_type
128 * @param string $head_arrow_size
129 * @param string $end_arrow_type
130 * @param string $end_arrow_size
131 */
132
133 public function setLineStyleProperties($line_width = NULL, $compound_type = NULL, $dash_type = NULL, $cap_type = NULL, $join_type = NULL, $head_arrow_type = NULL, $head_arrow_size = NULL, $end_arrow_type = NULL, $end_arrow_size = NULL) {
134 $this->_activateObject();
135 (!is_null($line_width))
136 ? $this->_line_properties['style']['width'] = $this->getExcelPointsWidth((float) $line_width)
137 : NULL;
138 (!is_null($compound_type))
139 ? $this->_line_properties['style']['compound'] = (string) $compound_type
140 : NULL;
141 (!is_null($dash_type))
142 ? $this->_line_properties['style']['dash'] = (string) $dash_type
143 : NULL;
144 (!is_null($cap_type))
145 ? $this->_line_properties['style']['cap'] = (string) $cap_type
146 : NULL;
147 (!is_null($join_type))
148 ? $this->_line_properties['style']['join'] = (string) $join_type
149 : NULL;
150 (!is_null($head_arrow_type))
151 ? $this->_line_properties['style']['arrow']['head']['type'] = (string) $head_arrow_type
152 : NULL;
153 (!is_null($head_arrow_size))
154 ? $this->_line_properties['style']['arrow']['head']['size'] = (string) $head_arrow_size
155 : NULL;
156 (!is_null($end_arrow_type))
157 ? $this->_line_properties['style']['arrow']['end']['type'] = (string) $end_arrow_type
158 : NULL;
159 (!is_null($end_arrow_size))
160 ? $this->_line_properties['style']['arrow']['end']['size'] = (string) $end_arrow_size
161 : NULL;
162 }
163
164 /**
165 * Get Line Color Property
166 *
167 * @param string $parameter
168 *
169 * @return string
170 */
171
172 public function getLineColorProperty($parameter) {
173 return $this->_line_properties['color'][$parameter];
174 }
175
176 /**
177 * Get Line Style Property
178 *
179 * @param array|string $elements
180 *
181 * @return string
182 */
183
184 public function getLineStyleProperty($elements) {
185 return $this->getArrayElementsValue($this->_line_properties['style'], $elements);
186 }
187
188 /**
189 * Set Glow Properties
190 *
191 * @param float $size
192 * @param string $color_value
193 * @param int $color_alpha
194 * @param string $color_type
195 *
196 */
197
198 public function setGlowProperties($size, $color_value = NULL, $color_alpha = NULL, $color_type = NULL) {
199 $this
200 ->_activateObject()
201 ->_setGlowSize($size)
202 ->_setGlowColor($color_value, $color_alpha, $color_type);
203 }
204
205 /**
206 * Get Glow Color Property
207 *
208 * @param string $property
209 *
210 * @return string
211 */
212
213 public function getGlowColor($property) {
214 return $this->_glow_properties['color'][$property];
215 }
216
217 /**
218 * Get Glow Size
219 *
220 * @return string
221 */
222
223 public function getGlowSize() {
224 return $this->_glow_properties['size'];
225 }
226
227 /**
228 * Set Glow Size
229 *
230 * @param float $size
231 *
232 * @return PHPExcel_Chart_GridLines
233 */
234
235 private function _setGlowSize($size) {
236 $this->_glow_properties['size'] = $this->getExcelPointsWidth((float) $size);
237
238 return $this;
239 }
240
241 /**
242 * Set Glow Color
243 *
244 * @param string $color
245 * @param int $alpha
246 * @param string $type
247 *
248 * @return PHPExcel_Chart_GridLines
249 */
250
251 private function _setGlowColor($color, $alpha, $type) {
252 if (!is_null($color)) {
253 $this->_glow_properties['color']['value'] = (string) $color;
254 }
255 if (!is_null($alpha)) {
256 $this->_glow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
257 }
258 if (!is_null($type)) {
259 $this->_glow_properties['color']['type'] = (string) $type;
260 }
261
262 return $this;
263 }
264
265 /**
266 * Get Line Style Arrow Parameters
267 *
268 * @param string $arrow_selector
269 * @param string $property_selector
270 *
271 * @return string
272 */
273
274 public function getLineStyleArrowParameters($arrow_selector, $property_selector) {
275 return $this->getLineStyleArrowSize($this->_line_properties['style']['arrow'][$arrow_selector]['size'], $property_selector);
276 }
277
278 /**
279 * Set Shadow Properties
280 *
281 * @param int $sh_presets
282 * @param string $sh_color_value
283 * @param string $sh_color_type
284 * @param int $sh_color_alpha
285 * @param string $sh_blur
286 * @param int $sh_angle
287 * @param float $sh_distance
288 *
289 */
290
291 public function setShadowProperties($sh_presets, $sh_color_value = NULL, $sh_color_type = NULL, $sh_color_alpha = NULL, $sh_blur = NULL, $sh_angle = NULL, $sh_distance = NULL) {
292 $this
293 ->_activateObject()
294 ->_setShadowPresetsProperties((int) $sh_presets)
295 ->_setShadowColor(
296 is_null($sh_color_value) ? $this->_shadow_properties['color']['value'] : $sh_color_value
297 , is_null($sh_color_alpha) ? (int) $this->_shadow_properties['color']['alpha']
298 : $this->getTrueAlpha($sh_color_alpha)
299 , is_null($sh_color_type) ? $this->_shadow_properties['color']['type'] : $sh_color_type)
300 ->_setShadowBlur($sh_blur)
301 ->_setShadowAngle($sh_angle)
302 ->_setShadowDistance($sh_distance);
303 }
304
305 /**
306 * Set Shadow Presets Properties
307 *
308 * @param int $shadow_presets
309 *
310 * @return PHPExcel_Chart_GridLines
311 */
312
313 private function _setShadowPresetsProperties($shadow_presets) {
314 $this->_shadow_properties['presets'] = $shadow_presets;
315 $this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
316
317 return $this;
318 }
319
320 /**
321 * Set Shadow Properties Values
322 *
323 * @param array $properties_map
324 * @param * $reference
325 *
326 * @return PHPExcel_Chart_GridLines
327 */
328
329 private function _setShadowProperiesMapValues(array $properties_map, &$reference = NULL) {
330 $base_reference = $reference;
331 foreach ($properties_map as $property_key => $property_val) {
332 if (is_array($property_val)) {
333 if ($reference === NULL) {
334 $reference = & $this->_shadow_properties[$property_key];
335 } else {
336 $reference = & $reference[$property_key];
337 }
338 $this->_setShadowProperiesMapValues($property_val, $reference);
339 } else {
340 if ($base_reference === NULL) {
341 $this->_shadow_properties[$property_key] = $property_val;
342 } else {
343 $reference[$property_key] = $property_val;
344 }
345 }
346 }
347
348 return $this;
349 }
350
351 /**
352 * Set Shadow Color
353 *
354 * @param string $color
355 * @param int $alpha
356 * @param string $type
357 *
358 * @return PHPExcel_Chart_GridLines
359 */
360
361 private function _setShadowColor($color, $alpha, $type) {
362 if (!is_null($color)) {
363 $this->_shadow_properties['color']['value'] = (string) $color;
364 }
365 if (!is_null($alpha)) {
366 $this->_shadow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
367 }
368 if (!is_null($type)) {
369 $this->_shadow_properties['color']['type'] = (string) $type;
370 }
371
372 return $this;
373 }
374
375 /**
376 * Set Shadow Blur
377 *
378 * @param float $blur
379 *
380 * @return PHPExcel_Chart_GridLines
381 */
382
383 private function _setShadowBlur($blur) {
384 if ($blur !== NULL) {
385 $this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur);
386 }
387
388 return $this;
389 }
390
391 /**
392 * Set Shadow Angle
393 *
394 * @param int $angle
395 *
396 * @return PHPExcel_Chart_GridLines
397 */
398
399 private function _setShadowAngle($angle) {
400 if ($angle !== NULL) {
401 $this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle);
402 }
403
404 return $this;
405 }
406
407 /**
408 * Set Shadow Distance
409 *
410 * @param float $distance
411 *
412 * @return PHPExcel_Chart_GridLines
413 */
414
415 private function _setShadowDistance($distance) {
416 if ($distance !== NULL) {
417 $this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance);
418 }
419
420 return $this;
421 }
422
423 /**
424 * Get Shadow Property
425 *
426 * @param string $elements
427 * @param array $elements
428 *
429 * @return string
430 */
431
432 public function getShadowProperty($elements) {
433 return $this->getArrayElementsValue($this->_shadow_properties, $elements);
434 }
435
436 /**
437 * Set Soft Edges Size
438 *
439 * @param float $size
440 */
441
442 public function setSoftEdgesSize($size) {
443 if (!is_null($size)) {
444 $this->_activateObject();
445 $_soft_edges['size'] = (string) $this->getExcelPointsWidth($size);
446 }
447 }
448
449 /**
450 * Get Soft Edges Size
451 *
452 * @return string
453 */
454
455 public function getSoftEdgesSize() {
456 return $this->_soft_edges['size'];
457 }
458 }