[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
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 Plot 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: Line.php,v 1.14 2006/03/02 12:37:37 nosey Exp $ 28 * @link http://pear.php.net/package/Image_Graph 29 */ 30 31 /** 32 * Include file Image/Graph/Plot/Smoothed/Bezier.php 33 */ 34 require_once 'Image/Graph/Plot/Smoothed/Bezier.php'; 35 36 /** 37 * Bezier smoothed line chart. 38 * 39 * Similar to a {@link Image_Graph_Plot_Line}, but the interconnecting lines 40 * between two datapoints are smoothed using a Bezier curve, which enables the 41 * chart to appear as a nice curved plot instead of the sharp edges of a 42 * conventional {@link Image_Graph_Plot_Line}. Smoothed charts are only supported 43 * with non-stacked types 44 * 45 * @category Images 46 * @package Image_Graph 47 * @subpackage Plot 48 * @author Jesper Veggerby <pear.nosey@veggerby.dk> 49 * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen 50 * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 51 * @version Release: 0.7.2 52 * @link http://pear.php.net/package/Image_Graph 53 */ 54 class Image_Graph_Plot_Smoothed_Line extends Image_Graph_Plot_Smoothed_Bezier 55 { 56 57 /** 58 * Gets the fill style of the element 59 * 60 * @return int A GD filestyle representing the fill style 61 * @see Image_Graph_Fill 62 * @access private 63 */ 64 function _getFillStyle($ID = false) 65 { 66 return IMG_COLOR_TRANSPARENT; 67 } 68 69 /** 70 * Perform the actual drawing on the legend. 71 * 72 * @param int $x0 The top-left x-coordinate 73 * @param int $y0 The top-left y-coordinate 74 * @param int $x1 The bottom-right x-coordinate 75 * @param int $y1 The bottom-right y-coordinate 76 * @access private 77 */ 78 function _drawLegendSample($x0, $y0, $x1, $y1) 79 { 80 $this->_addSamplePoints($x0, $y0, $x1, $y1); 81 $this->_canvas->polygon(array('connect' => false)); 82 } 83 84 /** 85 * Output the Bezier smoothed plot as an Line Chart 86 * 87 * @return bool Was the output 'good' (true) or 'bad' (false). 88 * @access private 89 */ 90 function _done() 91 { 92 if (parent::_done() === false) { 93 return false; 94 } 95 96 $this->_canvas->startGroup(get_class($this) . '_' . $this->_title); 97 $this->_clip(true); 98 $keys = array_keys($this->_dataset); 99 foreach ($keys as $key) { 100 $dataset =& $this->_dataset[$key]; 101 $dataset->_reset(); 102 $numPoints = 0; 103 while ($p1 = $dataset->_next()) { 104 if ($p1['Y'] === null) { 105 if ($numPoints > 1) { 106 $this->_getLineStyle($key); 107 $this->_canvas->polygon(array('connect' => false, 'map_vertices' => true)); 108 } 109 else { 110 $this->_canvas->reset(); 111 } 112 $numPoints = 0; 113 } else { 114 $p0 = $dataset->_nearby(-2); 115 $p2 = $dataset->_nearby(0); 116 $p3 = $dataset->_nearby(1); 117 118 if (($p0) && ($p0['Y'] === null)) { 119 $p0 = false; 120 } 121 if (($p2) && ($p2['Y'] === null)) { 122 $p2 = false; 123 } 124 if (($p3) && ($p3['Y'] === null)) { 125 $p3 = false; 126 } 127 128 if ($p2) { 129 $cp = $this->_getControlPoints($p1, $p0, $p2, $p3); 130 $this->_canvas->addSpline( 131 $this->_mergeData( 132 $p1, 133 array( 134 'x' => $cp['X'], 135 'y' => $cp['Y'], 136 'p1x' => $cp['P1X'], 137 'p1y' => $cp['P1Y'], 138 'p2x' => $cp['P2X'], 139 'p2y' => $cp['P2Y'] 140 ) 141 ) 142 ); 143 } else { 144 $x = $this->_pointX($p1); 145 $y = $this->_pointY($p1); 146 $this->_canvas->addVertex( 147 $this->_mergeData( 148 $p1, 149 array('x' => $x, 'y' => $y) 150 ) 151 ); 152 } 153 $numPoints++; 154 } 155 } 156 if ($numPoints > 1) { 157 $this->_getLineStyle(); 158 $this->_canvas->polygon(array('connect' => false, 'map_vertices' => true)); 159 } 160 else { 161 $this->_canvas->reset(); 162 } 163 } 164 unset($keys); 165 $this->_drawMarker(); 166 $this->_clip(false); 167 $this->_canvas->endGroup(); 168 return true; 169 } 170 171 } 172 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |