You are here

function pSpring::setNodesColor in Visitors 7

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

File

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

Class

pSpring

Code

function setNodesColor($Nodes, $Settings = "") {
  if (is_array($Nodes)) {
    foreach ($Nodes as $Key => $NodeID) {
      if (isset($this->Data[$NodeID])) {
        if (isset($Settings["R"])) {
          $this->Data[$NodeID]["R"] = $Settings["R"];
        }
        if (isset($Settings["G"])) {
          $this->Data[$NodeID]["G"] = $Settings["G"];
        }
        if (isset($Settings["B"])) {
          $this->Data[$NodeID]["B"] = $Settings["B"];
        }
        if (isset($Settings["Alpha"])) {
          $this->Data[$NodeID]["Alpha"] = $Settings["Alpha"];
        }
        if (isset($Settings["BorderR"])) {
          $this->Data[$NodeID]["BorderR"] = $Settings["BorderR"];
        }
        if (isset($Settings["BorderG"])) {
          $this->Data[$NodeID]["BorderG"] = $Settings["BorderG"];
        }
        if (isset($Settings["BorderB"])) {
          $this->Data[$NodeID]["BorderB"] = $Settings["BorderB"];
        }
        if (isset($Settings["BorderAlpha"])) {
          $this->Data[$NodeID]["BorderAlpha"] = $Settings["BorderAlpha"];
        }
        if (isset($Settings["Surrounding"])) {
          $this->Data[$NodeID]["BorderR"] = $this->Data[$NodeID]["R"] + $Settings["Surrounding"];
          $this->Data[$NodeID]["BorderG"] = $this->Data[$NodeID]["G"] + $Settings["Surrounding"];
          $this->Data[$NodeID]["BorderB"] = $this->Data[$NodeID]["B"] + $Settings["Surrounding"];
        }
      }
    }
  }
  else {
    if (isset($Settings["R"])) {
      $this->Data[$Nodes]["R"] = $Settings["R"];
    }
    if (isset($Settings["G"])) {
      $this->Data[$Nodes]["G"] = $Settings["G"];
    }
    if (isset($Settings["B"])) {
      $this->Data[$Nodes]["B"] = $Settings["B"];
    }
    if (isset($Settings["Alpha"])) {
      $this->Data[$Nodes]["Alpha"] = $Settings["Alpha"];
    }
    if (isset($Settings["BorderR"])) {
      $this->Data[$Nodes]["BorderR"] = $Settings["BorderR"];
    }
    if (isset($Settings["BorderG"])) {
      $this->Data[$Nodes]["BorderG"] = $Settings["BorderG"];
    }
    if (isset($Settings["BorderB"])) {
      $this->Data[$Nodes]["BorderB"] = $Settings["BorderB"];
    }
    if (isset($Settings["BorderAlpha"])) {
      $this->Data[$Nodes]["BorderAlpha"] = $Settings["BorderAlpha"];
    }
    if (isset($Settings["Surrounding"])) {
      $this->Data[$Nodes]["BorderR"] = $this->Data[$NodeID]["R"] + $Settings["Surrounding"];
      $this->Data[$NodeID]["BorderG"] = $this->Data[$NodeID]["G"] + $Settings["Surrounding"];
      $this->Data[$NodeID]["BorderB"] = $this->Data[$NodeID]["B"] + $Settings["Surrounding"];
    }
  }
}