ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
Axis.php
Go to the documentation of this file.
1 <?php
2 require_once 'Properties.php';
3 
11 class PHPExcel_Chart_Axis extends
13 
20  private
22  'format' => self::FORMAT_CODE_GENERAL,
23  'source_linked' => 1
24  );
25 
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
43  );
44 
52  'type' => self::EXCEL_COLOR_TYPE_ARGB,
53  'value' => NULL,
54  'alpha' => 0
55  );
56 
64  'type' => self::EXCEL_COLOR_TYPE_ARGB,
65  'value' => NULL,
66  'alpha' => 0
67  );
68 
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
85  ),
86  'end' => array(
87  'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
88  'size' => self::LINE_STYLE_ARROW_SIZE_8
89  ),
90  )
91  );
92 
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,
106  ),
107  'size' => array(
108  'sx' => NULL,
109  'sy' => NULL,
110  'kx' => NULL
111  ),
112  'blur' => NULL,
113  'direction' => NULL,
114  'distance' => NULL,
115  'algn' => NULL,
116  'rotWithShape' => NULL
117  );
118 
126  'size' => NULL,
127  'color' => array(
128  'type' => self::EXCEL_COLOR_TYPE_STANDARD,
129  'value' => 'black',
130  'alpha' => 40
131  )
132  );
133 
140  private $_soft_edges = array(
141  'size' => NULL
142  );
143 
150  public function setAxisNumberProperties($format_code) {
151  $this->_axis_number['format'] = (string) $format_code;
152  $this->_axis_number['source_linked'] = 0;
153  }
154 
161  public function getAxisNumberFormat() {
162  return $this->_axis_number['format'];
163  }
164 
171  public function getAxisNumberSourceLinked() {
172  return (string) $this->_axis_number['source_linked'];
173  }
174 
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) {
194 
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;
207  }
208 
217  public function getAxisOptionsProperty($property) {
218  return $this->_axis_options[$property];
219  }
220 
228  public function setAxisOrientation($orientation) {
229  $this->orientation = (string) $orientation;
230  }
231 
241  public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) {
242  $this->_fill_properties = $this->setColorProperties($color, $alpha, $type);
243  }
244 
254  public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) {
255  $this->_line_properties = $this->setColorProperties($color, $alpha, $type);
256  }
257 
266  public function getFillProperty($property) {
267  return $this->_fill_properties[$property];
268  }
269 
278  public function getLineProperty($property) {
279  return $this->_line_properties[$property];
280  }
281 
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) {
300 
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;
315  }
316 
325  public function getLineStyleProperty($elements) {
326  return $this->getArrayElementsValue($this->_line_style_properties, $elements);
327  }
328 
337  public function getLineStyleArrowWidth($arrow) {
338  return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'w');
339  }
340 
349  public function getLineStyleArrowLength($arrow) {
350  return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len');
351  }
352 
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);
376  }
377 
386  private function _setShadowPresetsProperties($shadow_presets) {
387  $this->_shadow_properties['presets'] = $shadow_presets;
388  $this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
389 
390  return $this;
391  }
392 
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];
410  }
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;
417  }
418  }
419  }
420 
421  return $this;
422  }
423 
434  private function _setShadowColor($color, $alpha, $type) {
435  $this->_shadow_properties['color'] = $this->setColorProperties($color, $alpha, $type);
436 
437  return $this;
438  }
439 
448  private function _setShadowBlur($blur) {
449  if ($blur !== NULL) {
450  $this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur);
451  }
452 
453  return $this;
454  }
455 
464  private function _setShadowAngle($angle) {
465  if ($angle !== NULL) {
466  $this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle);
467  }
468 
469  return $this;
470  }
471 
480  private function _setShadowDistance($distance) {
481  if ($distance !== NULL) {
482  $this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance);
483  }
484 
485  return $this;
486  }
487 
497  public function getShadowProperty($elements) {
498  return $this->getArrayElementsValue($this->_shadow_properties, $elements);
499  }
500 
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);
517  }
518 
527  public function getGlowProperty($property) {
528  return $this->getArrayElementsValue($this->_glow_properties, $property);
529  }
530 
539  private function _setGlowSize($size) {
540  if (!is_null($size)) {
541  $this->_glow_properties['size'] = $this->getExcelPointsWidth($size);
542  }
543 
544  return $this;
545  }
546 
557  private function _setGlowColor($color, $alpha, $type) {
558  $this->_glow_properties['color'] = $this->setColorProperties($color, $alpha, $type);
559 
560  return $this;
561  }
562 
569  public function setSoftEdges($size) {
570  if (!is_null($size)) {
571  $_soft_edges['size'] = (string) $this->getExcelPointsWidth($size);
572  }
573  }
574 
581  public function getSoftEdgesSize() {
582  return $this->_soft_edges['size'];
583  }
584 }
getShadowProperty($elements)
Get Glow Property.
Definition: Axis.php:497
getLineStyleArrowSize($array_selector, $array_kay_selector)
Definition: Properties.php:136
setFillParameters($color, $alpha=0, $type=self::EXCEL_COLOR_TYPE_ARGB)
Set Fill Property.
Definition: Axis.php:241
_setShadowColor($color, $alpha, $type)
Set Shadow Color.
Definition: Axis.php:434
$size
Definition: RandomTest.php:79
getArrayElementsValue($properties, $elements)
Definition: Properties.php:344
getShadowPresetsMap($shadow_presets_option)
Definition: Properties.php:152
_setShadowBlur($blur)
Set Shadow Blur.
Definition: Axis.php:448
Created by PhpStorm.
Definition: Axis.php:11
Add rich text string
The name of the decorator.
setColorProperties($color, $alpha, $type)
Definition: Properties.php:128
setGlowProperties($size, $color_value=NULL, $color_alpha=NULL, $color_type=NULL)
Set Glow Properties.
Definition: Axis.php:510
$angle
getLineProperty($property)
Get Line Property.
Definition: Axis.php:278
getExcelPointsAngle($angle)
Definition: Properties.php:120
getAxisOptionsProperty($property)
Get Axis Options Property.
Definition: Axis.php:217
getSoftEdgesSize()
Get Soft Edges Size.
Definition: Axis.php:581
setAxisOrientation($orientation)
Set Axis Orientation Property.
Definition: Axis.php:228
getGlowProperty($property)
Get Glow Property.
Definition: Axis.php:527
_setShadowPresetsProperties($shadow_presets)
Set Shadow Color.
Definition: Axis.php:386
getLineStyleProperty($elements)
Get Line Style Property.
Definition: Axis.php:325
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:297
setSoftEdges($size)
Set Soft Edges Size.
Definition: Axis.php:569
_setShadowProperiesMapValues(array $properties_map, &$reference=NULL)
Set Shadow Properties from Maped Values.
Definition: Axis.php:402
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:191
Create styles array
The data for the language used.
getAxisNumberFormat()
Get Axis Number Format Data Type.
Definition: Axis.php:161
getLineStyleArrowWidth($arrow)
Get Line Style Arrow Excel Width.
Definition: Axis.php:337
setLineParameters($color, $alpha=0, $type=self::EXCEL_COLOR_TYPE_ARGB)
Set Line Property.
Definition: Axis.php:254
_setGlowColor($color, $alpha, $type)
Set Glow Color.
Definition: Axis.php:557
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:366
getAxisNumberSourceLinked()
Get Axis Number Source Linked.
Definition: Axis.php:171
_setShadowAngle($angle)
Set Shadow Angle.
Definition: Axis.php:464
_setGlowSize($size)
Set Glow Color.
Definition: Axis.php:539
_setShadowDistance($distance)
Set Shadow Distance.
Definition: Axis.php:480
Created by PhpStorm.
Definition: Properties.php:9
getFillProperty($property)
Get Fill Property.
Definition: Axis.php:266
getExcelPointsWidth($width)
Definition: Properties.php:116
setAxisNumberProperties($format_code)
Get Series Data Type.
Definition: Axis.php:150
getLineStyleArrowLength($arrow)
Get Line Style Arrow Excel Length.
Definition: Axis.php:349