[ Index ]
 

Code source de Horde 3.1.3

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

title

Body

[fermer]

/lib/Horde/Graph/Plot/ -> line.php (source)

   1  <?php
   2  /**
   3   * Line graph implementation for the Horde_Graph package.
   4   *
   5   * $Horde: framework/Graph/Graph/Plot/line.php,v 1.4.12.4 2006/01/01 21:28:18 jan Exp $
   6   *
   7   * Copyright 2002-2006 Chuck Hagenbuch <chuck@horde.org>
   8   *
   9   * See the enclosed file COPYING for license information (LGPL). If you
  10   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  11   *
  12   * @author  Chuck Hagenbuch <chuck@horde.org>
  13   * @since   Horde 3.0
  14   * @package Horde_Graph
  15   */
  16  class Horde_Graph_Plot_line {
  17  
  18      var $_graph;
  19      var $_color = 'blue';
  20      var $_width = 1;
  21      var $_dataset;
  22  
  23      function Horde_Graph_Plot_line(&$graph, $params)
  24      {
  25          $this->_graph = &$graph;
  26  
  27          foreach ($params as $param => $value) {
  28              $key = '_' . $param;
  29              $this->$key = $value;
  30          }
  31      }
  32  
  33      function draw($minY = false)
  34      {
  35          $data = $this->_graph->_data['y'][$this->_dataset];
  36  
  37          $count = count($data);
  38          $verts = array();
  39          for ($i = 0; $i < $count; $i++) {
  40              $x = $i;
  41              if ($minY !== false && $data[$i] < $minY) {
  42                  if (count($verts) == 1) {
  43                      $this->_graph->img->circle($verts[0]['x'], $verts[0]['y'], $this->_width, $this->_color, $this->_color);
  44                  }
  45                  else {
  46                      $this->_graph->img->polyline($verts, $this->_color, $this->_width);
  47                  }
  48                  $verts = array();
  49              }
  50              else {
  51                  $y = $data[$i];
  52                  $this->_graph->translate($x, $y);
  53                  $verts[] = array('x' => $x, 'y' => $y);
  54              }
  55          }
  56  
  57          $this->_graph->img->polyline($verts, $this->_color, $this->_width);
  58      }
  59  
  60  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7