TeeChartPHP
[ class tree: TeeChartPHP ] [ index: TeeChartPHP ] [ all elements ]

Source for file Add.php

Documentation is available at Add.php

  1. <?php
  2.  
  3. /**
  4.  * Add class
  5.  *
  6.  * Description: Add Function
  7.  *
  8.  * Example:
  9.  * $addFunction = new Add();
  10.  * $addFunction->setChart($myChart->getChart());
  11.  * $addFunction->setPeriod(0); //all points
  12.  *
  13.  * @author
  14.  * @copyright (c) 1995-2010 by Steema Software SL. All Rights Reserved. <info@steema.com>
  15.  * @version 1.0
  16.  * @package TeeChartPHP
  17.  * @subpackage functions
  18.  * @link http://www.steema.com
  19.  */
  20.  
  21. class Add extends Functions
  22. {
  23.  
  24.     // Interceptors
  25.     function __get$property {
  26.       $method ="get{$property}";
  27.       if method_exists$this$method ) ) {
  28.         return $this->$method();
  29.       }
  30.     }
  31.  
  32.     function __set $property,$value {
  33.       $method ="set{$property}";
  34.       if method_exists$this$method ) ) {
  35.         return $this->$method($value);
  36.       }
  37.     }
  38.  
  39.    /**
  40.    * Performs function operation on SourceSeries series.
  41.    *
  42.    * @param sourceSeries Series
  43.    * @param firstIndex int
  44.    * @param lastIndex int
  45.    * @return double 
  46.    */
  47.    public function calculate($sourceSeries$firstIndex$lastIndex)
  48.    {
  49.       $v $this->valueList($sourceSeries);
  50.       if($firstIndex == - 1)
  51.       {
  52.          return $v->getTotal();
  53.       }
  54.       else
  55.       {
  56.          $result 0;
  57.          for($t $firstIndex$t <= $lastIndex$t++)
  58.          {
  59.             $result += $v->value[$t];
  60.          }
  61.          return $result;
  62.       }
  63.    }
  64.  
  65.    /**
  66.    * Performs function operation on list of series (SourceSeriesList).
  67.    *
  68.    * @param sourceSeriesList ArrayList
  69.    * @param valueIndex int
  70.    * @return double 
  71.    */
  72.    public function calculateMany($sourceSeriesList$valueIndex)
  73.    {
  74.       $result 0;
  75.  
  76.       for($t 0$t sizeof($sourceSeriesList)$t++)
  77.       {
  78.          $v $this->valueList($sourceSeriesList->offsetget($t));
  79.          if(sizeof($v$valueIndex)
  80.          {
  81.             $result += $v->value[$valueIndex];
  82.          }
  83.       }
  84.       return $result;
  85.    }
  86.  
  87.    /**
  88.    * Gets descriptive text.
  89.    *
  90.    * @return String 
  91.    */
  92.    public function getDescription()
  93.    {
  94.       return Language::getString("FunctionAdd");
  95.    }
  96. }
  97.  
  98. ?>

Documentation generated on Wed, 16 Jun 2010 12:02:21 +0200 by phpDocumentor 1.4.1