ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PHPExcel_Chart_Renderer_jpgraph Class Reference
+ Collaboration diagram for PHPExcel_Chart_Renderer_jpgraph:

Public Member Functions

 render ($outputDestination)
 
 __construct (PHPExcel_Chart $chart)
 Create a new PHPExcel_Chart_Renderer_jpgraph. More...
 

Private Member Functions

 _formatPointMarker ($seriesPlot, $markerID)
 
 _formatDataSetLabels ($groupID, $datasetLabels, $labelCount, $rotation='')
 
 _percentageSumCalculation ($groupID, $seriesCount)
 
 _percentageAdjustValues ($dataValues, $sumValues)
 
 _getCaption ($captionElement)
 
 _renderTitle ()
 
 _renderLegend ()
 
 _renderCartesianPlotArea ($type='textlin')
 
 _renderPiePlotArea ($doughnut=False)
 
 _renderRadarPlotArea ()
 
 _renderPlotLine ($groupID, $filled=false, $combination=false, $dimensions='2d')
 
 _renderPlotBar ($groupID, $dimensions='2d')
 
 _renderPlotScatter ($groupID, $bubble)
 
 _renderPlotRadar ($groupID)
 
 _renderPlotContour ($groupID)
 
 _renderPlotStock ($groupID)
 
 _renderAreaChart ($groupCount, $dimensions='2d')
 
 _renderLineChart ($groupCount, $dimensions='2d')
 
 _renderBarChart ($groupCount, $dimensions='2d')
 
 _renderScatterChart ($groupCount)
 
 _renderBubbleChart ($groupCount)
 
 _renderPieChart ($groupCount, $dimensions='2d', $doughnut=False, $multiplePlots=False)
 
 _renderRadarChart ($groupCount)
 
 _renderStockChart ($groupCount)
 
 _renderContourChart ($groupCount, $dimensions)
 
 _renderCombinationChart ($groupCount, $dimensions, $outputDestination)
 

Private Attributes

 $_chart = null
 
 $_graph = null
 

Static Private Attributes

static $_width = 640
 
static $_height = 480
 
static $_colourSet
 
static $_markSet
 
static $_plotColour = 0
 
static $_plotMark = 0
 

Detailed Description

Definition at line 40 of file jpgraph.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Chart_Renderer_jpgraph::__construct ( PHPExcel_Chart  $chart)

Create a new PHPExcel_Chart_Renderer_jpgraph.

Definition at line 849 of file jpgraph.php.

850 {
851 $this->_graph = null;
852 $this->_chart = $chart;
853 } // function __construct()

References $chart.

Member Function Documentation

◆ _formatDataSetLabels()

PHPExcel_Chart_Renderer_jpgraph::_formatDataSetLabels (   $groupID,
  $datasetLabels,
  $labelCount,
  $rotation = '' 
)
private

Definition at line 101 of file jpgraph.php.

101 {
102 $datasetLabelFormatCode = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode();
103 if (!is_null($datasetLabelFormatCode)) {
104 // Retrieve any label formatting code
105 $datasetLabelFormatCode = stripslashes($datasetLabelFormatCode);
106 }
107
108 $testCurrentIndex = 0;
109 foreach($datasetLabels as $i => $datasetLabel) {
110 if (is_array($datasetLabel)) {
111 if ($rotation == 'bar') {
112 $datasetLabels[$i] = implode(" ",$datasetLabel);
113 } else {
114 $datasetLabel = array_reverse($datasetLabel);
115 $datasetLabels[$i] = implode("\n",$datasetLabel);
116 }
117 } else {
118 // Format labels according to any formatting code
119 if (!is_null($datasetLabelFormatCode)) {
120 $datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel,$datasetLabelFormatCode);
121 }
122 }
123 ++$testCurrentIndex;
124 }
125
126 return $datasetLabels;
127 } // function _formatDataSetLabels()
static toFormattedString($value='0', $format=PHPExcel_Style_NumberFormat::FORMAT_GENERAL, $callBack=null)
Convert a value in a pre-defined format to a PHP string.

References PHPExcel_Style_NumberFormat\toFormattedString().

Referenced by _renderPieChart(), _renderPlotBar(), _renderPlotLine(), and _renderPlotStock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _formatPointMarker()

PHPExcel_Chart_Renderer_jpgraph::_formatPointMarker (   $seriesPlot,
  $markerID 
)
private

Definition at line 74 of file jpgraph.php.

74 {
75 $plotMarkKeys = array_keys(self::$_markSet);
76 if (is_null($markerID)) {
77 // Use default plot marker (next marker in the series)
78 self::$_plotMark %= count(self::$_markSet);
79 $seriesPlot->mark->SetType(self::$_markSet[$plotMarkKeys[self::$_plotMark++]]);
80 } elseif ($markerID !== 'none') {
81 // Use specified plot marker (if it exists)
82 if (isset(self::$_markSet[$markerID])) {
83 $seriesPlot->mark->SetType(self::$_markSet[$markerID]);
84 } else {
85 // If the specified plot marker doesn't exist, use default plot marker (next marker in the series)
86 self::$_plotMark %= count(self::$_markSet);
87 $seriesPlot->mark->SetType(self::$_markSet[$plotMarkKeys[self::$_plotMark++]]);
88 }
89 } else {
90 // Hide plot marker
91 $seriesPlot->mark->Hide();
92 }
93 $seriesPlot->mark->SetColor(self::$_colourSet[self::$_plotColour]);
94 $seriesPlot->mark->SetFillColor(self::$_colourSet[self::$_plotColour]);
95 $seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
96
97 return $seriesPlot;
98 } // function _formatPointMarker()

Referenced by _renderPlotLine(), _renderPlotRadar(), and _renderPlotScatter().

+ Here is the caller graph for this function:

◆ _getCaption()

PHPExcel_Chart_Renderer_jpgraph::_getCaption (   $captionElement)
private

Definition at line 160 of file jpgraph.php.

160 {
161 // Read any caption
162 $caption = (!is_null($captionElement)) ? $captionElement->getCaption() : NULL;
163 // Test if we have a title caption to display
164 if (!is_null($caption)) {
165 // If we do, it could be a plain string or an array
166 if (is_array($caption)) {
167 // Implode an array to a plain string
168 $caption = implode('',$caption);
169 }
170 }
171 return $caption;
172 } // function _getCaption()

Referenced by _renderCartesianPlotArea(), and _renderTitle().

+ Here is the caller graph for this function:

◆ _percentageAdjustValues()

PHPExcel_Chart_Renderer_jpgraph::_percentageAdjustValues (   $dataValues,
  $sumValues 
)
private

Definition at line 151 of file jpgraph.php.

151 {
152 foreach($dataValues as $k => $dataValue) {
153 $dataValues[$k] = $dataValue / $sumValues[$k] * 100;
154 }
155
156 return $dataValues;
157 } // function _percentageAdjustValues()

Referenced by _renderPlotBar(), and _renderPlotLine().

+ Here is the caller graph for this function:

◆ _percentageSumCalculation()

PHPExcel_Chart_Renderer_jpgraph::_percentageSumCalculation (   $groupID,
  $seriesCount 
)
private

Definition at line 130 of file jpgraph.php.

130 {
131 // Adjust our values to a percentage value across all series in the group
132 for($i = 0; $i < $seriesCount; ++$i) {
133 if ($i == 0) {
134 $sumValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
135 } else {
136 $nextValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
137 foreach($nextValues as $k => $value) {
138 if (isset($sumValues[$k])) {
139 $sumValues[$k] += $value;
140 } else {
141 $sumValues[$k] = $value;
142 }
143 }
144 }
145 }
146
147 return $sumValues;
148 } // function _percentageSumCalculation()

Referenced by _renderPlotBar(), and _renderPlotLine().

+ Here is the caller graph for this function:

◆ _renderAreaChart()

PHPExcel_Chart_Renderer_jpgraph::_renderAreaChart (   $groupCount,
  $dimensions = '2d' 
)
private

Definition at line 556 of file jpgraph.php.

556 {
557 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
558
560
561 for($i = 0; $i < $groupCount; ++$i) {
562 $this->_renderPlotLine($i,True,False,$dimensions);
563 }
564 } // function _renderAreaChart()
_renderPlotLine($groupID, $filled=false, $combination=false, $dimensions='2d')
Definition: jpgraph.php:266
_renderCartesianPlotArea($type='textlin')
Definition: jpgraph.php:214
static getChartRendererPath()
Return the directory path to the Chart Rendering Library that PHPExcel is currently configured to use...
Definition: Settings.php:270

References _renderCartesianPlotArea(), _renderPlotLine(), and PHPExcel_Settings\getChartRendererPath().

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderBarChart()

PHPExcel_Chart_Renderer_jpgraph::_renderBarChart (   $groupCount,
  $dimensions = '2d' 
)
private

Definition at line 578 of file jpgraph.php.

578 {
579 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php');
580
582
583 for($i = 0; $i < $groupCount; ++$i) {
584 $this->_renderPlotBar($i,$dimensions);
585 }
586 } // function _renderBarChart()
_renderPlotBar($groupID, $dimensions='2d')
Definition: jpgraph.php:329

References _renderCartesianPlotArea(), _renderPlotBar(), and PHPExcel_Settings\getChartRendererPath().

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderBubbleChart()

PHPExcel_Chart_Renderer_jpgraph::_renderBubbleChart (   $groupCount)
private

Definition at line 602 of file jpgraph.php.

602 {
603 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
604
605 $this->_renderCartesianPlotArea('linlin');
606
607 for($i = 0; $i < $groupCount; ++$i) {
608 $this->_renderPlotScatter($i,true);
609 }
610 } // function _renderBubbleChart()
_renderPlotScatter($groupID, $bubble)
Definition: jpgraph.php:414

References _renderCartesianPlotArea(), _renderPlotScatter(), and PHPExcel_Settings\getChartRendererPath().

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderCartesianPlotArea()

PHPExcel_Chart_Renderer_jpgraph::_renderCartesianPlotArea (   $type = 'textlin')
private

Definition at line 214 of file jpgraph.php.

214 {
215 $this->_graph = new Graph(self::$_width,self::$_height);
216 $this->_graph->SetScale($type);
217
218 $this->_renderTitle();
219
220 // Rotate for bar rather than column chart
221 $rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotDirection();
222 $reverse = ($rotation == 'bar') ? true : false;
223
224 $xAxisLabel = $this->_chart->getXAxisLabel();
225 if (!is_null($xAxisLabel)) {
227 if (!is_null($title)) {
228 $this->_graph->xaxis->SetTitle($title,'center');
229 $this->_graph->xaxis->title->SetMargin(35);
230 if ($reverse) {
231 $this->_graph->xaxis->title->SetAngle(90);
232 $this->_graph->xaxis->title->SetMargin(90);
233 }
234 }
235 }
236
237 $yAxisLabel = $this->_chart->getYAxisLabel();
238 if (!is_null($yAxisLabel)) {
240 if (!is_null($title)) {
241 $this->_graph->yaxis->SetTitle($title,'center');
242 if ($reverse) {
243 $this->_graph->yaxis->title->SetAngle(0);
244 $this->_graph->yaxis->title->SetMargin(-55);
245 }
246 }
247 }
248 } // function _renderCartesianPlotArea()
_getCaption($captionElement)
Definition: jpgraph.php:160

References $title, $xAxisLabel, $yAxisLabel, _getCaption(), and _renderTitle().

Referenced by _renderAreaChart(), _renderBarChart(), _renderBubbleChart(), _renderCombinationChart(), _renderContourChart(), _renderLineChart(), _renderScatterChart(), and _renderStockChart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderCombinationChart()

PHPExcel_Chart_Renderer_jpgraph::_renderCombinationChart (   $groupCount,
  $dimensions,
  $outputDestination 
)
private

Definition at line 721 of file jpgraph.php.

721 {
722 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
723 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php');
724 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
725 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_regstat.php');
726 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
727
729
730 for($i = 0; $i < $groupCount; ++$i) {
731 $dimensions = null;
732 $chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
733 switch ($chartType) {
734 case 'area3DChart' :
735 $dimensions = '3d';
736 case 'areaChart' :
737 $this->_renderPlotLine($i,True,True,$dimensions);
738 break;
739 case 'bar3DChart' :
740 $dimensions = '3d';
741 case 'barChart' :
742 $this->_renderPlotBar($i,$dimensions);
743 break;
744 case 'line3DChart' :
745 $dimensions = '3d';
746 case 'lineChart' :
747 $this->_renderPlotLine($i,False,True,$dimensions);
748 break;
749 case 'scatterChart' :
750 $this->_renderPlotScatter($i,false);
751 break;
752 case 'bubbleChart' :
753 $this->_renderPlotScatter($i,true);
754 break;
755 default :
756 $this->_graph = null;
757 return false;
758 }
759 }
760
761 $this->_renderLegend();
762
763 $this->_graph->Stroke($outputDestination);
764 return true;
765 } // function _renderCombinationChart()

References _renderCartesianPlotArea(), _renderLegend(), _renderPlotBar(), _renderPlotLine(), _renderPlotScatter(), and PHPExcel_Settings\getChartRendererPath().

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderContourChart()

PHPExcel_Chart_Renderer_jpgraph::_renderContourChart (   $groupCount,
  $dimensions 
)
private

Definition at line 710 of file jpgraph.php.

710 {
711 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_contour.php');
712
713 $this->_renderCartesianPlotArea('intint');
714
715 for($i = 0; $i < $groupCount; ++$i) {
716 $this->_renderPlotContour($i);
717 }
718 } // function _renderContourChart()

References _renderCartesianPlotArea(), _renderPlotContour(), and PHPExcel_Settings\getChartRendererPath().

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderLegend()

PHPExcel_Chart_Renderer_jpgraph::_renderLegend ( )
private

Definition at line 183 of file jpgraph.php.

