[ 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 DataPreprocessor 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: Array.php,v 1.6 2005/08/24 20:35:59 nosey Exp $ 28 * @link http://pear.php.net/package/Image_Graph 29 */ 30 31 /** 32 * Include file Image/Graph/DataPreprocessor.php 33 */ 34 require_once 'Image/Graph/DataPreprocessor.php'; 35 36 /** 37 * Format data as looked up in an array. 38 * 39 * ArrayData is useful when a numercal value is to be translated to 40 * something thats cannot directly be calculated from this value, this could for 41 * example be a dataset meant to plot population of various countries. Since x- 42 * values are numerical and they should really be country names, but there is no 43 * linear correlation between the number and the name, we use an array to 'map' 44 * the numbers to the name, i.e. $array[0] = 'Denmark'; $array[1] = 'Sweden'; 45 * ..., where the indexes are the numerical values from the dataset. This is NOT 46 * usefull when the x-values are a large domain, i.e. to map unix timestamps to 47 * date-strings for an x-axis. This is because the x-axis will selecte arbitrary 48 * values for labels, which would in principle require the ArrayData to hold 49 * values for every unix timestamp. However ArrayData can still be used to solve 50 * such a situation, since one can use another value for X-data in the dataset 51 * and then map this (smaller domain) value to a date. That is we for example 52 * instead of using the unix-timestamp we use value 0 to represent the 1st date, 53 * 1 to represent the next date, etc. 54 * 55 * @category Images 56 * @package Image_Graph 57 * @subpackage DataPreprocessor 58 * @author Jesper Veggerby <pear.nosey@veggerby.dk> 59 * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen 60 * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 61 * @version Release: 0.7.2 62 * @link http://pear.php.net/package/Image_Graph 63 */ 64 class Image_Graph_DataPreprocessor_Array extends Image_Graph_DataPreprocessor 65 { 66 67 /** 68 * The data label array 69 * @var array 70 * @access private 71 */ 72 var $_dataArray; 73 74 /** 75 * Image_Graph_ArrayData [Constructor]. 76 * 77 * @param array $array The array to use as a lookup table 78 */ 79 function Image_Graph_DataPreprocessor_Array($array) 80 { 81 parent::Image_Graph_DataPreprocessor(); 82 $this->_dataArray = $array; 83 } 84 85 /** 86 * Process the value 87 * 88 * @param var $value The value to process/format 89 * @return string The processed value 90 * @access private 91 */ 92 function _process($value) 93 { 94 if ((is_array($this->_dataArray)) && (isset ($this->_dataArray[$value]))) { 95 return $this->_dataArray[$value]; 96 } else { 97 return $value; 98 } 99 } 100 101 } 102 103 ?>
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 |