diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:08:29 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:08:29 +0200 |
commit | 75160b12821f7f4299cce7f0b69c83c1502ae071 (patch) | |
tree | 27e25e4ccaef45f0c58b22831164050d1af1d4db /admin/survey/pChart/classes/class.pChart.php | |
parent | prvi-commit (diff) | |
download | 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.gz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.bz2 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.lz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.xz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.zst 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.zip |
Diffstat (limited to 'admin/survey/pChart/classes/class.pChart.php')
-rw-r--r-- | admin/survey/pChart/classes/class.pChart.php | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/admin/survey/pChart/classes/class.pChart.php b/admin/survey/pChart/classes/class.pChart.php index af3c0a8..36929f6 100644 --- a/admin/survey/pChart/classes/class.pChart.php +++ b/admin/survey/pChart/classes/class.pChart.php @@ -412,8 +412,8 @@ {
if (isset($DataDescription["Values"][0]))
{
- $this->VMin = $Data[0][$DataDescription["Values"][0]];
- $this->VMax = $Data[0][$DataDescription["Values"][0]];
+ $this->VMin = (isset($Data[0][$DataDescription["Values"][0]])?$Data[0][$DataDescription["Values"][0]]:0);
+ $this->VMax = (isset($Data[0][$DataDescription["Values"][0]])?$Data[0][$DataDescription["Values"][0]]:0);
}
else { $this->VMin = 2147483647; $this->VMax = -2147483647; }
@@ -1500,9 +1500,9 @@ $C_TextColor =$this->AllocateColor($this->Picture,$R,$G,$B);
$C_ShadowColor =$this->AllocateColor($this->Picture,0,0,0);
if ( $Shadow )
- imagettftext($this->Picture,$this->FontSize,$Angle,$X+1,$Y+1,$C_ShadowColor,$this->FontName,$Text);
+ imagettftext($this->Picture,$this->FontSize,$Angle,round($X)+1,round($Y)+1,$C_ShadowColor,$this->FontName,$Text);
- imagettftext($this->Picture,$this->FontSize,$Angle,$X,$Y,$C_TextColor,$this->FontName,$Text);
+ imagettftext($this->Picture,$this->FontSize,$Angle,round($X),round($Y),$C_TextColor,$this->FontName,$Text);
}
/* Compute and draw the scale */
@@ -3540,17 +3540,17 @@ for($i=0;$i<=90;$i=$i+$Step)
{
- $Xi1 = cos(($i+180)*3.1418/180) * $Radius + $X1 + $Radius;
- $Yi1 = sin(($i+180)*3.1418/180) * $Radius + $Y1 + $Radius;
+ $Xi1 = round(cos(($i+180)*3.1418/180) * $Radius + $X1 + $Radius);
+ $Yi1 = round(sin(($i+180)*3.1418/180) * $Radius + $Y1 + $Radius);
- $Xi2 = cos(($i-90)*3.1418/180) * $Radius + $X2 - $Radius;
- $Yi2 = sin(($i-90)*3.1418/180) * $Radius + $Y1 + $Radius;
+ $Xi2 = round(cos(($i-90)*3.1418/180) * $Radius + $X2 - $Radius);
+ $Yi2 = round(sin(($i-90)*3.1418/180) * $Radius + $Y1 + $Radius);
- $Xi3 = cos(($i)*3.1418/180) * $Radius + $X2 - $Radius;
- $Yi3 = sin(($i)*3.1418/180) * $Radius + $Y2 - $Radius;
+ $Xi3 = round(cos(($i)*3.1418/180) * $Radius + $X2 - $Radius);
+ $Yi3 = round(sin(($i)*3.1418/180) * $Radius + $Y2 - $Radius);
- $Xi4 = cos(($i+90)*3.1418/180) * $Radius + $X1 + $Radius;
- $Yi4 = sin(($i+90)*3.1418/180) * $Radius + $Y2 - $Radius;
+ $Xi4 = round(cos(($i+90)*3.1418/180) * $Radius + $X1 + $Radius);
+ $Yi4 = round(sin(($i+90)*3.1418/180) * $Radius + $Y2 - $Radius);
imageline($this->Picture,$Xi1,$Yi1,$X1+$Radius,$Yi1,$C_Rectangle);
imageline($this->Picture,$X2-$Radius,$Yi2,$Xi2,$Yi2,$C_Rectangle);
@@ -3856,7 +3856,7 @@ if ( $Alpha == 100 )
{
$C_Aliased = $this->AllocateColor($this->Picture,$R,$G,$B);
- imagesetpixel($this->Picture,$X,$Y,$C_Aliased);
+ imagesetpixel($this->Picture,round($X),round($Y),$C_Aliased);
}
else
$this->drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B);
@@ -3888,7 +3888,7 @@ if ( $Alpha == 100 )
{
$C_Aliased = $this->AllocateColor($this->Picture,$R,$G,$B);
- imagesetpixel($this->Picture,$X,$Y,$C_Aliased);
+ imagesetpixel($this->Picture,round($X),round($Y),$C_Aliased);
}
else
$this->drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B);
@@ -3909,13 +3909,14 @@ if (!isset($DataDescription["Description"]))
{
$this->Errors[] = "[Warning] ".$FunctionName." - Series descriptions are not set.";
+ if(isset($DataDescription["Values"]))
foreach($DataDescription["Values"] as $key => $Value)
{
$DataDescription["Description"][$Value] = $Value;
}
}
- if (count($DataDescription["Description"]) < count($DataDescription["Values"]))
+ if (isset($DataDescription["Values"])&&count($DataDescription["Description"]) < count($DataDescription["Values"]))
{
$this->Errors[] = "[Warning] ".$FunctionName." - Some series descriptions are not set.";
foreach($DataDescription["Values"] as $key => $Value)
@@ -3943,7 +3944,7 @@ }
}
- if ( max($DataSummary) == 0 )
+ if ( count($DataSummary)==0||max($DataSummary) == 0 )
$this->Errors[] = "[Warning] ".$FunctionName." - No data set.";
foreach($DataSummary as $key => $Value)
|