123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <?php
- class PHPExcel_Chart_Legend
- {
-
- const xlLegendPositionBottom = -4107;
- const xlLegendPositionCorner = 2;
- const xlLegendPositionCustom = -4161;
- const xlLegendPositionLeft = -4131;
- const xlLegendPositionRight = -4152;
- const xlLegendPositionTop = -4160;
- const POSITION_RIGHT = 'r';
- const POSITION_LEFT = 'l';
- const POSITION_BOTTOM = 'b';
- const POSITION_TOP = 't';
- const POSITION_TOPRIGHT = 'tr';
- private static $_positionXLref = array( self::xlLegendPositionBottom => self::POSITION_BOTTOM,
- self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
- self::xlLegendPositionCustom => '??',
- self::xlLegendPositionLeft => self::POSITION_LEFT,
- self::xlLegendPositionRight => self::POSITION_RIGHT,
- self::xlLegendPositionTop => self::POSITION_TOP
- );
-
- private $_position = self::POSITION_RIGHT;
-
- private $_overlay = TRUE;
-
- private $_layout = NULL;
-
- public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = NULL, $overlay = FALSE)
- {
- $this->setPosition($position);
- $this->_layout = $layout;
- $this->setOverlay($overlay);
- }
-
- public function getPosition() {
- return $this->_position;
- }
-
- public function setPosition($position = self::POSITION_RIGHT) {
- if (!in_array($position,self::$_positionXLref)) {
- return false;
- }
- $this->_position = $position;
- return true;
- }
-
- public function getPositionXL() {
- return array_search($this->_position,self::$_positionXLref);
- }
-
- public function setPositionXL($positionXL = self::xlLegendPositionRight) {
- if (!array_key_exists($positionXL,self::$_positionXLref)) {
- return false;
- }
- $this->_position = self::$_positionXLref[$positionXL];
- return true;
- }
-
- public function getOverlay() {
- return $this->_overlay;
- }
-
- public function setOverlay($overlay = FALSE) {
- if (!is_bool($overlay)) {
- return false;
- }
- $this->_overlay = $overlay;
- return true;
- }
-
- public function getLayout() {
- return $this->_layout;
- }
- }
|