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

Source for file High.php

Documentation is available at High.php

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

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