You are here

function pChart::drawPlotGraph in Visitors 8

Same name and namespace in other branches
  1. 7.0 pchart/pChart.inc \pChart::drawPlotGraph()

File

pchart/pChart.inc, line 746

Class

pChart

Code

function drawPlotGraph(&$Data, &$DataDescription, $BigRadius = 5, $SmallRadius = 2, $R2 = -1, $G2 = -1, $B2 = -1) {

  /* Validate the Data and DataDescription array */
  $this
    ->validateDataDescription("drawPlotGraph", $DataDescription);
  $this
    ->validateData("drawPlotGraph", $Data);
  $GraphID = 0;
  foreach ($DataDescription["Values"] as $Key2 => $ColName) {
    $ID = 0;
    foreach ($DataDescription["Description"] as $keyI => $ValueI) {
      if ($keyI == $ColName) {
        $ColorID = $ID;
      }
      $ID++;
    }
    $XPos = $this->GArea_X1 + $this->GAreaXOffset;
    foreach ($Data as $Key => $Values) {
      $Value = $Data[$Key][$ColName];
      $YPos = $this->GArea_Y2 - ($Value - $this->VMin) * $this->DivisionRatio;
      if (is_numeric($Value)) {
        $R = $this->Palette[$ColorID]["R"];
        $G = $this->Palette[$ColorID]["G"];
        $B = $this->Palette[$ColorID]["B"];
        $this
          ->drawFilledCircle($XPos + 1, $YPos + 1, $BigRadius, $R, $G, $B);
        if ($R2 != -1 && $G2 != -1 && $B2 != -1) {
          $this
            ->drawFilledCircle($XPos + 1, $YPos + 1, $SmallRadius, $R2, $G2, $B2);
        }
        else {
          $R = $this->Palette[$ColorID]["R"] - 5;
          if ($R < 0) {
            $R = 0;
          }
          $G = $this->Palette[$ColorID]["G"] - 5;
          if ($G < 0) {
            $G = 0;
          }
          $B = $this->Palette[$ColorID]["B"] - 5;
          if ($B < 0) {
            $B = 0;
          }
          $this
            ->drawFilledCircle($XPos + 1, $YPos + 1, $SmallRadius, $R, $G, $B);
        }
      }
      $XPos = $XPos + $this->DivisionWidth;
    }
    $GraphID++;
  }
}