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

Source for file Callout.php

Documentation is available at Callout.php

  1. <?php
  2.  
  3. /**
  4.  * Callout class
  5.  *
  6.  * Description: Mark Callout pointer characteristics
  7.  *
  8.  * @author
  9.  * @copyright (c) 1995-2009 by Steema Software SL. All Rights Reserved. <info@steema.com>
  10.  * @version 1.0
  11.  * @package TeeChartPHP
  12.  * @subpackage styles
  13.  * @link http://www.steema.com
  14.  */
  15.  
  16. class Callout extends SeriesPointer
  17. {
  18.  
  19.    // when True, the Marks arrow pen
  20.    // color is changed if the point has
  21.    // the same color.
  22.  
  23.    private $CHECKMARKARROWCOLOR false;
  24.  
  25.    private $arrow;
  26.    private $arrowHead 0// ArrowHeadStyle::$NONE;
  27.    private $distance 0;
  28.    private $arrowHeadSize 8;
  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 Callout($s null)
  46.    {
  47.       parent::SeriesPointer(($s != null$s->getChart(null $s);
  48.  
  49.       $this->setStyle(PointerStyle::$RECTANGLE);
  50.       $tmpColor new Color(0,0,0);  // BLACK
  51.       $this->getBrush()->setDefaultColor($tmpColor);
  52.       $this->draw3D = false;
  53.       $this->bVisible = true;
  54.    }
  55.  
  56.    public function draw($c$pFrom$pTo$z)
  57.    {
  58.       $tmpGra $this->chart->getGraphics3D();
  59.  
  60.       if($this->getArrow()->getVisible())
  61.       {
  62.          $this->prepareCanvas($tmpGra$this->getColor());
  63.  
  64.          $tmpGra->setPen($this->getArrow());
  65.  
  66.          if($this->CHECKMARKARROWCOLOR &&
  67.          (($this->getArrow()->getColor(== $c||
  68.          ($this->getArrow()->getColor(== $this->chart->getPanel()->getColor())))
  69.          {
  70.             $tmpGra->getPen()->setColor(($this->chart->getPanel()->getColor(==
  71.             new Color(000new Color(255255255new Color(000)));
  72.          }
  73.  
  74.          if($this->arrowHead == ArrowHeadStyle::$LINE)
  75.          {
  76.             $tmpGra->arrow(false$pFrom$pTo$this->arrowHeadSize$this->arrowHeadSize$z);
  77.          }
  78.          else
  79.             if($this->arrowHead == ArrowHeadStyle::$SOLID)
  80.             {
  81.                $tmpGra->arrow(true$pFrom$pTo$this->arrowHeadSize$this->arrowHeadSize$z);
  82.             }
  83.             else
  84.                if($this->arrowHead == ArrowHeadStyle::$NONE)
  85.                {
  86.                   if($this->chart->getAspect()->getView3D())
  87.                   {
  88.                      $tmpGra->moveToZ($pFrom$z);
  89.                      $tmpGra->lineTo($pTo$z);
  90.                   }
  91.                   else
  92.                   {
  93.                      $tmpGra->__line($pFrom$pTo);
  94.                   }
  95.                }
  96.       }
  97.  
  98.       if($this->arrowHead == ArrowHeadStyle::$NONE && $this->getVisible())
  99.       {
  100.          $this->prepareCanvas($tmpGra$this->getColor());
  101.  
  102.          $tmpFrom $pFrom;
  103.  
  104.          if($this->chart->getAspect()->getView3D())
  105.          {
  106.             $tmpFrom $tmpGra->calc3DPoint($pFrom$z);
  107.          }
  108.  
  109.          parent::draw($tmpGra$this->chart->getAspect()->getView3D(),
  110.          $tmpFrom->x$tmpFrom->y$this->getHorizSize()$this->getVertSize(),
  111.          $this->getColor()$this->getStyle());
  112.       }
  113.    }
  114.  
  115.    /**
  116.    * Arrow line between a Series Mark and a Series point.<br>
  117.    * It is also used by Annotation tool to draw a line connecting the
  118.    * annotation and the series point.
  119.    *
  120.    * @return ChartPen 
  121.    */
  122.    public function getArrow()
  123.    {
  124.       if($this->arrow == null)
  125.       {
  126.          $tmpColor new Color(255255255);
  127.          $this->arrow new ChartPen($this->chart$tmpColor);
  128.       }
  129.       return $this->arrow;
  130.    }
  131.  
  132.    /**
  133.    * Sets the Arrow line between a Series Mark and a Series point.<br>
  134.    * It is also used by Annotation tool to draw a line connecting the
  135.    * annotation and the series point.
  136.    *
  137.    * @param value ChartPen
  138.    */
  139.    public function setArrow($value)
  140.    {
  141.       $this->getArrow()->assign($value);
  142.    }
  143.  
  144.    /**
  145.    * Determines if callout line will display an "arrow" head at the end or
  146.    * not. <br>
  147.    * See TArrowHeadStyle enumerated values for options.
  148.    *
  149.    *
  150.    * @return ArrowHeadStyle 
  151.    */
  152.    public function getArrowHead()
  153.    {
  154.       return $this->arrowHead;
  155.    }
  156.  
  157.    /**
  158.    * Determines if callout line will display an "arrow" head at the end or
  159.    * not. <br>
  160.    *
  161.    *
  162.    * @param value ArrowHeadStyle
  163.    */
  164.    public function setArrowHead($value)
  165.    {
  166.       if($this->arrowHead != $value)
  167.       {
  168.          $this->arrowHead $value;
  169.          $this->invalidate();
  170.       }
  171.    }
  172.  
  173.    /**
  174.    * The size in pixels to display the arrow head at the end of the
  175.    * callout line.
  176.    *
  177.    * @return int 
  178.    */
  179.    public function getArrowHeadSize()
  180.    {
  181.       return $this->arrowHeadSize;
  182.    }
  183.  
  184.    /**
  185.    * Sets the size in pixels of the arrow head at the end of the
  186.    * callout line.
  187.    *
  188.    * @param value int
  189.    */
  190.    public function setArrowHeadSize($value)
  191.    {
  192.       if($this->arrowHeadSize != $value)
  193.       {
  194.          $this->arrowHeadSize $value;
  195.          $this->invalidate();
  196.       }
  197.    }
  198.  
  199.    /**
  200.    * The length in pixels between a series point and the line connecting the
  201.    * series mark or annotation.
  202.    *
  203.    * @return int 
  204.    */
  205.    public function getDistance()
  206.    {
  207.       return $this->distance;
  208.    }
  209.  
  210.    /**
  211.    * The length in pixels between a series point and the line connecting the
  212.    * series mark or annotation.
  213.    *
  214.    * @param value int
  215.    */
  216.    public function setDistance($value)
  217.    {
  218.       if($this->distance != $value)
  219.       {
  220.          $this->distance $value;
  221.          $this->invalidate();
  222.       }
  223.    }
  224. }
  225.  
  226. ?>

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