183 {
184 $legend = $this->_chart->getLegend();
185 if (!is_null($legend)) {
186 $legendPosition = $legend->getPosition();
187 $legendOverlay = $legend->getOverlay();
188 switch ($legendPosition) {
189 case 'r' :
190 $this->_graph->legend->SetPos(0.01,0.5,'right','center'); // right
191 $this->_graph->legend->SetColumns(1);
192 break;
193 case 'l' :
194 $this->_graph->legend->SetPos(0.01,0.5,'left','center'); // left
195 $this->_graph->legend->SetColumns(1);
196 break;
197 case 't' :
198 $this->_graph->legend->SetPos(0.5,0.01,'center','top'); // top
199 break;
200 case 'b' :
201 $this->_graph->legend->SetPos(0.5,0.99,'center','bottom'); // bottom
202 break;
203 default :
204 $this->_graph->legend->SetPos(0.01,0.01,'right','top'); // top-right
205 $this->_graph->legend->SetColumns(1);
206 break;
207 }
208 } else {
209 $this->_graph->legend->Hide();
210 }
211 } // function _renderLegend()

References $legend.

Referenced by _renderCombinationChart(), and render().

+ Here is the caller graph for this function:

◆ _renderLineChart()

PHPExcel_Chart_Renderer_jpgraph::_renderLineChart (   $groupCount,
  $dimensions = '2d' 
)
private

Definition at line 567 of file jpgraph.php.

567 {
568 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
569
571
572 for($i = 0; $i < $groupCount; ++$i) {
573 $this->_renderPlotLine($i,False,False,$dimensions);
574 }
575 } // function _renderLineChart()

References _renderCartesianPlotArea(), _renderPlotLine(), and PHPExcel_Settings\getChartRendererPath().

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderPieChart()

PHPExcel_Chart_Renderer_jpgraph::_renderPieChart (   $groupCount,
  $dimensions = '2d',
  $doughnut = False,
  $multiplePlots = False 
)
private

Definition at line 613 of file jpgraph.php.

613 {
614 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_pie.php');
615 if ($dimensions == '3d') {
616 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_pie3d.php');
617 }
618
619 $this->_renderPiePlotArea($doughnut);
620
621 $iLimit = ($multiplePlots) ? $groupCount : 1;
622 for($groupID = 0; $groupID < $iLimit; ++$groupID) {
623 $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
624 $exploded = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
625 if ($groupID == 0) {
626 $labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
627 if ($labelCount > 0) {
628 $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
629 $datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
630 }
631 }
632
633 $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
634 $seriesPlots = array();
635 // For pie charts, we only display the first series: doughnut charts generally display all series
636 $jLimit = ($multiplePlots) ? $seriesCount : 1;
637 // Loop through each data series in turn
638 for($j = 0; $j < $jLimit; ++$j) {
639 $dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
640
641 // Fill in any missing values in the $dataValues array
642 $testCurrentIndex = 0;
643 foreach($dataValues as $k => $dataValue) {
644 while($k != $testCurrentIndex) {
645 $dataValues[$testCurrentIndex] = null;
646 ++$testCurrentIndex;
647 }
648 ++$testCurrentIndex;
649 }
650
651 if ($dimensions == '3d') {
652 $seriesPlot = new PiePlot3D($dataValues);
653 } else {
654 if ($doughnut) {
655 $seriesPlot = new PiePlotC($dataValues);
656 } else {
657 $seriesPlot = new PiePlot($dataValues);
658 }
659 }
660
661 if ($multiplePlots) {
662 $seriesPlot->SetSize(($jLimit-$j) / ($jLimit * 4));
663 }
664
665 if ($doughnut) {
666 $seriesPlot->SetMidColor('white');
667 }
668
669 $seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
670 if (count($datasetLabels) > 0)
671 $seriesPlot->SetLabels(array_fill(0,count($datasetLabels),''));
672 if ($dimensions != '3d') {
673 $seriesPlot->SetGuideLines(false);
674 }
675 if ($j == 0) {
676 if ($exploded) {
677 $seriesPlot->ExplodeAll();
678 }
679 $seriesPlot->SetLegends($datasetLabels);
680 }
681
682 $this->_graph->Add($seriesPlot);
683 }
684 }
685 } // function _renderPieChart()
_renderPiePlotArea($doughnut=False)
Definition: jpgraph.php:251
_formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation='')
Definition: jpgraph.php:101

References _formatDataSetLabels(), _renderPiePlotArea(), and PHPExcel_Settings\getChartRendererPath().

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderPiePlotArea()

PHPExcel_Chart_Renderer_jpgraph::_renderPiePlotArea (   $doughnut = False)
private

Definition at line 251 of file jpgraph.php.

251 {
252 $this->_graph = new PieGraph(self::$_width,self::$_height);
253
254 $this->_renderTitle();
255 } // function _renderPiePlotArea()

References _renderTitle().

Referenced by _renderPieChart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderPlotBar()

PHPExcel_Chart_Renderer_jpgraph::_renderPlotBar (   $groupID,
  $dimensions = '2d' 
)
private

