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

Source for file Low.php

Documentation is available at Low.php

  1. <?php
  2.  
  3. /**
  4. *
  5. * <p>Title: Low class</p>
  6. *
  7. * <p>Description: Low Function. Returns lowest value.</p>
  8. *
  9. * <p>Example:
  10. * <pre><font face="Courier" size="4">
  11. * $lowFunction = Low();
  12. * $lowFunction->setChart($myChart->getChart());
  13. * $lowFunction->setPeriod(0); //all points
  14. *
  15. * $lineSeries->setDataSource($barSeries);
  16. * $lineSeries->setFunction($lowFunction);
  17. * </font></pre></p>
  18. *
  19. * <p>Copyright (c) 2005-2008 by Steema Software SL. All Rights
  20. * Reserved.</p>
  21. *
  22. * <p>Company: Steema Software SL</p>
  23. *
  24. */
  25.  
  26. class Low extends Functions
  27. {
  28.  
  29.    // Interceptors
  30.    function __get($property)
  31.    {
  32.       $method "get{$property}";
  33.       if(method_exists($this$method))
  34.       {
  35.          return $this->$method();
  36.       }
  37.    }
  38.  
  39.    function __set($property$value)
  40.    {
  41.       $method "set{$property}";
  42.       if(method_exists($this$method))
  43.       {
  44.          return $this->$method($value);
  45.       }
  46.    }
  47.  
  48.    /**
  49.    * Performs function operation on SourceSeries series.<br>
  50.    * First and Last parameters are ValueIndex of first and last point used
  51.    * in calculation. <br>
  52.    * You can override Calculate function to perform customized calculation
  53.    * on one SourceSeries. <br>
  54.    *
  55.    * @param sourceSeries Series
  56.    * @param firstIndex int
  57.    * @param lastIndex int
  58.    * @return double 
  59.    */
  60.    public function calculate($sourceSeries$firstIndex$lastIndex)
  61.    {
  62.       $v $this->valueList($sourceSeries);
  63.       if($firstIndex == - 1)
  64.       {
  65.          return $v->getMinimum();
  66.       }
  67.       else
  68.       {
  69.          $result $v->value[$firstIndex];
  70.          for($t $firstIndex 1$t <= $lastIndex$t++)
  71.          {
  72.             $tmp $v->value[$t];
  73.             if($tmp $result)
  74.             {
  75.                $result $tmp;
  76.             }
  77.          }
  78.          return $result;
  79.       }
  80.    }
  81.  
  82.    /**
  83.    * Performs function operation on list of series (SourceSeriesList).
  84.    * The ValueIndex parameter defines ValueIndex of point in each Series in
  85.    * list. <br>
  86.    * You can override CalculateMany function to perform customized
  87.    * calculation on list of SourceSeries.
  88.    *
  89.    * @param sourceSeriesList ArrayList
  90.    * @param valueIndex int
  91.    * @return double 
  92.    */
  93.    public function calculateMany($sourceSeriesList$valueIndex)
  94.    {
  95.       $result 0;
  96.  
  97.       for($t 0$t sizeof($sourceSeriesList)$t++)
  98.       {
  99.          $v $this->valueList($sourceSeriesList->offsetget($t));
  100.          if(sizeof($v$valueIndex)
  101.          {
  102.             $tmp $v->value[$valueIndex];
  103.             if(($t == 0|| ($tmp $result))
  104.             {
  105.                $result $tmp;
  106.             }
  107.          }
  108.       }
  109.       return $result;
  110.    }
  111.  
  112.    /**
  113.    * Gets descriptive text.
  114.    *
  115.    * @return String 
  116.    */
  117.    public function getDescription()
  118.    {
  119.       return Language::getString("FunctionLow");
  120.    }
  121. }
  122. ?>

Documentation generated on Wed, 16 Jun 2010 12:06:54 +0200 by phpDocumentor 1.4.1