[ 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: Area.php,v 1.11 2005/11/27 22:21:17 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 area chart 38 * 39 * Similar to an {@link Image_Graph_Plot_Area}, 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_Area}. 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_Area extends Image_Graph_Plot_Smoothed_Bezier 55 { 56 57 /** 58 * Perform the actual drawing on the legend. 59 * 60 * @param int $x0 The top-left x-coordinate 61 * @param int $y0 The top-left y-coordinate 62 * @param int $x1 The bottom-right x-coordinate 63 * @param int $y1 The bottom-right y-coordinate 64 * @access private 65 */ 66 function _drawLegendSample($x0, $y0, $x1, $y1) 67 { 68 69 $this->_canvas->addVertex(array('x' => $x0, 'y' => $y1)); 70 $this->_addSamplePoints($x0, $y0, $x1, $y1); 71 $this->_canvas->addVertex(array('x' => $x1, 'y' => $y1)); 72 $this->_canvas->polygon(array('connect' => true)); 73 } 74 75 /** 76 * Output the Bezier smoothed plot as an Area Chart 77 * 78 * @return bool Was the output 'good' (true) or 'bad' (false). 79 * @access private 80 */ 81 function _done() 82 { 83 if (parent::_done() === false) { 84 return false; 85 } 86 87 $this->_canvas->startGroup(get_class($this) . '_' . $this->_title); 88 $this->_clip(true); 89 90 $keys = array_keys($this->_dataset); 91 foreach ($keys as $key) { 92 $dataset =& $this->_dataset[$key]; 93 $dataset->_reset(); 94 $first = true; 95 while ($p1 = $dataset->_next()) { 96 $p0 = $dataset->_nearby(-2); 97 $p2 = $dataset->_nearby(0); 98 $p3 = $dataset->_nearby(1); 99 if ($first) { 100 $p = $p1; 101 $p['Y'] = '#min_pos#'; 102 $x = $this->_pointX($p); 103 $y = $this->_pointY($p); 104 $this->_canvas->addVertex(array('x' => $x, 'y' => $y)); 105 } 106 107 if ($p2) { 108 $cp = $this->_getControlPoints($p1, $p0, $p2, $p3); 109 $this->_canvas->addSpline( 110 array( 111 'x' => $cp['X'], 112 'y' => $cp['Y'], 113 'p1x' => $cp['P1X'], 114 'p1y' => $cp['P1Y'], 115 'p2x' => $cp['P2X'], 116 'p2y' => $cp['P2Y'] 117 ) 118 ); 119 } else { 120 $x = $this->_pointX($p1); 121 $y = $this->_pointY($p1); 122 $this->_canvas->addVertex(array('x' => $x, 'y' => $y)); 123 } 124 $lastPoint = $p1; 125 $first = false; 126 } 127 $lastPoint['Y'] = '#min_pos#'; 128 $x = $this->_pointX($lastPoint); 129 $y = $this->_pointY($lastPoint); 130 $this->_canvas->addVertex(array('x' => $x, 'y' => $y)); 131 132 $this->_getFillStyle($key); 133 $this->_getLineStyle($key); 134 $this->_canvas->polygon(array('connect' => true)); 135 } 136 unset($keys); 137 $this->_drawMarker(); 138 $this->_clip(false); 139 $this->_canvas->endGroup(); 140 return true; 141 } 142 143 } 144 145 ?>
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 |