Exemple #1
0
 /**
  * Image_Graph_FunctionDataset [Constructor]
  *
  * @param double $minimumX The minimum X value
  * @param double $maximumX The maximum X value
  * @param string $function The name of the function, if must be a single
  * parameter function like fx sin(x) or cos(x)
  * @param int $points The number of points to create
  */
 function Image_Graph_Dataset_Function($minimumX, $maximumX, $function, $points)
 {
     parent::Image_Graph_Dataset();
     $this->_minimumX = $minimumX;
     $this->_maximumX = $maximumX;
     $this->_dataFunction = $function;
     $this->_count = $points;
     $this->_calculateMaxima();
 }
Exemple #2
0
 /**
  * Image_Graph_Dataset_Trivial [Constructor]
  *
  * Pass an associated array ($data[$x] = $y) to the constructor for easy
  * data addition. Alternatively (if multiple entries with same x value is
  * required) pass an array with (x, y) values: $data[$id] = array('x' => $x,
  * 'y' => $y); 
  *
  * NB! If passing the 1st type array at this point, the x-values will also
  * be used for ID tags, i.e. when using {@link Image_Graph_Fill_Array}. In
  * the 2nd type the key/index of the "outermost" array will be the id tag
  * (i.e. $id in the example)
  *
  * @param array $dataArray An associated array with values to the dataset
  */
 function Image_Graph_Dataset_Trivial($dataArray = false)
 {
     parent::Image_Graph_Dataset();
     $this->_data = array();
     if (is_array($dataArray)) {
         reset($dataArray);
         $keys = array_keys($dataArray);
         foreach ($keys as $x) {
             $y =& $dataArray[$x];
             if (is_array($y) && isset($y['x']) && isset($y['y'])) {
                 $this->addPoint($y['x'], $y['y'], isset($y['id']) ? $y['id'] : $x);
             } else {
                 $this->addPoint($x, $y, $x);
             }
         }
     }
 }
 /**
  * Image_Graph_VectorFunctionDataset [Constructor]
  *
  * @param double $minimumT The minimum value of the vector function variable
  * @param double $maximumT The maximum value of the vector function variable
  * @param string $functionX The name of the X function, if must be a single
  *   parameter function like fx sin(x) or cos(x)
  * @param string $functionY The name of the Y function, if must be a single
  *   parameter function like fx sin(x) or cos(x)
  * @param int $points The number of points to create
  */
 function Image_Graph_Dataset_VectorFunction($minimumT, $maximumT, $functionX, $functionY, $points)
 {
     parent::Image_Graph_Dataset();
     $this->_minimumT = $minimumT;
     $this->_maximumT = $maximumT;
     $this->_functionX = $functionX;
     $this->_functionY = $functionY;
     $this->_count = $points;
     $this->_calculateMaxima();
 }