ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Chart.php
Go to the documentation of this file.
1<?php
37{
43 private $_name = '';
44
50 private $_worksheet = null;
51
57 private $_title = null;
58
64 private $_legend = null;
65
71 private $_xAxisLabel = null;
72
78 private $_yAxisLabel = null;
79
85 private $_plotArea = null;
86
92 private $_plotVisibleOnly = true;
93
99 private $_displayBlanksAs = '0';
100
106 private $_yAxis = null;
107
113 private $_xAxis = null;
114
120 private $_majorGridlines = null;
121
127 private $_minorGridlines = null;
128
134 private $_topLeftCellRef = 'A1';
135
136
142 private $_topLeftXOffset = 0;
143
144
150 private $_topLeftYOffset = 0;
151
152
158 private $_bottomRightCellRef = 'A1';
159
160
167
168
175
176
180 public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null)
181 {
182 $this->_name = $name;
183 $this->_title = $title;
184 $this->_legend = $legend;
185 $this->_xAxisLabel = $xAxisLabel;
186 $this->_yAxisLabel = $yAxisLabel;
187 $this->_plotArea = $plotArea;
188 $this->_plotVisibleOnly = $plotVisibleOnly;
189 $this->_displayBlanksAs = $displayBlanksAs;
190 $this->_xAxis = $xAxis;
191 $this->_yAxis = $yAxis;
192 $this->_majorGridlines = $majorGridlines;
193 $this->_minorGridlines = $minorGridlines;
194 }
195
201 public function getName() {
202 return $this->_name;
203 }
204
210 public function getWorksheet() {
211 return $this->_worksheet;
212 }
213
221 public function setWorksheet(PHPExcel_Worksheet $pValue = null) {
222 $this->_worksheet = $pValue;
223
224 return $this;
225 }
226
232 public function getTitle() {
233 return $this->_title;
234 }
235
243 $this->_title = $title;
244
245 return $this;
246 }
247
253 public function getLegend() {
254 return $this->_legend;
255 }
256
264 $this->_legend = $legend;
265
266 return $this;
267 }
268
274 public function getXAxisLabel() {
275 return $this->_xAxisLabel;
276 }
277
284 public function setXAxisLabel(PHPExcel_Chart_Title $label) {
285 $this->_xAxisLabel = $label;
286
287 return $this;
288 }
289
295 public function getYAxisLabel() {
296 return $this->_yAxisLabel;
297 }
298
305 public function setYAxisLabel(PHPExcel_Chart_Title $label) {
306 $this->_yAxisLabel = $label;
307
308 return $this;
309 }
310
316 public function getPlotArea() {
317 return $this->_plotArea;
318 }
319
325 public function getPlotVisibleOnly() {
327 }
328
335 public function setPlotVisibleOnly($plotVisibleOnly = true) {
336 $this->_plotVisibleOnly = $plotVisibleOnly;
337
338 return $this;
339 }
340
346 public function getDisplayBlanksAs() {
348 }
349
356 public function setDisplayBlanksAs($displayBlanksAs = '0') {
357 $this->_displayBlanksAs = $displayBlanksAs;
358 }
359
360
366 public function getChartAxisY() {
367 if($this->_yAxis !== NULL){
368 return $this->_yAxis;
369 }
370
371 return new PHPExcel_Chart_Axis();
372 }
373
379 public function getChartAxisX() {
380 if($this->_xAxis !== NULL){
381 return $this->_xAxis;
382 }
383
384 return new PHPExcel_Chart_Axis();
385 }
386
392 public function getMajorGridlines() {
393 if($this->_majorGridlines !== NULL){
395 }
396
397 return new PHPExcel_Chart_GridLines();
398 }
399
405 public function getMinorGridlines() {
406 if($this->_minorGridlines !== NULL){
408 }
409
410 return new PHPExcel_Chart_GridLines();
411 }
412
413
422 public function setTopLeftPosition($cell, $xOffset=null, $yOffset=null) {
423 $this->_topLeftCellRef = $cell;
424 if (!is_null($xOffset))
425 $this->setTopLeftXOffset($xOffset);
426 if (!is_null($yOffset))
427 $this->setTopLeftYOffset($yOffset);
428
429 return $this;
430 }
431
437 public function getTopLeftPosition() {
438 return array( 'cell' => $this->_topLeftCellRef,
439 'xOffset' => $this->_topLeftXOffset,
440 'yOffset' => $this->_topLeftYOffset
441 );
442 }
443
449 public function getTopLeftCell() {
451 }
452
459 public function setTopLeftCell($cell) {
460 $this->_topLeftCellRef = $cell;
461
462 return $this;
463 }
464
472 public function setTopLeftOffset($xOffset=null,$yOffset=null) {
473 if (!is_null($xOffset))
474 $this->setTopLeftXOffset($xOffset);
475 if (!is_null($yOffset))
476 $this->setTopLeftYOffset($yOffset);
477
478 return $this;
479 }
480
486 public function getTopLeftOffset() {
487 return array( 'X' => $this->_topLeftXOffset,
488 'Y' => $this->_topLeftYOffset
489 );
490 }
491
492 public function setTopLeftXOffset($xOffset) {
493 $this->_topLeftXOffset = $xOffset;
494
495 return $this;
496 }
497
498 public function getTopLeftXOffset() {
500 }
501
502 public function setTopLeftYOffset($yOffset) {
503 $this->_topLeftYOffset = $yOffset;
504
505 return $this;
506 }
507
508 public function getTopLeftYOffset() {
510 }
511
520 public function setBottomRightPosition($cell, $xOffset=null, $yOffset=null) {
521 $this->_bottomRightCellRef = $cell;
522 if (!is_null($xOffset))
523 $this->setBottomRightXOffset($xOffset);
524 if (!is_null($yOffset))
525 $this->setBottomRightYOffset($yOffset);
526
527 return $this;
528 }
529
535 public function getBottomRightPosition() {
536 return array( 'cell' => $this->_bottomRightCellRef,
537 'xOffset' => $this->_bottomRightXOffset,
538 'yOffset' => $this->_bottomRightYOffset
539 );
540 }
541
542 public function setBottomRightCell($cell) {
543 $this->_bottomRightCellRef = $cell;
544
545 return $this;
546 }
547
553 public function getBottomRightCell() {
555 }
556
564 public function setBottomRightOffset($xOffset=null,$yOffset=null) {
565 if (!is_null($xOffset))
566 $this->setBottomRightXOffset($xOffset);
567 if (!is_null($yOffset))
568 $this->setBottomRightYOffset($yOffset);
569
570 return $this;
571 }
572
578 public function getBottomRightOffset() {
579 return array( 'X' => $this->_bottomRightXOffset,
580 'Y' => $this->_bottomRightYOffset
581 );
582 }
583
584 public function setBottomRightXOffset($xOffset) {
585 $this->_bottomRightXOffset = $xOffset;
586
587 return $this;
588 }
589
590 public function getBottomRightXOffset() {
592 }
593
594 public function setBottomRightYOffset($yOffset) {
595 $this->_bottomRightYOffset = $yOffset;
596
597 return $this;
598 }
599
600 public function getBottomRightYOffset() {
602 }
603
604
605 public function refresh() {
606 if ($this->_worksheet !== NULL) {
607 $this->_plotArea->refresh($this->_worksheet);
608 }
609 }
610
611 public function render($outputDestination = null) {
613 if (is_null($libraryName)) {
614 return false;
615 }
616 // Ensure that data series values are up-to-date before we render
617 $this->refresh();
618
620 $includePath = str_replace('\\','/',get_include_path());
621 $rendererPath = str_replace('\\','/',$libraryPath);
622 if (strpos($rendererPath,$includePath) === false) {
623 set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath);
624 }
625
626 $rendererName = 'PHPExcel_Chart_Renderer_'.$libraryName;
627 $renderer = new $rendererName($this);
628
629 if ($outputDestination == 'php://output') {
630 $outputDestination = null;
631 }
632 return $renderer->render($outputDestination);
633 }
634
635}
$rendererName
Include PHPExcel.
An exception for terminatinating execution or to throw for unit testing.
Created by PhpStorm.
Definition: Axis.php:12
Created by PhpStorm.
Definition: GridLines.php:11
setTopLeftXOffset($xOffset)
Definition: Chart.php:492
getTitle()
Get Title.
Definition: Chart.php:232
setTitle(PHPExcel_Chart_Title $title)
Set Title.
Definition: Chart.php:242
getBottomRightPosition()
Get the bottom right position of the chart.
Definition: Chart.php:535
$_bottomRightYOffset
Definition: Chart.php:174
getWorksheet()
Get Worksheet.
Definition: Chart.php:210
getPlotVisibleOnly()
Get Plot Visible Only.
Definition: Chart.php:325
render($outputDestination=null)
Definition: Chart.php:611
getMinorGridlines()
Get Minor Gridlines.
Definition: Chart.php:405
setBottomRightXOffset($xOffset)
Definition: Chart.php:584
setBottomRightYOffset($yOffset)
Definition: Chart.php:594
getTopLeftCell()
Get the cell address where the top left of the chart is fixed.
Definition: Chart.php:449
getTopLeftYOffset()
Definition: Chart.php:508
getDisplayBlanksAs()
Get Display Blanks as.
Definition: Chart.php:346
setTopLeftPosition($cell, $xOffset=null, $yOffset=null)
Set the Top Left position for the chart.
Definition: Chart.php:422
getBottomRightCell()
Get the cell address where the bottom right of the chart is fixed.
Definition: Chart.php:553
getBottomRightXOffset()
Definition: Chart.php:590
setTopLeftYOffset($yOffset)
Definition: Chart.php:502
getTopLeftOffset()
Get the offset position within the Top Left cell for the chart.
Definition: Chart.php:486
getPlotArea()
Get Plot Area.
Definition: Chart.php:316
getBottomRightOffset()
Get the offset position within the Bottom Right cell for the chart.
Definition: Chart.php:578
getChartAxisY()
Get yAxis.
Definition: Chart.php:366
getYAxisLabel()
Get Y-Axis Label.
Definition: Chart.php:295
setLegend(PHPExcel_Chart_Legend $legend)
Set Legend.
Definition: Chart.php:263
setWorksheet(PHPExcel_Worksheet $pValue=null)
Set Worksheet.
Definition: Chart.php:221
__construct($name, PHPExcel_Chart_Title $title=null, PHPExcel_Chart_Legend $legend=null, PHPExcel_Chart_PlotArea $plotArea=null, $plotVisibleOnly=true, $displayBlanksAs='0', PHPExcel_Chart_Title $xAxisLabel=null, PHPExcel_Chart_Title $yAxisLabel=null, PHPExcel_Chart_Axis $xAxis=null, PHPExcel_Chart_Axis $yAxis=null, PHPExcel_Chart_GridLines $majorGridlines=null, PHPExcel_Chart_GridLines $minorGridlines=null)
Create a new PHPExcel_Chart.
Definition: Chart.php:180
getTopLeftPosition()
Get the top left position of the chart.
Definition: Chart.php:437
getXAxisLabel()
Get X-Axis Label.
Definition: Chart.php:274
getMajorGridlines()
Get Major Gridlines.
Definition: Chart.php:392
setPlotVisibleOnly($plotVisibleOnly=true)
Set Plot Visible Only.
Definition: Chart.php:335
getBottomRightYOffset()
Definition: Chart.php:600
setTopLeftOffset($xOffset=null, $yOffset=null)
Set the offset position within the Top Left cell for the chart.
Definition: Chart.php:472
getChartAxisX()
Get xAxis.
Definition: Chart.php:379
getName()
Get Name.
Definition: Chart.php:201
setBottomRightPosition($cell, $xOffset=null, $yOffset=null)
Set the Bottom Right position of the chart.
Definition: Chart.php:520
setYAxisLabel(PHPExcel_Chart_Title $label)
Set Y-Axis Label.
Definition: Chart.php:305
$_bottomRightCellRef
Definition: Chart.php:158
setTopLeftCell($cell)
Set the Top Left cell position for the chart.
Definition: Chart.php:459
getTopLeftXOffset()
Definition: Chart.php:498
setDisplayBlanksAs($displayBlanksAs='0')
Set Display Blanks as.
Definition: Chart.php:356
setBottomRightOffset($xOffset=null, $yOffset=null)
Set the offset position within the Bottom Right cell for the chart.
Definition: Chart.php:564
getLegend()
Get Legend.
Definition: Chart.php:253
setXAxisLabel(PHPExcel_Chart_Title $label)
Set X-Axis Label.
Definition: Chart.php:284
setBottomRightCell($cell)
Definition: Chart.php:542
$_bottomRightXOffset
Definition: Chart.php:166
static getChartRendererPath()
Return the directory path to the Chart Rendering Library that PHPExcel is currently configured to use...
Definition: Settings.php:270
static getChartRendererName()
Return the Chart Rendering Library that PHPExcel is currently configured to use (e....
Definition: Settings.php:258
if($format !==null) $name
Definition: metadata.php:146