[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Image/Graph/Axis/Marker/ -> Area.php (source)

   1  <?php
   2  
   3  /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
   4  
   5  /**
   6   * Class file containing a axis marker used for explicitly highlighting a area
   7   * on the graph, based on an interval specified on an axis.
   8   *
   9   * PHP versions 4 and 5
  10   *
  11   * LICENSE: This library is free software; you can redistribute it and/or modify
  12   * it under the terms of the GNU Lesser General Public License as published by
  13   * the Free Software Foundation; either version 2.1 of the License, or (at your
  14   * option) any later version. This library is distributed in the hope that it
  15   * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  16   * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
  17   * General Public License for more details. You should have received a copy of
  18   * the GNU Lesser General Public License along with this library; if not, write
  19   * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  20   * 02111-1307 USA
  21   *
  22   * @category   Images
  23   * @package    Image_Graph
  24   * @subpackage Grid
  25   * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  26   * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  27   * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  28   * @version    CVS: $Id: Area.php,v 1.11 2005/08/24 20:36:04 nosey Exp $
  29   * @link       http://pear.php.net/package/Image_Graph
  30   */
  31  
  32  /**
  33   * Include file Image/Graph/Grid.php
  34   */
  35  require_once  'Image/Graph/Grid.php';
  36  
  37  /**
  38   * Display a grid
  39   *
  40   * {@link Image_Graph_Grid}
  41   *
  42   * @category   Images
  43   * @package    Image_Graph
  44   * @subpackage Grid
  45   * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  46   * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  47   * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  48   * @version    Release: 0.7.2
  49   * @link       http://pear.php.net/package/Image_Graph
  50   */
  51  class Image_Graph_Axis_Marker_Area extends Image_Graph_Grid
  52  {
  53  
  54      /**
  55       * The lower bound
  56       * @var double
  57       * @access private
  58       */
  59      var $_lower = false;
  60  
  61      /**
  62       * The upper bound
  63       * @var double
  64       * @access private
  65       */
  66      var $_upper = false;
  67  
  68      /**
  69       * [Constructor]
  70       */
  71      function Image_Graph_Axis_Marker_Area()
  72      {
  73          parent::Image_Graph_Grid();
  74          $this->_lineStyle = false;
  75      }
  76  
  77      /**
  78       * Sets the lower bound of the area (value on the axis)
  79       *
  80       * @param double $lower the lower bound
  81       */
  82      function setLowerBound($lower)
  83      {
  84          $this->_lower = $lower;
  85      }
  86  
  87      /**
  88       * Sets the upper bound of the area (value on the axis)
  89       *
  90       * @param double $upper the upper bound
  91       */
  92      function setUpperBound($upper)
  93      {
  94          $this->_upper = $upper;
  95      }
  96  
  97      /**
  98       * Output the grid
  99       *
 100       * @return bool Was the output 'good' (true) or 'bad' (false).
 101       * @access private
 102       */
 103      function _done()
 104      {
 105          if (parent::_done() === false) {
 106              return false;
 107          }
 108  
 109          if (!$this->_primaryAxis) {
 110              return false;
 111          }
 112  
 113          $this->_canvas->startGroup(get_class($this));
 114          
 115          $i = 0;
 116  
 117          $this->_lower = max($this->_primaryAxis->_getMinimum(), $this->_lower);
 118          $this->_upper = min($this->_primaryAxis->_getMaximum(), $this->_upper);
 119  
 120          $secondaryPoints = $this->_getSecondaryAxisPoints();
 121  
 122          reset($secondaryPoints);
 123          list ($id, $previousSecondaryValue) = each($secondaryPoints);
 124          while (list ($id, $secondaryValue) = each($secondaryPoints)) {
 125              if ($this->_primaryAxis->_type == IMAGE_GRAPH_AXIS_X) {
 126                  $p1 = array ('Y' => $secondaryValue, 'X' => $this->_lower);
 127                  $p2 = array ('Y' => $previousSecondaryValue, 'X' => $this->_lower);
 128                  $p3 = array ('Y' => $previousSecondaryValue, 'X' => $this->_upper);
 129                  $p4 = array ('Y' => $secondaryValue, 'X' => $this->_upper);
 130              } else {
 131                  $p1 = array ('X' => $secondaryValue, 'Y' => $this->_lower);
 132                  $p2 = array ('X' => $previousSecondaryValue, 'Y' => $this->_lower);
 133                  $p3 = array ('X' => $previousSecondaryValue, 'Y' => $this->_upper);
 134                  $p4 = array ('X' => $secondaryValue, 'Y' => $this->_upper);
 135              }
 136  
 137              $this->_canvas->addVertex(array('x' => $this->_pointX($p1), 'y' => $this->_pointY($p1)));
 138              $this->_canvas->addVertex(array('x' => $this->_pointX($p2), 'y' => $this->_pointY($p2)));
 139              $this->_canvas->addVertex(array('x' => $this->_pointX($p3), 'y' => $this->_pointY($p3)));
 140              $this->_canvas->addVertex(array('x' => $this->_pointX($p4), 'y' => $this->_pointY($p4)));
 141  
 142              $previousSecondaryValue = $secondaryValue;
 143  
 144              $this->_getLineStyle();
 145              $this->_getFillStyle();
 146              $this->_canvas->polygon(array('connect' => true));
 147          }
 148          
 149          $this->_canvas->endGroup();
 150          
 151          return true;
 152      }
 153  
 154  }
 155  
 156  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7