function pData::addRandomValues

5.x pData.class.php pData::addRandomValues($SerieName = "Serie1", $Options = "")

File

inc/pchart/pchart/class/pData.class.php, line 382

Class

pData

Code

function addRandomValues($SerieName = "Serie1", $Options = "") 
 {
  $Values = isset($Options ["Values"]) ? $Options ["Values"] : 20;
  $Min = isset($Options ["Min"]) ? $Options ["Min"] : 0;
  $Max = isset($Options ["Max"]) ? $Options ["Max"] : 100;
  $withFloat = isset($Options ["withFloat"]) ? $Options ["withFloat"] : FALSE;

  for ($i = 0; $i <= $Values; $i++) 
   {
    if ($withFloat) {
      $Value = rand($Min * 100, $Max * 100) / 100;
    }
    else {
      $Value = rand($Min, $Max);
    }
    $this->addPoints($Value, $SerieName);
  }
}