[ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 /** 3 * Bar graph implementation for the Horde_Graph package. 4 * 5 * $Horde: framework/Graph/Graph/Plot/bar.php,v 1.5.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_bar { 17 18 var $graph; 19 20 var $_color = 'blue'; 21 var $_outline = 'black'; 22 var $_width = 10; 23 var $_offset = 0; 24 var $_dataset; 25 26 function Horde_Graph_Plot_bar(&$graph, $params) 27 { 28 $this->graph = &$graph; 29 30 foreach ($params as $param => $value) { 31 $key = '_' . $param; 32 $this->$key = $value; 33 } 34 } 35 36 function draw($minY = false) 37 { 38 $data = $this->graph->_data['y'][$this->_dataset]; 39 40 $barWidth = $this->_width; 41 $barOffset = $this->_offset * $barWidth; 42 $u = 0; 43 $v = 0; 44 $count = count($data); 45 for ($i = 0; $i < $count; $i++) { 46 $x = $i; 47 if ($minY === false || $data[$i] >= $minY) { 48 $y = $data[$i]; 49 $this->graph->translate($x, $y); 50 $x = $x - ($barWidth / 2) + $barOffset; 51 $height = $this->graph->_graphBottom - $y; 52 53 $this->graph->img->rectangle($x, $y, $barWidth, $height, $this->_outline, $this->_color); 54 } 55 } 56 } 57 58 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |