function pDraw::drawFilledStepChart in Visitors 7
Same name and namespace in other branches
- 7.2 pChart/class/pDraw.class.php \pDraw::drawFilledStepChart()
File
- pChart/
class/ pDraw.class.php, line 4094
Class
Code
function drawFilledStepChart($Format = NULL) {
$ReCenter = isset($Format["ReCenter"]) ? $Format["ReCenter"] : TRUE;
$DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE;
$DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2;
$DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL;
$ForceTransparency = isset($Format["ForceTransparency"]) ? $Format["ForceTransparency"] : NULL;
$DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0;
$DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0;
$DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0;
$AroundZero = isset($Format["AroundZero"]) ? $Format["AroundZero"] : TRUE;
$this->LastChartLayout = CHART_LAST_LAYOUT_REGULAR;
$Data = $this->DataSet
->getData();
list($XMargin, $XDivs) = $this
->scaleGetXSettings();
foreach ($Data["Series"] as $SerieName => $Serie) {
if ($Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"]) {
$R = $Serie["Color"]["R"];
$G = $Serie["Color"]["G"];
$B = $Serie["Color"]["B"];
$Alpha = $Serie["Color"]["Alpha"];
$Ticks = $Serie["Ticks"];
$Weight = $Serie["Weight"];
if ($DisplayColor == DISPLAY_AUTO) {
$DisplayR = $R;
$DisplayG = $G;
$DisplayB = $B;
}
$AxisID = $Serie["Axis"];
$Mode = $Data["Axis"][$AxisID]["Display"];
$Format = $Data["Axis"][$AxisID]["Format"];
$Unit = $Data["Axis"][$AxisID]["Unit"];
$Color = array(
"R" => $R,
"G" => $G,
"B" => $B,
);
if ($ForceTransparency != NULL) {
$Color["Alpha"] = $ForceTransparency;
}
else {
$Color["Alpha"] = $Alpha;
}
$PosArray = $this
->scaleComputeY($Serie["Data"], array(
"AxisID" => $Serie["Axis"],
));
$YZero = $this
->scaleComputeY(0, array(
"AxisID" => $Serie["Axis"],
));
$this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0;
if ($Data["Orientation"] == SCALE_POS_LEFTRIGHT) {
if ($YZero > $this->GraphAreaY2 - 1) {
$YZero = $this->GraphAreaY2 - 1;
}
if ($YZero < $this->GraphAreaY1 + 1) {
$YZero = $this->GraphAreaY1 + 1;
}
if ($XDivs == 0) {
$XStep = ($this->GraphAreaX2 - $this->GraphAreaX1) / 4;
}
else {
$XStep = ($this->GraphAreaX2 - $this->GraphAreaX1 - $XMargin * 2) / $XDivs;
}
$X = $this->GraphAreaX1 + $XMargin;
$LastX = NULL;
$LastY = NULL;
if (!$AroundZero) {
$YZero = $this->GraphAreaY2 - 1;
}
if (!is_array($PosArray)) {
$Value = $PosArray;
$PosArray = "";
$PosArray[0] = $Value;
}
$LastGoodY = NULL;
$LastGoodX = NULL;
$Points = "";
$Init = FALSE;
foreach ($PosArray as $Key => $Y) {
if ($Y == VOID && $LastX != NULL && $LastY != NULL && $Points != "") {
$Points[] = $LastX;
$Points[] = $LastY;
$Points[] = $X;
$Points[] = $LastY;
$Points[] = $X;
$Points[] = $YZero;
$this
->drawPolygon($Points, $Color);
$Points = "";
}
if ($Y != VOID && $LastX != NULL && $LastY != NULL) {
if ($Points == "") {
$Points[] = $LastX;
$Points[] = $YZero;
}
$Points[] = $LastX;
$Points[] = $LastY;
$Points[] = $X;
$Points[] = $LastY;
$Points[] = $X;
$Points[] = $Y;
}
if ($Y != VOID) {
$LastGoodY = $Y;
$LastGoodX = $X;
}
if ($Y == VOID) {
$Y = NULL;
}
if (!$Init && $ReCenter) {
$X = $X - $XStep / 2;
$Init = TRUE;
}
$LastX = $X;
$LastY = $Y;
if ($LastX < $this->GraphAreaX1 + $XMargin) {
$LastX = $this->GraphAreaX1 + $XMargin;
}
$X = $X + $XStep;
}
if ($ReCenter) {
$Points[] = $LastX + $XStep / 2;
$Points[] = $LastY;
$Points[] = $LastX + $XStep / 2;
$Points[] = $YZero;
}
else {
$Points[] = $LastX;
$Points[] = $YZero;
}
$this
->drawPolygon($Points, $Color);
}
else {
if ($YZero < $this->GraphAreaX1 + 1) {
$YZero = $this->GraphAreaX1 + 1;
}
if ($YZero > $this->GraphAreaX2 - 1) {
$YZero = $this->GraphAreaX2 - 1;
}
if ($XDivs == 0) {
$YStep = ($this->GraphAreaY2 - $this->GraphAreaY1) / 4;
}
else {
$YStep = ($this->GraphAreaY2 - $this->GraphAreaY1 - $XMargin * 2) / $XDivs;
}
$Y = $this->GraphAreaY1 + $XMargin;
$LastX = NULL;
$LastY = NULL;
if (!is_array($PosArray)) {
$Value = $PosArray;
$PosArray = "";
$PosArray[0] = $Value;
}
$LastGoodY = NULL;
$LastGoodX = NULL;
$Points = "";
foreach ($PosArray as $Key => $X) {
if ($X == VOID && $LastX != NULL && $LastY != NULL && $Points != "") {
$Points[] = $LastX;
$Points[] = $LastY;
$Points[] = $LastX;
$Points[] = $Y;
$Points[] = $YZero;
$Points[] = $Y;
$this
->drawPolygon($Points, $Color);
$Points = "";
}
if ($X != VOID && $LastX != NULL && $LastY != NULL) {
if ($Points == "") {
$Points[] = $YZero;
$Points[] = $LastY;
}
$Points[] = $LastX;
$Points[] = $LastY;
$Points[] = $LastX;
$Points[] = $Y;
$Points[] = $X;
$Points[] = $Y;
}
if ($X != VOID) {
$LastGoodY = $Y;
$LastGoodX = $X;
}
if ($X == VOID) {
$X = NULL;
}
if ($LastX == NULL && $ReCenter) {
$Y = $Y - $YStep / 2;
}
$LastX = $X;
$LastY = $Y;
if ($LastY < $this->GraphAreaY1 + $XMargin) {
$LastY = $this->GraphAreaY1 + $XMargin;
}
$Y = $Y + $YStep;
}
if ($ReCenter) {
$Points[] = $LastX;
$Points[] = $LastY + $YStep / 2;
$Points[] = $YZero;
$Points[] = $LastY + $YStep / 2;
}
else {
$Points[] = $YZero;
$Points[] = $LastY;
}
$this
->drawPolygon($Points, $Color);
}
}
}
}