You are here

function pData::getGeometricMean in Visitors 7

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

File

pChart/class/pData.class.php, line 283

Class

pData

Code

function getGeometricMean($Serie) {
  if (isset($this->Data["Series"][$Serie])) {
    $SerieData = $this
      ->stripVOID($this->Data["Series"][$Serie]["Data"]);
    $Seriesum = 1;
    foreach ($SerieData as $Key => $Value) {
      $Seriesum = $Seriesum * $Value;
    }
    return pow($Seriesum, 1 / sizeof($SerieData));
  }
  else {
    return NULL;
  }
}