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

Source for file Count.php

Documentation is available at Count.php

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

Documentation generated on Wed, 16 Jun 2010 12:04:39 +0200 by phpDocumentor 1.4.1