You are here

function pData::getSeriePercentile in Visitors 7

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

File

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 + 0.5);
  $SortedValues = $this->Data["Series"][$Serie]["Data"];
  sort($SortedValues);
  if (is_numeric($SortedValues[$PercentilID])) {
    return $SortedValues[$PercentilID];
  }
  else {
    return NULL;
  }
}