[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/Image/Graph/Grid/ -> Bars.php (source)

   1  <?php
   2  
   3  /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
   4  
   5  /**
   6   * Image_Graph - PEAR PHP OO Graph Rendering Utility.
   7   *
   8   * PHP versions 4 and 5
   9   *
  10   * LICENSE: This library is free software; you can redistribute it and/or modify
  11   * it under the terms of the GNU Lesser General Public License as published by
  12   * the Free Software Foundation; either version 2.1 of the License, or (at your
  13   * option) any later version. This library is distributed in the hope that it
  14   * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  15   * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
  16   * General Public License for more details. You should have received a copy of
  17   * the GNU Lesser General Public License along with this library; if not, write
  18   * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  19   * 02111-1307 USA
  20   *
  21   * @category   Images
  22   * @package    Image_Graph
  23   * @subpackage Grid
  24   * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  25   * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  26   * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  27   * @version    CVS: $Id: Bars.php,v 1.10 2005/09/14 20:27:25 nosey Exp $
  28   * @link       http://pear.php.net/package/Image_Graph
  29   */
  30   
  31  /**
  32   * Include file Image/Graph/Grid.php
  33   */
  34  require_once  'Image/Graph/Grid.php';
  35  
  36  /**
  37   * Display alternating bars on the plotarea.
  38   *
  39   * {@link Image_Graph_Grid}
  40   *
  41   * @category   Images
  42   * @package    Image_Graph
  43   * @subpackage Grid
  44   * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  45   * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  46   * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  47   * @version    Release: 0.7.2
  48   * @link       http://pear.php.net/package/Image_Graph
  49   */
  50  class Image_Graph_Grid_Bars extends Image_Graph_Grid
  51  {
  52  
  53      /**
  54       * Output the grid
  55       *
  56       * @return bool Was the output 'good' (true) or 'bad' (false).
  57       * @access private
  58       */
  59      function _done()
  60      {
  61          if (parent::_done() === false) {
  62              return false;
  63          }
  64  
  65          if (!$this->_primaryAxis) {
  66              return false;
  67          }
  68          
  69          $this->_canvas->startGroup(get_class($this));
  70  
  71          $i = 0;
  72          $value = false;
  73  
  74          $previousValue = 0;
  75  
  76          $secondaryPoints = $this->_getSecondaryAxisPoints();
  77  
  78          while (($value = $this->_primaryAxis->_getNextLabel($value)) !== false) {
  79              if ($i == 1) {
  80                  reset($secondaryPoints);
  81                  list ($id, $previousSecondaryValue) = each($secondaryPoints);
  82                  while (list ($id, $secondaryValue) = each($secondaryPoints)) {
  83                      if ($this->_primaryAxis->_type == IMAGE_GRAPH_AXIS_X) {
  84                          $p1 = array ('Y' => $secondaryValue, 'X' => $value);
  85                          $p2 = array ('Y' => $previousSecondaryValue, 'X' => $value);
  86                          $p3 = array ('Y' => $previousSecondaryValue, 'X' => $previousValue);
  87                          $p4 = array ('Y' => $secondaryValue, 'X' => $previousValue);
  88                      } else {
  89                          $p1 = array ('X' => $secondaryValue, 'Y' => $value);
  90                          $p2 = array ('X' => $previousSecondaryValue, 'Y' => $value);
  91                          $p3 = array ('X' => $previousSecondaryValue, 'Y' => $previousValue);
  92                          $p4 = array ('X' => $secondaryValue, 'Y' => $previousValue);
  93                      }
  94  
  95                      $this->_canvas->addVertex(array('x' => $this->_pointX($p1), 'y' => $this->_pointY($p1)));
  96                      $this->_canvas->addVertex(array('x' => $this->_pointX($p2), 'y' => $this->_pointY($p2)));
  97                      $this->_canvas->addVertex(array('x' => $this->_pointX($p3), 'y' => $this->_pointY($p3)));
  98                      $this->_canvas->addVertex(array('x' => $this->_pointX($p4), 'y' => $this->_pointY($p4)));
  99  
 100                      $this->_getFillStyle();
 101                      $this->_canvas->polygon(array('connect' => true));
 102  
 103                      $previousSecondaryValue = $secondaryValue;
 104                  }
 105              }
 106              $i = 1 - $i;
 107              $previousValue = $value;
 108          }
 109          
 110          $this->_canvas->endGroup();
 111          
 112          return true;
 113      }
 114  
 115  }
 116  
 117  ?>


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