function pData::getSeriePercentile

5.x pData.class.php pData::getSeriePercentile($Serie = "Serie1", $Percentil = 95)

File

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

Class

pData

Code

function getSeriePercentile($Serie = "Serie1", $Percentil = 95) 
 {
  if (!isset($this->Data ["Series"][$Serie]["Data"])) {
    return (NULL);
  }

  $Values = count($this->Data ["Series"][$Serie]["Data"]) -1;
  if ($Values < 0) {
    $Values = 0;
  }

  $PercentilID = floor(($Values / 100) * $Percentil + .5);
  $SortedValues = $this->Data ["Series"][$Serie]["Data"];
  sort($SortedValues);

  if (is_numeric($SortedValues [$PercentilID])) {
    return ($SortedValues [$PercentilID]);
  }
  else {
    return (NULL);
  }
}