You are here

function pSpring::getMedianOffset in Visitors 7

Same name and namespace in other branches
  1. 7.2 pChart/class/pSpring.class.php \pSpring::getMedianOffset()
1 call to pSpring::getMedianOffset()
pSpring::firstPass in pChart/class/pSpring.class.php

File

pChart/class/pSpring.class.php, line 261

Class

pSpring

Code

function getMedianOffset($Key, $X, $Y) {
  $Cpt = 1;
  if (isset($this->Data[$Key]["Connections"])) {
    foreach ($this->Data[$Key]["Connections"] as $ID => $NodeID) {
      if (isset($this->Data[$NodeID]["X"]) && isset($this->Data[$NodeID]["Y"])) {
        $X = $X + $this->Data[$NodeID]["X"];
        $Y = $Y + $this->Data[$NodeID]["Y"];
        $Cpt++;
      }
    }
  }
  return array(
    "X" => $X / $Cpt,
    "Y" => $Y / $Cpt,
  );
}