| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * PHPExcel | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2012-03-03 21:08:29 +00:00
										 |  |  |  * Copyright (c) 2006 - 2012 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 | 
					
						
							| 
									
										
										
										
											2012-03-03 21:08:29 +00:00
										 |  |  |  * @copyright	Copyright (c) 2006 - 2012 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 | 
					
						
							| 
									
										
										
										
											2012-03-03 21:08:29 +00:00
										 |  |  |  * @copyright	Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | class PHPExcel_Chart_DataSeriesValues | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function __construct($dataType = null, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		$this->_dataType = $dataType; | 
					
						
							|  |  |  | 		$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-03-11 17:58:38 +00:00
										 |  |  | 	 * @param	string	$dataType | 
					
						
							|  |  |  | 	 * @return	PHPExcel_Chart_DataSeriesValues | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function setDataType($dataType = 'Number') { | 
					
						
							|  |  |  | 		$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
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public function setDataValues($dataValues = array(), $refreshDataSource = true) { | 
					
						
							|  |  |  | 		$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues); | 
					
						
							|  |  |  | 		$this->_pointCount = count($dataValues); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if ($refreshDataSource) { | 
					
						
							|  |  |  | 			//	TO DO
 | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		return $this; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-07 20:54:55 +00:00
										 |  |  | 	public function refresh(PHPExcel_Worksheet $worksheet) { | 
					
						
							| 
									
										
										
										
											2012-04-07 23:15:41 +00:00
										 |  |  |         if ($this->_dataSource !== NULL) { | 
					
						
							| 
									
										
										
										
											2012-04-07 20:54:55 +00:00
										 |  |  |         	$calcEngine = PHPExcel_Calculation::getInstance(); | 
					
						
							|  |  |  | 			$this->_dataValues = PHPExcel_Calculation::_unwrapResult( | 
					
						
							|  |  |  | 			    $calcEngine->_calculateFormulaValue( | 
					
						
							|  |  |  | 			        $this->_dataSource | 
					
						
							|  |  |  | 			    ) | 
					
						
							|  |  |  | 			); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-08 21:17:39 +00:00
										 |  |  | } |