[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * PHPExcel_Chart_Legend 5 * 6 * Copyright (c) 2006 - 2015 PHPExcel 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2.1 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 * 22 * @category PHPExcel 23 * @package PHPExcel_Chart 24 * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) 25 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL 26 * @version ##VERSION##, ##DATE## 27 */ 28 class PHPExcel_Chart_Legend 29 { 30 /** Legend positions */ 31 const xlLegendPositionBottom = -4107; // Below the chart. 32 const xlLegendPositionCorner = 2; // In the upper right-hand corner of the chart border. 33 const xlLegendPositionCustom = -4161; // A custom position. 34 const xlLegendPositionLeft = -4131; // Left of the chart. 35 const xlLegendPositionRight = -4152; // Right of the chart. 36 const xlLegendPositionTop = -4160; // Above the chart. 37 38 const POSITION_RIGHT = 'r'; 39 const POSITION_LEFT = 'l'; 40 const POSITION_BOTTOM = 'b'; 41 const POSITION_TOP = 't'; 42 const POSITION_TOPRIGHT = 'tr'; 43 44 private static $positionXLref = array( 45 self::xlLegendPositionBottom => self::POSITION_BOTTOM, 46 self::xlLegendPositionCorner => self::POSITION_TOPRIGHT, 47 self::xlLegendPositionCustom => '??', 48 self::xlLegendPositionLeft => self::POSITION_LEFT, 49 self::xlLegendPositionRight => self::POSITION_RIGHT, 50 self::xlLegendPositionTop => self::POSITION_TOP 51 ); 52 53 /** 54 * Legend position 55 * 56 * @var string 57 */ 58 private $position = self::POSITION_RIGHT; 59 60 /** 61 * Allow overlay of other elements? 62 * 63 * @var boolean 64 */ 65 private $overlay = true; 66 67 /** 68 * Legend Layout 69 * 70 * @var PHPExcel_Chart_Layout 71 */ 72 private $layout = null; 73 74 75 /** 76 * Create a new PHPExcel_Chart_Legend 77 */ 78 public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = null, $overlay = false) 79 { 80 $this->setPosition($position); 81 $this->layout = $layout; 82 $this->setOverlay($overlay); 83 } 84 85 /** 86 * Get legend position as an excel string value 87 * 88 * @return string 89 */ 90 public function getPosition() 91 { 92 return $this->position; 93 } 94 95 /** 96 * Get legend position using an excel string value 97 * 98 * @param string $position 99 */ 100 public function setPosition($position = self::POSITION_RIGHT) 101 { 102 if (!in_array($position, self::$positionXLref)) { 103 return false; 104 } 105 106 $this->position = $position; 107 return true; 108 } 109 110 /** 111 * Get legend position as an Excel internal numeric value 112 * 113 * @return number 114 */ 115 public function getPositionXL() 116 { 117 return array_search($this->position, self::$positionXLref); 118 } 119 120 /** 121 * Set legend position using an Excel internal numeric value 122 * 123 * @param number $positionXL 124 */ 125 public function setPositionXL($positionXL = self::xlLegendPositionRight) 126 { 127 if (!array_key_exists($positionXL, self::$positionXLref)) { 128 return false; 129 } 130 131 $this->position = self::$positionXLref[$positionXL]; 132 return true; 133 } 134 135 /** 136 * Get allow overlay of other elements? 137 * 138 * @return boolean 139 */ 140 public function getOverlay() 141 { 142 return $this->overlay; 143 } 144 145 /** 146 * Set allow overlay of other elements? 147 * 148 * @param boolean $overlay 149 * @return boolean 150 */ 151 public function setOverlay($overlay = false) 152 { 153 if (!is_bool($overlay)) { 154 return false; 155 } 156 157 $this->overlay = $overlay; 158 return true; 159 } 160 161 /** 162 * Get Layout 163 * 164 * @return PHPExcel_Chart_Layout 165 */ 166 public function getLayout() 167 { 168 return $this->layout; 169 } 170 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |