[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * PHPExcel 4 * 5 * Copyright (c) 2006 - 2012 PHPExcel 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 * 21 * @category PHPExcel 22 * @package PHPExcel_Chart 23 * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) 24 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL 25 * @version 1.7.7, 2012-05-19 26 */ 27 28 29 /** 30 * PHPExcel_Chart_DataSeriesValues 31 * 32 * @category PHPExcel 33 * @package PHPExcel_Chart 34 * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) 35 */ 36 class PHPExcel_Chart_DataSeriesValues 37 { 38 39 /** 40 * Series Data Type 41 * 42 * @var string 43 */ 44 private $_dataType = null; 45 46 /** 47 * Series Data Source 48 * 49 * @var string 50 */ 51 private $_dataSource = null; 52 53 /** 54 * Format Code 55 * 56 * @var string 57 */ 58 private $_formatCode = null; 59 60 /** 61 * Series Point Marker 62 * 63 * @var string 64 */ 65 private $_marker = null; 66 67 /** 68 * Point Count (The number of datapoints in the dataseries) 69 * 70 * @var integer 71 */ 72 private $_pointCount = 0; 73 74 /** 75 * Data Values 76 * 77 * @var array of mixed 78 */ 79 private $_dataValues = array(); 80 81 /** 82 * Create a new PHPExcel_Chart_DataSeriesValues object 83 */ 84 public function __construct($dataType = null, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null) 85 { 86 $this->_dataType = $dataType; 87 $this->_dataSource = $dataSource; 88 $this->_formatCode = $formatCode; 89 $this->_pointCount = $pointCount; 90 $this->_dataValues = $dataValues; 91 $this->_marker = $marker; 92 } 93 94 /** 95 * Get Series Data Type 96 * 97 * @return string 98 */ 99 public function getDataType() { 100 return $this->_dataType; 101 } 102 103 /** 104 * Set Series Data Type 105 * 106 * @param string $dataType 107 * @return PHPExcel_Chart_DataSeriesValues 108 */ 109 public function setDataType($dataType = 'Number') { 110 $this->_dataType = $dataType; 111 112 return $this; 113 } 114 115 /** 116 * Get Series Data Source (formula) 117 * 118 * @return string 119 */ 120 public function getDataSource() { 121 return $this->_dataSource; 122 } 123 124 /** 125 * Set Series Data Source (formula) 126 * 127 * @param string $dataSource 128 * @return PHPExcel_Chart_DataSeriesValues 129 */ 130 public function setDataSource($dataSource = null, $refreshDataValues = true) { 131 $this->_dataSource = $dataSource; 132 133 if ($refreshDataValues) { 134 // TO DO 135 } 136 137 return $this; 138 } 139 140 /** 141 * Get Point Marker 142 * 143 * @return string 144 */ 145 public function getPointMarker() { 146 return $this->_marker; 147 } 148 149 /** 150 * Set Point Marker 151 * 152 * @param string $marker 153 * @return PHPExcel_Chart_DataSeriesValues 154 */ 155 public function setPointMarker($marker = null) { 156 $this->_marker = $marker; 157 158 return $this; 159 } 160 161 /** 162 * Get Series Format Code 163 * 164 * @return string 165 */ 166 public function getFormatCode() { 167 return $this->_formatCode; 168 } 169 170 /** 171 * Set Series Format Code 172 * 173 * @param string $formatCode 174 * @return PHPExcel_Chart_DataSeriesValues 175 */ 176 public function setFormatCode($formatCode = null) { 177 $this->_formatCode = $formatCode; 178 179 return $this; 180 } 181 182 /** 183 * Get Series Point Count 184 * 185 * @return integer 186 */ 187 public function getPointCount() { 188 return $this->_pointCount; 189 } 190 191 /** 192 * Identify if the Data Series is a multi-level or a simple series 193 * 194 * @return boolean 195 */ 196 public function isMultiLevelSeries() { 197 if (count($this->_dataValues) > 0) { 198 return is_array($this->_dataValues[0]); 199 } 200 return null; 201 } 202 203 /** 204 * Return the level count of a multi-level Data Series 205 * 206 * @return boolean 207 */ 208 public function multiLevelCount() { 209 $levelCount = 0; 210 foreach($this->_dataValues as $dataValueSet) { 211 $levelCount = max($levelCount,count($dataValueSet)); 212 } 213 return $levelCount; 214 } 215 216 /** 217 * Get Series Data Values 218 * 219 * @return array of mixed 220 */ 221 public function getDataValues() { 222 return $this->_dataValues; 223 } 224 225 /** 226 * Get the first Series Data value 227 * 228 * @return mixed 229 */ 230 public function getDataValue() { 231 $count = count($this->_dataValues); 232 if ($count == 0) { 233 return null; 234 } elseif ($count == 1) { 235 return $this->_dataValues[0]; 236 } 237 return $this->_dataValues; 238 } 239 240 /** 241 * Set Series Data Values 242 * 243 * @param array $dataValues 244 * @param boolean $refreshDataSource 245 * TRUE - refresh the value of _dataSource based on the values of $dataValues 246 * FALSE - don't change the value of _dataSource 247 * @return PHPExcel_Chart_DataSeriesValues 248 */ 249 public function setDataValues($dataValues = array(), $refreshDataSource = true) { 250 $this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues); 251 $this->_pointCount = count($dataValues); 252 253 if ($refreshDataSource) { 254 // TO DO 255 } 256 257 return $this; 258 } 259 260 public function refresh(PHPExcel_Worksheet $worksheet) { 261 if ($this->_dataSource !== NULL) { 262 $calcEngine = PHPExcel_Calculation::getInstance(); 263 $this->_dataValues = PHPExcel_Calculation::_unwrapResult( 264 $calcEngine->_calculateFormulaValue( 265 $this->_dataSource 266 ) 267 ); 268 } 269 } 270 271 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |