ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Axis.php
Go to the documentation of this file.
1<?php
2
4
11class Axis extends Properties
12{
18 private $axisNumber = [
19 'format' => self::FORMAT_CODE_GENERAL,
20 'source_linked' => 1,
21 ];
22
28 private $axisOptions = [
29 'minimum' => null,
30 'maximum' => null,
31 'major_unit' => null,
32 'minor_unit' => null,
33 'orientation' => self::ORIENTATION_NORMAL,
34 'minor_tick_mark' => self::TICK_MARK_NONE,
35 'major_tick_mark' => self::TICK_MARK_NONE,
36 'axis_labels' => self::AXIS_LABELS_NEXT_TO,
37 'horizontal_crosses' => self::HORIZONTAL_CROSSES_AUTOZERO,
38 'horizontal_crosses_value' => null,
39 ];
40
46 private $fillProperties = [
48 'value' => null,
49 'alpha' => 0,
50 ];
51
57 private $lineProperties = [
59 'value' => null,
60 'alpha' => 0,
61 ];
62
69 'width' => '9525',
74 'arrow' => [
75 'head' => [
78 ],
79 'end' => [
82 ],
83 ],
84 ];
85
93 'effect' => null,
94 'color' => [
96 'value' => 'black',
97 'alpha' => 40,
98 ],
99 'size' => [
100 'sx' => null,
101 'sy' => null,
102 'kx' => null,
103 ],
104 'blur' => null,
105 'direction' => null,
106 'distance' => null,
107 'algn' => null,
108 'rotWithShape' => null,
109 ];
110
116 private $glowProperties = [
117 'size' => null,
118 'color' => [
120 'value' => 'black',
121 'alpha' => 40,
122 ],
123 ];
124
130 private $softEdges = [
131 'size' => null,
132 ];
133
139 public function setAxisNumberProperties($format_code): void
140 {
141 $this->axisNumber['format'] = (string) $format_code;
142 $this->axisNumber['source_linked'] = 0;
143 }
144
150 public function getAxisNumberFormat()
151 {
152 return $this->axisNumber['format'];
153 }
154
161 {
162 return (string) $this->axisNumber['source_linked'];
163 }
164
179 public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null): void
180 {
181 $this->axisOptions['axis_labels'] = (string) $axis_labels;
182 ($horizontal_crosses_value !== null) ? $this->axisOptions['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null;
183 ($horizontal_crosses !== null) ? $this->axisOptions['horizontal_crosses'] = (string) $horizontal_crosses : null;
184 ($axis_orientation !== null) ? $this->axisOptions['orientation'] = (string) $axis_orientation : null;
185 ($major_tmt !== null) ? $this->axisOptions['major_tick_mark'] = (string) $major_tmt : null;
186 ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
187 ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
188 ($minimum !== null) ? $this->axisOptions['minimum'] = (string) $minimum : null;
189 ($maximum !== null) ? $this->axisOptions['maximum'] = (string) $maximum : null;
190 ($major_unit !== null) ? $this->axisOptions['major_unit'] = (string) $major_unit : null;
191 ($minor_unit !== null) ? $this->axisOptions['minor_unit'] = (string) $minor_unit : null;
192 }
193
201 public function getAxisOptionsProperty($property)
202 {
203 return $this->axisOptions[$property];
204 }
205
211 public function setAxisOrientation($orientation): void
212 {
213 $this->axisOptions['orientation'] = (string) $orientation;
214 }
215
223 public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB): void
224 {
225 $this->fillProperties = $this->setColorProperties($color, $alpha, $type);
226 }
227
235 public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB): void
236 {
237 $this->lineProperties = $this->setColorProperties($color, $alpha, $type);
238 }
239
247 public function getFillProperty($property)
248 {
249 return $this->fillProperties[$property];
250 }
251
259 public function getLineProperty($property)
260 {
261 return $this->lineProperties[$property];
262 }
263
277 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): void
278 {
279 ($line_width !== null) ? $this->lineStyleProperties['width'] = $this->getExcelPointsWidth((float) $line_width) : null;
280 ($compound_type !== null) ? $this->lineStyleProperties['compound'] = (string) $compound_type : null;
281 ($dash_type !== null) ? $this->lineStyleProperties['dash'] = (string) $dash_type : null;
282 ($cap_type !== null) ? $this->lineStyleProperties['cap'] = (string) $cap_type : null;
283 ($join_type !== null) ? $this->lineStyleProperties['join'] = (string) $join_type : null;
284 ($head_arrow_type !== null) ? $this->lineStyleProperties['arrow']['head']['type'] = (string) $head_arrow_type : null;
285 ($head_arrow_size !== null) ? $this->lineStyleProperties['arrow']['head']['size'] = (string) $head_arrow_size : null;
286 ($end_arrow_type !== null) ? $this->lineStyleProperties['arrow']['end']['type'] = (string) $end_arrow_type : null;
287 ($end_arrow_size !== null) ? $this->lineStyleProperties['arrow']['end']['size'] = (string) $end_arrow_size : null;
288 }
289
297 public function getLineStyleProperty($elements)
298 {
299 return $this->getArrayElementsValue($this->lineStyleProperties, $elements);
300 }
301
309 public function getLineStyleArrowWidth($arrow)
310 {
311 return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'w');
312 }
313
321 public function getLineStyleArrowLength($arrow)
322 {
323 return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'len');
324 }
325
337 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): void
338 {
339 $this->setShadowPresetsProperties((int) $sh_presets)
340 ->setShadowColor(
341 $sh_color_value ?? $this->shadowProperties['color']['value'],
342 $sh_color_alpha ?? (int) $this->shadowProperties['color']['alpha'],
343 $sh_color_type ?? $this->shadowProperties['color']['type']
344 )
345 ->setShadowBlur($sh_blur)
346 ->setShadowAngle($sh_angle)
347 ->setShadowDistance($sh_distance);
348 }
349
357 private function setShadowPresetsProperties($shadow_presets)
358 {
359 $this->shadowProperties['presets'] = $shadow_presets;
360 $this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
361
362 return $this;
363 }
364
372 private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
373 {
374 $base_reference = $reference;
375 foreach ($properties_map as $property_key => $property_val) {
376 if (is_array($property_val)) {
377 if ($reference === null) {
378 $reference = &$this->shadowProperties[$property_key];
379 } else {
380 $reference = &$reference[$property_key];
381 }
382 $this->setShadowProperiesMapValues($property_val, $reference);
383 } else {
384 if ($base_reference === null) {
385 $this->shadowProperties[$property_key] = $property_val;
386 } else {
387 $reference[$property_key] = $property_val;
388 }
389 }
390 }
391
392 return $this;
393 }
394
404 private function setShadowColor($color, $alpha, $type)
405 {
406 $this->shadowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
407
408 return $this;
409 }
410
418 private function setShadowBlur($blur)
419 {
420 if ($blur !== null) {
421 $this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
422 }
423
424 return $this;
425 }
426
434 private function setShadowAngle($angle)
435 {
436 if ($angle !== null) {
437 $this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
438 }
439
440 return $this;
441 }
442
450 private function setShadowDistance($distance)
451 {
452 if ($distance !== null) {
453 $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
454 }
455
456 return $this;
457 }
458
466 public function getShadowProperty($elements)
467 {
468 return $this->getArrayElementsValue($this->shadowProperties, $elements);
469 }
470
479 public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null): void
480 {
481 $this->setGlowSize($size)
482 ->setGlowColor(
483 $color_value ?? $this->glowProperties['color']['value'],
484 $color_alpha ?? (int) $this->glowProperties['color']['alpha'],
485 $color_type ?? $this->glowProperties['color']['type']
486 );
487 }
488
496 public function getGlowProperty($property)
497 {
498 return $this->getArrayElementsValue($this->glowProperties, $property);
499 }
500
508 private function setGlowSize($size)
509 {
510 if ($size !== null) {
511 $this->glowProperties['size'] = $this->getExcelPointsWidth($size);
512 }
513
514 return $this;
515 }
516
526 private function setGlowColor($color, $alpha, $type)
527 {
528 $this->glowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
529
530 return $this;
531 }
532
538 public function setSoftEdges($size): void
539 {
540 if ($size !== null) {
541 $softEdges['size'] = (string) $this->getExcelPointsWidth($size);
542 }
543 }
544
550 public function getSoftEdgesSize()
551 {
552 return $this->softEdges['size'];
553 }
554}
$size
Definition: RandomTest.php:84
An exception for terminatinating execution or to throw for unit testing.
Created by PhpStorm.
Definition: Axis.php:12
setGlowSize($size)
Set Glow Color.
Definition: Axis.php:508
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)
Set Line Style Properties.
Definition: Axis.php:277
setSoftEdges($size)
Set Soft Edges Size.
Definition: Axis.php:538
getAxisOptionsProperty($property)
Get Axis Options Property.
Definition: Axis.php:201
setAxisOptionsProperties($axis_labels, $horizontal_crosses_value=null, $horizontal_crosses=null, $axis_orientation=null, $major_tmt=null, $minor_tmt=null, $minimum=null, $maximum=null, $major_unit=null, $minor_unit=null)
Set Axis Options Properties.
Definition: Axis.php:179
setShadowColor($color, $alpha, $type)
Set Shadow Color.
Definition: Axis.php:404
setGlowProperties($size, $color_value=null, $color_alpha=null, $color_type=null)
Set Glow Properties.
Definition: Axis.php:479
getGlowProperty($property)
Get Glow Property.
Definition: Axis.php:496
setShadowProperiesMapValues(array $properties_map, &$reference=null)
Set Shadow Properties from Mapped Values.
Definition: Axis.php:372
setShadowDistance($distance)
Set Shadow Distance.
Definition: Axis.php:450
setGlowColor($color, $alpha, $type)
Set Glow Color.
Definition: Axis.php:526
setLineParameters($color, $alpha=0, $type=self::EXCEL_COLOR_TYPE_ARGB)
Set Line Property.
Definition: Axis.php:235
getAxisNumberFormat()
Get Axis Number Format Data Type.
Definition: Axis.php:150
getSoftEdgesSize()
Get Soft Edges Size.
Definition: Axis.php:550
getLineStyleArrowWidth($arrow)
Get Line Style Arrow Excel Width.
Definition: Axis.php:309
setAxisNumberProperties($format_code)
Get Series Data Type.
Definition: Axis.php:139
setShadowProperties($sh_presets, $sh_color_value=null, $sh_color_type=null, $sh_color_alpha=null, $sh_blur=null, $sh_angle=null, $sh_distance=null)
Set Shadow Properties.
Definition: Axis.php:337
getLineProperty($property)
Get Line Property.
Definition: Axis.php:259
getAxisNumberSourceLinked()
Get Axis Number Source Linked.
Definition: Axis.php:160
setAxisOrientation($orientation)
Set Axis Orientation Property.
Definition: Axis.php:211
getLineStyleArrowLength($arrow)
Get Line Style Arrow Excel Length.
Definition: Axis.php:321
getShadowProperty($elements)
Get Shadow Property.
Definition: Axis.php:466
setShadowPresetsProperties($shadow_presets)
Set Shadow Color.
Definition: Axis.php:357
getLineStyleProperty($elements)
Get Line Style Property.
Definition: Axis.php:297
getFillProperty($property)
Get Fill Property.
Definition: Axis.php:247
setFillParameters($color, $alpha=0, $type=self::EXCEL_COLOR_TYPE_ARGB)
Set Fill Property.
Definition: Axis.php:223
setShadowAngle($angle)
Set Shadow Angle.
Definition: Axis.php:434
setShadowBlur($blur)
Set Shadow Blur.
Definition: Axis.php:418
getArrayElementsValue($properties, $elements)
Definition: Properties.php:356
getShadowPresetsMap($shadow_presets_option)
Definition: Properties.php:164
getLineStyleArrowSize($array_selector, $array_kay_selector)
Definition: Properties.php:147
setColorProperties($color, $alpha, $type)
Definition: Properties.php:138
$angle
$type