Skip to content

Commit

Permalink
Fixed arrays initialized as strings, again
Browse files Browse the repository at this point in the history
  • Loading branch information
szymach committed Jul 15, 2017
1 parent 4f47bf9 commit aba6cda
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/Chart/Barcode128.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ public function encode128($Value, $Format = "")
* @param string $Value
* @param int $X
* @param int $Y
* @param string $Format
* @param array $Format
*/
public function draw(Image $Object, $Value, $X, $Y, $Format = "")
public function draw(Image $Object, $Value, $X, $Y, $Format = [])
{
$this->pChartObject = $Object;

Expand Down
2 changes: 1 addition & 1 deletion src/Chart/Barcode39.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function encode39($Value)
* @param type $Y
* @param array $Format
*/
public function draw(Image $Object, $Value, $X, $Y, $Format = "")
public function draw(Image $Object, $Value, $X, $Y, $Format = [])
{
$this->pChartObject = $Object;

Expand Down
25 changes: 13 additions & 12 deletions src/Chart/BaseDraw.php
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ public function getLegendSize(array $Format = [])
$vY = $vY + max($this->FontSize * count($Lines), $IconAreaHeight) + 5;
} elseif ($Mode == LEGEND_HORIZONTAL) {
$Lines = preg_split("/\n/", $Serie["Description"]);
$Width = "";
$Width = [];
foreach ($Lines as $Key => $Value) {
$BoxArray = $this->getTextBox(
$vX + $IconAreaWidth + 6,
Expand Down Expand Up @@ -1408,7 +1408,7 @@ public function writeLabel($SeriesName, $Indexes, array $Format = [])
}

$MinY = $this->GraphAreaY2;
foreach ($SeriesName as $iKey => $SerieName) {
foreach ($SeriesName as $SerieName) {
if (isset($Data["Series"][$SerieName]["Data"][$Index])) {
$AxisID = $Data["Series"][$SerieName]["Axis"];
$XAxisMode = $Data["XAxisDisplay"];
Expand All @@ -1417,6 +1417,7 @@ public function writeLabel($SeriesName, $Indexes, array $Format = [])
$AxisMode = $Data["Axis"][$AxisID]["Display"];
$AxisFormat = $Data["Axis"][$AxisID]["Format"];
$AxisUnit = $Data["Axis"][$AxisID]["Unit"];
$XLabel = "";

if (isset($Data["Abscissa"])
&& isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index])
Expand All @@ -1427,9 +1428,8 @@ public function writeLabel($SeriesName, $Indexes, array $Format = [])
$XAxisFormat,
$XAxisUnit
);
} else {
$XLabel = "";
}

if ($OverrideTitle != null) {
$Description = $OverrideTitle;
} elseif (count($SeriesName) == 1) {
Expand All @@ -1439,12 +1439,13 @@ public function writeLabel($SeriesName, $Indexes, array $Format = [])
) {
$Description = $XLabel;
}
$Serie = "";
$Serie["R"] = $Data["Series"][$SerieName]["Color"]["R"];
$Serie["G"] = $Data["Series"][$SerieName]["Color"]["G"];
$Serie["B"] = $Data["Series"][$SerieName]["Color"]["B"];
$Serie["Alpha"] = $Data["Series"][$SerieName]["Color"]["Alpha"];

$Serie = [
"R" => $Data["Series"][$SerieName]["Color"]["R"],
"G" => $Data["Series"][$SerieName]["Color"]["G"],
"B" => $Data["Series"][$SerieName]["Color"]["B"],
"Alpha" => $Data["Series"][$SerieName]["Color"]["Alpha"]
];
if (count($SeriesName) == 1
&& isset($Data["Series"][$SerieName]["XOffset"])
) {
Expand Down Expand Up @@ -1568,6 +1569,7 @@ public function writeLabel($SeriesName, $Indexes, array $Format = [])
$AxisMode = $Data["Axis"][$AxisID]["Display"];
$AxisFormat = $Data["Axis"][$AxisID]["Format"];
$AxisUnit = $Data["Axis"][$AxisID]["Unit"];
$XLabel = "";

if (isset($Data["Abscissa"])
&& isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index])
Expand All @@ -1578,9 +1580,8 @@ public function writeLabel($SeriesName, $Indexes, array $Format = [])
$XAxisFormat,
$XAxisUnit
);
} else {
$XLabel = "";
}

if ($OverrideTitle != null) {
$Description = $OverrideTitle;
} elseif (count($SeriesName) == 1) {
Expand All @@ -1594,7 +1595,7 @@ public function writeLabel($SeriesName, $Indexes, array $Format = [])
) {
$Description = $XLabel;
}
$Serie = "";
$Serie = [];
if (isset($Data["Extended"]["Palette"][$Index])) {
$Serie["R"] = $Data["Extended"]["Palette"][$Index]["R"];
$Serie["G"] = $Data["Extended"]["Palette"][$Index]["G"];
Expand Down
12 changes: 6 additions & 6 deletions src/Chart/Bubble.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public function __construct(Image $pChartObject, Data $pDataObject)
/**
* Prepare the scale
*
* @param type $DataSeries
* @param type $WeightSeries
* @param mixed $DataSeries
* @param mixed $WeightSeries
*/
public function bubbleScale($DataSeries, $WeightSeries)
{
Expand All @@ -53,8 +53,8 @@ public function bubbleScale($DataSeries, $WeightSeries)
}

/* Parse each data series to find the new min & max boundaries to scale */
$NewPositiveSerie = "";
$NewNegativeSerie = "";
$NewPositiveSerie = [];
$NewNegativeSerie = [];
$MaxValues = 0;
$LastPositive = 0;
$LastNegative = 0;
Expand Down Expand Up @@ -92,7 +92,7 @@ public function bubbleScale($DataSeries, $WeightSeries)
}

/* Check for missing values and all the fake positive serie */
if ($NewPositiveSerie != "") {
if (count($NewPositiveSerie)) {
for ($i = 0; $i < $MaxValues; $i++) {
if (!isset($NewPositiveSerie[$i])) {
$NewPositiveSerie[$i] = $LastPositive;
Expand All @@ -102,7 +102,7 @@ public function bubbleScale($DataSeries, $WeightSeries)
}

/* Check for missing values and all the fake negative serie */
if ($NewNegativeSerie != "") {
if (count($NewNegativeSerie)) {
for ($i = 0; $i < $MaxValues; $i++) {
if (!isset($NewNegativeSerie[$i])) {
$NewNegativeSerie[$i] = $LastNegative;
Expand Down

0 comments on commit aba6cda

Please sign in to comment.