You are here

function pDraw::drawShape in Visitors 7.2

Same name and namespace in other branches
  1. 7 pChart/class/pDraw.class.php \pDraw::drawShape()
1 call to pDraw::drawShape()
pDraw::drawPlotChart in pChart/class/pDraw.class.php

File

pChart/class/pDraw.class.php, line 5971

Class

pDraw

Code

function drawShape($X, $Y, $Shape, $PlotSize, $PlotBorder, $BorderSize, $R, $G, $B, $Alpha, $BorderR, $BorderG, $BorderB, $BorderAlpha) {
  if ($Shape == SERIE_SHAPE_FILLEDCIRCLE) {
    if ($PlotBorder) {
      $this
        ->drawFilledCircle($X, $Y, $PlotSize + $BorderSize, array(
        "R" => $BorderR,
        "G" => $BorderG,
        "B" => $BorderB,
        "Alpha" => $BorderAlpha,
      ));
    }
    $this
      ->drawFilledCircle($X, $Y, $PlotSize, array(
      "R" => $R,
      "G" => $G,
      "B" => $B,
      "Alpha" => $Alpha,
    ));
  }
  elseif ($Shape == SERIE_SHAPE_FILLEDSQUARE) {
    if ($PlotBorder) {
      $this
        ->drawFilledRectangle($X - $PlotSize - $BorderSize, $Y - $PlotSize - $BorderSize, $X + $PlotSize + $BorderSize, $Y + $PlotSize + $BorderSize, array(
        "R" => $BorderR,
        "G" => $BorderG,
        "B" => $BorderB,
        "Alpha" => $BorderAlpha,
      ));
    }
    $this
      ->drawFilledRectangle($X - $PlotSize, $Y - $PlotSize, $X + $PlotSize, $Y + $PlotSize, array(
      "R" => $R,
      "G" => $G,
      "B" => $B,
      "Alpha" => $Alpha,
    ));
  }
  elseif ($Shape == SERIE_SHAPE_FILLEDTRIANGLE) {
    if ($PlotBorder) {
      $Pos = "";
      $Pos[] = $X;
      $Pos[] = $Y - $PlotSize - $BorderSize;
      $Pos[] = $X - $PlotSize - $BorderSize;
      $Pos[] = $Y + $PlotSize + $BorderSize;
      $Pos[] = $X + $PlotSize + $BorderSize;
      $Pos[] = $Y + $PlotSize + $BorderSize;
      $this
        ->drawPolygon($Pos, array(
        "R" => $BorderR,
        "G" => $BorderG,
        "B" => $BorderB,
        "Alpha" => $BorderAlpha,
      ));
    }
    $Pos = "";
    $Pos[] = $X;
    $Pos[] = $Y - $PlotSize;
    $Pos[] = $X - $PlotSize;
    $Pos[] = $Y + $PlotSize;
    $Pos[] = $X + $PlotSize;
    $Pos[] = $Y + $PlotSize;
    $this
      ->drawPolygon($Pos, array(
      "R" => $R,
      "G" => $G,
      "B" => $B,
      "Alpha" => $Alpha,
    ));
  }
  elseif ($Shape == SERIE_SHAPE_TRIANGLE) {
    $this
      ->drawLine($X, $Y - $PlotSize, $X - $PlotSize, $Y + $PlotSize, array(
      "R" => $R,
      "G" => $G,
      "B" => $B,
      "Alpha" => $Alpha,
    ));
    $this
      ->drawLine($X - $PlotSize, $Y + $PlotSize, $X + $PlotSize, $Y + $PlotSize, array(
      "R" => $R,
      "G" => $G,
      "B" => $B,
      "Alpha" => $Alpha,
    ));
    $this
      ->drawLine($X + $PlotSize, $Y + $PlotSize, $X, $Y - $PlotSize, array(
      "R" => $R,
      "G" => $G,
      "B" => $B,
      "Alpha" => $Alpha,
    ));
  }
  elseif ($Shape == SERIE_SHAPE_SQUARE) {
    $this
      ->drawRectangle($X - $PlotSize, $Y - $PlotSize, $X + $PlotSize, $Y + $PlotSize, array(
      "R" => $R,
      "G" => $G,
      "B" => $B,
      "Alpha" => $Alpha,
    ));
  }
  elseif ($Shape == SERIE_SHAPE_CIRCLE) {
    $this
      ->drawCircle($X, $Y, $PlotSize, $PlotSize, array(
      "R" => $R,
      "G" => $G,
      "B" => $B,
      "Alpha" => $Alpha,
    ));
  }
  elseif ($Shape == SERIE_SHAPE_DIAMOND) {
    $Pos = "";
    $Pos[] = $X - $PlotSize;
    $Pos[] = $Y;
    $Pos[] = $X;
    $Pos[] = $Y - $PlotSize;
    $Pos[] = $X + $PlotSize;
    $Pos[] = $Y;
    $Pos[] = $X;
    $Pos[] = $Y + $PlotSize;
    $this
      ->drawPolygon($Pos, array(
      "NoFill" => TRUE,
      "BorderR" => $R,
      "BorderG" => $G,
      "BorderB" => $B,
      "BorderAlpha" => $Alpha,
    ));
  }
  elseif ($Shape == SERIE_SHAPE_FILLEDDIAMOND) {
    if ($PlotBorder) {
      $Pos = "";
      $Pos[] = $X - $PlotSize - $BorderSize;
      $Pos[] = $Y;
      $Pos[] = $X;
      $Pos[] = $Y - $PlotSize - $BorderSize;
      $Pos[] = $X + $PlotSize + $BorderSize;
      $Pos[] = $Y;
      $Pos[] = $X;
      $Pos[] = $Y + $PlotSize + $BorderSize;
      $this
        ->drawPolygon($Pos, array(
        "R" => $BorderR,
        "G" => $BorderG,
        "B" => $BorderB,
        "Alpha" => $BorderAlpha,
      ));
    }
    $Pos = "";
    $Pos[] = $X - $PlotSize;
    $Pos[] = $Y;
    $Pos[] = $X;
    $Pos[] = $Y - $PlotSize;
    $Pos[] = $X + $PlotSize;
    $Pos[] = $Y;
    $Pos[] = $X;
    $Pos[] = $Y + $PlotSize;
    $this
      ->drawPolygon($Pos, array(
      "R" => $R,
      "G" => $G,
      "B" => $B,
      "Alpha" => $Alpha,
    ));
  }
}