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

Source for file Perimeter.php

Documentation is available at Perimeter.php

  1. <?php
  2. /**
  3.   *
  4.   * <p>Title: Perimeter class</p>
  5.   *
  6.   * <p>Description: Perimeter function.</p>
  7.   *
  8.   *<p>Example:
  9.   * <pre><font face="Courier" size="4">
  10.   * $function = new Perimeter();
  11.   * $function->setChart($myChart->getChart());
  12.   * $function->setPeriod(0); //all points
  13.   *
  14.   * $functionSeries = new Line($myChart->getChart());
  15.   * $functionSeries->setTitle("Perimeter");
  16.   * $functionSeries->setDataSource($series);
  17.   * $functionSeries->getXValues()->setOrder(ValueListOrder::$NONE);
  18.   * //$functionSeries->setVerticalAxis(VerticalAxis::$RIGHT);
  19.   * $functionSeries->setFunction($function);
  20.   * </font></pre></p>
  21.   *
  22.   * <p>Copyright (c) 2005-2008 by Steema Software SL. All Rights
  23.   * Reserved.</p>
  24.   *
  25.   * <p>Company: Steema Software SL</p>
  26.   *
  27.   */
  28.  class Perimeter extends Functions {
  29.  
  30.     // Interceptors
  31.     function __get$property {
  32.       $method ="get{$property}";
  33.       if method_exists$this$method ) ) {
  34.         return $this->$method();
  35.       }
  36.     }
  37.  
  38.     function __set $property,$value {
  39.       $method ="set{$property}";
  40.       if method_exists$this$method ) ) {
  41.         return $this->$method($value);
  42.       }
  43.     }
  44.  
  45.     public function Perimeter($c=null{
  46.         parent::Functions($c);
  47.  
  48.         $this->canUsePeriod = false;
  49.         $this->SingleSource = true;
  50.     }
  51.  
  52.     public function addPoints($source{
  53.  
  54.         if (!$this->updating{
  55.             if ($source != null{
  56.                 if (sizeof($source0{
  57.                     $src $source[0];
  58.  
  59.                     if ($src->getCount(0{
  60.  
  61.                         $this->getSeries()->beginUpdate();
  62.                         $this->getSeries()->clear();
  63.                         $this->getSeries()->getXValues()->setOrder(ValueListOrder::$NONE);
  64.  
  65.                         $p Array();  // Array of Point[$src->getCount()]
  66.  
  67.                         if ($src->getVertAxis()->iAxisSize == ||
  68.                             $src->getHorizAxis()->iAxisSize == 0{
  69.  
  70.                             // MS : Not good, rectangle is (0,0,0,0).
  71.                             // How to match it with actual size ??
  72.                             // Force repaint:
  73.                             // TODO check $this->getChart()->getParent()->refreshControl();
  74.                         }
  75.  
  76.                         $tmpG $this->getChart()->getGraphics3D();
  77.  
  78.                         for $t 0$t $src->getCount()$t++{
  79.                                     $p[$t$tmpG->calc3DPoint(
  80.                                     $src->calcXPos($t)$src->calcYPos($t),
  81.                                     $src->getMiddleZ());
  82.                         }
  83.  
  84.                         $sz $tmpG->convexHull($p);
  85.  
  86.                         for $t 0$t $sz$t++{
  87.                             $this->getSeries()->add($this->getSeries()->xScreenToValue(
  88.                             $p[$t]->getX())$this->getSeries()->yScreenToValue($p[$t]->getY()));
  89.                         }
  90.                         if ($sz 0{
  91.                             $this->getSeries()->add($this->getSeries()->getXValues()->value[0],
  92.                                             $this->getSeries()->getYValues()->value[0]);
  93.                         }
  94.                         $p null;
  95.                         $this->getSeries()->endUpdate();
  96.                     }
  97.                 }
  98.             }
  99.         }
  100.     }
  101.  
  102.     /**
  103.     * Gets descriptive text.
  104.     *
  105.     * @return String 
  106.     */
  107.     public function getDescription({
  108.         return Language::getString("FunctionPerimeter");
  109.     }
  110. }
  111. ?>

Documentation generated on Wed, 16 Jun 2010 12:07:11 +0200 by phpDocumentor 1.4.1