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

Source for file TeePanel.php

Documentation is available at TeePanel.php

  1. <?php
  2.  
  3. /**
  4.  * TeePanel class
  5.  *
  6.  * Description: Chart background panel characteristics
  7.  *
  8.  * @author
  9.  * @copyright (c) 1995-2010 by Steema Software SL. All Rights Reserved. <info@steema.com>
  10.  * @version 1.0
  11.  * @package TeeChartPHP
  12.  * @link http://www.steema.com
  13.  */
  14.  
  15. class TeePanel extends TeeShape {
  16.  
  17.     private $marginLeft 3;
  18.     private $marginTop 4;
  19.     private $marginRight 3;
  20.     private $marginBottom 4;
  21.     private $backInside=false;
  22.     private $marginUnits=null;
  23.  
  24.     protected $internalCanvas;
  25.  
  26.     // Interceptors
  27.     function __get$property {
  28.       $method ="get{$property}";
  29.       if method_exists$this$method ) ) {
  30.         return $this->$method();
  31.       }
  32.     }
  33.  
  34.     function __set $property,$value {
  35.       $method ="set{$property}";
  36.       if method_exists$this$method ) ) {
  37.         return $this->$method($value);
  38.       }
  39.     }
  40.  
  41.     function __construct($c=null{
  42.         $this->marginUnits PanelMarginUnits::$PERCENT;
  43.  
  44.         parent::__construct($c);
  45.                
  46.         $this->getPen()->setDefaultVisible(false);
  47.         $this->getBrush()->setDefaultColor(new Color(220,220,220));  // defaultColor
  48.         $this->getBevel()->setOuter(BevelStyle::$RAISED);
  49.         $this->getBevel()->defaultOuter=BevelStyle::$RAISED;
  50.     }
  51.  
  52.     /**
  53.      * Obsolete.&nbsp;Please use the Pen method instead.
  54.      *
  55.      * @return ChartPen 
  56.      */
  57.     public function getBorderPen({
  58.         return $this->getPen();
  59.     }
  60.  
  61.     /**
  62.      * Shows or hides the Panel.
  63.      *
  64.      * @return boolean 
  65.      */
  66.     public function getVisible({
  67.         return parent::getVisible();
  68.     }
  69.  
  70.     /**
  71.      * Shows or hides the Panel.
  72.      *
  73.      * @param value boolean
  74.      */
  75.     public function setVisible($value{
  76.         parent::setVisible($value);
  77.     }
  78.  
  79.     public function setTransparent($value{
  80.     }
  81.  
  82.     /**
  83.      * Paints the Chart in your preferred Canvas and region.
  84.      *
  85.      * @param IGraphics3D
  86.      * @param Rectangle
  87.      * @return Rectangle 
  88.      */
  89.     public function draw($g$r{
  90.         
  91.       if ($this->chart->canDrawPanelBack()) {
  92.             if ($this->getShadow()->getVisible()) {
  93.  
  94.                 $w $this->getShadow()->getWidth();
  95.                 if ($w 0{
  96.                     $r->width -= $w;
  97.                 else {
  98.                     $r->+= $w;
  99.                 }
  100.                 $h $this->getShadow()->getHeight();
  101.                 if ($h 0{
  102.                     $r->height -= $h;
  103.                 else {
  104.                     $r->+= $h;
  105.                 }
  106.             }
  107.  
  108.             $r->setWidth($r->getWidth()-$this->getPen()->getWidth());
  109.             $r->setHeight($r->getHeight()-$this->getPen()->getWidth());
  110.             
  111.             $this->paint($g$r);
  112.         }
  113.  
  114.         return $this->applyMargins($r);
  115.     }
  116.  
  117.     public function applyMargins($r{
  118.         // Apply panel margins
  119.         $tmpH $r->getHeight();
  120.  
  121.         if ($this->marginTop != 0{
  122.             $tmp ($this->marginUnits == PanelMarginUnits::$PERCENT?
  123.                       MathUtils::round($tmpH $this->marginTop 0.01:
  124.                       MathUtils::round($this->marginTop);
  125.             $r->+= $tmp;
  126.             $r->height -= $tmp;
  127.         }
  128.  
  129.         if ($this->marginBottom != 0{
  130.             $tmp ($this->marginUnits == PanelMarginUnits::$PERCENT?
  131.                       MathUtils::round($tmpH $this->marginBottom 0.01:
  132.                       MathUtils::round($this->marginBottom);
  133.             $r->height -= $tmp;
  134.         }
  135.  
  136.         $tmpW $r->getWidth();
  137.  
  138.         if ($this->marginLeft != 0{
  139.             $tmp ($this->marginUnits == PanelMarginUnits::$PERCENT?
  140.                       MathUtils::round($tmpW $this->marginLeft 0.01:
  141.                       MathUtils::round($this->marginLeft);
  142.             $r->+= $tmp;
  143.             $r->width -= $tmp;
  144.         }
  145.  
  146.         if ($this->marginRight != 0{
  147.             $tmp ($this->marginUnits == PanelMarginUnits::$PERCENT?
  148.                       MathUtils::round($tmpW $this->marginRight 0.01:
  149.                       MathUtils::round($this->marginRight);
  150.             $r->width -= $tmp;
  151.         }
  152.  
  153.         return $r;
  154.     }
  155.  
  156.     /**
  157.      * Obsolete.&nbsp;Please Set Panel.<!-- -->Image=null.
  158.      */
  159.     public function backImageClear({
  160.         $this->setImage(null);
  161.     }
  162.  
  163.     /**
  164.      * The units in which the Margins are expressed.<br>
  165.      * Either as a percentage of the pixel height and width of the Chart
  166.      * Drawing Canvas, or in pixels from the panel borders.<br>
  167.      * Default value: Percent
  168.      *
  169.      * @return PanelMarginUnits 
  170.      */
  171.     public function getMarginUnits({
  172.         return $this->marginUnits;
  173.     }
  174.  
  175.     /**
  176.      * Sets the units in which the Margins are expressed.<br>
  177.      * Default value: Percent
  178.      *
  179.      * @param value PanelMarginUnits
  180.      */
  181.     public function setMarginUnits($value{
  182.         if ($this->marginUnits != $value{
  183.             $this->marginUnits $value;
  184.             $this->invalidate();
  185.         }
  186.     }
  187.  
  188.     /**
  189.      * Left margin expressed as percentage of Chart Drawing.<br>
  190.      * Each Chart.Panel class has four margin parameters: LeftMargin,
  191.      * RightMargin, TopMargin, BottomMargin. These properties are expressed as
  192.      * a percentage of the pixel height (for top and bottom margins) and width
  193.      * (for left and right margins) of the Chart Drawing Canvas. Default values
  194.      * are 8 for top and bottom margins and 12 for left and right margins.
  195.      * Or they can be expressed in pixels by changing the MarginUnits from
  196.      * percentage (default) to pixels.<br>
  197.      * Default value: 12
  198.      *
  199.      * @return double 
  200.      */
  201.     public function getMarginLeft({
  202.         return $this->marginLeft;
  203.     }
  204.  
  205.     /**
  206.      * Sets Left margin as percentage of Chart Drawing.<br>
  207.      * Default value: 12
  208.      *
  209.      * @see Panel#getMarginLeft
  210.      * @param value double
  211.      */
  212.     public function setMarginLeft($value{
  213.         $this->marginLeft $this->setDoubleProperty($this->marginLeft$value);
  214.     }
  215.  
  216.  
  217.     /**
  218.      * Top margin  expressed as percentage of Chart Drawing.<br>
  219.      * Each Chart.Panel class has four margin properties: LeftMargin,
  220.      * RightMargin, TopMargin, BottomMargin. These properties are expressed as
  221.      * a percentage of the pixel height (for top and bottom margins) and width
  222.      * (for left and right margins) of the Chart Drawing Canvas. Default values
  223.      * are 8 for top and bottom margins and 12 for left and right margins.
  224.      * Or they can be expressed in pixels by changing the MarginUnits from
  225.      * percentage (default) to pixels.<br>
  226.      * Default value: 8
  227.      *
  228.      * @return double 
  229.      */
  230.     public function getMarginTop({
  231.         return $this->marginTop;
  232.     }
  233.  
  234.     /**
  235.      * Sets Top margin as percentage of Chart Drawing.<br>
  236.      * Default value: 8
  237.      *
  238.      * @see Panel#getMarginTop
  239.      * @param value double
  240.      */
  241.     public function setMarginTop($value{
  242.         $this->marginTop $this->setDoubleProperty($this->marginTop$value);
  243.     }
  244.  
  245.     /**
  246.      * Right margin expressed as percentage of Chart Drawing.<br>
  247.      * Each Chart.Panel class has four margin properties: LeftMargin,
  248.      * RightMargin, TopMargin, BottomMargin. These properties are expressed as
  249.      * a percentage of the pixel height (for top and bottom margins) and width
  250.      * (for left and right margins) of the Chart Drawing Canvas. Default values
  251.      * are 8 for top and bottom margins and 12 for left and right margins.
  252.      * Or they can be expressed in pixels by changing the MarginUnits from
  253.      * percentage (default) to pixels.<br>
  254.      * Default value: 12
  255.      *
  256.      * @return double 
  257.      */
  258.     public function getMarginRight({
  259.         return $this->marginRight;
  260.     }
  261.  
  262.     /**
  263.      * Sets Right margin as percentage of Chart Drawing.<br>
  264.      * Default value: 12
  265.      *
  266.      * @see Panel#getMarginRight
  267.      * @param value double
  268.      */
  269.     public function setMarginRight($value{
  270.         $this->marginRight $this->setDoubleProperty($this->marginRight$value);
  271.     }
  272.  
  273.     /**
  274.      * Bottom margin expressed as percentage of Chart Drawing.<br>
  275.      * Each Chart.Panel class has four margin properties: LeftMargin,
  276.      * RightMargin, TopMargin, BottomMargin. These properties are expressed as
  277.      * a percentage of the pixel height (for top and bottom margins) and width
  278.      * (for left and right margins) of the Chart Drawing Canvas. Default values
  279.      * are 8 for top and bottom margins and 12 for left and right margins.
  280.      * Or they can be expressed in pixels by changing the MarginUnits from
  281.      * percentage (default) to pixels.<br>
  282.      * Default value: 8
  283.      *
  284.      * @return double 
  285.      */
  286.     public function getMarginBottom({
  287.         return $this->marginBottom;
  288.     }
  289.  
  290.     /**
  291.      * Sets Bottom margin as percentage of Chart Drawing.<br>
  292.      * Default value: 8
  293.      *
  294.      * @see Panel#getMarginBottom
  295.      * @param value double
  296.      */
  297.     public function setMarginBottom($value{
  298.         $this->marginBottom $this->setDoubleProperty($this->marginBottom$value);
  299.     }
  300.  
  301.  
  302.     /**
  303.      * Obsolete.&nbsp;Please use Walls.<!-- -->Back.<!-- -->Image instead.
  304.      *
  305.      * @return boolean 
  306.      */
  307.     public function getBackImageInside({
  308.         return $this->backInside;
  309.     }
  310.  
  311.     /**
  312.      * Obsolete.&nbsp;Please use Walls.<!-- -->Back.<!-- -->Image instead.
  313.      *
  314.      * @param value boolean
  315.      */
  316.     public function setBackImageInside($value{
  317.         $this->backInside $this->setBooleanProperty($this->backInside$value);
  318.     }
  319. }
  320.  
  321. ?>

Documentation generated on Wed, 16 Jun 2010 12:08:38 +0200 by phpDocumentor 1.4.1