home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Image / Graph / Dataset / Sequential.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  3.4 KB  |  114 lines

  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 Dataset
  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: Sequential.php,v 1.7 2005/08/24 20:35:58 nosey Exp $
  28.  * @link       http://pear.php.net/package/Image_Graph
  29.  */
  30.  
  31. /**
  32.  * Include file Image/Graph/Dataset/Trivial.php
  33.  */
  34. require_once 'Image/Graph/Dataset/Trivial.php';
  35.  
  36. /**
  37.  * Sequential data set, simply add points (y) 1 by 1.
  38.  *
  39.  * This is a single point (1D) dataset, all points are of the type (0, y1), (1,
  40.  * y2), (2,  y3)... Where the X-value is implicitly incremented. This is useful
  41.  * for example for barcharts, where you could fx. use an {@link
  42.  * Image_Graph_Dataset_Array} datapreprocessor to make sence of the x-values.
  43.  *
  44.  * @category   Images
  45.  * @package    Image_Graph
  46.  * @subpackage Dataset
  47.  * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  48.  * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  49.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  50.  * @version    Release: 0.7.2
  51.  * @link       http://pear.php.net/package/Image_Graph
  52.  */
  53. class Image_Graph_Dataset_Sequential extends Image_Graph_Dataset_Trivial
  54. {
  55.  
  56.     /**
  57.      * Image_Graph_SequentialDataset [Constructor]
  58.      */
  59.     function Image_Graph_Dataset_Sequential($dataArray = false)
  60.     {
  61.         parent::Image_Graph_Dataset_Trivial();
  62.         if (is_array($dataArray)) {
  63.             reset($dataArray);
  64.             foreach ($dataArray as $value) {
  65.                 $this->addPoint($value);
  66.             }
  67.         }
  68.     }
  69.  
  70.     /**
  71.      * Add a point to the dataset
  72.      *
  73.      * @param int $y The Y value to add, can be omited
  74.      * @param var $ID The ID of the point
  75.      */
  76.     function addPoint($y, $ID = false)
  77.     {
  78.         parent::addPoint($this->count(), $y);
  79.     }
  80.  
  81.     /**
  82.      * Gets a X point from the dataset
  83.      *
  84.      * @param var $x The variable to return an X value from, fx in a
  85.      *   vector function data set
  86.      * @return var The X value of the variable
  87.      * @access private
  88.      */
  89.     function _getPointX($x)
  90.     {
  91.         return ((int) $x);
  92.     }
  93.  
  94.     /**
  95.      * The minimum X value
  96.      * @return var The minimum X value
  97.      */
  98.     function minimumX()
  99.     {
  100.         return 0;
  101.     }
  102.  
  103.     /**
  104.      * The maximum X value
  105.      * @return var The maximum X value
  106.      */
  107.     function maximumX()
  108.     {
  109.         return $this->count();
  110.     }
  111.  
  112. }
  113.  
  114. ?>