Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

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

   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 null|Layout $layout
  27       * @param DataSeries[] $plotSeries
  28       */
  29      public function __construct(Layout $layout = null, array $plotSeries = [])
  30      {
  31          $this->layout = $layout;
  32          $this->plotSeries = $plotSeries;
  33      }
  34  
  35      /**
  36       * Get Layout.
  37       *
  38       * @return Layout
  39       */
  40      public function getLayout()
  41      {
  42          return $this->layout;
  43      }
  44  
  45      /**
  46       * Get Number of Plot Groups.
  47       *
  48       * @return array of DataSeries
  49       */
  50      public function getPlotGroupCount()
  51      {
  52          return count($this->plotSeries);
  53      }
  54  
  55      /**
  56       * Get Number of Plot Series.
  57       *
  58       * @return int
  59       */
  60      public function getPlotSeriesCount()
  61      {
  62          $seriesCount = 0;
  63          foreach ($this->plotSeries as $plot) {
  64              $seriesCount += $plot->getPlotSeriesCount();
  65          }
  66  
  67          return $seriesCount;
  68      }
  69  
  70      /**
  71       * Get Plot Series.
  72       *
  73       * @return array of DataSeries
  74       */
  75      public function getPlotGroup()
  76      {
  77          return $this->plotSeries;
  78      }
  79  
  80      /**
  81       * Get Plot Series by Index.
  82       *
  83       * @param mixed $index
  84       *
  85       * @return DataSeries
  86       */
  87      public function getPlotGroupByIndex($index)
  88      {
  89          return $this->plotSeries[$index];
  90      }
  91  
  92      /**
  93       * Set Plot Series.
  94       *
  95       * @param DataSeries[] $plotSeries
  96       *
  97       * @return PlotArea
  98       */
  99      public function setPlotSeries(array $plotSeries)
 100      {
 101          $this->plotSeries = $plotSeries;
 102  
 103          return $this;
 104      }
 105  
 106      public function refresh(Worksheet $worksheet)
 107      {
 108          foreach ($this->plotSeries as $plotSeries) {
 109              $plotSeries->refresh($worksheet);
 110          }
 111      }
 112  }