You are here

function pData::getHarmonicMean in Visitors 7

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

File

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

Class

pData

Code

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