Definition at line 329 of file jpgraph.php.

329 {
330 $rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection();
331 // Rotate for bar rather than column chart
332 if (($groupID == 0) && ($rotation == 'bar')) {
333 $this->_graph->Set90AndMargin();
334 }
335 $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
336
337 $labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
338 if ($labelCount > 0) {
339 $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
340 $datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation);
341 // Rotate for bar rather than column chart
342 if ($rotation == 'bar') {
343 $datasetLabels = array_reverse($datasetLabels);
344 $this->_graph->yaxis->SetPos('max');
345 $this->_graph->yaxis->SetLabelAlign('center','top');
346 $this->_graph->yaxis->SetLabelSide(SIDE_RIGHT);
347 }
348 $this->_graph->xaxis->SetTickLabels($datasetLabels);
349 }
350
351
352 $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
353 $seriesPlots = array();
354 if ($grouping == 'percentStacked') {
355 $sumValues = $this->_percentageSumCalculation($groupID,$seriesCount);
356 }
357
358 // Loop through each data series in turn
359 for($j = 0; $j < $seriesCount; ++$j) {
360 $dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
361 if ($grouping == 'percentStacked') {
362 $dataValues = $this->_percentageAdjustValues($dataValues,$sumValues);
363 }
364
365 // Fill in any missing values in the $dataValues array
366 $testCurrentIndex = 0;
367 foreach($dataValues as $k => $dataValue) {
368 while($k != $testCurrentIndex) {
369 $dataValues[$testCurrentIndex] = null;
370 ++$testCurrentIndex;
371 }
372 ++$testCurrentIndex;
373 }
374
375 // Reverse the $dataValues order for bar rather than column chart
376 if ($rotation == 'bar') {
377 $dataValues = array_reverse($dataValues);
378 }
379 $seriesPlot = new BarPlot($dataValues);
380 $seriesPlot->SetColor('black');
381 $seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]);
382 if ($dimensions == '3d') {
383 $seriesPlot->SetShadow();
384 }
385 if (!$this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) {
386 $dataLabel = '';
387 } else {
388 $dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue();
389 }
390 $seriesPlot->SetLegend($dataLabel);
391
392 $seriesPlots[] = $seriesPlot;
393 }
394 // Reverse the plot order for bar rather than column chart
395 if (($rotation == 'bar') && (!($grouping == 'percentStacked'))) {
396 $seriesPlots = array_reverse($seriesPlots);
397 }
398
399 if ($grouping == 'clustered') {
400 $groupPlot = new GroupBarPlot($seriesPlots);
401 } elseif ($grouping == 'standard') {
402 $groupPlot = new GroupBarPlot($seriesPlots);
403 } else {
404 $groupPlot = new AccBarPlot($seriesPlots);
405 if ($dimensions == '3d') {
406 $groupPlot->SetShadow();
407 }
408 }
409
410 $this->_graph->Add($groupPlot);
411 } // function _renderPlotBar()
_percentageAdjustValues($dataValues, $sumValues)
Definition: jpgraph.php:151
_percentageSumCalculation($groupID, $seriesCount)
Definition: jpgraph.php:130

References _formatDataSetLabels(), _percentageAdjustValues(), and _percentageSumCalculation().

Referenced by _renderBarChart(), and _renderCombinationChart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderPlotContour()

PHPExcel_Chart_Renderer_jpgraph::_renderPlotContour (   $groupID)
private

Definition at line 497 of file jpgraph.php.

497 {
498 $contourStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
499
500 $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
501 $seriesPlots = array();
502
503 $dataValues = array();
504 // Loop through each data series in turn
505 for($i = 0; $i < $seriesCount; ++$i) {
506 $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
507 $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
508
509 $dataValues[$i] = $dataValuesX;
510 }
511 $seriesPlot = new ContourPlot($dataValues);
512
513 $this->_graph->Add($seriesPlot);
514 } // function _renderPlotContour()

Referenced by _renderContourChart().

+ Here is the caller graph for this function:

◆ _renderPlotLine()

PHPExcel_Chart_Renderer_jpgraph::_renderPlotLine (   $groupID,
  $filled = false,
  $combination = false,
  $dimensions = '2d' 
)
private

Definition at line 266 of file jpgraph.php.

266 {
267 $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
268
269 $labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
270 if ($labelCount > 0) {
271 $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
272 $datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
273 $this->_graph->xaxis->SetTickLabels($datasetLabels);
274 }
275
276 $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
277 $seriesPlots = array();
278 if ($grouping == 'percentStacked') {
279 $sumValues = $this->_percentageSumCalculation($groupID,$seriesCount);
280 }
281
282 // Loop through each data series in turn
283 for($i = 0; $i < $seriesCount; ++$i) {
284 $dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
285 $marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
286
287 if ($grouping == 'percentStacked') {
288 $dataValues = $this->_percentageAdjustValues($dataValues,$sumValues);
289 }
290
291 // Fill in any missing values in the $dataValues array
292 $testCurrentIndex = 0;
293 foreach($dataValues as $k => $dataValue) {
294 while($k != $testCurrentIndex) {
295 $dataValues[$testCurrentIndex] = null;
296 ++$testCurrentIndex;
297 }
298 ++$testCurrentIndex;
299 }
300
301 $seriesPlot = new LinePlot($dataValues);
302 if ($combination) {
303 $seriesPlot->SetBarCenter();
304 }
305
306 if ($filled) {
307 $seriesPlot->SetFilled(true);
308 $seriesPlot->SetColor('black');
309 $seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]);
310 } else {
311 // Set the appropriate plot marker
312 $this->_formatPointMarker($seriesPlot,$marker);
313 }
314 $dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
315 $seriesPlot->SetLegend($dataLabel);
316
317 $seriesPlots[] = $seriesPlot;
318 }
319
320 if ($grouping == 'standard') {
321 $groupPlot = $seriesPlots;
322 } else {
323 $groupPlot = new AccLinePlot($seriesPlots);
324 }
325 $this->_graph->Add($groupPlot);
326 } // function _renderPlotLine()
_formatPointMarker($seriesPlot, $markerID)
Definition: jpgraph.php:74

References _formatDataSetLabels(), _formatPointMarker(), _percentageAdjustValues(), and _percentageSumCalculation().

Referenced by _renderAreaChart(), _renderCombinationChart(), and _renderLineChart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderPlotRadar()

PHPExcel_Chart_Renderer_jpgraph::_renderPlotRadar (   $groupID)
private

Definition at line 459 of file jpgraph.php.

459 {
460 $radarStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
461
462 $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
463 $seriesPlots = array();
464
465 // Loop through each data series in turn
466 for($i = 0; $i < $seriesCount; ++$i) {
467 $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
468 $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
469 $marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
470
471 $dataValues = array();
472 foreach($dataValuesY as $k => $dataValueY) {
473 $dataValues[$k] = implode(' ',array_reverse($dataValueY));
474 }
475 $tmp = array_shift($dataValues);
476 $dataValues[] = $tmp;
477 $tmp = array_shift($dataValuesX);
478 $dataValuesX[] = $tmp;
479
480 $this->_graph->SetTitles(array_reverse($dataValues));
481
482 $seriesPlot = new RadarPlot(array_reverse($dataValuesX));
483
484 $dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
485 $seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
486 if ($radarStyle == 'filled') {
487 $seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour]);
488 }
489 $this->_formatPointMarker($seriesPlot,$marker);
490 $seriesPlot->SetLegend($dataLabel);
491
492 $this->_graph->Add($seriesPlot);
493 }
494 } // function _renderPlotRadar()

References _formatPointMarker().

Referenced by _renderRadarChart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderPlotScatter()

PHPExcel_Chart_Renderer_jpgraph::_renderPlotScatter (   $groupID,
  $bubble 
)
private

Definition at line 414 of file jpgraph.php.

414 {
415 $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
416 $scatterStyle = $bubbleSize = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
417
418 $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
419 $seriesPlots = array();
420
421 // Loop through each data series in turn
422 for($i = 0; $i < $seriesCount; ++$i) {
423 $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
424 $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
425
426 foreach($dataValuesY as $k => $dataValueY) {
427 $dataValuesY[$k] = $k;
428 }
429
430 $seriesPlot = new ScatterPlot($dataValuesX,$dataValuesY);
431 if ($scatterStyle == 'lineMarker') {
432 $seriesPlot->SetLinkPoints();
433 $seriesPlot->link->SetColor(self::$_colourSet[self::$_plotColour]);
434 } elseif ($scatterStyle == 'smoothMarker') {
435 $spline = new Spline($dataValuesY,$dataValuesX);
436 list($splineDataY,$splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20);
437 $lplot = new LinePlot($splineDataX,$splineDataY);
438 $lplot->SetColor(self::$_colourSet[self::$_plotColour]);
439
440 $this->_graph->Add($lplot);
441 }
442
443 if ($bubble) {
444 $this->_formatPointMarker($seriesPlot,'dot');
445 $seriesPlot->mark->SetColor('black');
446 $seriesPlot->mark->SetSize($bubbleSize);
447 } else {
448 $marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
449 $this->_formatPointMarker($seriesPlot,$marker);
450 }
451 $dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
452 $seriesPlot->SetLegend($dataLabel);
453
454 $this->_graph->Add($seriesPlot);
455 }
456 } // function _renderPlotScatter()

References _formatPointMarker().

Referenced by _renderBubbleChart(), _renderCombinationChart(), and _renderScatterChart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderPlotStock()

