ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Legend.php
Go to the documentation of this file.
1<?php
37{
39 const xlLegendPositionBottom = -4107; // Below the chart.
40 const xlLegendPositionCorner = 2; // In the upper right-hand corner of the chart border.
41 const xlLegendPositionCustom = -4161; // A custom position.
42 const xlLegendPositionLeft = -4131; // Left of the chart.
43 const xlLegendPositionRight = -4152; // Right of the chart.
44 const xlLegendPositionTop = -4160; // Above the chart.
45
46 const POSITION_RIGHT = 'r';
47 const POSITION_LEFT = 'l';
48 const POSITION_BOTTOM = 'b';
49 const POSITION_TOP = 't';
50 const POSITION_TOPRIGHT = 'tr';
51
52 private static $_positionXLref = array( self::xlLegendPositionBottom => self::POSITION_BOTTOM,
53 self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
54 self::xlLegendPositionCustom => '??',
55 self::xlLegendPositionLeft => self::POSITION_LEFT,
56 self::xlLegendPositionRight => self::POSITION_RIGHT,
57 self::xlLegendPositionTop => self::POSITION_TOP
58 );
59
66
72 private $_overlay = TRUE;
73
79 private $_layout = NULL;
80
81
85 public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = NULL, $overlay = FALSE)
86 {
87 $this->setPosition($position);
88 $this->_layout = $layout;
89 $this->setOverlay($overlay);
90 }
91
97 public function getPosition() {
98 return $this->_position;
99 }
100
106 public function setPosition($position = self::POSITION_RIGHT) {
107 if (!in_array($position,self::$_positionXLref)) {
108 return false;
109 }
110
111 $this->_position = $position;
112 return true;
113 }
114
120 public function getPositionXL() {
121 return array_search($this->_position,self::$_positionXLref);
122 }
123
129 public function setPositionXL($positionXL = self::xlLegendPositionRight) {
130 if (!array_key_exists($positionXL,self::$_positionXLref)) {
131 return false;
132 }
133
134 $this->_position = self::$_positionXLref[$positionXL];
135 return true;
136 }
137
143 public function getOverlay() {
144 return $this->_overlay;
145 }
146
153 public function setOverlay($overlay = FALSE) {
154 if (!is_bool($overlay)) {
155 return false;
156 }
157
158 $this->_overlay = $overlay;
159 return true;
160 }
161
167 public function getLayout() {
168 return $this->_layout;
169 }
170
171}
An exception for terminatinating execution or to throw for unit testing.
getOverlay()
Get allow overlay of other elements?
Definition: Legend.php:143
static $_positionXLref
Definition: Legend.php:52
const xlLegendPositionCorner
Definition: Legend.php:40
getLayout()
Get Layout.
Definition: Legend.php:167
getPositionXL()
Get legend position as an Excel internal numeric value.
Definition: Legend.php:120
__construct($position=self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout=NULL, $overlay=FALSE)
Create a new PHPExcel_Chart_Legend.
Definition: Legend.php:85
const POSITION_TOPRIGHT
Definition: Legend.php:50
const xlLegendPositionTop
Definition: Legend.php:44
const xlLegendPositionLeft
Definition: Legend.php:42
setPosition($position=self::POSITION_RIGHT)
Get legend position using an excel string value.
Definition: Legend.php:106
setPositionXL($positionXL=self::xlLegendPositionRight)
Set legend position using an Excel internal numeric value.
Definition: Legend.php:129
const xlLegendPositionRight
Definition: Legend.php:43
const xlLegendPositionBottom
Legend positions.
Definition: Legend.php:39
getPosition()
Get legend position as an excel string value.
Definition: Legend.php:97
const xlLegendPositionCustom
Definition: Legend.php:41
setOverlay($overlay=FALSE)
Set allow overlay of other elements?
Definition: Legend.php:153