[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

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

   1  <?php
   2  /**
   3   * PHPExcel
   4   *
   5   * Copyright (c) 2006 - 2014 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 - 2014 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 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
  35   */
  36  class PHPExcel_Chart_DataSeries
  37  {
  38  
  39      const TYPE_BARCHART            = 'barChart';
  40      const TYPE_BARCHART_3D        = 'bar3DChart';
  41      const TYPE_LINECHART        = 'lineChart';
  42      const TYPE_LINECHART_3D        = 'line3DChart';
  43      const TYPE_AREACHART        = 'areaChart';
  44      const TYPE_AREACHART_3D        = 'area3DChart';
  45      const TYPE_PIECHART            = 'pieChart';
  46      const TYPE_PIECHART_3D        = 'pie3DChart';
  47      const TYPE_DOUGHTNUTCHART    = 'doughnutChart';
  48      const TYPE_DONUTCHART        = self::TYPE_DOUGHTNUTCHART;    //    Synonym
  49      const TYPE_SCATTERCHART        = 'scatterChart';
  50      const TYPE_SURFACECHART        = 'surfaceChart';
  51      const TYPE_SURFACECHART_3D    = 'surface3DChart';
  52      const TYPE_RADARCHART        = 'radarChart';
  53      const TYPE_BUBBLECHART        = 'bubbleChart';
  54      const TYPE_STOCKCHART        = 'stockChart';
  55      const TYPE_CANDLECHART        = self::TYPE_STOCKCHART;       //    Synonym
  56  
  57      const GROUPING_CLUSTERED            = 'clustered';
  58      const GROUPING_STACKED                = 'stacked';
  59      const GROUPING_PERCENT_STACKED        = 'percentStacked';
  60      const GROUPING_STANDARD                = 'standard';
  61  
  62      const DIRECTION_BAR            = 'bar';
  63      const DIRECTION_HORIZONTAL    = self::DIRECTION_BAR;
  64      const DIRECTION_COL            = 'col';
  65      const DIRECTION_COLUMN        = self::DIRECTION_COL;
  66      const DIRECTION_VERTICAL    = self::DIRECTION_COL;
  67  
  68      const STYLE_LINEMARKER        = 'lineMarker';
  69      const STYLE_SMOOTHMARKER    = 'smoothMarker';
  70      const STYLE_MARKER            = 'marker';
  71      const STYLE_FILLED            = 'filled';
  72  
  73  
  74      /**
  75       * Series Plot Type
  76       *
  77       * @var string
  78       */
  79      private $_plotType = null;
  80  
  81      /**
  82       * Plot Grouping Type
  83       *
  84       * @var boolean
  85       */
  86      private $_plotGrouping = null;
  87  
  88      /**
  89       * Plot Direction
  90       *
  91       * @var boolean
  92       */
  93      private $_plotDirection = null;
  94  
  95      /**
  96       * Plot Style
  97       *
  98       * @var string
  99       */
 100      private $_plotStyle = null;
 101  
 102      /**
 103       * Order of plots in Series
 104       *
 105       * @var array of integer
 106       */
 107      private $_plotOrder = array();
 108  
 109      /**
 110       * Plot Label
 111       *
 112       * @var array of PHPExcel_Chart_DataSeriesValues
 113       */
 114      private $_plotLabel = array();
 115  
 116      /**
 117       * Plot Category
 118       *
 119       * @var array of PHPExcel_Chart_DataSeriesValues
 120       */
 121      private $_plotCategory = array();
 122  
 123      /**
 124       * Smooth Line
 125       *
 126       * @var string
 127       */
 128      private $_smoothLine = null;
 129  
 130      /**
 131       * Plot Values
 132       *
 133       * @var array of PHPExcel_Chart_DataSeriesValues
 134       */
 135      private $_plotValues = array();
 136  
 137      /**
 138       * Create a new PHPExcel_Chart_DataSeries
 139       */
 140  	public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $smoothLine = null, $plotStyle = null)
 141      {
 142          $this->_plotType = $plotType;
 143          $this->_plotGrouping = $plotGrouping;
 144          $this->_plotOrder = $plotOrder;
 145          $keys = array_keys($plotValues);
 146          $this->_plotValues = $plotValues;
 147          if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) {
 148              $plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
 149          }
 150  
 151          $this->_plotLabel = $plotLabel;
 152          if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) {
 153              $plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
 154          }
 155          $this->_plotCategory = $plotCategory;
 156          $this->_smoothLine = $smoothLine;
 157          $this->_plotStyle = $plotStyle;
 158      }
 159  
 160      /**
 161       * Get Plot Type
 162       *
 163       * @return string
 164       */
 165  	public function getPlotType() {
 166          return $this->_plotType;
 167      }
 168  
 169      /**
 170       * Set Plot Type
 171       *
 172       * @param string $plotType
 173       * @return PHPExcel_Chart_DataSeries
 174       */
 175  	public function setPlotType($plotType = '') {
 176          $this->_plotType = $plotType;
 177          return $this;
 178      }
 179  
 180      /**
 181       * Get Plot Grouping Type
 182       *
 183       * @return string
 184       */
 185  	public function getPlotGrouping() {
 186          return $this->_plotGrouping;
 187      }
 188  
 189      /**
 190       * Set Plot Grouping Type
 191       *
 192       * @param string $groupingType
 193       * @return PHPExcel_Chart_DataSeries
 194       */
 195  	public function setPlotGrouping($groupingType = null) {
 196          $this->_plotGrouping = $groupingType;
 197          return $this;
 198      }
 199  
 200      /**
 201       * Get Plot Direction
 202       *
 203       * @return string
 204       */
 205  	public function getPlotDirection() {
 206          return $this->_plotDirection;
 207      }
 208  
 209      /**
 210       * Set Plot Direction
 211       *
 212       * @param string $plotDirection
 213       * @return PHPExcel_Chart_DataSeries
 214       */
 215  	public function setPlotDirection($plotDirection = null) {
 216          $this->_plotDirection = $plotDirection;
 217          return $this;
 218      }
 219  
 220      /**
 221       * Get Plot Order
 222       *
 223       * @return string
 224       */
 225  	public function getPlotOrder() {
 226          return $this->_plotOrder;
 227      }
 228  
 229      /**
 230       * Get Plot Labels
 231       *
 232       * @return array of PHPExcel_Chart_DataSeriesValues
 233       */
 234  	public function getPlotLabels() {
 235          return $this->_plotLabel;
 236      }
 237  
 238      /**
 239       * Get Plot Label by Index
 240       *
 241       * @return PHPExcel_Chart_DataSeriesValues
 242       */
 243  	public function getPlotLabelByIndex($index) {
 244          $keys = array_keys($this->_plotLabel);
 245          if (in_array($index,$keys)) {
 246              return $this->_plotLabel[$index];
 247          } elseif(isset($keys[$index])) {
 248              return $this->_plotLabel[$keys[$index]];
 249          }
 250          return false;
 251      }
 252  
 253      /**
 254       * Get Plot Categories
 255       *
 256       * @return array of PHPExcel_Chart_DataSeriesValues
 257       */
 258  	public function getPlotCategories() {
 259          return $this->_plotCategory;
 260      }
 261  
 262      /**
 263       * Get Plot Category by Index
 264       *
 265       * @return PHPExcel_Chart_DataSeriesValues
 266       */
 267  	public function getPlotCategoryByIndex($index) {
 268          $keys = array_keys($this->_plotCategory);
 269          if (in_array($index,$keys)) {
 270              return $this->_plotCategory[$index];
 271          } elseif(isset($keys[$index])) {
 272              return $this->_plotCategory[$keys[$index]];
 273          }
 274          return false;
 275      }
 276  
 277      /**
 278       * Get Plot Style
 279       *
 280       * @return string
 281       */
 282  	public function getPlotStyle() {
 283          return $this->_plotStyle;
 284      }
 285  
 286      /**
 287       * Set Plot Style
 288       *
 289       * @param string $plotStyle
 290       * @return PHPExcel_Chart_DataSeries
 291       */
 292  	public function setPlotStyle($plotStyle = null) {
 293          $this->_plotStyle = $plotStyle;
 294          return $this;
 295      }
 296  
 297      /**
 298       * Get Plot Values
 299       *
 300       * @return array of PHPExcel_Chart_DataSeriesValues
 301       */
 302  	public function getPlotValues() {
 303          return $this->_plotValues;
 304      }
 305  
 306      /**
 307       * Get Plot Values by Index
 308       *
 309       * @return PHPExcel_Chart_DataSeriesValues
 310       */
 311  	public function getPlotValuesByIndex($index) {
 312          $keys = array_keys($this->_plotValues);
 313          if (in_array($index,$keys)) {
 314              return $this->_plotValues[$index];
 315          } elseif(isset($keys[$index])) {
 316              return $this->_plotValues[$keys[$index]];
 317          }
 318          return false;
 319      }
 320  
 321      /**
 322       * Get Number of Plot Series
 323       *
 324       * @return integer
 325       */
 326  	public function getPlotSeriesCount() {
 327          return count($this->_plotValues);
 328      }
 329  
 330      /**
 331       * Get Smooth Line
 332       *
 333       * @return boolean
 334       */
 335  	public function getSmoothLine() {
 336          return $this->_smoothLine;
 337      }
 338  
 339      /**
 340       * Set Smooth Line
 341       *
 342       * @param boolean $smoothLine
 343       * @return PHPExcel_Chart_DataSeries
 344       */
 345  	public function setSmoothLine($smoothLine = TRUE) {
 346          $this->_smoothLine = $smoothLine;
 347          return $this;
 348      }
 349  
 350  	public function refresh(PHPExcel_Worksheet $worksheet) {
 351          foreach($this->_plotValues as $plotValues) {
 352              if ($plotValues !== NULL)
 353                  $plotValues->refresh($worksheet, TRUE);
 354          }
 355          foreach($this->_plotLabel as $plotValues) {
 356              if ($plotValues !== NULL)
 357                  $plotValues->refresh($worksheet, TRUE);
 358          }
 359          foreach($this->_plotCategory as $plotValues) {
 360              if ($plotValues !== NULL)
 361                  $plotValues->refresh($worksheet, FALSE);
 362          }
 363      }
 364  
 365  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1