Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Chart;
   4  
   5  use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
   6  
   7  class PlotArea
   8  {
   9      /**
  10       * PlotArea Layout.
  11       *
  12       * @var Layout
  13       */
  14      private $layout;
  15  
  16      /**
  17       * Plot Series.
  18       *
  19       * @var DataSeries[]
  20       */
  21      private $plotSeries = [];
  22  
  23      /**
  24       * Create a new PlotArea.
  25       *
  26       * @param DataSeries[] $plotSeries
  27       */
  28      public function __construct(?Layout $layout = null, array $plotSeries = [])
  29      {
  30          $this->layout = $layout;
  31          $this->plotSeries = $plotSeries;
  32      }
  33  
  34      /**
  35       * Get Layout.
  36       *
  37       * @return Layout
  38       */
  39      public function getLayout()
  40      {
  41          return $this->layout;
  42      }
  43  
  44      /**
  45       * Get Number of Plot Groups.
  46       *
  47       * @return array of DataSeries
  48       */
  49      public function getPlotGroupCount()
  50      {
  51          return count($this->plotSeries);
  52      }
  53  
  54      /**
  55       * Get Number of Plot Series.
  56       *
  57       * @return int
  58       */
  59      public function getPlotSeriesCount()
  60      {
  61          $seriesCount = 0;
  62          foreach ($this->plotSeries as $plot) {
  63              $seriesCount += $plot->getPlotSeriesCount();
  64          }
  65  
  66          return $seriesCount;
  67      }
  68  
  69      /**
  70       * Get Plot Series.
  71       *
  72       * @return array of DataSeries
  73       */
  74      public function getPlotGroup()
  75      {
  76          return $this->plotSeries;
  77      }
  78  
  79      /**
  80       * Get Plot Series by Index.
  81       *
  82       * @param mixed $index
  83       *
  84       * @return DataSeries
  85       */
  86      public function getPlotGroupByIndex($index)
  87      {
  88          return $this->plotSeries[$index];
  89      }
  90  
  91      /**
  92       * Set Plot Series.
  93       *
  94       * @param DataSeries[] $plotSeries
  95       *
  96       * @return $this
  97       */
  98      public function setPlotSeries(array $plotSeries)
  99      {
 100          $this->plotSeries = $plotSeries;
 101  
 102          return $this;
 103      }
 104  
 105      public function refresh(Worksheet $worksheet): void
 106      {
 107          foreach ($this->plotSeries as $plotSeries) {
 108              $plotSeries->refresh($worksheet);
 109          }
 110      }
 111  }