@@ -102,13 +102,11 @@ private function formatPointMarker($seriesPlot, $markerID)
102
102
return $ seriesPlot ;
103
103
}
104
104
105
- private function formatDataSetLabels ($ groupID , $ datasetLabels , $ labelCount , $ rotation = '' )
105
+ private function formatDataSetLabels ($ groupID , $ datasetLabels , $ rotation = '' )
106
106
{
107
- $ datasetLabelFormatCode = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotCategoryByIndex (0 )->getFormatCode ();
108
- if ($ datasetLabelFormatCode !== null ) {
109
- // Retrieve any label formatting code
110
- $ datasetLabelFormatCode = stripslashes ($ datasetLabelFormatCode );
111
- }
107
+ $ datasetLabelFormatCode = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotCategoryByIndex (0 )->getFormatCode () ?? '' ;
108
+ // Retrieve any label formatting code
109
+ $ datasetLabelFormatCode = stripslashes ($ datasetLabelFormatCode );
112
110
113
111
$ testCurrentIndex = 0 ;
114
112
foreach ($ datasetLabels as $ i => $ datasetLabel ) {
@@ -273,15 +271,15 @@ private function renderRadarPlotArea(): void
273
271
$ this ->renderTitle ();
274
272
}
275
273
276
- private function renderPlotLine ($ groupID , $ filled = false , $ combination = false , $ dimensions = ' 2d ' ): void
274
+ private function renderPlotLine ($ groupID , $ filled = false , $ combination = false ): void
277
275
{
278
276
$ grouping = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotGrouping ();
279
277
280
278
$ index = array_keys ($ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotOrder ())[0 ];
281
279
$ labelCount = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotValuesByIndex ($ index )->getPointCount ();
282
280
if ($ labelCount > 0 ) {
283
281
$ datasetLabels = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotCategoryByIndex (0 )->getDataValues ();
284
- $ datasetLabels = $ this ->formatDataSetLabels ($ groupID , $ datasetLabels, $ labelCount );
282
+ $ datasetLabels = $ this ->formatDataSetLabels ($ groupID , $ datasetLabels );
285
283
$ this ->graph ->xaxis ->SetTickLabels ($ datasetLabels );
286
284
}
287
285
@@ -353,7 +351,7 @@ private function renderPlotBar($groupID, $dimensions = '2d'): void
353
351
$ labelCount = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotValuesByIndex ($ index )->getPointCount ();
354
352
if ($ labelCount > 0 ) {
355
353
$ datasetLabels = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotCategoryByIndex (0 )->getDataValues ();
356
- $ datasetLabels = $ this ->formatDataSetLabels ($ groupID , $ datasetLabels , $ labelCount , $ rotation );
354
+ $ datasetLabels = $ this ->formatDataSetLabels ($ groupID , $ datasetLabels , $ rotation );
357
355
// Rotate for bar rather than column chart
358
356
if ($ rotation == 'bar ' ) {
359
357
$ datasetLabels = array_reverse ($ datasetLabels );
@@ -430,11 +428,9 @@ private function renderPlotBar($groupID, $dimensions = '2d'): void
430
428
431
429
private function renderPlotScatter ($ groupID , $ bubble ): void
432
430
{
433
- $ grouping = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotGrouping ();
434
431
$ scatterStyle = $ bubbleSize = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotStyle ();
435
432
436
433
$ seriesCount = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotSeriesCount ();
437
- $ seriesPlots = [];
438
434
439
435
// Loop through each data series in turn
440
436
for ($ i = 0 ; $ i < $ seriesCount ; ++$ i ) {
@@ -478,7 +474,6 @@ private function renderPlotRadar($groupID): void
478
474
$ radarStyle = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotStyle ();
479
475
480
476
$ seriesCount = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotSeriesCount ();
481
- $ seriesPlots = [];
482
477
483
478
// Loop through each data series in turn
484
479
for ($ i = 0 ; $ i < $ seriesCount ; ++$ i ) {
@@ -513,15 +508,11 @@ private function renderPlotRadar($groupID): void
513
508
514
509
private function renderPlotContour ($ groupID ): void
515
510
{
516
- $ contourStyle = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotStyle ();
517
-
518
511
$ seriesCount = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotSeriesCount ();
519
- $ seriesPlots = [];
520
512
521
513
$ dataValues = [];
522
514
// Loop through each data series in turn
523
515
for ($ i = 0 ; $ i < $ seriesCount ; ++$ i ) {
524
- $ dataValuesY = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotCategoryByIndex ($ i )->getDataValues ();
525
516
$ dataValuesX = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotValuesByIndex ($ i )->getDataValues ();
526
517
527
518
$ dataValues [$ i ] = $ dataValuesX ;
@@ -565,7 +556,7 @@ private function renderPlotStock($groupID): void
565
556
$ labelCount = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotValuesByIndex (0 )->getPointCount ();
566
557
if ($ labelCount > 0 ) {
567
558
$ datasetLabels = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotCategoryByIndex (0 )->getDataValues ();
568
- $ datasetLabels = $ this ->formatDataSetLabels ($ groupID , $ datasetLabels, $ labelCount );
559
+ $ datasetLabels = $ this ->formatDataSetLabels ($ groupID , $ datasetLabels );
569
560
$ this ->graph ->xaxis ->SetTickLabels ($ datasetLabels );
570
561
}
571
562
@@ -575,21 +566,21 @@ private function renderPlotStock($groupID): void
575
566
$ this ->graph ->Add ($ seriesPlot );
576
567
}
577
568
578
- private function renderAreaChart ($ groupCount, $ dimensions = ' 2d ' ): void
569
+ private function renderAreaChart ($ groupCount ): void
579
570
{
580
571
$ this ->renderCartesianPlotArea ();
581
572
582
573
for ($ i = 0 ; $ i < $ groupCount ; ++$ i ) {
583
- $ this ->renderPlotLine ($ i , true , false , $ dimensions );
574
+ $ this ->renderPlotLine ($ i , true , false );
584
575
}
585
576
}
586
577
587
- private function renderLineChart ($ groupCount, $ dimensions = ' 2d ' ): void
578
+ private function renderLineChart ($ groupCount ): void
588
579
{
589
580
$ this ->renderCartesianPlotArea ();
590
581
591
582
for ($ i = 0 ; $ i < $ groupCount ; ++$ i ) {
592
- $ this ->renderPlotLine ($ i , false , false , $ dimensions );
583
+ $ this ->renderPlotLine ($ i , false , false );
593
584
}
594
585
}
595
586
@@ -626,19 +617,17 @@ private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = fal
626
617
627
618
$ iLimit = ($ multiplePlots ) ? $ groupCount : 1 ;
628
619
for ($ groupID = 0 ; $ groupID < $ iLimit ; ++$ groupID ) {
629
- $ grouping = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotGrouping ();
630
620
$ exploded = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotStyle ();
631
621
$ datasetLabels = [];
632
622
if ($ groupID == 0 ) {
633
623
$ labelCount = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotValuesByIndex (0 )->getPointCount ();
634
624
if ($ labelCount > 0 ) {
635
625
$ datasetLabels = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotCategoryByIndex (0 )->getDataValues ();
636
- $ datasetLabels = $ this ->formatDataSetLabels ($ groupID , $ datasetLabels, $ labelCount );
626
+ $ datasetLabels = $ this ->formatDataSetLabels ($ groupID , $ datasetLabels );
637
627
}
638
628
}
639
629
640
630
$ seriesCount = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ groupID )->getPlotSeriesCount ();
641
- $ seriesPlots = [];
642
631
// For pie charts, we only display the first series: doughnut charts generally display all series
643
632
$ jLimit = ($ multiplePlots ) ? $ seriesCount : 1 ;
644
633
// Loop through each data series in turn
@@ -669,7 +658,7 @@ private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = fal
669
658
$ seriesPlot ->SetSize (($ jLimit - $ j ) / ($ jLimit * 4 ));
670
659
}
671
660
672
- if ($ doughnut ) {
661
+ if ($ doughnut && method_exists ( $ seriesPlot , ' SetMidColor ' ) ) {
673
662
$ seriesPlot ->SetMidColor ('white ' );
674
663
}
675
664
@@ -710,7 +699,7 @@ private function renderStockChart($groupCount): void
710
699
}
711
700
}
712
701
713
- private function renderContourChart ($ groupCount, $ dimensions ): void
702
+ private function renderContourChart ($ groupCount ): void
714
703
{
715
704
$ this ->renderCartesianPlotArea ('intint ' );
716
705
@@ -719,7 +708,7 @@ private function renderContourChart($groupCount, $dimensions): void
719
708
}
720
709
}
721
710
722
- private function renderCombinationChart ($ groupCount , $ dimensions , $ outputDestination )
711
+ private function renderCombinationChart ($ groupCount , $ outputDestination )
723
712
{
724
713
$ this ->renderCartesianPlotArea ();
725
714
@@ -728,10 +717,8 @@ private function renderCombinationChart($groupCount, $dimensions, $outputDestina
728
717
$ chartType = $ this ->chart ->getPlotArea ()->getPlotGroupByIndex ($ i )->getPlotType ();
729
718
switch ($ chartType ) {
730
719
case 'area3DChart ' :
731
- $ dimensions = '3d ' ;
732
- // no break
733
720
case 'areaChart ' :
734
- $ this ->renderPlotLine ($ i , true , true , $ dimensions );
721
+ $ this ->renderPlotLine ($ i , true , true );
735
722
736
723
break ;
737
724
case 'bar3DChart ' :
@@ -742,10 +729,8 @@ private function renderCombinationChart($groupCount, $dimensions, $outputDestina
742
729
743
730
break ;
744
731
case 'line3DChart ' :
745
- $ dimensions = '3d ' ;
746
- // no break
747
732
case 'lineChart ' :
748
- $ this ->renderPlotLine ($ i , false , true , $ dimensions );
733
+ $ this ->renderPlotLine ($ i , false , true );
749
734
750
735
break ;
751
736
case 'scatterChart ' :
@@ -792,7 +777,7 @@ public function render($outputDestination)
792
777
793
778
return false ;
794
779
} else {
795
- return $ this ->renderCombinationChart ($ groupCount , $ dimensions , $ outputDestination );
780
+ return $ this ->renderCombinationChart ($ groupCount , $ outputDestination );
796
781
}
797
782
}
798
783
@@ -801,7 +786,7 @@ public function render($outputDestination)
801
786
$ dimensions = '3d ' ;
802
787
// no break
803
788
case 'areaChart ' :
804
- $ this ->renderAreaChart ($ groupCount, $ dimensions );
789
+ $ this ->renderAreaChart ($ groupCount );
805
790
806
791
break ;
807
792
case 'bar3DChart ' :
@@ -815,7 +800,7 @@ public function render($outputDestination)
815
800
$ dimensions = '3d ' ;
816
801
// no break
817
802
case 'lineChart ' :
818
- $ this ->renderLineChart ($ groupCount, $ dimensions );
803
+ $ this ->renderLineChart ($ groupCount );
819
804
820
805
break ;
821
806
case 'pie3DChart ' :
@@ -845,10 +830,8 @@ public function render($outputDestination)
845
830
846
831
break ;
847
832
case 'surface3DChart ' :
848
- $ dimensions = '3d ' ;
849
- // no break
850
833
case 'surfaceChart ' :
851
- $ this ->renderContourChart ($ groupCount, $ dimensions );
834
+ $ this ->renderContourChart ($ groupCount );
852
835
853
836
break ;
854
837
case 'stockChart ' :
0 commit comments