PHPExcel_Chart_Renderer_jpgraph::_renderPlotStock (   $groupID)
private

Definition at line 517 of file jpgraph.php.

517 {
518 $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
519 $plotOrder = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder();
520
521 $dataValues = array();
522 // Loop through each data series in turn and build the plot arrays
523 foreach($plotOrder as $i => $v) {
524 $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues();
525 foreach($dataValuesX as $j => $dataValueX) {
526 $dataValues[$plotOrder[$i]][$j] = $dataValueX;
527 }
528 }
529 if(empty($dataValues)) {
530 return;
531 }
532
533 $dataValuesPlot = array();
534 // Flatten the plot arrays to a single dimensional array to work with jpgraph
535 for($j = 0; $j < count($dataValues[0]); $j++) {
536 for($i = 0; $i < $seriesCount; $i++) {
537 $dataValuesPlot[] = $dataValues[$i][$j];
538 }
539 }
540
541 // Set the x-axis labels
542 $labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
543 if ($labelCount > 0) {
544 $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
545 $datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
546 $this->_graph->xaxis->SetTickLabels($datasetLabels);
547 }
548
549 $seriesPlot = new StockPlot($dataValuesPlot);
550 $seriesPlot->SetWidth(20);
551
552 $this->_graph->Add($seriesPlot);
553 } // function _renderPlotStock()

References _formatDataSetLabels().

Referenced by _renderStockChart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderRadarChart()

PHPExcel_Chart_Renderer_jpgraph::_renderRadarChart (   $groupCount)
private

Definition at line 688 of file jpgraph.php.

688 {
689 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_radar.php');
690
691 $this->_renderRadarPlotArea();
692
693 for($groupID = 0; $groupID < $groupCount; ++$groupID) {
694 $this->_renderPlotRadar($groupID);
695 }
696 } // function _renderRadarChart()

References _renderPlotRadar(), _renderRadarPlotArea(), and PHPExcel_Settings\getChartRendererPath().

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderRadarPlotArea()

PHPExcel_Chart_Renderer_jpgraph::_renderRadarPlotArea ( )
private

Definition at line 258 of file jpgraph.php.

258 {
259 $this->_graph = new RadarGraph(self::$_width,self::$_height);
260 $this->_graph->SetScale('lin');
261
262 $this->_renderTitle();
263 } // function _renderRadarPlotArea()

References _renderTitle().

Referenced by _renderRadarChart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderScatterChart()

PHPExcel_Chart_Renderer_jpgraph::_renderScatterChart (   $groupCount)
private

Definition at line 589 of file jpgraph.php.

589 {
590 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
591 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_regstat.php');
592 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
593
594 $this->_renderCartesianPlotArea('linlin');
595
596 for($i = 0; $i < $groupCount; ++$i) {
597 $this->_renderPlotScatter($i,false);
598 }
599 } // function _renderScatterChart()

References _renderCartesianPlotArea(), _renderPlotScatter(), and PHPExcel_Settings\getChartRendererPath().

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderStockChart()

PHPExcel_Chart_Renderer_jpgraph::_renderStockChart (   $groupCount)
private

Definition at line 699 of file jpgraph.php.

699 {
700 require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_stock.php');
701
702 $this->_renderCartesianPlotArea('intint');
703
704 for($groupID = 0; $groupID < $groupCount; ++$groupID) {
705 $this->_renderPlotStock($groupID);
706 }
707 } // function _renderStockChart()

References _renderCartesianPlotArea(), _renderPlotStock(), and PHPExcel_Settings\getChartRendererPath().

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderTitle()

PHPExcel_Chart_Renderer_jpgraph::_renderTitle ( )
private

Definition at line 175 of file jpgraph.php.

175 {
176 $title = $this->_getCaption($this->_chart->getTitle());
177 if (!is_null($title)) {
178 $this->_graph->title->Set($title);
179 }
180 } // function _renderTitle()

References $title, and _getCaption().

Referenced by _renderCartesianPlotArea(), _renderPiePlotArea(), and _renderRadarPlotArea().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

PHPExcel_Chart_Renderer_jpgraph::render (   $outputDestination)

Definition at line 768 of file jpgraph.php.

768 {
769 self::$_plotColour = 0;
770
771 $groupCount = $this->_chart->getPlotArea()->getPlotGroupCount();
772
773 $dimensions = null;
774 if ($groupCount == 1) {
775 $chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
776 } else {
777 $chartTypes = array();
778 for($i = 0; $i < $groupCount; ++$i) {
779 $chartTypes[] = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
780 }
781 $chartTypes = array_unique($chartTypes);
782 if (count($chartTypes) == 1) {
783 $chartType = array_pop($chartTypes);
784 } elseif (count($chartTypes) == 0) {
785 echo 'Chart is not yet implemented<br />';
786 return false;
787 } else {
788 return $this->_renderCombinationChart($groupCount,$dimensions,$outputDestination);
789 }
790 }
791
792 switch ($chartType) {
793 case 'area3DChart' :
794 $dimensions = '3d';
795 case 'areaChart' :
796 $this->_renderAreaChart($groupCount,$dimensions);
797 break;
798 case 'bar3DChart' :
799 $dimensions = '3d';
800 case 'barChart' :
801 $this->_renderBarChart($groupCount,$dimensions);
802 break;
803 case 'line3DChart' :
804 $dimensions = '3d';
805 case 'lineChart' :
806 $this->_renderLineChart($groupCount,$dimensions);
807 break;
808 case 'pie3DChart' :
809 $dimensions = '3d';
810 case 'pieChart' :
811 $this->_renderPieChart($groupCount,$dimensions,False,False);
812 break;
813 case 'doughnut3DChart' :
814 $dimensions = '3d';
815 case 'doughnutChart' :
816 $this->_renderPieChart($groupCount,$dimensions,True,True);
817 break;
818 case 'scatterChart' :
819 $this->_renderScatterChart($groupCount);
820 break;
821 case 'bubbleChart' :
822 $this->_renderBubbleChart($groupCount);
823 break;
824 case 'radarChart' :
825 $this->_renderRadarChart($groupCount);
826 break;
827 case 'surface3DChart' :
828 $dimensions = '3d';
829 case 'surfaceChart' :
830 $this->_renderContourChart($groupCount,$dimensions);
831 break;
832 case 'stockChart' :
833 $this->_renderStockChart($groupCount,$dimensions);
834 break;
835 default :
836 echo $chartType.' is not yet implemented<br />';
837 return false;
838 }
839 $this->_renderLegend();
840
841 $this->_graph->Stroke($outputDestination);
842 return true;
843 } // function render()
_renderAreaChart($groupCount, $dimensions='2d')
Definition: jpgraph.php:556
_renderBarChart($groupCount, $dimensions='2d')
Definition: jpgraph.php:578
_renderContourChart($groupCount, $dimensions)
Definition: jpgraph.php:710
_renderPieChart($groupCount, $dimensions='2d', $doughnut=False, $multiplePlots=False)
Definition: jpgraph.php:613
_renderLineChart($groupCount, $dimensions='2d')
Definition: jpgraph.php:567
_renderCombinationChart($groupCount, $dimensions, $outputDestination)
Definition: jpgraph.php:721
_renderScatterChart($groupCount)
Definition: jpgraph.php:589

References _renderAreaChart(), _renderBarChart(), _renderBubbleChart(), _renderCombinationChart(), _renderContourChart(), _renderLegend(), _renderLineChart(), _renderPieChart(), _renderRadarChart(), _renderScatterChart(), and _renderStockChart().

+ Here is the call graph for this function:

Field Documentation

◆ $_chart

PHPExcel_Chart_Renderer_jpgraph::$_chart = null
private

Definition at line 65 of file jpgraph.php.

◆ $_colourSet

PHPExcel_Chart_Renderer_jpgraph::$_colourSet
staticprivate
Initial value:
= array( 'mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1',
'darkmagenta', 'coral', 'dodgerblue3', 'eggplant',
'mediumblue', 'magenta', 'sandybrown', 'cyan',
'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen',
'goldenrod2'
)

Definition at line 46 of file jpgraph.php.

◆ $_graph

PHPExcel_Chart_Renderer_jpgraph::$_graph = null
private

Definition at line 67 of file jpgraph.php.

◆ $_height

PHPExcel_Chart_Renderer_jpgraph::$_height = 480
staticprivate

Definition at line 44 of file jpgraph.php.

◆ $_markSet

PHPExcel_Chart_Renderer_jpgraph::$_markSet
staticprivate
Initial value:
= array( 'diamond' => MARK_DIAMOND,
'square' => MARK_SQUARE,
'triangle' => MARK_UTRIANGLE,
'x' => MARK_X,
'star' => MARK_STAR,
'dot' => MARK_FILLEDCIRCLE,
'dash' => MARK_DTRIANGLE,
'circle' => MARK_CIRCLE,
'plus' => MARK_CROSS
)

Definition at line 53 of file jpgraph.php.

◆ $_plotColour

PHPExcel_Chart_Renderer_jpgraph::$_plotColour = 0
staticprivate

Definition at line 69 of file jpgraph.php.

◆ $_plotMark

PHPExcel_Chart_Renderer_jpgraph::$_plotMark = 0
staticprivate

Definition at line 71 of file jpgraph.php.

◆ $_width

PHPExcel_Chart_Renderer_jpgraph::$_width = 640
staticprivate

Definition at line 42 of file jpgraph.php.


The documentation for this class was generated from the following file: