[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/library/ezc/Graph/src/data_container/ -> single.php (source)

   1  <?php
   2  /**
   3   * File containing the abstract ezcGraphChartSingleDataContainer class
   4   *
   5   * @package Graph
   6   * @version 1.5
   7   * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
   8   * @license http://ez.no/licenses/new_bsd New BSD License
   9   */
  10  /**
  11   * Container class for datasets, which ensures, that only one dataset is used.
  12   * Needed for pie charts which can only display one dataset.
  13   *
  14   * @version 1.5
  15   * @package Graph
  16   */
  17  
  18  class ezcGraphChartSingleDataContainer extends ezcGraphChartDataContainer 
  19  {
  20      /**
  21       * Adds a dataset to the charts data
  22       * 
  23       * @param string $name
  24       * @param ezcGraphDataSet $dataSet
  25       * @throws ezcGraphTooManyDataSetExceptions
  26       *          If too many datasets are created
  27       * @return ezcGraphDataSet
  28       */
  29      protected function addDataSet( $name, ezcGraphDataSet $dataSet )
  30      {
  31          if ( count( $this->data ) >= 1 &&
  32               !isset( $this->data[$name] ) )
  33          {
  34              throw new ezcGraphTooManyDataSetsExceptions( $name );
  35          }
  36          else
  37          {
  38              parent::addDataSet( $name, $dataSet );
  39  
  40              // Resette palette color counter
  41              $this->chart->palette->resetColorCounter();
  42  
  43              // Colorize each data element
  44              foreach ( $this->data[$name] as $label => $value )
  45              {
  46                  $this->data[$name]->color[$label] = $this->chart->palette->dataSetColor;
  47              }
  48          }
  49      }
  50  }
  51  ?>


Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7