| [ 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 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: Grid.php,v 1.8 2005/02/21 20:49:47 nosey Exp $ 28 * @link http://pear.php.net/package/Image_Graph 29 */ 30 31 /** 32 * Include file Image/Graph/Element.php 33 */ 34 require_once 'Image/Graph/Element.php'; 35 36 /** 37 * A grid displayed on the plotarea. 38 * 39 * A grid is associated with a primary and a secondary axis. The grid is 40 * displayed in context of the primary axis' label interval - meaning that a 41 * grid for an Y-axis displays a grid for every label on the y-axis (fx. a {@link 42 * Image_Graph_Grid_Lines}, which displays horizontal lines for every label on 43 * the y-axis from the x-axis minimum to the x-axis maximum). You should always 44 * add the grid as one of the first elements to the plotarea. This is due to the 45 * fact that elements are 'outputted' in the order they are added, i.e. if an 46 * grid is added *after* a chart, the grid will be displayed on top of the chart 47 * which is (probably) not desired. 48 * 49 * @category Images 50 * @package Image_Graph 51 * @subpackage Grid 52 * @author Jesper Veggerby <pear.nosey@veggerby.dk> 53 * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen 54 * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 55 * @version Release: 0.7.2 56 * @link http://pear.php.net/package/Image_Graph 57 * @abstract 58 */ 59 class Image_Graph_Grid extends Image_Graph_Plotarea_Element 60 { 61 62 /** 63 * The primary axis: the grid 'refers' to 64 * @var Axis 65 * @access private 66 */ 67 var $_primaryAxis = null; 68 69 /** 70 * The secondary axis 71 * @var Axis 72 * @access private 73 */ 74 var $_secondaryAxis = null; 75 76 /** 77 * Set the primary axis: the grid should 'refer' to 78 * 79 * @param Image_Graph_Axis $axis The axis 80 * @access private 81 */ 82 function _setPrimaryAxis(& $axis) 83 { 84 $this->_primaryAxis =& $axis; 85 } 86 87 /** 88 * Set the secondary axis 89 * 90 * @param Image_Graph_Axis $axis The axis 91 * @access private 92 */ 93 function _setSecondaryAxis(& $axis) 94 { 95 $this->_secondaryAxis =& $axis; 96 } 97 98 /** 99 * Get the points on the secondary axis that the grid should 'connect' 100 * 101 * @return array The secondary data values that should mark the grid 'end points' 102 * @access private 103 */ 104 function _getSecondaryAxisPoints() 105 { 106 if (is_a($this->_secondaryAxis, 'Image_Graph_Axis_Radar')) { 107 $secondaryValue = false; 108 $firstValue = $secondaryValue; 109 while (($secondaryValue = $this->_secondaryAxis->_getNextLabel($secondaryValue)) !== false) { 110 $secondaryAxisPoints[] = $secondaryValue; 111 } 112 $secondaryAxisPoints[] = $firstValue; 113 } else { 114 $secondaryAxisPoints = array ('#min#', '#max#'); 115 } 116 return $secondaryAxisPoints; 117 } 118 119 /** 120 * Get the X pixel position represented by a value 121 * 122 * @param double $point the value to get the pixel-point for 123 * @return double The pixel position along the axis 124 * @access private 125 */ 126 function _pointX($point) 127 { 128 if (($this->_primaryAxis->_type == IMAGE_GRAPH_AXIS_Y) || 129 ($this->_primaryAxis->_type == IMAGE_GRAPH_AXIS_Y_SECONDARY)) 130 { 131 $point['AXIS_Y'] = $this->_primaryAxis->_type; 132 } else { 133 $point['AXIS_Y'] = $this->_secondaryAxis->_type; 134 } 135 return parent::_pointX($point); 136 } 137 138 /** 139 * Get the Y pixel position represented by a value 140 * 141 * @param double $point the value to get the pixel-point for 142 * @return double The pixel position along the axis 143 * @access private 144 */ 145 function _pointY($point) 146 { 147 if (($this->_primaryAxis->_type == IMAGE_GRAPH_AXIS_Y) || 148 ($this->_primaryAxis->_type == IMAGE_GRAPH_AXIS_Y_SECONDARY)) 149 { 150 $point['AXIS_Y'] = $this->_primaryAxis->_type; 151 } else { 152 $point['AXIS_Y'] = $this->_secondaryAxis->_type; 153 } 154 return parent::_pointY($point); 155 } 156 157 /** 158 * Causes the object to update all sub elements coordinates. 159 * 160 * @access private 161 */ 162 function _updateCoords() 163 { 164 $this->_setCoords( 165 $this->_parent->_plotLeft, 166 $this->_parent->_plotTop, 167 $this->_parent->_plotRight, 168 $this->_parent->_plotBottom 169 ); 170 parent::_updateCoords(); 171 } 172 173 } 174 175 ?>
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 |