Updated gui for user facility settings (#1327)
[openemr.git] / vendor / phpoffice / phpexcel / Classes / PHPExcel / Chart / Axis.php
blobefb39e9f410f6c019aa44d45fe5ae76b390b4053
1 <?php
2 require_once 'Properties.php';
4 /**
5 * Created by PhpStorm.
6 * User: Wiktor Trzonkowski
7 * Date: 6/17/14
8 * Time: 12:11 PM
9 */
11 class PHPExcel_Chart_Axis extends
12 PHPExcel_Properties {
14 /**
15 * Axis Number
17 * @var array of mixed
20 private
21 $_axis_number = array(
22 'format' => self::FORMAT_CODE_GENERAL,
23 'source_linked' => 1
26 /**
27 * Axis Options
29 * @var array of mixed
32 private $_axis_options = array(
33 'minimum' => NULL,
34 'maximum' => NULL,
35 'major_unit' => NULL,
36 'minor_unit' => NULL,
37 'orientation' => self::ORIENTATION_NORMAL,
38 'minor_tick_mark' => self::TICK_MARK_NONE,
39 'major_tick_mark' => self::TICK_MARK_NONE,
40 'axis_labels' => self::AXIS_LABELS_NEXT_TO,
41 'horizontal_crosses' => self::HORIZONTAL_CROSSES_AUTOZERO,
42 'horizontal_crosses_value' => NULL
45 /**
46 * Fill Properties
48 * @var array of mixed
51 private $_fill_properties = array(
52 'type' => self::EXCEL_COLOR_TYPE_ARGB,
53 'value' => NULL,
54 'alpha' => 0
57 /**
58 * Line Properties
60 * @var array of mixed
63 private $_line_properties = array(
64 'type' => self::EXCEL_COLOR_TYPE_ARGB,
65 'value' => NULL,
66 'alpha' => 0
69 /**
70 * Line Style Properties
72 * @var array of mixed
75 private $_line_style_properties = array(
76 'width' => '9525',
77 'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
78 'dash' => self::LINE_STYLE_DASH_SOLID,
79 'cap' => self::LINE_STYLE_CAP_FLAT,
80 'join' => self::LINE_STYLE_JOIN_BEVEL,
81 'arrow' => array(
82 'head' => array(
83 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
84 'size' => self::LINE_STYLE_ARROW_SIZE_5
86 'end' => array(
87 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
88 'size' => self::LINE_STYLE_ARROW_SIZE_8
93 /**
94 * Shadow Properties
96 * @var array of mixed
99 private $_shadow_properties = array(
100 'presets' => self::SHADOW_PRESETS_NOSHADOW,
101 'effect' => NULL,
102 'color' => array(
103 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
104 'value' => 'black',
105 'alpha' => 40,
107 'size' => array(
108 'sx' => NULL,
109 'sy' => NULL,
110 'kx' => NULL
112 'blur' => NULL,
113 'direction' => NULL,
114 'distance' => NULL,
115 'algn' => NULL,
116 'rotWithShape' => NULL
120 * Glow Properties
122 * @var array of mixed
125 private $_glow_properties = array(
126 'size' => NULL,
127 'color' => array(
128 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
129 'value' => 'black',
130 'alpha' => 40
135 * Soft Edge Properties
137 * @var array of mixed
140 private $_soft_edges = array(
141 'size' => NULL
145 * Get Series Data Type
147 * @return string
150 public function setAxisNumberProperties($format_code) {
151 $this->_axis_number['format'] = (string) $format_code;
152 $this->_axis_number['source_linked'] = 0;
156 * Get Axis Number Format Data Type
158 * @return string
161 public function getAxisNumberFormat() {
162 return $this->_axis_number['format'];
166 * Get Axis Number Source Linked
168 * @return string
171 public function getAxisNumberSourceLinked() {
172 return (string) $this->_axis_number['source_linked'];
176 * Set Axis Options Properties
178 * @param string $axis_labels
179 * @param string $horizontal_crosses_value
180 * @param string $horizontal_crosses
181 * @param string $axis_orientation
182 * @param string $major_tmt
183 * @param string $minor_tmt
184 * @param string $minimum
185 * @param string $maximum
186 * @param string $major_unit
187 * @param string $minor_unit
191 public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = NULL, $horizontal_crosses = NULL,
192 $axis_orientation = NULL, $major_tmt = NULL, $minor_tmt = NULL, $minimum = NULL, $maximum = NULL, $major_unit = NULL,
193 $minor_unit = NULL) {
195 $this->_axis_options['axis_labels'] = (string) $axis_labels;
196 ($horizontal_crosses_value !== NULL)
197 ? $this->_axis_options['horizontal_crosses_value'] = (string) $horizontal_crosses_value : NULL;
198 ($horizontal_crosses !== NULL) ? $this->_axis_options['horizontal_crosses'] = (string) $horizontal_crosses : NULL;
199 ($axis_orientation !== NULL) ? $this->_axis_options['orientation'] = (string) $axis_orientation : NULL;
200 ($major_tmt !== NULL) ? $this->_axis_options['major_tick_mark'] = (string) $major_tmt : NULL;
201 ($minor_tmt !== NULL) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : NULL;
202 ($minor_tmt !== NULL) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : NULL;
203 ($minimum !== NULL) ? $this->_axis_options['minimum'] = (string) $minimum : NULL;
204 ($maximum !== NULL) ? $this->_axis_options['maximum'] = (string) $maximum : NULL;
205 ($major_unit !== NULL) ? $this->_axis_options['major_unit'] = (string) $major_unit : NULL;
206 ($minor_unit !== NULL) ? $this->_axis_options['minor_unit'] = (string) $minor_unit : NULL;
210 * Get Axis Options Property
212 * @param string $property
214 * @return string
217 public function getAxisOptionsProperty($property) {
218 return $this->_axis_options[$property];
222 * Set Axis Orientation Property
224 * @param string $orientation
228 public function setAxisOrientation($orientation) {
229 $this->orientation = (string) $orientation;
233 * Set Fill Property
235 * @param string $color
236 * @param int $alpha
237 * @param string $type
241 public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) {
242 $this->_fill_properties = $this->setColorProperties($color, $alpha, $type);
246 * Set Line Property
248 * @param string $color
249 * @param int $alpha
250 * @param string $type
254 public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) {
255 $this->_line_properties = $this->setColorProperties($color, $alpha, $type);
259 * Get Fill Property
261 * @param string $property
263 * @return string
266 public function getFillProperty($property) {
267 return $this->_fill_properties[$property];
271 * Get Line Property
273 * @param string $property
275 * @return string
278 public function getLineProperty($property) {
279 return $this->_line_properties[$property];
283 * Set Line Style Properties
285 * @param float $line_width
286 * @param string $compound_type
287 * @param string $dash_type
288 * @param string $cap_type
289 * @param string $join_type
290 * @param string $head_arrow_type
291 * @param string $head_arrow_size
292 * @param string $end_arrow_type
293 * @param string $end_arrow_size
297 public function setLineStyleProperties($line_width = NULL, $compound_type = NULL,
298 $dash_type = NULL, $cap_type = NULL, $join_type = NULL, $head_arrow_type = NULL,
299 $head_arrow_size = NULL, $end_arrow_type = NULL, $end_arrow_size = NULL) {
301 (!is_null($line_width)) ? $this->_line_style_properties['width'] = $this->getExcelPointsWidth((float) $line_width)
302 : NULL;
303 (!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : NULL;
304 (!is_null($dash_type)) ? $this->_line_style_properties['dash'] = (string) $dash_type : NULL;
305 (!is_null($cap_type)) ? $this->_line_style_properties['cap'] = (string) $cap_type : NULL;
306 (!is_null($join_type)) ? $this->_line_style_properties['join'] = (string) $join_type : NULL;
307 (!is_null($head_arrow_type)) ? $this->_line_style_properties['arrow']['head']['type'] = (string) $head_arrow_type
308 : NULL;
309 (!is_null($head_arrow_size)) ? $this->_line_style_properties['arrow']['head']['size'] = (string) $head_arrow_size
310 : NULL;
311 (!is_null($end_arrow_type)) ? $this->_line_style_properties['arrow']['end']['type'] = (string) $end_arrow_type
312 : NULL;
313 (!is_null($end_arrow_size)) ? $this->_line_style_properties['arrow']['end']['size'] = (string) $end_arrow_size
314 : NULL;
318 * Get Line Style Property
320 * @param array|string $elements
322 * @return string
325 public function getLineStyleProperty($elements) {
326 return $this->getArrayElementsValue($this->_line_style_properties, $elements);
330 * Get Line Style Arrow Excel Width
332 * @param string $arrow
334 * @return string
337 public function getLineStyleArrowWidth($arrow) {
338 return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'w');
342 * Get Line Style Arrow Excel Length
344 * @param string $arrow
346 * @return string
349 public function getLineStyleArrowLength($arrow) {
350 return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len');
354 * Set Shadow Properties
356 * @param int $shadow_presets
357 * @param string $sh_color_value
358 * @param string $sh_color_type
359 * @param string $sh_color_alpha
360 * @param float $sh_blur
361 * @param int $sh_angle
362 * @param float $sh_distance
366 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) {
367 $this
368 ->_setShadowPresetsProperties((int) $sh_presets)
369 ->_setShadowColor(
370 is_null($sh_color_value) ? $this->_shadow_properties['color']['value'] : $sh_color_value
371 , is_null($sh_color_alpha) ? (int) $this->_shadow_properties['color']['alpha'] : $sh_color_alpha
372 , is_null($sh_color_type) ? $this->_shadow_properties['color']['type'] : $sh_color_type)
373 ->_setShadowBlur($sh_blur)
374 ->_setShadowAngle($sh_angle)
375 ->_setShadowDistance($sh_distance);
379 * Set Shadow Color
381 * @param int $shadow_presets
383 * @return PHPExcel_Chart_Axis
386 private function _setShadowPresetsProperties($shadow_presets) {
387 $this->_shadow_properties['presets'] = $shadow_presets;
388 $this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
390 return $this;
394 * Set Shadow Properties from Maped Values
396 * @param array $properties_map
397 * @param * $reference
399 * @return PHPExcel_Chart_Axis
402 private function _setShadowProperiesMapValues(array $properties_map, &$reference = NULL) {
403 $base_reference = $reference;
404 foreach ($properties_map as $property_key => $property_val) {
405 if (is_array($property_val)) {
406 if ($reference === NULL) {
407 $reference = & $this->_shadow_properties[$property_key];
408 } else {
409 $reference = & $reference[$property_key];
411 $this->_setShadowProperiesMapValues($property_val, $reference);
412 } else {
413 if ($base_reference === NULL) {
414 $this->_shadow_properties[$property_key] = $property_val;
415 } else {
416 $reference[$property_key] = $property_val;
421 return $this;
425 * Set Shadow Color
427 * @param string $color
428 * @param int $alpha
429 * @param string $type
431 * @return PHPExcel_Chart_Axis
434 private function _setShadowColor($color, $alpha, $type) {
435 $this->_shadow_properties['color'] = $this->setColorProperties($color, $alpha, $type);
437 return $this;
441 * Set Shadow Blur
443 * @param float $blur
445 * @return PHPExcel_Chart_Axis
448 private function _setShadowBlur($blur) {
449 if ($blur !== NULL) {
450 $this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur);
453 return $this;
457 * Set Shadow Angle
459 * @param int $angle
461 * @return PHPExcel_Chart_Axis
464 private function _setShadowAngle($angle) {
465 if ($angle !== NULL) {
466 $this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle);
469 return $this;
473 * Set Shadow Distance
475 * @param float $distance
477 * @return PHPExcel_Chart_Axis
480 private function _setShadowDistance($distance) {
481 if ($distance !== NULL) {
482 $this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance);
485 return $this;
489 * Get Glow Property
491 * @param float $size
492 * @param string $color_value
493 * @param int $color_alpha
494 * @param string $color_type
497 public function getShadowProperty($elements) {
498 return $this->getArrayElementsValue($this->_shadow_properties, $elements);
502 * Set Glow Properties
504 * @param float $size
505 * @param string $color_value
506 * @param int $color_alpha
507 * @param string $color_type
510 public function setGlowProperties($size, $color_value = NULL, $color_alpha = NULL, $color_type = NULL) {
511 $this
512 ->_setGlowSize($size)
513 ->_setGlowColor(
514 is_null($color_value) ? $this->_glow_properties['color']['value'] : $color_value
515 , is_null($color_alpha) ? (int) $this->_glow_properties['color']['alpha'] : $color_alpha
516 , is_null($color_type) ? $this->_glow_properties['color']['type'] : $color_type);
520 * Get Glow Property
522 * @param array|string $property
524 * @return string
527 public function getGlowProperty($property) {
528 return $this->getArrayElementsValue($this->_glow_properties, $property);
532 * Set Glow Color
534 * @param float $size
536 * @return PHPExcel_Chart_Axis
539 private function _setGlowSize($size) {
540 if (!is_null($size)) {
541 $this->_glow_properties['size'] = $this->getExcelPointsWidth($size);
544 return $this;
548 * Set Glow Color
550 * @param string $color
551 * @param int $alpha
552 * @param string $type
554 * @return PHPExcel_Chart_Axis
557 private function _setGlowColor($color, $alpha, $type) {
558 $this->_glow_properties['color'] = $this->setColorProperties($color, $alpha, $type);
560 return $this;
564 * Set Soft Edges Size
566 * @param float $size
569 public function setSoftEdges($size) {
570 if (!is_null($size)) {
571 $_soft_edges['size'] = (string) $this->getExcelPointsWidth($size);
576 * Get Soft Edges Size
578 * @return string
581 public function getSoftEdgesSize() {
582 return $this->_soft_edges['size'];