You are here

function pData::addRandomValues in Visitors 7

Same name and namespace in other branches
  1. 7.2 pChart/class/pData.class.php \pData::addRandomValues()

File

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);
  }
}