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

Source for file CustomAxes.php

Documentation is available at CustomAxes.php

  1. <?php
  2.  
  3.  /**
  4.  * CustomAxes class
  5.  *
  6.  * Description: Used to access the Custom series List
  7.  *
  8.  * @author
  9.  * @copyright (c) 1995-2008 by Steema Software SL. All Rights Reserved. <info@steema.com>
  10.  * @version 1.0
  11.  * @package TeeChartPHP
  12.  * @subpackage axis
  13.  * @link http://www.steema.com
  14.  */
  15.  
  16. final class CustomAxes extends ArrayObject
  17. {
  18.  
  19.    private $chart;
  20.  
  21.    // Interceptors
  22.    function __get$property {
  23.      $method ="get{$property}";
  24.      if method_exists$this$method ) ) {
  25.        return $this->$method();
  26.      }
  27.    }
  28.  
  29.    function __set $property,$value {
  30.      $method ="set{$property}";
  31.      if method_exists$this$method ) ) {
  32.        return $this->$method($value);
  33.      }
  34.    }
  35.    /**
  36.    * Creates and adds a custom axis to the chart.
  37.    *
  38.    * @return Axis 
  39.    */
  40.    public function getNew()
  41.    {
  42.       return $this->add(new Axis(false,false,$this->chart));
  43.    }
  44.  
  45.    public function setChart($value)
  46.    {
  47.       $this->chart $value;
  48.  
  49.       for($t 0$t sizeof($this)$t++)
  50.       {
  51.          $this->getAxis($t)->setChart($this->chart);
  52.       }
  53.    }
  54.  
  55.    /**
  56.    * Adds a Custom Axis.
  57.    *
  58.    * @param axis Axis
  59.    * @return Axis 
  60.    */
  61.    public function add($axis)
  62.    {
  63.       if($this->indexOf($axis== - 1)
  64.       {
  65.            if (is_object($this)) {
  66.               parent::offsetset(sizeof($this),$axis);
  67.            }
  68.            else
  69.            {
  70.               parent::append($axis);
  71.            }
  72.       }
  73.       // remove $axis->setChart($this->chart);
  74.       return $axis;
  75.    }
  76.  
  77.    /**
  78.    * Accesses Axis characteristics of corresponding index value.
  79.    *
  80.    * @param index int
  81.    * @return Axis 
  82.    */
  83.    public function getAxis($index)
  84.    {
  85.       return $this->offsetGet($index);
  86.    }
  87.     /**
  88.     * Sets Axis characteristics of corresponding index value.
  89.     *
  90.     * @param index int
  91.     * @param value Axis
  92.     */
  93.    public function setAxis($index$value)
  94.    {
  95.       $this->offsetSet($index$value);
  96.    }
  97.     /**
  98.     * Returns the corresponding axis index which has the specified value.
  99.     *
  100.     * @param Axis
  101.     * @return int 
  102.     */
  103.    public function indexOf($a)
  104.    {
  105.       for($t 0$t sizeof($this)$t++)
  106.       {
  107.          if($this->offsetGet($t== $a)
  108.          {
  109.             return $t;
  110.          }
  111.       }
  112.       return 1;
  113.    }
  114.  
  115.    /**
  116.    * Removes the Custom Axis of Index 'CustomAxisIndex'.<br>
  117.    * Any Series associated with the Axis are reset to their default Axes.
  118.    *
  119.    * @param Axis
  120.    */
  121.    public function remove($a)
  122.    {
  123.       $i $this->indexOf($a);
  124.       if($i != - 1)
  125.       {
  126.          $this->remove($i);
  127.       }
  128.    }
  129.  
  130.    /**
  131.    * Removes all Custom Axes.<br>
  132.    * Any Series associated with the Axes are reset to their default Axes.
  133.    */
  134.    public function removeAll()
  135.    {
  136.       while(sizeof($this0)
  137.       {
  138.          $this->remove(0);
  139.       }
  140.    }
  141. }
  142. ?>

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