[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/phpexcel/PHPExcel/Chart/ -> DataSeries.php (source)

   1  <?php
   2  /**
   3   * PHPExcel
   4   *
   5   * Copyright (c) 2006 - 2015 PHPExcel
   6   *
   7   * This library is free software; you can redistribute it and/or
   8   * modify it under the terms of the GNU Lesser General Public
   9   * License as published by the Free Software Foundation; either
  10   * version 2.1 of the License, or (at your option) any later version.
  11   *
  12   * This library is distributed in the hope that it will be useful,
  13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15   * Lesser General Public License for more details.
  16   *
  17   * You should have received a copy of the GNU Lesser General Public
  18   * License along with this library; if not, write to the Free Software
  19   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20   *
  21   * @category    PHPExcel
  22   * @package        PHPExcel_Chart
  23   * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  24   * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25   * @version    ##VERSION##, ##DATE##
  26   */
  27  
  28  
  29  /**
  30   * PHPExcel_Chart_DataSeries
  31   *
  32   * @category    PHPExcel
  33   * @package        PHPExcel_Chart
  34   * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  35   */
  36  class PHPExcel_Chart_DataSeries
  37  {
  38      const TYPE_BARCHART        = 'barChart';
  39      const TYPE_BARCHART_3D     = 'bar3DChart';
  40      const TYPE_LINECHART       = 'lineChart';
  41      const TYPE_LINECHART_3D    = 'line3DChart';
  42      const TYPE_AREACHART       = 'areaChart';
  43      const TYPE_AREACHART_3D    = 'area3DChart';
  44      const TYPE_PIECHART        = 'pieChart';
  45      const TYPE_PIECHART_3D     = 'pie3DChart';
  46      const TYPE_DOUGHTNUTCHART  = 'doughnutChart';
  47      const TYPE_DONUTCHART      = self::TYPE_DOUGHTNUTCHART;    //    Synonym
  48      const TYPE_SCATTERCHART    = 'scatterChart';
  49      const TYPE_SURFACECHART    = 'surfaceChart';
  50      const TYPE_SURFACECHART_3D = 'surface3DChart';
  51      const TYPE_RADARCHART      = 'radarChart';
  52      const TYPE_BUBBLECHART     = 'bubbleChart';
  53      const TYPE_STOCKCHART      = 'stockChart';
  54      const TYPE_CANDLECHART     = self::TYPE_STOCKCHART;       //    Synonym
  55  
  56      const GROUPING_CLUSTERED       = 'clustered';
  57      const GROUPING_STACKED         = 'stacked';
  58      const GROUPING_PERCENT_STACKED = 'percentStacked';
  59      const GROUPING_STANDARD        = 'standard';
  60  
  61      const DIRECTION_BAR        = 'bar';
  62      const DIRECTION_HORIZONTAL = self::DIRECTION_BAR;
  63      const DIRECTION_COL        = 'col';
  64      const DIRECTION_COLUMN     = self::DIRECTION_COL;
  65      const DIRECTION_VERTICAL   = self::DIRECTION_COL;
  66  
  67      const STYLE_LINEMARKER   = 'lineMarker';
  68      const STYLE_SMOOTHMARKER = 'smoothMarker';
  69      const STYLE_MARKER       = 'marker';
  70      const STYLE_FILLED       = 'filled';
  71  
  72  
  73      /**
  74       * Series Plot Type
  75       *
  76       * @var string
  77       */
  78      private $plotType;
  79  
  80      /**
  81       * Plot Grouping Type
  82       *
  83       * @var boolean
  84       */
  85      private $plotGrouping;
  86  
  87      /**
  88       * Plot Direction
  89       *
  90       * @var boolean
  91       */
  92      private $plotDirection;
  93  
  94      /**
  95       * Plot Style
  96       *
  97       * @var string
  98       */
  99      private $plotStyle;
 100  
 101      /**
 102       * Order of plots in Series
 103       *
 104       * @var array of integer
 105       */
 106      private $plotOrder = array();
 107  
 108      /**
 109       * Plot Label
 110       *
 111       * @var array of PHPExcel_Chart_DataSeriesValues
 112       */
 113      private $plotLabel = array();
 114  
 115      /**
 116       * Plot Category
 117       *
 118       * @var array of PHPExcel_Chart_DataSeriesValues
 119       */
 120      private $plotCategory = array();
 121  
 122      /**
 123       * Smooth Line
 124       *
 125       * @var string
 126       */
 127      private $smoothLine;
 128  
 129      /**
 130       * Plot Values
 131       *
 132       * @var array of PHPExcel_Chart_DataSeriesValues
 133       */
 134      private $plotValues = array();
 135  
 136      /**
 137       * Create a new PHPExcel_Chart_DataSeries
 138       */
 139      public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $plotDirection = null, $smoothLine = null, $plotStyle = null)
 140      {
 141          $this->plotType = $plotType;
 142          $this->plotGrouping = $plotGrouping;
 143          $this->plotOrder = $plotOrder;
 144          $keys = array_keys($plotValues);
 145          $this->plotValues = $plotValues;
 146          if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) {
 147              $plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
 148          }
 149  
 150          $this->plotLabel = $plotLabel;
 151          if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) {
 152              $plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
 153          }
 154          $this->plotCategory = $plotCategory;
 155          $this->smoothLine = $smoothLine;
 156          $this->plotStyle = $plotStyle;
 157          
 158          if (is_null($plotDirection)) {
 159              $plotDirection = self::DIRECTION_COL;
 160          }
 161          $this->plotDirection = $plotDirection;
 162      }
 163  
 164      /**
 165       * Get Plot Type
 166       *
 167       * @return string
 168       */
 169      public function getPlotType()
 170      {
 171          return $this->plotType;
 172      }
 173  
 174      /**
 175       * Set Plot Type
 176       *
 177       * @param string $plotType
 178       * @return PHPExcel_Chart_DataSeries
 179       */
 180      public function setPlotType($plotType = '')
 181      {
 182          $this->plotType = $plotType;
 183          return $this;
 184      }
 185  
 186      /**
 187       * Get Plot Grouping Type
 188       *
 189       * @return string
 190       */
 191      public function getPlotGrouping()
 192      {
 193          return $this->plotGrouping;
 194      }
 195  
 196      /**
 197       * Set Plot Grouping Type
 198       *
 199       * @param string $groupingType
 200       * @return PHPExcel_Chart_DataSeries
 201       */
 202      public function setPlotGrouping($groupingType = null)
 203      {
 204          $this->plotGrouping = $groupingType;
 205          return $this;
 206      }
 207  
 208      /**
 209       * Get Plot Direction
 210       *
 211       * @return string
 212       */
 213      public function getPlotDirection()
 214      {
 215          return $this->plotDirection;
 216      }
 217  
 218      /**
 219       * Set Plot Direction
 220       *
 221       * @param string $plotDirection
 222       * @return PHPExcel_Chart_DataSeries
 223       */
 224      public function setPlotDirection($plotDirection = null)
 225      {
 226          $this->plotDirection = $plotDirection;
 227          return $this;
 228      }
 229  
 230      /**
 231       * Get Plot Order
 232       *
 233       * @return string
 234       */
 235      public function getPlotOrder()
 236      {
 237          return $this->plotOrder;
 238      }
 239  
 240      /**
 241       * Get Plot Labels
 242       *
 243       * @return array of PHPExcel_Chart_DataSeriesValues
 244       */
 245      public function getPlotLabels()
 246      {
 247          return $this->plotLabel;
 248      }
 249  
 250      /**
 251       * Get Plot Label by Index
 252       *
 253       * @return PHPExcel_Chart_DataSeriesValues
 254       */
 255      public function getPlotLabelByIndex($index)
 256      {
 257          $keys = array_keys($this->plotLabel);
 258          if (in_array($index, $keys)) {
 259              return $this->plotLabel[$index];
 260          } elseif (isset($keys[$index])) {
 261              return $this->plotLabel[$keys[$index]];
 262          }
 263          return false;
 264      }
 265  
 266      /**
 267       * Get Plot Categories
 268       *
 269       * @return array of PHPExcel_Chart_DataSeriesValues
 270       */
 271      public function getPlotCategories()
 272      {
 273          return $this->plotCategory;
 274      }
 275  
 276      /**
 277       * Get Plot Category by Index
 278       *
 279       * @return PHPExcel_Chart_DataSeriesValues
 280       */
 281      public function getPlotCategoryByIndex($index)
 282      {
 283          $keys = array_keys($this->plotCategory);
 284          if (in_array($index, $keys)) {
 285              return $this->plotCategory[$index];
 286          } elseif (isset($keys[$index])) {
 287              return $this->plotCategory[$keys[$index]];
 288          }
 289          return false;
 290      }
 291  
 292      /**
 293       * Get Plot Style
 294       *
 295       * @return string
 296       */
 297      public function getPlotStyle()
 298      {
 299          return $this->plotStyle;
 300      }
 301  
 302      /**
 303       * Set Plot Style
 304       *
 305       * @param string $plotStyle
 306       * @return PHPExcel_Chart_DataSeries
 307       */
 308      public function setPlotStyle($plotStyle = null)
 309      {
 310          $this->plotStyle = $plotStyle;
 311          return $this;
 312      }
 313  
 314      /**
 315       * Get Plot Values
 316       *
 317       * @return array of PHPExcel_Chart_DataSeriesValues
 318       */
 319      public function getPlotValues()
 320      {
 321          return $this->plotValues;
 322      }
 323  
 324      /**
 325       * Get Plot Values by Index
 326       *
 327       * @return PHPExcel_Chart_DataSeriesValues
 328       */
 329      public function getPlotValuesByIndex($index)
 330      {
 331          $keys = array_keys($this->plotValues);
 332          if (in_array($index, $keys)) {
 333              return $this->plotValues[$index];
 334          } elseif (isset($keys[$index])) {
 335              return $this->plotValues[$keys[$index]];
 336          }
 337          return false;
 338      }
 339  
 340      /**
 341       * Get Number of Plot Series
 342       *
 343       * @return integer
 344       */
 345      public function getPlotSeriesCount()
 346      {
 347          return count($this->plotValues);
 348      }
 349  
 350      /**
 351       * Get Smooth Line
 352       *
 353       * @return boolean
 354       */
 355      public function getSmoothLine()
 356      {
 357          return $this->smoothLine;
 358      }
 359  
 360      /**
 361       * Set Smooth Line
 362       *
 363       * @param boolean $smoothLine
 364       * @return PHPExcel_Chart_DataSeries
 365       */
 366      public function setSmoothLine($smoothLine = true)
 367      {
 368          $this->smoothLine = $smoothLine;
 369          return $this;
 370      }
 371  
 372      public function refresh(PHPExcel_Worksheet $worksheet)
 373      {
 374          foreach ($this->plotValues as $plotValues) {
 375              if ($plotValues !== null) {
 376                  $plotValues->refresh($worksheet, true);
 377              }
 378          }
 379          foreach ($this->plotLabel as $plotValues) {
 380              if ($plotValues !== null) {
 381                  $plotValues->refresh($worksheet, true);
 382              }
 383          }
 384          foreach ($this->plotCategory as $plotValues) {
 385              if ($plotValues !== null) {
 386                  $plotValues->refresh($worksheet, false);
 387              }
 388          }
 389      }
 390  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1