| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * PHPExcel | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2015-05-02 22:50:37 +00:00
										 |  |  |  * Copyright (c) 2006 - 2015 PHPExcel | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * This library is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU Lesser General Public | 
					
						
							|  |  |  |  * License as published by the Free Software Foundation; either | 
					
						
							|  |  |  |  * version 2.1 of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This library is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
					
						
							|  |  |  |  * Lesser General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU Lesser General Public | 
					
						
							|  |  |  |  * License along with this library; if not, write to the Free Software | 
					
						
							|  |  |  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @category	PHPExcel | 
					
						
							|  |  |  |  * @package		PHPExcel_Chart | 
					
						
							| 
									
										
										
										
											2015-05-02 22:50:37 +00:00
										 |  |  |  * @copyright	Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  |  * @license		http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL | 
					
						
							|  |  |  |  * @version		##VERSION##, ##DATE##
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * PHPExcel_Chart_DataSeriesValues | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @category	PHPExcel | 
					
						
							|  |  |  |  * @package		PHPExcel_Chart | 
					
						
							| 
									
										
										
										
											2015-05-02 22:50:37 +00:00
										 |  |  |  * @copyright	Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | class PHPExcel_Chart_DataSeriesValues | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-24 12:34:57 +00:00
										 |  |  | 	const DATASERIES_TYPE_STRING	= 'String'; | 
					
						
							|  |  |  | 	const DATASERIES_TYPE_NUMBER	= 'Number'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	private static $_dataTypeValues = array( | 
					
						
							|  |  |  | 		self::DATASERIES_TYPE_STRING, | 
					
						
							|  |  |  | 		self::DATASERIES_TYPE_NUMBER, | 
					
						
							|  |  |  | 	); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Series Data Type | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @var	string | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private $_dataType = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Series Data Source | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @var	string | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private $_dataSource = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Format Code | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @var	string | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private $_formatCode = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Series Point Marker | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @var	string | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private $_marker = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Point Count (The number of datapoints in the dataseries) | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @var	integer | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private $_pointCount = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Data Values | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @var	array of mixed | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private $_dataValues = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Create a new PHPExcel_Chart_DataSeriesValues object | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2012-06-24 12:34:57 +00:00
										 |  |  | 	public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null) | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2012-06-24 12:34:57 +00:00
										 |  |  | 		$this->setDataType($dataType); | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 		$this->_dataSource = $dataSource; | 
					
						
							|  |  |  | 		$this->_formatCode = $formatCode; | 
					
						
							|  |  |  | 		$this->_pointCount = $pointCount; | 
					
						
							|  |  |  | 		$this->_dataValues = $dataValues; | 
					
						
							|  |  |  | 		$this->_marker = $marker; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Get Series Data Type | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @return	string | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function getDataType() { | 
					
						
							|  |  |  | 		return $this->_dataType; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Set Series Data Type | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-06-24 12:34:57 +00:00
										 |  |  | 	 * @param	string	$dataType	Datatype of this data series | 
					
						
							|  |  |  | 	 *								Typical values are: | 
					
						
							|  |  |  | 	 *									PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_STRING | 
					
						
							|  |  |  | 	 *										Normally used for axis point values | 
					
						
							|  |  |  | 	 *									PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_NUMBER | 
					
						
							|  |  |  | 	 *										Normally used for chart data values | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @return	PHPExcel_Chart_DataSeriesValues | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2012-06-24 12:34:57 +00:00
										 |  |  | 	public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER) { | 
					
						
							|  |  |  | 		if (!in_array($dataType, self::$_dataTypeValues)) { | 
					
						
							|  |  |  |     		throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values'); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 		$this->_dataType = $dataType; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		return $this; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Get Series Data Source (formula) | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @return	string | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function getDataSource() { | 
					
						
							|  |  |  | 		return $this->_dataSource; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Set Series Data Source (formula) | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @param	string	$dataSource | 
					
						
							|  |  |  | 	 * @return	PHPExcel_Chart_DataSeriesValues | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function setDataSource($dataSource = null, $refreshDataValues = true) { | 
					
						
							|  |  |  | 		$this->_dataSource = $dataSource; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if ($refreshDataValues) { | 
					
						
							|  |  |  | 			//	TO DO
 | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		return $this; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Get Point Marker | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @return string | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function getPointMarker() { | 
					
						
							|  |  |  | 		return $this->_marker; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Set Point Marker | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @param	string	$marker | 
					
						
							|  |  |  | 	 * @return	PHPExcel_Chart_DataSeriesValues | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function setPointMarker($marker = null) { | 
					
						
							|  |  |  | 		$this->_marker = $marker; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		return $this; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Get Series Format Code | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @return	string | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function getFormatCode() { | 
					
						
							|  |  |  | 		return $this->_formatCode; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Set Series Format Code | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @param	string	$formatCode | 
					
						
							|  |  |  | 	 * @return	PHPExcel_Chart_DataSeriesValues | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function setFormatCode($formatCode = null) { | 
					
						
							|  |  |  | 		$this->_formatCode = $formatCode; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		return $this; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Get Series Point Count | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @return	integer | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function getPointCount() { | 
					
						
							|  |  |  | 		return $this->_pointCount; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Identify if the Data Series is a multi-level or a simple series | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @return	boolean | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function isMultiLevelSeries() { | 
					
						
							|  |  |  | 		if (count($this->_dataValues) > 0) { | 
					
						
							|  |  |  | 			return is_array($this->_dataValues[0]); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return null; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Return the level count of a multi-level Data Series | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @return	boolean | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function multiLevelCount() { | 
					
						
							|  |  |  | 		$levelCount = 0; | 
					
						
							|  |  |  | 		foreach($this->_dataValues as $dataValueSet) { | 
					
						
							|  |  |  | 			$levelCount = max($levelCount,count($dataValueSet)); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return $levelCount; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Get Series Data Values | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @return	array of mixed | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function getDataValues() { | 
					
						
							|  |  |  | 		return $this->_dataValues; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Get the first Series Data value | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @return	mixed | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function getDataValue() { | 
					
						
							|  |  |  | 		$count = count($this->_dataValues); | 
					
						
							|  |  |  | 		if ($count == 0) { | 
					
						
							|  |  |  | 			return null; | 
					
						
							|  |  |  | 		} elseif ($count == 1) { | 
					
						
							|  |  |  | 			return $this->_dataValues[0]; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return $this->_dataValues; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Set Series Data Values | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @param	array	$dataValues | 
					
						
							|  |  |  | 	 * @param	boolean	$refreshDataSource | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 *					TRUE - refresh the value of _dataSource based on the values of $dataValues | 
					
						
							|  |  |  | 	 *					FALSE - don't change the value of _dataSource | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @return	PHPExcel_Chart_DataSeriesValues | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2012-10-10 11:31:05 +00:00
										 |  |  | 	public function setDataValues($dataValues = array(), $refreshDataSource = TRUE) { | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 		$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues); | 
					
						
							|  |  |  | 		$this->_pointCount = count($dataValues); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if ($refreshDataSource) { | 
					
						
							|  |  |  | 			//	TO DO
 | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		return $this; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-21 10:52:20 +00:00
										 |  |  | 	private function _stripNulls($var) { | 
					
						
							|  |  |  | 		return $var !== NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-10 11:31:05 +00:00
										 |  |  | 	public function refresh(PHPExcel_Worksheet $worksheet, $flatten = TRUE) { | 
					
						
							| 
									
										
										
										
											2012-04-07 23:15:41 +00:00
										 |  |  |         if ($this->_dataSource !== NULL) { | 
					
						
							| 
									
										
										
										
											2013-02-11 14:11:36 +00:00
										 |  |  |         	$calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent()); | 
					
						
							| 
									
										
										
										
											2012-07-21 10:52:20 +00:00
										 |  |  | 			$newDataValues = PHPExcel_Calculation::_unwrapResult( | 
					
						
							| 
									
										
										
										
											2012-04-07 20:54:55 +00:00
										 |  |  | 			    $calcEngine->_calculateFormulaValue( | 
					
						
							| 
									
										
										
										
											2012-07-21 10:52:20 +00:00
										 |  |  | 			        '='.$this->_dataSource, | 
					
						
							|  |  |  | 			        NULL, | 
					
						
							|  |  |  | 			        $worksheet->getCell('A1') | 
					
						
							| 
									
										
										
										
											2012-04-07 20:54:55 +00:00
										 |  |  | 			    ) | 
					
						
							|  |  |  | 			); | 
					
						
							| 
									
										
										
										
											2012-10-10 11:31:05 +00:00
										 |  |  | 			if ($flatten) { | 
					
						
							|  |  |  | 				$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); | 
					
						
							| 
									
										
										
										
											2012-10-26 23:02:38 +00:00
										 |  |  | 				foreach($this->_dataValues as &$dataValue) { | 
					
						
							|  |  |  | 					if ((!empty($dataValue)) && ($dataValue[0] == '#')) { | 
					
						
							|  |  |  | 						$dataValue = 0.0; | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				unset($dataValue); | 
					
						
							| 
									
										
										
										
											2012-10-10 11:31:05 +00:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2012-10-13 16:24:11 +00:00
										 |  |  | 				$cellRange = explode('!',$this->_dataSource); | 
					
						
							|  |  |  | 				if (count($cellRange) > 1) { | 
					
						
							|  |  |  | 					list(,$cellRange) = $cellRange; | 
					
						
							| 
									
										
										
										
											2012-10-10 11:31:05 +00:00
										 |  |  | 				} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-13 16:24:11 +00:00
										 |  |  | 				$dimensions = PHPExcel_Cell::rangeDimension(str_replace('$','',$cellRange)); | 
					
						
							|  |  |  | 				if (($dimensions[0] == 1) || ($dimensions[1] == 1)) { | 
					
						
							|  |  |  | 					$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); | 
					
						
							|  |  |  | 				} else { | 
					
						
							|  |  |  | 					$newArray = array_values(array_shift($newDataValues)); | 
					
						
							|  |  |  | 					foreach($newArray as $i => $newDataSet) { | 
					
						
							|  |  |  | 						$newArray[$i] = array($newDataSet); | 
					
						
							| 
									
										
										
										
											2012-10-10 11:31:05 +00:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2012-10-13 16:24:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 					foreach($newDataValues as $newDataSet) { | 
					
						
							|  |  |  | 						$i = 0; | 
					
						
							|  |  |  | 						foreach($newDataSet as $newDataVal) { | 
					
						
							|  |  |  | 							array_unshift($newArray[$i++],$newDataVal); | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					$this->_dataValues = $newArray; | 
					
						
							| 
									
										
										
										
											2012-10-10 11:31:05 +00:00
										 |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			$this->_pointCount = count($this->_dataValues); | 
					
						
							| 
									
										
										
										
											2012-04-07 20:54:55 +00:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2012-10-10 11:31:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-07 20:54:55 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | } |