Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
define("ABSOLUTE_MIN", -10000000000000);
define("ABSOLUTE_MAX", 10000000000000);
/* Replacement to the PHP null keyword */
define("VOID", 0.123456789);
define("VOID_NULL", 0.123456789);
/* Euro symbol for GD fonts */
define("EURO_SYMBOL", "€");

Expand Down
2 changes: 1 addition & 1 deletion resources/doc/filled_step.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use CpChart\Image;

/* Create and populate the Data object */
$data = new Data();
$data->addPoints([-4, 2, VOID, 12, 8, 3], "Probe 1");
$data->addPoints([-4, 2, VOID_NULL, 12, 8, 3], "Probe 1");
$data->addPoints([3, 12, 15, 8, 5, -5], "Probe 2");
$data->addPoints([2, 7, 5, 18, 19, 22], "Probe 3");
$data->setSerieTicks("Probe 2", 4);
Expand Down
2 changes: 1 addition & 1 deletion resources/doc/line.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use CpChart\Image;

/* Build a dataset */
$data = new Data();
$data->addPoints([-4, VOID, VOID, 12, 8, 3], "Probe 1");
$data->addPoints([-4, VOID_NULL, VOID_NULL, 12, 8, 3], "Probe 1");
$data->addPoints([3, 12, 15, 8, 5, -5], "Probe 2");
$data->addPoints([2, 7, 5, 18, 19, 22], "Probe 3");
$data->setSerieTicks("Probe 2", 4);
Expand Down
2 changes: 1 addition & 1 deletion resources/doc/step.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use CpChart\Image;

/* Create and populate the Data object */
$data = new Data();
$data->addPoints([-4, VOID, VOID, 12, 8, 3], "Probe 1");
$data->addPoints([-4, VOID_NULL, VOID_NULL, 12, 8, 3], "Probe 1");
$data->addPoints([3, 12, 15, 8, 5, -5], "Probe 2");
$data->addPoints([2, 7, 5, 18, 19, 22], "Probe 3");
$data->setSerieTicks("Probe 2", 4);
Expand Down
34 changes: 17 additions & 17 deletions src/BaseDraw.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
use const TEXT_ALIGN_MIDDLELEFT;
use const TEXT_ALIGN_MIDDLERIGHT;
use const TEXT_ALIGN_TOPMIDDLE;
use const VOID;
use const VOID_NULL;

/**
* This class exists only to try and reduce the number of methods and properties
Expand Down Expand Up @@ -986,16 +986,16 @@ public function scaleComputeY($Values, array $Option = [], $ReturnOnly0Height =

if ($ReturnOnly0Height) {
foreach ($Values as $Key => $Value) {
if ($Value == VOID) {
$Result[] = VOID;
if ($Value == VOID_NULL) {
$Result[] = VOID_NULL;
} else {
$Result[] = $Step * $Value;
}
}
} else {
foreach ($Values as $Key => $Value) {
if ($Value == VOID) {
$Result[] = VOID;
if ($Value == VOID_NULL) {
$Result[] = VOID_NULL;
} else {
$Result[] = $this->GraphAreaY2
- $Data["Axis"][$AxisID]["Margin"]
Expand All @@ -1011,16 +1011,16 @@ public function scaleComputeY($Values, array $Option = [], $ReturnOnly0Height =

if ($ReturnOnly0Height) {
foreach ($Values as $Key => $Value) {
if ($Value == VOID) {
$Result[] = VOID;
if ($Value == VOID_NULL) {
$Result[] = VOID_NULL;
} else {
$Result[] = $Step * $Value;
}
}
} else {
foreach ($Values as $Key => $Value) {
if ($Value == VOID) {
$Result[] = VOID;
if ($Value == VOID_NULL) {
$Result[] = VOID_NULL;
} else {
$Result[] = $this->GraphAreaX1
+ $Data["Axis"][$AxisID]["Margin"]
Expand All @@ -1043,7 +1043,7 @@ public function scaleComputeY($Values, array $Option = [], $ReturnOnly0Height =
*/
public function scaleFormat($Value, $Mode = null, $Format = null, $Unit = null)
{
if ($Value == VOID) {
if ($Value == VOID_NULL) {
return "";
}

Expand Down Expand Up @@ -1185,10 +1185,10 @@ public function writeBounds($Type = BOUND_BOTH, $Format = null)
$MinValue = $this->DataSet->getMin($SerieName);
$MaxValue = $this->DataSet->getMax($SerieName);

$MinPos = VOID;
$MaxPos = VOID;
$MinPos = VOID_NULL;
$MaxPos = VOID_NULL;
foreach ($Serie["Data"] as $Key => $Value) {
if ($Value == $MinValue && $MinPos == VOID) {
if ($Value == $MinValue && $MinPos == VOID_NULL) {
$MinPos = $Key;
}
if ($Value == $MaxValue) {
Expand Down Expand Up @@ -1518,7 +1518,7 @@ public function writeLabel($SeriesName, $Indexes, array $Format = [])
$SerieOffset = 0;
}
$Value = $Data["Series"][$SerieName]["Data"][$Index];
if ($Value == VOID) {
if ($Value == VOID_NULL) {
$Value = "NaN";
}

Expand All @@ -1544,7 +1544,7 @@ public function writeLabel($SeriesName, $Indexes, array $Format = [])
) {
if (
isset($Data["Series"][$Name]["Data"][$Index])
&& $Data["Series"][$Name]["Data"][$Index] != VOID
&& $Data["Series"][$Name]["Data"][$Index] != VOID_NULL
) {
if ($Data["Series"][$Name]["Data"][$Index] >= 0 && $LookFor == "+") {
$Value = $Value + $Data["Series"][$Name]["Data"][$Index];
Expand Down Expand Up @@ -1690,7 +1690,7 @@ public function writeLabel($SeriesName, $Indexes, array $Format = [])
} else {
$Caption = $this->scaleFormat($Value, $AxisMode, $AxisFormat, $AxisUnit);
}
if ($Value == VOID) {
if ($Value == VOID_NULL) {
$Value = "NaN";
}

Expand All @@ -1711,7 +1711,7 @@ public function writeLabel($SeriesName, $Indexes, array $Format = [])
) {
if (
isset($Data["Series"][$Name]["Data"][$Index])
&& $Data["Series"][$Name]["Data"][$Index] != VOID
&& $Data["Series"][$Name]["Data"][$Index] != VOID_NULL
) {
if ($Data["Series"][$Name]["Data"][$Index] >= 0 && $LookFor == "+") {
$Value = $Value + $Data["Series"][$Name]["Data"][$Index];
Expand Down
8 changes: 4 additions & 4 deletions src/Chart/Bubble.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function resetSeriesColors()

public function drawBubbleChart($DataSeries, $WeightSeries, $Format = "")
{
$ForceAlpha = isset($Format["ForceAlpha"]) ? $Format["ForceAlpha"] : VOID;
$ForceAlpha = isset($Format["ForceAlpha"]) ? $Format["ForceAlpha"] : VOID_NULL;
$DrawBorder = isset($Format["DrawBorder"]) ? $Format["DrawBorder"] : true;
$BorderWidth = isset($Format["BorderWidth"]) ? $Format["BorderWidth"] : 1;
$Shape = isset($Format["Shape"]) ? $Format["Shape"] : BUBBLE_SHAPE_ROUND;
Expand Down Expand Up @@ -174,7 +174,7 @@ public function drawBubbleChart($DataSeries, $WeightSeries, $Format = "")
"Alpha" => $Palette[$Key]["Alpha"]
];

if ($ForceAlpha != VOID) {
if ($ForceAlpha != VOID_NULL) {
$Color["Alpha"] = $ForceAlpha;
}

Expand All @@ -185,7 +185,7 @@ public function drawBubbleChart($DataSeries, $WeightSeries, $Format = "")
$BorderG = $Palette[$Key]["G"] + $Surrounding;
$BorderB = $Palette[$Key]["B"] + $Surrounding;
}
if ($ForceAlpha != VOID) {
if ($ForceAlpha != VOID_NULL) {
$BorderAlpha = $ForceAlpha / 2;
}
$BorderColor = [
Expand All @@ -206,7 +206,7 @@ public function drawBubbleChart($DataSeries, $WeightSeries, $Format = "")
$Color["BorderG"] = $BorderG;
$Color["BorderB"] = $BorderB;
}
if ($ForceAlpha != VOID) {
if ($ForceAlpha != VOID_NULL) {
$Color["BorderAlpha"] = $ForceAlpha / 2;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Chart/Indicator.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(Image $pChartObject)
*/
public function draw($X, $Y, $Width, $Height, array $Format = [])
{
$Values = isset($Format["Values"]) ? $Format["Values"] : VOID;
$Values = isset($Format["Values"]) ? $Format["Values"] : VOID_NULL;
$IndicatorSections = isset($Format["IndicatorSections"]) ? $Format["IndicatorSections"] : null;
$ValueDisplay = isset($Format["ValueDisplay"]) ? $Format["ValueDisplay"] : INDICATOR_VALUE_BUBBLE;
$SectionsMargin = isset($Format["SectionsMargin"]) ? $Format["SectionsMargin"] : 4;
Expand Down
26 changes: 13 additions & 13 deletions src/Chart/Pie.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use const TEXT_ALIGN_MIDDLERIGHT;
use const TEXT_ALIGN_TOPLEFT;
use const TEXT_ALIGN_TOPRIGHT;
use const VOID;
use const VOID_NULL;

class Pie
{
Expand Down Expand Up @@ -1807,8 +1807,8 @@ public function draw3DRing($X, $Y, array $Format = [])
}

$Step = (360 / (2 * PI * $OuterRadius)) / 2;
$OutX1 = VOID;
$OutY1 = VOID;
$OutX1 = VOID_NULL;
$OutY1 = VOID_NULL;
for ($i = $Offset; $i >= $EndAngle; $i = $i - $Step) {
$Xc = cos(($i - 90) * PI / 180) * ($OuterRadius + $DataGapRadius - 2) + $X;
$Yc = sin(($i - 90) * PI / 180) * ($OuterRadius + $DataGapRadius - 2) * $SkewFactor + $Y;
Expand All @@ -1822,7 +1822,7 @@ public function draw3DRing($X, $Y, array $Format = [])
$Yc = sin(($i - 90) * PI / 180) * ($OuterRadius + $DataGapRadius) * $SkewFactor + $Y;
$this->pChartObject->drawAntialiasPixel($Xc, $Yc, $Settings);

if ($OutX1 == VOID) {
if ($OutX1 == VOID_NULL) {
$OutX1 = $Xc;
$OutY1 = $Yc;
}
Expand Down Expand Up @@ -1850,12 +1850,12 @@ public function draw3DRing($X, $Y, array $Format = [])
$OutX2 = $Xc;
$OutY2 = $Yc;

$Slices[$Slice]["Angle"][] = VOID;
$Slices[$Slice]["Angle"][] = VOID_NULL;
$Lasti = $i;

$Step = (360 / (2 * PI * $InnerRadius)) / 2;
$InX1 = VOID;
$InY1 = VOID;
$InX1 = VOID_NULL;
$InY1 = VOID_NULL;
for ($i = $EndAngle; $i <= $Offset; $i = $i + $Step) {
$Xc = cos(($i - 90) * PI / 180) * ($InnerRadius + $DataGapRadius - 1) + $X;
$Yc = sin(($i - 90) * PI / 180) * ($InnerRadius + $DataGapRadius - 1) * $SkewFactor + $Y;
Expand All @@ -1865,7 +1865,7 @@ public function draw3DRing($X, $Y, array $Format = [])
$Yc = sin(($i - 90) * PI / 180) * ($InnerRadius + $DataGapRadius) * $SkewFactor + $Y;
$Slices[$Slice]["AA"][] = [$Xc, $Yc];

if ($InX1 == VOID) {
if ($InX1 == VOID_NULL) {
$InX1 = $Xc;
$InY1 = $Yc;
}
Expand Down Expand Up @@ -1945,7 +1945,7 @@ public function draw3DRing($X, $Y, array $Format = [])

$StartAngle = $Plots["Angle"][0];
foreach ($Plots["Angle"] as $Key => $Angle) {
if ($Angle == VOID) {
if ($Angle == VOID_NULL) {
$EndAngle = $Plots["Angle"][$Key - 1];
}
}
Expand Down Expand Up @@ -1997,7 +1997,7 @@ public function draw3DRing($X, $Y, array $Format = [])
$InnerPlotsA = [];
$InnerPlotsB = [];
foreach ($Plots["Angle"] as $ID => $Angle) {
if ($Angle == VOID) {
if ($Angle == VOID_NULL) {
$Outer = false;
$Inner = true;
} elseif ($Inner && ($Angle < 90 || $Angle > 270) && isset($Plots["BottomPoly"][$ID * 2])) {
Expand Down Expand Up @@ -2027,7 +2027,7 @@ public function draw3DRing($X, $Y, array $Format = [])

$StartAngle = $Plots["Angle"][0];
foreach ($Plots["Angle"] as $Key => $Angle) {
if ($Angle == VOID) {
if ($Angle == VOID_NULL) {
$EndAngle = $Plots["Angle"][$Key - 1];
}
}
Expand Down Expand Up @@ -2072,7 +2072,7 @@ public function draw3DRing($X, $Y, array $Format = [])

$StartAngle = $Plots["Angle"][0];
foreach ($Plots["Angle"] as $Key => $Angle) {
if ($Angle == VOID) {
if ($Angle == VOID_NULL) {
$EndAngle = $Plots["Angle"][$Key - 1];
}
}
Expand Down Expand Up @@ -2113,7 +2113,7 @@ public function draw3DRing($X, $Y, array $Format = [])
$InnerPlotsA = [];
$InnerPlotsB = [];
foreach ($Plots["Angle"] as $ID => $Angle) {
if ($Angle == VOID) {
if ($Angle == VOID_NULL) {
$Outer = false;
$Inner = true;
} elseif ($Outer && ($Angle > 90 && $Angle < 270) && isset($Plots["BottomPoly"][$ID * 2])) {
Expand Down
24 changes: 12 additions & 12 deletions src/Chart/Radar.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function drawRadar(Image $Object, Data $Values, array $Format = [])
{
$this->pChartObject = $Object;

$FixedMax = isset($Format["FixedMax"]) ? $Format["FixedMax"] : VOID;
$FixedMax = isset($Format["FixedMax"]) ? $Format["FixedMax"] : VOID_NULL;
$AxisR = isset($Format["AxisR"]) ? $Format["AxisR"] : 60;
$AxisG = isset($Format["AxisG"]) ? $Format["AxisG"] : 60;
$AxisB = isset($Format["AxisB"]) ? $Format["AxisB"] : 60;
Expand All @@ -42,9 +42,9 @@ public function drawRadar(Image $Object, Data $Values, array $Format = [])
;
$ValuePadding = isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 4;
$OuterBubbleRadius = isset($Format["OuterBubbleRadius"]) ? $Format["OuterBubbleRadius"] : 2;
$OuterBubbleR = isset($Format["OuterBubbleR"]) ? $Format["OuterBubbleR"] : VOID;
$OuterBubbleG = isset($Format["OuterBubbleG"]) ? $Format["OuterBubbleG"] : VOID;
$OuterBubbleB = isset($Format["OuterBubbleB"]) ? $Format["OuterBubbleB"] : VOID;
$OuterBubbleR = isset($Format["OuterBubbleR"]) ? $Format["OuterBubbleR"] : VOID_NULL;
$OuterBubbleG = isset($Format["OuterBubbleG"]) ? $Format["OuterBubbleG"] : VOID_NULL;
$OuterBubbleB = isset($Format["OuterBubbleB"]) ? $Format["OuterBubbleB"] : VOID_NULL;
$OuterBubbleAlpha = isset($Format["OuterBubbleAlpha"]) ? $Format["OuterBubbleAlpha"] : 100;
$InnerBubbleR = isset($Format["InnerBubbleR"]) ? $Format["InnerBubbleR"] : 255;
$InnerBubbleG = isset($Format["InnerBubbleG"]) ? $Format["InnerBubbleG"] : 255;
Expand Down Expand Up @@ -115,7 +115,7 @@ public function drawRadar(Image $Object, Data $Values, array $Format = [])
}
/* Determine the scale if set to automatic */
if ($SegmentHeight == SEGMENT_HEIGHT_AUTO) {
if ($FixedMax != VOID) {
if ($FixedMax != VOID_NULL) {
$Max = $FixedMax;
} else {
$Max = 0;
Expand Down Expand Up @@ -501,7 +501,7 @@ public function drawRadar(Image $Object, Data $Values, array $Format = [])
"B" => $InnerBubbleB,
"Alpha" => $InnerBubbleAlpha
];
if ($OuterBubbleR != VOID) {
if ($OuterBubbleR != VOID_NULL) {
$OuterColor = [
"R" => $OuterBubbleR,
"G" => $OuterBubbleG,
Expand Down Expand Up @@ -603,7 +603,7 @@ public function drawPolar(Image $Object, Data $Values, array $Format = [])
{
$this->pChartObject = $Object;

$FixedMax = isset($Format["FixedMax"]) ? $Format["FixedMax"] : VOID;
$FixedMax = isset($Format["FixedMax"]) ? $Format["FixedMax"] : VOID_NULL;
$AxisR = isset($Format["AxisR"]) ? $Format["AxisR"] : 60;
$AxisG = isset($Format["AxisG"]) ? $Format["AxisG"] : 60;
$AxisB = isset($Format["AxisB"]) ? $Format["AxisB"] : 60;
Expand All @@ -625,9 +625,9 @@ public function drawPolar(Image $Object, Data $Values, array $Format = [])
;
$ValuePadding = isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 4;
$OuterBubbleRadius = isset($Format["OuterBubbleRadius"]) ? $Format["OuterBubbleRadius"] : 2;
$OuterBubbleR = isset($Format["OuterBubbleR"]) ? $Format["OuterBubbleR"] : VOID;
$OuterBubbleG = isset($Format["OuterBubbleG"]) ? $Format["OuterBubbleG"] : VOID;
$OuterBubbleB = isset($Format["OuterBubbleB"]) ? $Format["OuterBubbleB"] : VOID;
$OuterBubbleR = isset($Format["OuterBubbleR"]) ? $Format["OuterBubbleR"] : VOID_NULL;
$OuterBubbleG = isset($Format["OuterBubbleG"]) ? $Format["OuterBubbleG"] : VOID_NULL;
$OuterBubbleB = isset($Format["OuterBubbleB"]) ? $Format["OuterBubbleB"] : VOID_NULL;
$OuterBubbleAlpha = isset($Format["OuterBubbleAlpha"]) ? $Format["OuterBubbleAlpha"] : 100;
$InnerBubbleR = isset($Format["InnerBubbleR"]) ? $Format["InnerBubbleR"] : 255;
$InnerBubbleG = isset($Format["InnerBubbleG"]) ? $Format["InnerBubbleG"] : 255;
Expand Down Expand Up @@ -701,7 +701,7 @@ public function drawPolar(Image $Object, Data $Values, array $Format = [])

/* Determine the scale if set to automatic */
if ($SegmentHeight == SEGMENT_HEIGHT_AUTO) {
if ($FixedMax != VOID) {
if ($FixedMax != VOID_NULL) {
$Max = $FixedMax;
} else {
$Max = 0;
Expand Down Expand Up @@ -989,7 +989,7 @@ public function drawPolar(Image $Object, Data $Values, array $Format = [])
"B" => $InnerBubbleB,
"Alpha" => $InnerBubbleAlpha
];
if ($OuterBubbleR != VOID) {
if ($OuterBubbleR != VOID_NULL) {
$OuterColor = [
"R" => $OuterBubbleR,
"G" => $OuterBubbleG,
Expand Down
Loading