ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
DataSeries.php
Go to the documentation of this file.
1 <?php
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  const TYPE_CANDLECHART = self::TYPE_STOCKCHART; // Synonym
56 
57  const GROUPING_CLUSTERED = 'clustered';
58  const GROUPING_STACKED = 'stacked';
59  const GROUPING_PERCENT_STACKED = 'percentStacked';
60  const GROUPING_STANDARD = 'standard';
61 
62  const DIRECTION_BAR = 'bar';
63  const DIRECTION_HORIZONTAL = self::DIRECTION_BAR;
64  const DIRECTION_COL = 'col';
65  const DIRECTION_COLUMN = self::DIRECTION_COL;
66  const DIRECTION_VERTICAL = self::DIRECTION_COL;
67 
68  const STYLE_LINEMARKER = 'lineMarker';
69  const STYLE_SMOOTHMARKER = 'smoothMarker';
70  const STYLE_MARKER = 'marker';
71  const STYLE_FILLED = 'filled';
72 
73 
79  private $_plotType = null;
80 
86  private $_plotGrouping = null;
87 
93  private $_plotDirection = null;
94 
100  private $_plotStyle = null;
101 
107  private $_plotOrder = array();
108 
114  private $_plotLabel = array();
115 
121  private $_plotCategory = array();
122 
128  private $_smoothLine = null;
129 
135  private $_plotValues = array();
136 
140  public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $plotDirection = null, $smoothLine = null, $plotStyle = null)
141  {
142  $this->_plotType = $plotType;
143  $this->_plotGrouping = $plotGrouping;
144  $this->_plotOrder = $plotOrder;
145  $keys = array_keys($plotValues);
146  $this->_plotValues = $plotValues;
147  if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) {
148  $plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
149  }
150 
151  $this->_plotLabel = $plotLabel;
152  if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) {
153  $plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
154  }
155  $this->_plotCategory = $plotCategory;
156  $this->_smoothLine = $smoothLine;
157  $this->_plotStyle = $plotStyle;
158 
159  if (is_null($plotDirection)) {
160  $plotDirection = self::DIRECTION_COL;
161  }
162  $this->_plotDirection = $plotDirection;
163  }
164 
170  public function getPlotType() {
171  return $this->_plotType;
172  }
173 
180  public function setPlotType($plotType = '') {
181  $this->_plotType = $plotType;
182  return $this;
183  }
184 
190  public function getPlotGrouping() {
191  return $this->_plotGrouping;
192  }
193 
200  public function setPlotGrouping($groupingType = null) {
201  $this->_plotGrouping = $groupingType;
202  return $this;
203  }
204 
210  public function getPlotDirection() {
211  return $this->_plotDirection;
212  }
213 
220  public function setPlotDirection($plotDirection = null) {
221  $this->_plotDirection = $plotDirection;
222  return $this;
223  }
224 
230  public function getPlotOrder() {
231  return $this->_plotOrder;
232  }
233 
239  public function getPlotLabels() {
240  return $this->_plotLabel;
241  }
242 
248  public function getPlotLabelByIndex($index) {
249  $keys = array_keys($this->_plotLabel);
250  if (in_array($index,$keys)) {
251  return $this->_plotLabel[$index];
252  } elseif(isset($keys[$index])) {
253  return $this->_plotLabel[$keys[$index]];
254  }
255  return false;
256  }
257 
263  public function getPlotCategories() {
264  return $this->_plotCategory;
265  }
266 
272  public function getPlotCategoryByIndex($index) {
273  $keys = array_keys($this->_plotCategory);
274  if (in_array($index,$keys)) {
275  return $this->_plotCategory[$index];
276  } elseif(isset($keys[$index])) {
277  return $this->_plotCategory[$keys[$index]];
278  }
279  return false;
280  }
281 
287  public function getPlotStyle() {
288  return $this->_plotStyle;
289  }
290 
297  public function setPlotStyle($plotStyle = null) {
298  $this->_plotStyle = $plotStyle;
299  return $this;
300  }
301 
307  public function getPlotValues() {
308  return $this->_plotValues;
309  }
310 
316  public function getPlotValuesByIndex($index) {
317  $keys = array_keys($this->_plotValues);
318  if (in_array($index,$keys)) {
319  return $this->_plotValues[$index];
320  } elseif(isset($keys[$index])) {
321  return $this->_plotValues[$keys[$index]];
322  }
323  return false;
324  }
325 
331  public function getPlotSeriesCount() {
332  return count($this->_plotValues);
333  }
334 
340  public function getSmoothLine() {
341  return $this->_smoothLine;
342  }
343 
350  public function setSmoothLine($smoothLine = TRUE) {
351  $this->_smoothLine = $smoothLine;
352  return $this;
353  }
354 
356  foreach($this->_plotValues as $plotValues) {
357  if ($plotValues !== NULL)
358  $plotValues->refresh($worksheet, TRUE);
359  }
360  foreach($this->_plotLabel as $plotValues) {
361  if ($plotValues !== NULL)
362  $plotValues->refresh($worksheet, TRUE);
363  }
364  foreach($this->_plotCategory as $plotValues) {
365  if ($plotValues !== NULL)
366  $plotValues->refresh($worksheet, FALSE);
367  }
368  }
369 
370 }
setPlotStyle($plotStyle=null)
Set Plot Style.
Definition: DataSeries.php:297
$worksheet
getPlotLabels()
Get Plot Labels.
Definition: DataSeries.php:239
getPlotValuesByIndex($index)
Get Plot Values by Index.
Definition: DataSeries.php:316
setPlotDirection($plotDirection=null)
Set Plot Direction.
Definition: DataSeries.php:220
getPlotCategoryByIndex($index)
Get Plot Category by Index.
Definition: DataSeries.php:272
getPlotGrouping()
Get Plot Grouping Type.
Definition: DataSeries.php:190
__construct($plotType=null, $plotGrouping=null, $plotOrder=array(), $plotLabel=array(), $plotCategory=array(), $plotValues=array(), $plotDirection=null, $smoothLine=null, $plotStyle=null)
Create a new PHPExcel_Chart_DataSeries.
Definition: DataSeries.php:140
getPlotOrder()
Get Plot Order.
Definition: DataSeries.php:230
getPlotType()
Get Plot Type.
Definition: DataSeries.php:170
refresh(PHPExcel_Worksheet $worksheet)
Definition: DataSeries.php:355
getPlotValues()
Get Plot Values.
Definition: DataSeries.php:307
setPlotType($plotType='')
Set Plot Type.
Definition: DataSeries.php:180
getPlotSeriesCount()
Get Number of Plot Series.
Definition: DataSeries.php:331
getSmoothLine()
Get Smooth Line.
Definition: DataSeries.php:340
setSmoothLine($smoothLine=TRUE)
Set Smooth Line.
Definition: DataSeries.php:350
Create styles array
The data for the language used.
getPlotDirection()
Get Plot Direction.
Definition: DataSeries.php:210
getPlotLabelByIndex($index)
Get Plot Label by Index.
Definition: DataSeries.php:248
setPlotGrouping($groupingType=null)
Set Plot Grouping Type.
Definition: DataSeries.php:200
getPlotCategories()
Get Plot Categories.
Definition: DataSeries.php:263
getPlotStyle()
Get Plot Style.
Definition: DataSeries.php:287