Subversion Repositories eFlore/Applications.cel

Rev

Rev 2388 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2388 jpm 1
<?php
2
/**
3
 * PHPExcel
4
 *
5
 * Copyright (c) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
24
 * @license		http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
25
 * @version	##VERSION##, ##DATE##
26
 */
27
 
28
 
29
/**
30
 * PHPExcel_Chart_DataSeries
31
 *
32
 * @category	PHPExcel
33
 * @package		PHPExcel_Chart
34
 * @copyright	Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
35
 */
36
class PHPExcel_Chart_DataSeries
37
{
38
 
39
	const TYPE_BARCHART			= 'barChart';
40
	const TYPE_BARCHART_3D		= 'bar3DChart';
41
	const TYPE_LINECHART		= 'lineChart';
42
	const TYPE_LINECHART_3D		= 'line3DChart';
43
	const TYPE_AREACHART		= 'areaChart';
44
	const TYPE_AREACHART_3D		= 'area3DChart';
45
	const TYPE_PIECHART			= 'pieChart';
46
	const TYPE_PIECHART_3D		= 'pie3DChart';
47
	const TYPE_DOUGHTNUTCHART	= 'doughnutChart';
48
	const TYPE_DONUTCHART		= self::TYPE_DOUGHTNUTCHART;	//	Synonym
49
	const TYPE_SCATTERCHART		= 'scatterChart';
50
	const TYPE_SURFACECHART		= 'surfaceChart';
51
	const TYPE_SURFACECHART_3D	= 'surface3DChart';
52
	const TYPE_RADARCHART		= 'radarChart';
53
	const TYPE_BUBBLECHART		= 'bubbleChart';
54
	const TYPE_STOCKCHART		= 'stockChart';
55
 
56
	const GROUPING_CLUSTERED			= 'clustered';
57
	const GROUPING_STACKED				= 'stacked';
58
	const GROUPING_PERCENT_STACKED		= 'percentStacked';
59
	const GROUPING_STANDARD				= 'standard';
60
 
61
	const DIRECTION_BAR			= 'bar';
62
	const DIRECTION_HORIZONTAL	= self::DIRECTION_BAR;
63
	const DIRECTION_COL			= 'col';
64
	const DIRECTION_COLUMN		= self::DIRECTION_COL;
65
	const DIRECTION_VERTICAL	= self::DIRECTION_COL;
66
 
67
	const STYLE_LINEMARKER		= 'lineMarker';
68
	const STYLE_SMOOTHMARKER	= 'smoothMarker';
69
	const STYLE_MARKER			= 'marker';
70
	const STYLE_FILLED			= 'filled';
71
 
72
 
73
	/**
74
	 * Series Plot Type
75
	 *
76
	 * @var string
77
	 */
78
	private $_plotType = null;
79
 
80
	/**
81
	 * Plot Grouping Type
82
	 *
83
	 * @var boolean
84
	 */
85
	private $_plotGrouping = null;
86
 
87
	/**
88
	 * Plot Direction
89
	 *
90
	 * @var boolean
91
	 */
92
	private $_plotDirection = null;
93
 
94
	/**
95
	 * Plot Style
96
	 *
97
	 * @var string
98
	 */
99
	private $_plotStyle = null;
100
 
101
	/**
102
	 * Order of plots in Series
103
	 *
104
	 * @var array of integer
105
	 */
106
	private $_plotOrder = array();
107
 
108
	/**
109
	 * Plot Label
110
	 *
111
	 * @var array of PHPExcel_Chart_DataSeriesValues
112
	 */
113
	private $_plotLabel = array();
114
 
115
	/**
116
	 * Plot Category
117
	 *
118
	 * @var array of PHPExcel_Chart_DataSeriesValues
119
	 */
120
	private $_plotCategory = array();
121
 
122
	/**
123
	 * Smooth Line
124
	 *
125
	 * @var string
126
	 */
127
	private $_smoothLine = null;
128
 
129
	/**
130
	 * Plot Values
131
	 *
132
	 * @var array of PHPExcel_Chart_DataSeriesValues
133
	 */
134
	private $_plotValues = array();
135
 
136
	/**
137
	 * Create a new PHPExcel_Chart_DataSeries
138
	 */
139
	public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $smoothLine = null, $plotStyle = null)
140
	{
141
		$this->_plotType = $plotType;
142
		$this->_plotGrouping = $plotGrouping;
143
		$this->_plotOrder = $plotOrder;
144
		$keys = array_keys($plotValues);
145
		$this->_plotValues = $plotValues;
146
		if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) {
147
			$plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
148
		}
149
 
150
		$this->_plotLabel = $plotLabel;
151
		if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) {
152
			$plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
153
		}
154
		$this->_plotCategory = $plotCategory;
155
		$this->_smoothLine = $smoothLine;
156
		$this->_plotStyle = $plotStyle;
157
	}
158
 
159
	/**
160
	 * Get Plot Type
161
	 *
162
	 * @return string
163
	 */
164
	public function getPlotType() {
165
		return $this->_plotType;
166
	}
167
 
168
	/**
169
	 * Set Plot Type
170
	 *
171
	 * @param string $plotType
172
	 */
173
	public function setPlotType($plotType = '') {
174
		$this->_plotType = $plotType;
175
	}
176
 
177
	/**
178
	 * Get Plot Grouping Type
179
	 *
180
	 * @return string
181
	 */
182
	public function getPlotGrouping() {
183
		return $this->_plotGrouping;
184
	}
185
 
186
	/**
187
	 * Set Plot Grouping Type
188
	 *
189
	 * @param string $groupingType
190
	 */
191
	public function setPlotGrouping($groupingType = null) {
192
		$this->_plotGrouping = $groupingType;
193
	}
194
 
195
	/**
196
	 * Get Plot Direction
197
	 *
198
	 * @return string
199
	 */
200
	public function getPlotDirection() {
201
		return $this->_plotDirection;
202
	}
203
 
204
	/**
205
	 * Set Plot Direction
206
	 *
207
	 * @param string $plotDirection
208
	 */
209
	public function setPlotDirection($plotDirection = null) {
210
		$this->_plotDirection = $plotDirection;
211
	}
212
 
213
	/**
214
	 * Get Plot Order
215
	 *
216
	 * @return string
217
	 */
218
	public function getPlotOrder() {
219
		return $this->_plotOrder;
220
	}
221
 
222
	/**
223
	 * Get Plot Labels
224
	 *
225
	 * @return array of PHPExcel_Chart_DataSeriesValues
226
	 */
227
	public function getPlotLabels() {
228
		return $this->_plotLabel;
229
	}
230
 
231
	/**
232
	 * Get Plot Label by Index
233
	 *
234
	 * @return PHPExcel_Chart_DataSeriesValues
235
	 */
236
	public function getPlotLabelByIndex($index) {
237
		$keys = array_keys($this->_plotLabel);
238
		if (in_array($index,$keys)) {
239
			return $this->_plotLabel[$index];
240
		} elseif(isset($keys[$index])) {
241
			return $this->_plotLabel[$keys[$index]];
242
		}
243
		return false;
244
	}
245
 
246
	/**
247
	 * Get Plot Categories
248
	 *
249
	 * @return array of PHPExcel_Chart_DataSeriesValues
250
	 */
251
	public function getPlotCategories() {
252
		return $this->_plotCategory;
253
	}
254
 
255
	/**
256
	 * Get Plot Category by Index
257
	 *
258
	 * @return PHPExcel_Chart_DataSeriesValues
259
	 */
260
	public function getPlotCategoryByIndex($index) {
261
		$keys = array_keys($this->_plotCategory);
262
		if (in_array($index,$keys)) {
263
			return $this->_plotCategory[$index];
264
		} elseif(isset($keys[$index])) {
265
			return $this->_plotCategory[$keys[$index]];
266
		}
267
		return false;
268
	}
269
 
270
	/**
271
	 * Get Plot Style
272
	 *
273
	 * @return string
274
	 */
275
	public function getPlotStyle() {
276
		return $this->_plotStyle;
277
	}
278
 
279
	/**
280
	 * Set Plot Style
281
	 *
282
	 * @param string $plotStyle
283
	 */
284
	public function setPlotStyle($plotStyle = null) {
285
		$this->_plotStyle = $plotStyle;
286
	}
287
 
288
	/**
289
	 * Get Plot Values
290
	 *
291
	 * @return array of PHPExcel_Chart_DataSeriesValues
292
	 */
293
	public function getPlotValues() {
294
		return $this->_plotValues;
295
	}
296
 
297
	/**
298
	 * Get Plot Values by Index
299
	 *
300
	 * @return PHPExcel_Chart_DataSeriesValues
301
	 */
302
	public function getPlotValuesByIndex($index) {
303
		$keys = array_keys($this->_plotValues);
304
		if (in_array($index,$keys)) {
305
			return $this->_plotValues[$index];
306
		} elseif(isset($keys[$index])) {
307
			return $this->_plotValues[$keys[$index]];
308
		}
309
		return false;
310
	}
311
 
312
	/**
313
	 * Get Number of Plot Series
314
	 *
315
	 * @return integer
316
	 */
317
	public function getPlotSeriesCount() {
318
		return count($this->_plotValues);
319
	}
320
 
321
	/**
322
	 * Get Smooth Line
323
	 *
324
	 * @return boolean
325
	 */
326
	public function getSmoothLine() {
327
		return $this->_smoothLine;
328
	}
329
 
330
	/**
331
	 * Set Smooth Line
332
	 *
333
	 * @param boolean $smoothLine
334
	 */
335
	public function setSmoothLine($smoothLine = TRUE) {
336
		$this->_smoothLine = $smoothLine;
337
	}
338
 
339
	public function refresh(PHPExcel_Worksheet $worksheet) {
340
	    foreach($this->_plotValues as $plotValues) {
341
			if ($plotValues !== NULL)
342
				$plotValues->refresh($worksheet, TRUE);
343
		}
344
		foreach($this->_plotLabel as $plotValues) {
345
			if ($plotValues !== NULL)
346
				$plotValues->refresh($worksheet, TRUE);
347
		}
348
		foreach($this->_plotCategory as $plotValues) {
349
			if ($plotValues !== NULL)
350
				$plotValues->refresh($worksheet, FALSE);
351
		}
352
	}
353
 
354
}