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 / Random.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  2.7 KB  |  77 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: Random.php,v 1.6 2005/08/24 20:35:57 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.  * Random data set, points are generated by random.
  38.  *
  39.  * This dataset is mostly (if not solely) used for demo-purposes.
  40.  *
  41.  * @category   Images
  42.  * @package    Image_Graph
  43.  * @subpackage Dataset
  44.  * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  45.  * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  46.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  47.  * @version    Release: 0.7.2
  48.  * @link       http://pear.php.net/package/Image_Graph
  49.  */
  50. class Image_Graph_Dataset_Random extends Image_Graph_Dataset_Trivial
  51. {
  52.  
  53.     /**
  54.      * RandomDataset [Constructor]
  55.      *
  56.      * @param int $count The number of points to create
  57.      * @param double $minimum The minimum value the random set can be
  58.      * @param double $maximum The maximum value the random set can be
  59.      * @param bool $includeZero Whether 0 should be included or not as an X
  60.      *   value, may be omitted, default: false</false>
  61.      */
  62.     function Image_Graph_Dataset_Random($count, $minimum, $maximum, $includeZero = false)
  63.     {
  64.         parent::Image_Graph_Dataset_Trivial();
  65.         $i = 0;
  66.         while ($i < $count) {
  67.             $this->addPoint(
  68.                 $ixc = ($includeZero ? $i : $i +1),
  69.                 rand($minimum, $maximum)
  70.             );
  71.             $i ++;
  72.         }
  73.     }
  74.  
  75. }
  76.  
  77. ?>