Server IP : 172.67.145.202 / Your IP : 162.158.163.223 Web Server : Apache/2.2.15 (CentOS) System : Linux GA 2.6.32-431.1.2.0.1.el6.x86_64 #1 SMP Fri Dec 13 13:06:13 UTC 2013 x86_64 User : apache ( 48) PHP Version : 5.6.38 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/html/carmax/backup/myadmin/libraries/chart/pChart/ |
Upload File : |
| Current File : /var/www/html/carmax/backup/myadmin/libraries/chart/pChart/pChart.class |
<?php
/*
pChart - a PHP class to build charts!
Copyright (C) 2008 Jean-Damien POGOLOTTI
Version 1.27d last updated on 09/30/08
http://pchart.sourceforge.net
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 1,2,3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Class initialisation :
pChart($XSize,$YSize)
Draw methods :
drawBackground($R,$G,$B)
drawRectangle($X1,$Y1,$X2,$Y2,$R,$G,$B)
drawFilledRectangle($X1,$Y1,$X2,$Y2,$R,$G,$B,$DrawBorder=TRUE,$Alpha=100)
drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
drawFilledRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
drawCircle($Xc,$Yc,$Height,$R,$G,$B,$Width=0)
drawFilledCircle($Xc,$Yc,$Height,$R,$G,$B,$Width=0)
drawEllipse($Xc,$Yc,$Height,$Width,$R,$G,$B)
drawFilledEllipse($Xc,$Yc,$Height,$Width,$R,$G,$B)
drawLine($X1,$Y1,$X2,$Y2,$R,$G,$B,$GraphFunction=FALSE)
drawDottedLine($X1,$Y1,$X2,$Y2,$DotSize,$R,$G,$B)
drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B)
drawFromPNG($FileName,$X,$Y,$Alpha=100)
drawFromGIF($FileName,$X,$Y,$Alpha=100)
drawFromJPG($FileName,$X,$Y,$Alpha=100)
Graph setup methods :
addBorder($Width=3,$R=0,$G=0,$B=0)
clearScale()
clearShadow()
createColorGradientPalette($R1,$G1,$B1,$R2,$G2,$B2,$Shades)
drawGraphArea($R,$G,$B,$Stripe=FALSE)
drawScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$RightScale=FALSE)
drawRightScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1)
drawXYScale($Data,$DataDescription,$YSerieName,$XSerieName,$R,$G,$B,$WithMargin=0,$Angle=0,$Decimals=1)
drawGrid($LineWidth,$Mosaic=TRUE,$R=220,$G=220,$B=220,$Alpha=100)
drawLegend($XPos,$YPos,$DataDescription,$R,$G,$B,$Rs=-1,$Gs=-1,$Bs=-1,$Rt=0,$Gt=0,$Bt=0,$Border=FALSE)
drawPieLegend($XPos,$YPos,$Data,$DataDescription,$R,$G,$B)
drawTitle($XPos,$YPos,$Value,$R,$G,$B,$XPos2=-1,$YPos2=-1,$Shadow=FALSE)
drawTreshold($Value,$R,$G,$B,$ShowLabel=FALSE,$ShowOnRight=FALSE,$TickWidth=4,$FreeText=NULL)
drawArea($Data,$Serie1,$Serie2,$R,$G,$B,$Alpha = 50)
drawRadarAxis($Data,$DataDescription,$Mosaic=TRUE,$BorderOffset=10,$A_R=60,$A_G=60,$A_B=60,$S_R=200,$S_G=200,$S_B=200,$MaxValue=-1)
drawGraphAreaGradient($R,$G,$B,$Decay,$Target=TARGET_GRAPHAREA)
drawTextBox($X1,$Y1,$X2,$Y2,$Text,$Angle=0,$R=255,$G=255,$B=255,$Align=ALIGN_LEFT,$Shadow=TRUE,$BgR=-1,$BgG=-1,$BgB=-1,$Alpha=100)
getLegendBoxSize($DataDescription)
loadColorPalette($FileName,$Delimiter=",")
reportWarnings($Interface="CLI")
setGraphArea($X1,$Y1,$X2,$Y2)
setLabel($Data,$DataDescription,$SerieName,$ValueName,$Caption,$R=210,$G=210,$B=210)
setColorPalette($ID,$R,$G,$B)
setCurrency($Currency)
setDateFormat($Format)
setFontProperties($FontName,$FontSize)
setLineStyle($Width=1,$DotSize=0)
setFixedScale($VMin,$VMax,$Divisions=5,$VXMin=0,$VXMin=0,$XDivisions=5)
setShadowProperties($XDistance=1,$YDistance=1,$R=60,$G=60,$B=60,$Alpha)
writeValues($Data,$DataDescription,$Series)
Graphs methods :
drawPlotGraph($Data,$DataDescription,$BigRadius=5,$SmallRadius=2,$R2=-1,$G2=-1,$B2=-1,$Shadow=FALSE)
drawXYPlotGraph($Data,$DataDescription,$YSerieName,$XSerieName,$PaletteID=0,$BigRadius=5,$SmallRadius=2,$R2=-1,$G2=-1,$B2=-1)
drawLineGraph($Data,$DataDescription,$SerieName="")
drawXYGraph($Data,$DataDescription,$YSerieName,$XSerieName,$PaletteID=0)
drawFilledLineGraph($Data,$DataDescription,$Alpha=100,$AroundZero=FALSE)
drawCubicCurve($Data,$DataDescription,$Accuracy=.1,$SerieName="")
drawFilledCubicCurve($Data,$DataDescription,$Accuracy=.1,$Alpha=100,$AroundZero=FALSE)
drawOverlayBarGraph($Data,$DataDescription,$Alpha=50)
drawBarGraph($Data,$DataDescription,$Shadow=FALSE)
drawStackedBarGraph($Data,$DataDescription,$Alpha=50,$Contiguous=FALSE)
drawLimitsGraph($Data,$DataDescription,$R=0,$G=0,$B=0)
drawRadar($Data,$DataDescription,$BorderOffset=10,$MaxValue=-1)
drawFilledRadar($Data,$DataDescription,$Alpha=50,$BorderOffset=10,$MaxValue=-1)
drawBasicPieGraph($Data,$DataDescription,$XPos,$YPos,$Radius=100,$DrawLabels=PIE_NOLABEL,$R=255,$G=255,$B=255,$Decimals=0)
drawFlatPieGraph($Data,$DataDescription,$XPos,$YPos,$Radius=100,$DrawLabels=PIE_NOLABEL,$SpliceDistance=0,$Decimals = 0)
drawFlatPieGraphWithShadow($Data,$DataDescription,$XPos,$YPos,$Radius=100,$DrawLabels=PIE_NOLABEL,$SpliceDistance=0,$Decimals = 0)
drawPieGraph($Data,$DataDescription,$XPos,$YPos,$Radius=100,$DrawLabels=PIE_NOLABEL,$EnhanceColors=TRUE,$Skew=60,$SpliceHeight=20,$SpliceDistance=0,$Decimals=0)
Other methods :
setImageMap($Mode=TRUE,$GraphID="MyGraph")
getImageMap()
getSavedImageMap($MapName,$Flush=TRUE)
Render($FileName)
Stroke()
*/
/* Declare some script wide constants */
define("SCALE_NORMAL",1);
define("SCALE_ADDALL",2);
define("SCALE_START0",3);
define("SCALE_ADDALLSTART0",4);
define("PIE_PERCENTAGE", 1);
define("PIE_LABELS",2);
define("PIE_NOLABEL",3);
define("PIE_PERCENTAGE_LABEL", 4);
define("TARGET_GRAPHAREA",1);
define("TARGET_BACKGROUND",2);
define("ALIGN_TOP_LEFT",1);
define("ALIGN_TOP_CENTER",2);
define("ALIGN_TOP_RIGHT",3);
define("ALIGN_LEFT",4);
define("ALIGN_CENTER",5);
define("ALIGN_RIGHT",6);
define("ALIGN_BOTTOM_LEFT",7);
define("ALIGN_BOTTOM_CENTER",8);
define("ALIGN_BOTTOM_RIGHT",9);
/* pChart class definition */
class pChart
{
/* Palettes definition */
var $Palette = array("0"=>array("R"=>188,"G"=>224,"B"=>46),
"1"=>array("R"=>224,"G"=>100,"B"=>46),
"2"=>array("R"=>224,"G"=>214,"B"=>46),
"3"=>array("R"=>46,"G"=>151,"B"=>224),
"4"=>array("R"=>176,"G"=>46,"B"=>224),
"5"=>array("R"=>224,"G"=>46,"B"=>117),
"6"=>array("R"=>92,"G"=>224,"B"=>46),
"7"=>array("R"=>224,"G"=>176,"B"=>46));
/* Some static vars used in the class */
var $XSize = NULL;
var $YSize = NULL;
var $Picture = NULL;
var $ImageMap = NULL;
/* Error management */
var $ErrorReporting = FALSE;
var $ErrorInterface = "CLI";
var $Errors = NULL;
var $ErrorFontName = "Fonts/pf_arma_five.ttf";
var $ErrorFontSize = 6;
/* vars related to the graphing area */
var $GArea_X1 = NULL;
var $GArea_Y1 = NULL;
var $GArea_X2 = NULL;
var $GArea_Y2 = NULL;
var $GAreaXOffset = NULL;
var $VMax = NULL;
var $VMin = NULL;
var $VXMax = NULL;
var $VXMin = NULL;
var $Divisions = NULL;
var $XDivisions = NULL;
var $DivisionHeight = NULL;
var $XDivisionHeight = NULL;
var $DivisionCount = NULL;
var $XDivisionCount = NULL;
var $DivisionRatio = NULL;
var $XDivisionRatio = NULL;
var $DivisionWidth = NULL;
var $DataCount = NULL;
var $Currency = "\$";
/* Text format related vars */
var $FontName = NULL;
var $FontSize = NULL;
var $DateFormat = "d/m/Y";
/* Lines format related vars */
var $LineWidth = 1;
var $LineDotSize = 0;
/* Layer related vars */
var $Layers = NULL;
/* Set antialias quality : 0 is maximum, 100 minimum*/
var $AntialiasQuality = 0;
/* Shadow settings */
var $ShadowActive = FALSE;
var $ShadowXDistance = 1;
var $ShadowYDistance = 1;
var $ShadowRColor = 60;
var $ShadowGColor = 60;
var $ShadowBColor = 60;
var $ShadowAlpha = 50;
var $ShadowBlur = 0;
/* Image Map settings */
var $BuildMap = FALSE;
var $MapFunction = NULL;
var $tmpFolder = "tmp/";
var $MapID = NULL;
/* This function create the background picture */
function pChart($XSize,$YSize)
{
$this->XSize = $XSize;
$this->YSize = $YSize;
$this->Picture = imagecreatetruecolor($XSize,$YSize);
$C_White =$this->AllocateColor($this->Picture,255,255,255);
imagefilledrectangle($this->Picture,0,0,$XSize,$YSize,$C_White);
imagecolortransparent($this->Picture,$C_White);
$this->setFontProperties("tahoma.ttf",8);
}
/* Set if warnings should be reported */
function reportWarnings($Interface="CLI")
{
$this->ErrorReporting = TRUE;
$this->ErrorInterface = $Interface;
}
/* Set the font properties */
function setFontProperties($FontName,$FontSize)
{
$this->FontName = $FontName;
$this->FontSize = $FontSize;
}
/* Set the shadow properties */
function setShadowProperties($XDistance=1,$YDistance=1,$R=60,$G=60,$B=60,$Alpha=50,$Blur=0)
{
$this->ShadowActive = TRUE;
$this->ShadowXDistance = $XDistance;
$this->ShadowYDistance = $YDistance;
$this->ShadowRColor = $R;
$this->ShadowGColor = $G;
$this->ShadowBColor = $B;
$this->ShadowAlpha = $Alpha;
$this->ShadowBlur = $Blur;
}
/* Remove shadow option */
function clearShadow()
{
$this->ShadowActive = FALSE;
}
/* Set Palette color */
function setColorPalette($ID,$R,$G,$B)
{
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$this->Palette[$ID]["R"] = $R;
$this->Palette[$ID]["G"] = $G;
$this->Palette[$ID]["B"] = $B;
}
/* Create a color palette shading from one color to another */
function createColorGradientPalette($R1,$G1,$B1,$R2,$G2,$B2,$Shades)
{
$RFactor = ($R2-$R1)/$Shades;
$GFactor = ($G2-$G1)/$Shades;
$BFactor = ($B2-$B1)/$Shades;
for($i=0;$i<=$Shades-1;$i++)
{
$this->Palette[$i]["R"] = $R1+$RFactor*$i;
$this->Palette[$i]["G"] = $G1+$GFactor*$i;
$this->Palette[$i]["B"] = $B1+$BFactor*$i;
}
}
/* Load Color Palette from file */
function loadColorPalette($FileName,$Delimiter=",")
{
$handle = @fopen($FileName,"r");
$ColorID = 0;
if ($handle)
{
while (!feof($handle))
{
$buffer = fgets($handle, 4096);
$buffer = str_replace(chr(10),"",$buffer);
$buffer = str_replace(chr(13),"",$buffer);
$Values = split($Delimiter,$buffer);
if ( count($Values) == 3 )
{
$this->Palette[$ColorID]["R"] = $Values[0];
$this->Palette[$ColorID]["G"] = $Values[1];
$this->Palette[$ColorID]["B"] = $Values[2];
$ColorID++;
}
}
}
}
/* Set line style */
function setLineStyle($Width=1,$DotSize=0)
{
$this->LineWidth = $Width;
$this->LineDotSize = $DotSize;
}
/* Set currency symbol */
function setCurrency($Currency)
{
$this->Currency = $Currency;
}
/* Set the graph area location */
function setGraphArea($X1,$Y1,$X2,$Y2)
{
$this->GArea_X1 = $X1;
$this->GArea_Y1 = $Y1;
$this->GArea_X2 = $X2;
$this->GArea_Y2 = $Y2;
}
/* Prepare the graph area */
function drawGraphArea($R,$G,$B,$Stripe=FALSE)
{
$this->drawFilledRectangle($this->GArea_X1,$this->GArea_Y1,$this->GArea_X2,$this->GArea_Y2,$R,$G,$B,FALSE);
$this->drawRectangle($this->GArea_X1,$this->GArea_Y1,$this->GArea_X2,$this->GArea_Y2,$R-40,$G-40,$B-40);
if ( $Stripe )
{
$R2 = $R-15; if ( $R2 < 0 ) { $R2 = 0; }
$G2 = $R-15; if ( $G2 < 0 ) { $G2 = 0; }
$B2 = $R-15; if ( $B2 < 0 ) { $B2 = 0; }
$LineColor =$this->AllocateColor($this->Picture,$R2,$G2,$B2);
$SkewWidth = $this->GArea_Y2-$this->GArea_Y1-1;
for($i=$this->GArea_X1-$SkewWidth;$i<=$this->GArea_X2;$i=$i+4)
{
$X1 = $i; $Y1 = $this->GArea_Y2;
$X2 = $i+$SkewWidth; $Y2 = $this->GArea_Y1;
if ( $X1 < $this->GArea_X1 )
{ $X1 = $this->GArea_X1; $Y1 = $this->GArea_Y1 + $X2 - $this->GArea_X1 + 1; }
if ( $X2 >= $this->GArea_X2 )
{ $Y2 = $this->GArea_Y1 + $X2 - $this->GArea_X2 +1; $X2 = $this->GArea_X2 - 1; }
// * Fixed in 1.27 * { $X2 = $this->GArea_X2 - 1; $Y2 = $this->GArea_Y2 - ($this->GArea_X2 - $X1); }
imageline($this->Picture,$X1,$Y1,$X2,$Y2+1,$LineColor);
}
}
}
/* Allow you to clear the scale : used if drawing multiple charts */
function clearScale()
{
$this->VMin = NULL;
$this->VMax = NULL;
$this->VXMin = NULL;
$this->VXMax = NULL;
$this->Divisions = NULL;
$this->XDivisions = NULL; }
/* Allow you to fix the scale, use this to bypass the automatic scaling */
function setFixedScale($VMin,$VMax,$Divisions=5,$VXMin=0,$VXMax=0,$XDivisions=5)
{
$this->VMin = $VMin;
$this->VMax = $VMax;
$this->Divisions = $Divisions;
if ( !$VXMin == 0 )
{
$this->VXMin = $VXMin;
$this->VXMax = $VXMax;
$this->XDivisions = $XDivisions;
}
}
/* Wrapper to the drawScale() function allowing a second scale to be drawn */
function drawRightScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1)
{
$this->drawScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks,$Angle,$Decimals,$WithMargin,$SkipLabels,TRUE);
}
/* Compute and draw the scale */
function drawScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$RightScale=FALSE)
{
/* Validate the Data and DataDescription array */
$this->validateData("drawScale",$Data);
$C_TextColor =$this->AllocateColor($this->Picture,$R,$G,$B);
$this->drawLine($this->GArea_X1,$this->GArea_Y1,$this->GArea_X1,$this->GArea_Y2,$R,$G,$B);
$this->drawLine($this->GArea_X1,$this->GArea_Y2,$this->GArea_X2,$this->GArea_Y2,$R,$G,$B);
if ( $this->VMin == NULL && $this->VMax == NULL)
{
if (isset($DataDescription["Values"][0]))
{
$this->VMin = $Data[0][$DataDescription["Values"][0]];
$this->VMax = $Data[0][$DataDescription["Values"][0]];
}
else { $this->VMin = 2147483647; $this->VMax = -2147483647; }
/* Compute Min and Max values */
if ( $ScaleMode == SCALE_NORMAL || $ScaleMode == SCALE_START0 )
{
if ( $ScaleMode == SCALE_START0 ) { $this->VMin = 0; }
foreach ( $Data as $Key => $Values )
{
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
if (isset($Data[$Key][$ColName]))
{
$Value = $Data[$Key][$ColName];
if ( is_numeric($Value) )
{
if ( $this->VMax < $Value) { $this->VMax = $Value; }
if ( $this->VMin > $Value) { $this->VMin = $Value; }
}
}
}
}
}
elseif ( $ScaleMode == SCALE_ADDALL || $ScaleMode == SCALE_ADDALLSTART0 ) /* Experimental */
{
if ( $ScaleMode == SCALE_ADDALLSTART0 ) { $this->VMin = 0; }
foreach ( $Data as $Key => $Values )
{
$Sum = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
if (isset($Data[$Key][$ColName]))
{
$Value = $Data[$Key][$ColName];
if ( is_numeric($Value) )
$Sum += $Value;
}
}
if ( $this->VMax < $Sum) { $this->VMax = $Sum; }
if ( $this->VMin > $Sum) { $this->VMin = $Sum; }
}
}
if ( $this->VMax > preg_replace('/\.[0-9]+/','',$this->VMax) )
$this->VMax = preg_replace('/\.[0-9]+/','',$this->VMax)+1;
/* If all values are the same */
if ( $this->VMax == $this->VMin )
{
if ( $this->VMax >= 0 ) { $this->VMax++; }
else { $this->VMin--; }
}
$DataRange = $this->VMax - $this->VMin;
if ( $DataRange == 0 ) { $DataRange = .1; }
/* Compute automatic scaling */
$ScaleOk = FALSE; $Factor = 1;
$MinDivHeight = 25; $MaxDivs = ($this->GArea_Y2 - $this->GArea_Y1) / $MinDivHeight;
if ( $this->VMin == 0 && $this->VMax == 0 )
{ $this->VMin = 0; $this->VMax = 2; $Scale = 1; $Divisions = 2;}
elseif ($MaxDivs > 1)
{
while(!$ScaleOk)
{
$Scale1 = ( $this->VMax - $this->VMin ) / $Factor;
$Scale2 = ( $this->VMax - $this->VMin ) / $Factor / 2;
$Scale4 = ( $this->VMax - $this->VMin ) / $Factor / 4;
if ( $Scale1 > 1 && $Scale1 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale1); $Scale = 1;}
if ( $Scale2 > 1 && $Scale2 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale2); $Scale = 2;}
if (!$ScaleOk)
{
if ( $Scale2 > 1 ) { $Factor = $Factor * 10; }
if ( $Scale2 < 1 ) { $Factor = $Factor / 10; }
}
}
if ( floor($this->VMax / $Scale / $Factor) != $this->VMax / $Scale / $Factor)
{
$GridID = floor ( $this->VMax / $Scale / $Factor) + 1;
$this->VMax = $GridID * $Scale * $Factor;
$Divisions++;
}
if ( floor($this->VMin / $Scale / $Factor) != $this->VMin / $Scale / $Factor)
{
$GridID = floor( $this->VMin / $Scale / $Factor);
$this->VMin = $GridID * $Scale * $Factor;
$Divisions++;
}
}
else /* Can occurs for small graphs */
$Scale = 1;
if ( !isset($Divisions) )
$Divisions = 2;
if ($Scale == 1 && $Divisions%2 == 1)
$Divisions--;
}
else
$Divisions = $this->Divisions;
$this->DivisionCount = $Divisions;
$DataRange = $this->VMax - $this->VMin;
if ( $DataRange == 0 ) { $DataRange = .1; }
$this->DivisionHeight = ( $this->GArea_Y2 - $this->GArea_Y1 ) / $Divisions;
$this->DivisionRatio = ( $this->GArea_Y2 - $this->GArea_Y1 ) / $DataRange;
$this->GAreaXOffset = 0;
if ( count($Data) > 1 )
{
if ( $WithMargin == FALSE )
$this->DivisionWidth = ( $this->GArea_X2 - $this->GArea_X1 ) / (count($Data)-1);
else
{
$this->DivisionWidth = ( $this->GArea_X2 - $this->GArea_X1 ) / (count($Data));
$this->GAreaXOffset = $this->DivisionWidth / 2;
}
}
else
{
$this->DivisionWidth = $this->GArea_X2 - $this->GArea_X1;
$this->GAreaXOffset = $this->DivisionWidth / 2;
}
$this->DataCount = count($Data);
if ( $DrawTicks == FALSE )
return(0);
$YPos = $this->GArea_Y2; $XMin = NULL;
for($i=1;$i<=$Divisions+1;$i++)
{
if ( $RightScale )
$this->drawLine($this->GArea_X2,$YPos,$this->GArea_X2+5,$YPos,$R,$G,$B);
else
$this->drawLine($this->GArea_X1,$YPos,$this->GArea_X1-5,$YPos,$R,$G,$B);
$Value = $this->VMin + ($i-1) * (( $this->VMax - $this->VMin ) / $Divisions);
$Value = round($Value * pow(10,$Decimals)) / pow(10,$Decimals);
if ( $DataDescription["Format"]["Y"] == "number" )
$Value = $Value.$DataDescription["Unit"]["Y"];
if ( $DataDescription["Format"]["Y"] == "time" )
$Value = $this->ToTime($Value);
if ( $DataDescription["Format"]["Y"] == "date" )
$Value = $this->ToDate($Value);
if ( $DataDescription["Format"]["Y"] == "metric" )
$Value = $this->ToMetric($Value);
if ( $DataDescription["Format"]["Y"] == "currency" )
$Value = $this->ToCurrency($Value);
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value);
$TextWidth = $Position[2]-$Position[0];
if ( $RightScale )
{
imagettftext($this->Picture,$this->FontSize,0,$this->GArea_X2+10,$YPos+($this->FontSize/2),$C_TextColor,$this->FontName,$Value);
if ( $XMin < $this->GArea_X2+15+$TextWidth || $XMin == NULL ) { $XMin = $this->GArea_X2+15+$TextWidth; }
}
else
{
imagettftext($this->Picture,$this->FontSize,0,$this->GArea_X1-10-$TextWidth,$YPos+($this->FontSize/2),$C_TextColor,$this->FontName,$Value);
if ( $XMin > $this->GArea_X1-10-$TextWidth || $XMin == NULL ) { $XMin = $this->GArea_X1-10-$TextWidth; }
}
$YPos = $YPos - $this->DivisionHeight;
}
/* Write the Y Axis caption if set */
if ( isset($DataDescription["Axis"]["Y"]) )
{
$Position = imageftbbox($this->FontSize,90,$this->FontName,$DataDescription["Axis"]["Y"]);
$TextHeight = abs($Position[1])+abs($Position[3]);
$TextTop = (($this->GArea_Y2 - $this->GArea_Y1) / 2) + $this->GArea_Y1 + ($TextHeight/2);
if ( $RightScale )
imagettftext($this->Picture,$this->FontSize,90,$XMin+$this->FontSize,$TextTop,$C_TextColor,$this->FontName,$DataDescription["Axis"]["Y"]);
else
imagettftext($this->Picture,$this->FontSize,90,$XMin-$this->FontSize,$TextTop,$C_TextColor,$this->FontName,$DataDescription["Axis"]["Y"]);
}
/* Horizontal Axis */
$XPos = $this->GArea_X1 + $this->GAreaXOffset;
$ID = 1; $YMax = NULL;
foreach ( $Data as $Key => $Values )
{
if ( $ID % $SkipLabels == 0 )
{
$this->drawLine(floor($XPos),$this->GArea_Y2,floor($XPos),$this->GArea_Y2+5,$R,$G,$B);
$Value = $Data[$Key][$DataDescription["Position"]];
if ( $DataDescription["Format"]["X"] == "number" )
$Value = $Value.$DataDescription["Unit"]["X"];
if ( $DataDescription["Format"]["X"] == "time" )
$Value = $this->ToTime($Value);
if ( $DataDescription["Format"]["X"] == "date" )
$Value = $this->ToDate($Value);
if ( $DataDescription["Format"]["X"] == "metric" )
$Value = $this->ToMetric($Value);
if ( $DataDescription["Format"]["X"] == "currency" )
$Value = $this->ToCurrency($Value);
$Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Value);
$TextWidth = abs($Position[2])+abs($Position[0]);
$TextHeight = abs($Position[1])+abs($Position[3]);
if ( $Angle == 0 )
{
$YPos = $this->GArea_Y2+18;
imagettftext($this->Picture,$this->FontSize,$Angle,floor($XPos)-floor($TextWidth/2),$YPos,$C_TextColor,$this->FontName,$Value);
}
else
{
$YPos = $this->GArea_Y2+10+$TextHeight;
if ( $Angle <= 90 )
imagettftext($this->Picture,$this->FontSize,$Angle,floor($XPos)-$TextWidth+5,$YPos,$C_TextColor,$this->FontName,$Value);
else
imagettftext($this->Picture,$this->FontSize,$Angle,floor($XPos)+$TextWidth+5,$YPos,$C_TextColor,$this->FontName,$Value);
}
if ( $YMax < $YPos || $YMax == NULL ) { $YMax = $YPos; }
}
$XPos = $XPos + $this->DivisionWidth;
$ID++;
}
/* Write the X Axis caption if set */
if ( isset($DataDescription["Axis"]["X"]) )
{
$Position = imageftbbox($this->FontSize,90,$this->FontName,$DataDescription["Axis"]["X"]);
$TextWidth = abs($Position[2])+abs($Position[0]);
$TextLeft = (($this->GArea_X2 - $this->GArea_X1) / 2) + $this->GArea_X1 + ($TextWidth/2);
imagettftext($this->Picture,$this->FontSize,0,$TextLeft,$YMax+$this->FontSize+5,$C_TextColor,$this->FontName,$DataDescription["Axis"]["X"]);
}
}
/* Compute and draw the scale for X/Y charts */
function drawXYScale($Data,$DataDescription,$YSerieName,$XSerieName,$R,$G,$B,$WithMargin=0,$Angle=0,$Decimals=1)
{
/* Validate the Data and DataDescription array */
$this->validateData("drawScale",$Data);
$C_TextColor =$this->AllocateColor($this->Picture,$R,$G,$B);
$this->drawLine($this->GArea_X1,$this->GArea_Y1,$this->GArea_X1,$this->GArea_Y2,$R,$G,$B);
$this->drawLine($this->GArea_X1,$this->GArea_Y2,$this->GArea_X2,$this->GArea_Y2,$R,$G,$B);
/* Process Y scale */
if ( $this->VMin == NULL && $this->VMax == NULL)
{
$this->VMin = $Data[0][$YSerieName];
$this->VMax = $Data[0][$YSerieName];
foreach ( $Data as $Key => $Values )
{
if (isset($Data[$Key][$YSerieName]))
{
$Value = $Data[$Key][$YSerieName];
if ( $this->VMax < $Value) { $this->VMax = $Value; }
if ( $this->VMin > $Value) { $this->VMin = $Value; }
}
}
if ( $this->VMax > preg_replace('/\.[0-9]+/','',$this->VMax) )
$this->VMax = preg_replace('/\.[0-9]+/','',$this->VMax)+1;
$DataRange = $this->VMax - $this->VMin;
if ( $DataRange == 0 ) { $DataRange = .1; }
/* Compute automatic scaling */
$ScaleOk = FALSE; $Factor = 1;
$MinDivHeight = 25; $MaxDivs = ($this->GArea_Y2 - $this->GArea_Y1) / $MinDivHeight;
if ( $this->VMin == 0 && $this->VMax == 0 )
{ $this->VMin = 0; $this->VMax = 2; $Scale = 1; $Divisions = 2;}
elseif ($MaxDivs > 1)
{
while(!$ScaleOk)
{
$Scale1 = ( $this->VMax - $this->VMin ) / $Factor;
$Scale2 = ( $this->VMax - $this->VMin ) / $Factor / 2;
$Scale4 = ( $this->VMax - $this->VMin ) / $Factor / 4;
if ( $Scale1 > 1 && $Scale1 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale1); $Scale = 1;}
if ( $Scale2 > 1 && $Scale2 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale2); $Scale = 2;}
if (!$ScaleOk)
{
if ( $Scale2 > 1 ) { $Factor = $Factor * 10; }
if ( $Scale2 < 1 ) { $Factor = $Factor / 10; }
}
}
if ( floor($this->VMax / $Scale / $Factor) != $this->VMax / $Scale / $Factor)
{
$GridID = floor ( $this->VMax / $Scale / $Factor) + 1;
$this->VMax = $GridID * $Scale * $Factor;
$Divisions++;
}
if ( floor($this->VMin / $Scale / $Factor) != $this->VMin / $Scale / $Factor)
{
$GridID = floor( $this->VMin / $Scale / $Factor);
$this->VMin = $GridID * $Scale * $Factor;
$Divisions++;
}
}
else /* Can occurs for small graphs */
$Scale = 1;
if ( !isset($Divisions) )
$Divisions = 2;
if ( $this->isRealInt(($this->VMax-$this->VMin)/($Divisions-1)))
$Divisions--;
elseif ( $this->isRealInt(($this->VMax-$this->VMin)/($Divisions+1)))
$Divisions++;
}
else
$Divisions = $this->Divisions;
$this->DivisionCount = $Divisions;
$DataRange = $this->VMax - $this->VMin;
if ( $DataRange == 0 ) { $DataRange = .1; }
$this->DivisionHeight = ( $this->GArea_Y2 - $this->GArea_Y1 ) / $Divisions;
$this->DivisionRatio = ( $this->GArea_Y2 - $this->GArea_Y1 ) / $DataRange;
$YPos = $this->GArea_Y2; $XMin = NULL;
for($i=1;$i<=$Divisions+1;$i++)
{
$this->drawLine($this->GArea_X1,$YPos,$this->GArea_X1-5,$YPos,$R,$G,$B);
$Value = $this->VMin + ($i-1) * (( $this->VMax - $this->VMin ) / $Divisions);
$Value = round($Value * pow(10,$Decimals)) / pow(10,$Decimals);
if ( $DataDescription["Format"]["Y"] == "number" )
$Value = $Value.$DataDescription["Unit"]["Y"];
if ( $DataDescription["Format"]["Y"] == "time" )
$Value = $this->ToTime($Value);
if ( $DataDescription["Format"]["Y"] == "date" )
$Value = $this->ToDate($Value);
if ( $DataDescription["Format"]["Y"] == "metric" )
$Value = $this->ToMetric($Value);
if ( $DataDescription["Format"]["Y"] == "currency" )
$Value = $this->ToCurrency($Value);
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value);
$TextWidth = $Position[2]-$Position[0];
imagettftext($this->Picture,$this->FontSize,0,$this->GArea_X1-10-$TextWidth,$YPos+($this->FontSize/2),$C_TextColor,$this->FontName,$Value);
if ( $XMin > $this->GArea_X1-10-$TextWidth || $XMin == NULL ) { $XMin = $this->GArea_X1-10-$TextWidth; }
$YPos = $YPos - $this->DivisionHeight;
}
/* Process X scale */
if ( $this->VXMin == NULL && $this->VXMax == NULL)
{
$this->VXMin = $Data[0][$XSerieName];
$this->VXMax = $Data[0][$XSerieName];
foreach ( $Data as $Key => $Values )
{
if (isset($Data[$Key][$XSerieName]))
{
$Value = $Data[$Key][$XSerieName];
if ( $this->VXMax < $Value) { $this->VXMax = $Value; }
if ( $this->VXMin > $Value) { $this->VXMin = $Value; }
}
}
if ( $this->VXMax > preg_replace('/\.[0-9]+/','',$this->VXMax) )
$this->VXMax = preg_replace('/\.[0-9]+/','',$this->VXMax)+1;
$DataRange = $this->VMax - $this->VMin;
if ( $DataRange == 0 ) { $DataRange = .1; }
/* Compute automatic scaling */
$ScaleOk = FALSE; $Factor = 1;
$MinDivWidth = 25; $MaxDivs = ($this->GArea_X2 - $this->GArea_X1) / $MinDivWidth;
if ( $this->VXMin == 0 && $this->VXMax == 0 )
{ $this->VXMin = 0; $this->VXMax = 2; $Scale = 1; $XDivisions = 2;}
elseif ($MaxDivs > 1)
{
while(!$ScaleOk)
{
$Scale1 = ( $this->VXMax - $this->VXMin ) / $Factor;
$Scale2 = ( $this->VXMax - $this->VXMin ) / $Factor / 2;
$Scale4 = ( $this->VXMax - $this->VXMin ) / $Factor / 4;
if ( $Scale1 > 1 && $Scale1 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $XDivisions = floor($Scale1); $Scale = 1;}
if ( $Scale2 > 1 && $Scale2 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $XDivisions = floor($Scale2); $Scale = 2;}
if (!$ScaleOk)
{
if ( $Scale2 > 1 ) { $Factor = $Factor * 10; }
if ( $Scale2 < 1 ) { $Factor = $Factor / 10; }
}
}
if ( floor($this->VXMax / $Scale / $Factor) != $this->VXMax / $Scale / $Factor)
{
$GridID = floor ( $this->VXMax / $Scale / $Factor) + 1;
$this->VXMax = $GridID * $Scale * $Factor;
$XDivisions++;
}
if ( floor($this->VXMin / $Scale / $Factor) != $this->VXMin / $Scale / $Factor)
{
$GridID = floor( $this->VXMin / $Scale / $Factor);
$this->VXMin = $GridID * $Scale * $Factor;
$XDivisions++;
}
}
else /* Can occurs for small graphs */
$Scale = 1;
if ( !isset($XDivisions) )
$XDivisions = 2;
if ( $this->isRealInt(($this->VXMax-$this->VXMin)/($XDivisions-1)))
$XDivisions--;
elseif ( $this->isRealInt(($this->VXMax-$this->VXMin)/($XDivisions+1)))
$XDivisions++;
}
else
$XDivisions = $this->XDivisions;
$this->XDivisionCount = $Divisions;
$this->DataCount = $Divisions + 2;
$XDataRange = $this->VXMax - $this->VXMin;
if ( $XDataRange == 0 ) { $XDataRange = .1; }
$this->DivisionWidth = ( $this->GArea_X2 - $this->GArea_X1 ) / $XDivisions;
$this->XDivisionRatio = ( $this->GArea_X2 - $this->GArea_X1 ) / $XDataRange;
$XPos = $this->GArea_X1; $YMax = NULL;
for($i=1;$i<=$XDivisions+1;$i++)
{
$this->drawLine($XPos,$this->GArea_Y2,$XPos,$this->GArea_Y2+5,$R,$G,$B);
$Value = $this->VXMin + ($i-1) * (( $this->VXMax - $this->VXMin ) / $XDivisions);
$Value = round($Value * pow(10,$Decimals)) / pow(10,$Decimals);
if ( $DataDescription["Format"]["Y"] == "number" )
$Value = $Value.$DataDescription["Unit"]["Y"];
if ( $DataDescription["Format"]["Y"] == "time" )
$Value = $this->ToTime($Value);
if ( $DataDescription["Format"]["Y"] == "date" )
$Value = $this->ToDate($Value);
if ( $DataDescription["Format"]["Y"] == "metric" )
$Value = $this->ToMetric($Value);
if ( $DataDescription["Format"]["Y"] == "currency" )
$Value = $this->ToCurrency($Value);
$Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Value);
$TextWidth = abs($Position[2])+abs($Position[0]);
$TextHeight = abs($Position[1])+abs($Position[3]);
if ( $Angle == 0 )
{
$YPos = $this->GArea_Y2+18;
imagettftext($this->Picture,$this->FontSize,$Angle,floor($XPos)-floor($TextWidth/2),$YPos,$C_TextColor,$this->FontName,$Value);
}
else
{
$YPos = $this->GArea_Y2+10+$TextHeight;
if ( $Angle <= 90 )
imagettftext($this->Picture,$this->FontSize,$Angle,floor($XPos)-$TextWidth+5,$YPos,$C_TextColor,$this->FontName,$Value);
else
imagettftext($this->Picture,$this->FontSize,$Angle,floor($XPos)+$TextWidth+5,$YPos,$C_TextColor,$this->FontName,$Value);
}
if ( $YMax < $YPos || $YMax == NULL ) { $YMax = $YPos; }
$XPos = $XPos + $this->DivisionWidth;
}
/* Write the Y Axis caption if set */
if ( isset($DataDescription["Axis"]["Y"]) )
{
$Position = imageftbbox($this->FontSize,90,$this->FontName,$DataDescription["Axis"]["Y"]);
$TextHeight = abs($Position[1])+abs($Position[3]);
$TextTop = (($this->GArea_Y2 - $this->GArea_Y1) / 2) + $this->GArea_Y1 + ($TextHeight/2);
imagettftext($this->Picture,$this->FontSize,90,$XMin-$this->FontSize,$TextTop,$C_TextColor,$this->FontName,$DataDescription["Axis"]["Y"]);
}
/* Write the X Axis caption if set */
if ( isset($DataDescription["Axis"]["X"]) )
{
$Position = imageftbbox($this->FontSize,90,$this->FontName,$DataDescription["Axis"]["X"]);
$TextWidth = abs($Position[2])+abs($Position[0]);
$TextLeft = (($this->GArea_X2 - $this->GArea_X1) / 2) + $this->GArea_X1 + ($TextWidth/2);
imagettftext($this->Picture,$this->FontSize,0,$TextLeft,$YMax+$this->FontSize+5,$C_TextColor,$this->FontName,$DataDescription["Axis"]["X"]);
}
}
/* Compute and draw the scale */
function drawGrid($LineWidth,$Mosaic=TRUE,$R=220,$G=220,$B=220,$Alpha=100)
{
/* Draw mosaic */
if ( $Mosaic )
{
$LayerWidth = $this->GArea_X2-$this->GArea_X1;
$LayerHeight = $this->GArea_Y2-$this->GArea_Y1;
$this->Layers[0] = imagecreatetruecolor($LayerWidth,$LayerHeight);
$C_White =$this->AllocateColor($this->Layers[0],255,255,255);
imagefilledrectangle($this->Layers[0],0,0,$LayerWidth,$LayerHeight,$C_White);
imagecolortransparent($this->Layers[0],$C_White);
$C_Rectangle =$this->AllocateColor($this->Layers[0],250,250,250);
$YPos = $LayerHeight; //$this->GArea_Y2-1;
$LastY = $YPos;
for($i=0;$i<=$this->DivisionCount;$i++)
{
$LastY = $YPos;
$YPos = $YPos - $this->DivisionHeight;
if ( $YPos <= 0 ) { $YPos = 1; }
if ( $i % 2 == 0 )
{
imagefilledrectangle($this->Layers[0],1,$YPos,$LayerWidth-1,$LastY,$C_Rectangle);
}
}
imagecopymerge($this->Picture,$this->Layers[0],$this->GArea_X1,$this->GArea_Y1,0,0,$LayerWidth,$LayerHeight,$Alpha);
imagedestroy($this->Layers[0]);
}
/* Horizontal lines */
$YPos = $this->GArea_Y2 - $this->DivisionHeight;
for($i=1;$i<=$this->DivisionCount;$i++)
{
if ( $YPos > $this->GArea_Y1 && $YPos < $this->GArea_Y2 )
$this->drawDottedLine($this->GArea_X1,$YPos,$this->GArea_X2,$YPos,$LineWidth,$R,$G,$B);
$YPos = $YPos - $this->DivisionHeight;
}
/* Vertical lines */
if ( $this->GAreaXOffset == 0 )
{ $XPos = $this->GArea_X1 + $this->DivisionWidth + $this->GAreaXOffset; $ColCount = $this->DataCount-2; }
else
{ $XPos = $this->GArea_X1 + $this->GAreaXOffset; $ColCount = floor( ($this->GArea_X2 - $this->GArea_X1) / $this->DivisionWidth ); }
for($i=1;$i<=$ColCount;$i++)
{
if ( $XPos > $this->GArea_X1 && $XPos < $this->GArea_X2 )
$this->drawDottedLine(floor($XPos),$this->GArea_Y1,floor($XPos),$this->GArea_Y2,$LineWidth,$R,$G,$B);
$XPos = $XPos + $this->DivisionWidth;
}
}
/* retrieve the legends size */
function getLegendBoxSize($DataDescription)
{
if ( !isset($DataDescription["Description"]) )
return(-1);
/* <-10->[8]<-4->Text<-10-> */
$MaxWidth = 0; $MaxHeight = 8;
foreach($DataDescription["Description"] as $Key => $Value)
{
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value);
$TextWidth = $Position[2]-$Position[0];
$TextHeight = $Position[1]-$Position[7];
if ( $TextWidth > $MaxWidth) { $MaxWidth = $TextWidth; }
$MaxHeight = $MaxHeight + $TextHeight + 4;
}
$MaxHeight = $MaxHeight - 3;
$MaxWidth = $MaxWidth + 32;
return(array($MaxWidth,$MaxHeight));
}
function getPieLegendBoxSize($Data)
{
$MaxWidth = 0; $MaxHeight = 8;
foreach($Data as $Value)
{
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value['Keys']);
$TextWidth = $Position[2]-$Position[0];
$TextHeight = $Position[1]-$Position[7];
if ( $TextWidth > $MaxWidth) { $MaxWidth = $TextWidth; }
$MaxHeight = $MaxHeight + $TextHeight + 4;
}
$MaxHeight = $MaxHeight - 3;
$MaxWidth = $MaxWidth + 32;
return(array($MaxWidth,$MaxHeight));
}
/* Draw the data legends */
function drawLegend($XPos,$YPos,$DataDescription,$R,$G,$B,$Rs=-1,$Gs=-1,$Bs=-1,$Rt=0,$Gt=0,$Bt=0,$Border=TRUE)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawLegend",$DataDescription);
if ( !isset($DataDescription["Description"]) )
return(-1);
$C_TextColor =$this->AllocateColor($this->Picture,$Rt,$Gt,$Bt);
/* <-10->[8]<-4->Text<-10-> */
$MaxWidth = 0; $MaxHeight = 8;
foreach($DataDescription["Description"] as $Key => $Value)
{
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value);
$TextWidth = $Position[2]-$Position[0];
$TextHeight = $Position[1]-$Position[7];
if ( $TextWidth > $MaxWidth) { $MaxWidth = $TextWidth; }
$MaxHeight = $MaxHeight + $TextHeight + 4;
}
$MaxHeight = $MaxHeight - 5;
$MaxWidth = $MaxWidth + 32;
if ( $Rs == -1 || $Gs == -1 || $Bs == -1 )
{ $Rs = $R-30; $Gs = $G-30; $Bs = $B-30; }
if ( $Border )
{
$this->drawFilledRoundedRectangle($XPos+1,$YPos+1,$XPos+$MaxWidth+1,$YPos+$MaxHeight+1,5,$Rs,$Gs,$Bs);
$this->drawFilledRoundedRectangle($XPos,$YPos,$XPos+$MaxWidth,$YPos+$MaxHeight,5,$R,$G,$B);
}
$YOffset = 4 + $this->FontSize; $ID = 0;
foreach($DataDescription["Description"] as $Key => $Value)
{
$this->drawFilledRoundedRectangle($XPos+10,$YPos+$YOffset-4,$XPos+14,$YPos+$YOffset-4,2,$this->Palette[$ID]["R"],$this->Palette[$ID]["G"],$this->Palette[$ID]["B"]);
imagettftext($this->Picture,$this->FontSize,0,$XPos+22,$YPos+$YOffset,$C_TextColor,$this->FontName,$Value);
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value);
$TextHeight = $Position[1]-$Position[7];
$YOffset = $YOffset + $TextHeight + 4;
$ID++;
}
}
/* Draw the data legends */
function drawPieLegend($XPos,$YPos,$Data,$DataDescription,$R,$G,$B)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawPieLegend",$DataDescription,FALSE);
$this->validateData("drawPieLegend",$Data);
if ( !isset($DataDescription["Position"]) )
return(-1);
$C_TextColor =$this->AllocateColor($this->Picture,0,0,0);
/* <-10->[8]<-4->Text<-10-> */
$MaxWidth = 0; $MaxHeight = 8;
foreach($Data as $Key => $Value)
{
$Value2 = $Value[$DataDescription["Position"]];
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value2);
$TextWidth = $Position[2]-$Position[0];
$TextHeight = $Position[1]-$Position[7];
if ( $TextWidth > $MaxWidth) { $MaxWidth = $TextWidth; }
$MaxHeight = $MaxHeight + $TextHeight + 4;
}
$MaxHeight = $MaxHeight - 3;
$MaxWidth = $MaxWidth + 32;
$this->drawFilledRoundedRectangle($XPos+1,$YPos+1,$XPos+$MaxWidth+1,$YPos+$MaxHeight+1,5,$R-30,$G-30,$B-30);
$this->drawFilledRoundedRectangle($XPos,$YPos,$XPos+$MaxWidth,$YPos+$MaxHeight,5,$R,$G,$B);
$YOffset = 4 + $this->FontSize; $ID = 0;
foreach($Data as $Key => $Value)
{
$Value2 = $Value[$DataDescription["Position"]];
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value2);
$TextHeight = $Position[1]-$Position[7];
$this->drawFilledRectangle($XPos+10,$YPos+$YOffset-6,$XPos+14,$YPos+$YOffset-2,$this->Palette[$ID]["R"],$this->Palette[$ID]["G"],$this->Palette[$ID]["B"]);
imagettftext($this->Picture,$this->FontSize,0,$XPos+22,$YPos+$YOffset,$C_TextColor,$this->FontName,$Value2);
$YOffset = $YOffset + $TextHeight + 4;
$ID++;
}
}
/* Draw the graph title */
function drawTitle($XPos,$YPos,$Value,$R,$G,$B,$XPos2=-1,$YPos2=-1,$Shadow=FALSE)
{
$C_TextColor = $this->AllocateColor($this->Picture,$R,$G,$B);
if ( $XPos2 != -1 )
{
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value);
$TextWidth = $Position[2]-$Position[0];
$XPos = floor(( $XPos2 - $XPos - $TextWidth ) / 2 ) + $XPos;
}
if ( $YPos2 != -1 )
{
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value);
$TextHeight = $Position[5]-$Position[3];
$YPos = floor(( $YPos2 - $YPos - $TextHeight ) / 2 ) + $YPos;
}
if ( $Shadow )
{
$C_ShadowColor = $this->AllocateColor($this->Picture,$this->ShadowRColor,$this->ShadowGColor,$this->ShadowBColor);
imagettftext($this->Picture,$this->FontSize,0,$XPos+$this->ShadowXDistance,$YPos+$this->ShadowYDistance,$C_ShadowColor,$this->FontName,$Value);
}
imagettftext($this->Picture,$this->FontSize,0,$XPos,$YPos,$C_TextColor,$this->FontName,$Value);
}
/* Draw a text box with text align & alpha properties */
function drawTextBox($X1,$Y1,$X2,$Y2,$Text,$Angle=0,$R=255,$G=255,$B=255,$Align=ALIGN_LEFT,$Shadow=TRUE,$BgR=-1,$BgG=-1,$BgB=-1,$Alpha=100)
{
$Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Text);
$TextWidth = $Position[2]-$Position[0];
$TextHeight = $Position[5]-$Position[3];
$AreaWidth = $X2 - $X1;
$AreaHeight = $Y2 - $Y1;
if ( $BgR != -1 && $BgG != -1 && $BgB != -1 )
$this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$BgR,$BgG,$BgB,FALSE,$Alpha);
if ( $Align == ALIGN_TOP_LEFT ) { $X = $X1+1; $Y = $Y1+$this->FontSize+1; }
if ( $Align == ALIGN_TOP_CENTER ) { $X = $X1+($AreaWidth/2)-($TextWidth/2); $Y = $Y1+$this->FontSize+1; }
if ( $Align == ALIGN_TOP_RIGHT ) { $X = $X2-$TextWidth-1; $Y = $Y1+$this->FontSize+1; }
if ( $Align == ALIGN_LEFT ) { $X = $X1+1; $Y = $Y1+($AreaHeight/2)-($TextHeight/2); }
if ( $Align == ALIGN_CENTER ) { $X = $X1+($AreaWidth/2)-($TextWidth/2); $Y = $Y1+($AreaHeight/2)-($TextHeight/2); }
if ( $Align == ALIGN_RIGHT ) { $X = $X2-$TextWidth-1; $Y = $Y1+($AreaHeight/2)-($TextHeight/2); }
if ( $Align == ALIGN_BOTTOM_LEFT ) { $X = $X1+1; $Y = $Y2-1; }
if ( $Align == ALIGN_BOTTOM_CENTER ) { $X = $X1+($AreaWidth/2)-($TextWidth/2); $Y = $Y2-1; }
if ( $Align == ALIGN_BOTTOM_RIGHT ) { $X = $X2-$TextWidth-1; $Y = $Y2-1; }
$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,$X,$Y,$C_TextColor,$this->FontName,$Text);
}
/* Compute and draw the scale */
function drawTreshold($Value,$R,$G,$B,$ShowLabel=FALSE,$ShowOnRight=FALSE,$TickWidth=4,$FreeText=NULL)
{
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$C_TextColor =$this->AllocateColor($this->Picture,$R,$G,$B);
$Y = $this->GArea_Y2 - ($Value - $this->VMin) * $this->DivisionRatio;
if ( $Y <= $this->GArea_Y1 || $Y >= $this->GArea_Y2 )
return(-1);
if ( $TickWidth == 0 )
$this->drawLine($this->GArea_X1,$Y,$this->GArea_X2,$Y,$R,$G,$B);
else
$this->drawDottedLine($this->GArea_X1,$Y,$this->GArea_X2,$Y,$TickWidth,$R,$G,$B);
if ( $ShowLabel )
{
if ( $FreeText == NULL )
{ $Label = $Value; } else { $Label = $FreeText; }
if ( $ShowOnRight )
imagettftext($this->Picture,$this->FontSize,0,$this->GArea_X2+2,$Y+($this->FontSize/2),$C_TextColor,$this->FontName,$Label);
else
imagettftext($this->Picture,$this->FontSize,0,$this->GArea_X1+2,$Y-($this->FontSize/2),$C_TextColor,$this->FontName,$Label);
}
}
/* This function put a label on a specific point */
function setLabel($Data,$DataDescription,$SerieName,$ValueName,$Caption,$R=210,$G=210,$B=210)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("setLabel",$DataDescription);
$this->validateData("setLabel",$Data);
$ShadowFactor = 100;
$C_Label =$this->AllocateColor($this->Picture,$R,$G,$B);
$C_Shadow =$this->AllocateColor($this->Picture,$R-$ShadowFactor,$G-$ShadowFactor,$B-$ShadowFactor);
$C_TextColor =$this->AllocateColor($this->Picture,0,0,0);
$Cp = 0; $Found = FALSE;
foreach ( $Data as $Key => $Value )
{
if ( $Data[$Key][$DataDescription["Position"]] == $ValueName )
{ $NumericalValue = $Data[$Key][$SerieName]; $Found = TRUE; }
if ( !$Found )
$Cp++;
}
$XPos = $this->GArea_X1 + $this->GAreaXOffset + ( $this->DivisionWidth * $Cp ) + 2;
$YPos = $this->GArea_Y2 - ($NumericalValue - $this->VMin) * $this->DivisionRatio;
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Caption);
$TextHeight = $Position[3] - $Position[5];
$TextWidth = $Position[2]-$Position[0] + 2;
$TextOffset = floor($TextHeight/2);
// Shadow
$Poly = array($XPos+1,$YPos+1,$XPos + 9,$YPos - $TextOffset,$XPos + 8,$YPos + $TextOffset + 2);
imagefilledpolygon($this->Picture,$Poly,3,$C_Shadow);
$this->drawLine($XPos,$YPos+1,$XPos + 9,$YPos - $TextOffset - .2,$R-$ShadowFactor,$G-$ShadowFactor,$B-$ShadowFactor);
$this->drawLine($XPos,$YPos+1,$XPos + 9,$YPos + $TextOffset + 2.2,$R-$ShadowFactor,$G-$ShadowFactor,$B-$ShadowFactor);
$this->drawFilledRectangle($XPos + 9,$YPos - $TextOffset-.2,$XPos + 13 + $TextWidth,$YPos + $TextOffset + 2.2,$R-$ShadowFactor,$G-$ShadowFactor,$B-$ShadowFactor);
// Label background
$Poly = array($XPos,$YPos,$XPos + 8,$YPos - $TextOffset - 1,$XPos + 8,$YPos + $TextOffset + 1);
imagefilledpolygon($this->Picture,$Poly,3,$C_Label);
$this->drawLine($XPos-1,$YPos,$XPos + 8,$YPos - $TextOffset - 1.2,$R,$G,$B);
$this->drawLine($XPos-1,$YPos,$XPos + 8,$YPos + $TextOffset + 1.2,$R,$G,$B);
$this->drawFilledRectangle($XPos + 8,$YPos - $TextOffset - 1.2,$XPos + 12 + $TextWidth,$YPos + $TextOffset + 1.2,$R,$G,$B);
imagettftext($this->Picture,$this->FontSize,0,$XPos + 10,$YPos + $TextOffset,$C_TextColor,$this->FontName,$Caption);
}
/* This function draw a plot graph */
function drawPlotGraph($Data,$DataDescription,$BigRadius=5,$SmallRadius=2,$R2=-1,$G2=-1,$B2=-1,$Shadow=FALSE)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawPlotGraph",$DataDescription);
$this->validateData("drawPlotGraph",$Data);
$GraphID = 0;
$Ro = $R2; $Go = $G2; $Bo = $B2;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }
$R = $this->Palette[$ColorID]["R"];
$G = $this->Palette[$ColorID]["G"];
$B = $this->Palette[$ColorID]["B"];
$R2 = $Ro; $G2 = $Go; $B2 = $Bo;
if ( isset($DataDescription["Symbol"][$ColName]) )
{
$Is_Alpha = ((ord ( file_get_contents ($DataDescription["Symbol"][$ColName], false, null, 25, 1)) & 6) & 4) == 4;
$Infos = getimagesize($DataDescription["Symbol"][$ColName]);
$ImageWidth = $Infos[0];
$ImageHeight = $Infos[1];
$Symbol = imagecreatefromgif($DataDescription["Symbol"][$ColName]);
}
$XPos = $this->GArea_X1 + $this->GAreaXOffset;
$Hsize = round($BigRadius/2);
$R3 = -1; $G3 = -1; $B3 = -1;
foreach ( $Data as $Key => $Values )
{
$Value = $Data[$Key][$ColName];
$YPos = $this->GArea_Y2 - (($Value-$this->VMin) * $this->DivisionRatio);
/* Save point into the image map if option activated */
if ( $this->BuildMap )
$this->addToImageMap($XPos-$Hsize,$YPos-$Hsize,$XPos+1+$Hsize,$YPos+$Hsize+1,$DataDescription["Description"][$ColName],$Data[$Key][$ColName].$DataDescription["Unit"]["Y"],"Plot");
if ( is_numeric($Value) )
{
if ( !isset($DataDescription["Symbol"][$ColName]) )
{
if ( $Shadow )
{
if ( $R3 !=-1 && $G3 !=-1 && $B3 !=-1 )
$this->drawFilledCircle($XPos+2,$YPos+2,$BigRadius,$R3,$G3,$B3);
else
{
$R3 = $this->Palette[$ColorID]["R"]-20; if ( $R3 < 0 ) { $R3 = 0; }
$G3 = $this->Palette[$ColorID]["G"]-20; if ( $G3 < 0 ) { $G3 = 0; }
$B3 = $this->Palette[$ColorID]["B"]-20; if ( $B3 < 0 ) { $B3 = 0; }
$this->drawFilledCircle($XPos+2,$YPos+2,$BigRadius,$R3,$G3,$B3);
}
}
$this->drawFilledCircle($XPos+1,$YPos+1,$BigRadius,$R,$G,$B);
if ( $SmallRadius != 0 )
{
if ( $R2 !=-1 && $G2 !=-1 && $B2 !=-1 )
$this->drawFilledCircle($XPos+1,$YPos+1,$SmallRadius,$R2,$G2,$B2);
else
{
$R2 = $this->Palette[$ColorID]["R"]-15; if ( $R2 < 0 ) { $R2 = 0; }
$G2 = $this->Palette[$ColorID]["G"]-15; if ( $G2 < 0 ) { $G2 = 0; }
$B2 = $this->Palette[$ColorID]["B"]-15; if ( $B2 < 0 ) { $B2 = 0; }
$this->drawFilledCircle($XPos+1,$YPos+1,$SmallRadius,$R2,$G2,$B2);
}
}
}
else
{
imagecopymerge($this->Picture,$Symbol,$XPos+1-$ImageWidth/2,$YPos+1-$ImageHeight/2,0,0,$ImageWidth,$ImageHeight,100);
}
}
$XPos = $XPos + $this->DivisionWidth;
}
$GraphID++;
}
}
/* This function draw a plot graph in an X/Y space */
function drawXYPlotGraph($Data,$DataDescription,$YSerieName,$XSerieName,$PaletteID=0,$BigRadius=5,$SmallRadius=2,$R2=-1,$G2=-1,$B2=-1,$Shadow=TRUE)
{
$R = $this->Palette[$PaletteID]["R"];
$G = $this->Palette[$PaletteID]["G"];
$B = $this->Palette[$PaletteID]["B"];
$R3 = -1; $G3 = -1; $B3 = -1;
$YLast = -1; $XLast = -1;
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$YSerieName]) && isset($Data[$Key][$XSerieName]) )
{
$X = $Data[$Key][$XSerieName];
$Y = $Data[$Key][$YSerieName];
$Y = $this->GArea_Y2 - (($Y-$this->VMin) * $this->DivisionRatio);
$X = $this->GArea_X1 + (($X-$this->VXMin) * $this->XDivisionRatio);
if ( $Shadow )
{
if ( $R3 !=-1 && $G3 !=-1 && $B3 !=-1 )
$this->drawFilledCircle($X+2,$Y+2,$BigRadius,$R3,$G3,$B3);
else
{
$R3 = $this->Palette[$PaletteID]["R"]-20; if ( $R < 0 ) { $R = 0; }
$G3 = $this->Palette[$PaletteID]["G"]-20; if ( $G < 0 ) { $G = 0; }
$B3 = $this->Palette[$PaletteID]["B"]-20; if ( $B < 0 ) { $B = 0; }
$this->drawFilledCircle($X+2,$Y+2,$BigRadius,$R3,$G3,$B3);
}
}
$this->drawFilledCircle($X+1,$Y+1,$BigRadius,$R,$G,$B);
if ( $R2 !=-1 && $G2 !=-1 && $B2 !=-1 )
$this->drawFilledCircle($X+1,$Y+1,$SmallRadius,$R2,$G2,$B2);
else
{
$R2 = $this->Palette[$PaletteID]["R"]+20; if ( $R > 255 ) { $R = 255; }
$G2 = $this->Palette[$PaletteID]["G"]+20; if ( $G > 255 ) { $G = 255; }
$B2 = $this->Palette[$PaletteID]["B"]+20; if ( $B > 255 ) { $B = 255; }
$this->drawFilledCircle($X+1,$Y+1,$SmallRadius,$R2,$G2,$B2);
}
}
}
}
/* This function draw an area between two series */
function drawArea($Data,$Serie1,$Serie2,$R,$G,$B,$Alpha = 50)
{
/* Validate the Data and DataDescription array */
$this->validateData("drawArea",$Data);
$LayerWidth = $this->GArea_X2-$this->GArea_X1;
$LayerHeight = $this->GArea_Y2-$this->GArea_Y1;
$this->Layers[0] = imagecreatetruecolor($LayerWidth,$LayerHeight);
$C_White =$this->AllocateColor($this->Layers[0],255,255,255);
imagefilledrectangle($this->Layers[0],0,0,$LayerWidth,$LayerHeight,$C_White);
imagecolortransparent($this->Layers[0],$C_White);
$C_Graph =$this->AllocateColor($this->Layers[0],$R,$G,$B);
$XPos = $this->GAreaXOffset;
$LastXPos = -1;
foreach ( $Data as $Key => $Values )
{
$Value1 = $Data[$Key][$Serie1];
$Value2 = $Data[$Key][$Serie2];
$YPos1 = $LayerHeight - (($Value1-$this->VMin) * $this->DivisionRatio);
$YPos2 = $LayerHeight - (($Value2-$this->VMin) * $this->DivisionRatio);
if ( $LastXPos != -1 )
{
$Points = "";
$Points[] = $LastXPos; $Points[] = $LastYPos1;
$Points[] = $LastXPos; $Points[] = $LastYPos2;
$Points[] = $XPos; $Points[] = $YPos2;
$Points[] = $XPos; $Points[] = $YPos1;
imagefilledpolygon($this->Layers[0],$Points,4,$C_Graph);
}
$LastYPos1 = $YPos1;
$LastYPos2 = $YPos2;
$LastXPos = $XPos;
$XPos = $XPos + $this->DivisionWidth;
}
imagecopymerge($this->Picture,$this->Layers[0],$this->GArea_X1,$this->GArea_Y1,0,0,$LayerWidth,$LayerHeight,$Alpha);
imagedestroy($this->Layers[0]);
}
/* This function write the values of the specified series */
function writeValues($Data,$DataDescription,$Series)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("writeValues",$DataDescription);
$this->validateData("writeValues",$Data);
if ( !is_array($Series) ) { $Series = array($Series); }
foreach($Series as $Key => $Serie)
{
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $Serie ) { $ColorID = $ID; }; $ID++; }
$XPos = $this->GArea_X1 + $this->GAreaXOffset;
$XLast = -1;
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$Serie]) && is_numeric($Data[$Key][$Serie]))
{
$Value = $Data[$Key][$Serie];
$YPos = $this->GArea_Y2 - (($Value-$this->VMin) * $this->DivisionRatio);
$Positions = imagettfbbox($this->FontSize,0,$this->FontName,$Value);
$Width = $Positions[2] - $Positions[6]; $XOffset = $XPos - ($Width/2);
$Height = $Positions[3] - $Positions[7]; $YOffset = $YPos - 4;
$C_TextColor =$this->AllocateColor($this->Picture,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"]);
imagettftext($this->Picture,$this->FontSize,0,$XOffset,$YOffset,$C_TextColor,$this->FontName,$Value);
}
$XPos = $XPos + $this->DivisionWidth;
}
}
}
/* This function draw a line graph */
function drawLineGraph($Data,$DataDescription,$SerieName="")
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawLineGraph",$DataDescription);
$this->validateData("drawLineGraph",$Data);
$GraphID = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }
if ( $SerieName == "" || $SerieName == $ColName )
{
$XPos = $this->GArea_X1 + $this->GAreaXOffset;
$XLast = -1;
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
{
$Value = $Data[$Key][$ColName];
$YPos = $this->GArea_Y2 - (($Value-$this->VMin) * $this->DivisionRatio);
/* Save point into the image map if option activated */
if ( $this->BuildMap )
$this->addToImageMap($XPos-3,$YPos-3,$XPos+3,$YPos+3,$DataDescription["Description"][$ColName],$Data[$Key][$ColName].$DataDescription["Unit"]["Y"],"Line");
if (!is_numeric($Value)) { $XLast = -1; }
if ( $XLast != -1 )
$this->drawLine($XLast,$YLast,$XPos,$YPos,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE);
$XLast = $XPos;
$YLast = $YPos;
if (!is_numeric($Value)) { $XLast = -1; }
}
$XPos = $XPos + $this->DivisionWidth;
}
$GraphID++;
}
}
}
/* This function draw a line graph */
function drawXYGraph($Data,$DataDescription,$YSerieName,$XSerieName,$PaletteID=0)
{
$YLast = -1; $XLast = -1;
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$YSerieName]) && isset($Data[$Key][$XSerieName]) )
{
$X = $Data[$Key][$XSerieName];
$Y = $Data[$Key][$YSerieName];
$Y = $this->GArea_Y2 - (($Y-$this->VMin) * $this->DivisionRatio);
$X = $this->GArea_X1 + (($X-$this->VXMin) * $this->XDivisionRatio);
if ($XLast != -1 && $YLast != -1)
{
$this->drawLine($XLast,$YLast,$X,$Y,$this->Palette[$PaletteID]["R"],$this->Palette[$PaletteID]["G"],$this->Palette[$PaletteID]["B"],TRUE);
}
$XLast = $X;
$YLast = $Y;
}
}
}
/* This function draw a cubic curve */
function drawCubicCurve($Data,$DataDescription,$Accuracy=.1,$SerieName="")
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawCubicCurve",$DataDescription);
$this->validateData("drawCubicCurve",$Data);
$GraphID = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
if ( $SerieName == "" || $SerieName == $ColName )
{
$XIn = ""; $Yin = ""; $Yt = ""; $U = "";
$XIn[0] = 0; $YIn[0] = 0;
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }
$Index = 1;
$XLast = -1; $Missing = "";
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]) )
{
$Value = $Data[$Key][$ColName];
$XIn[$Index] = $Index;
$YIn[$Index] = $Value;
if ( !is_numeric($Value) ) { $Missing[$Index] = TRUE; }
$Index++;
}
}
$Index--;
$Yt[0] = 0;
$Yt[1] = 0;
$U[1] = 0;
for($i=2;$i<=$Index-1;$i++)
{
$Sig = ($XIn[$i] - $XIn[$i-1]) / ($XIn[$i+1] - $XIn[$i-1]);
$p = $Sig * $Yt[$i-1] + 2;
$Yt[$i] = ($Sig - 1) / $p;
$U[$i] = ($YIn[$i+1] - $YIn[$i]) / ($XIn[$i+1] - $XIn[$i]) - ($YIn[$i] - $YIn[$i-1]) / ($XIn[$i] - $XIn[$i-1]);
$U[$i] = (6 * $U[$i] / ($XIn[$i+1] - $XIn[$i-1]) - $Sig * $U[$i-1]) / $p;
}
$qn = 0;
$un = 0;
$Yt[$Index] = ($un - $qn * $U[$Index-1]) / ($qn * $Yt[$Index-1] + 1);
for($k=$Index-1;$k>=1;$k--)
$Yt[$k] = $Yt[$k] * $Yt[$k+1] + $U[$k];
$XPos = $this->GArea_X1 + $this->GAreaXOffset;
for($X=1;$X<=$Index;$X=$X+$Accuracy)
{
$klo = 1;
$khi = $Index;
$k = $khi - $klo;
while($k > 1)
{
$k = $khi - $klo;
If ( $XIn[$k] >= $X )
$khi = $k;
else
$klo = $k;
}
$klo = $khi - 1;
$h = $XIn[$khi] - $XIn[$klo];
$a = ($XIn[$khi] - $X) / $h;
$b = ($X - $XIn[$klo]) / $h;
$Value = $a * $YIn[$klo] + $b * $YIn[$khi] + (($a*$a*$a - $a) * $Yt[$klo] + ($b*$b*$b - $b) * $Yt[$khi]) * ($h*$h) / 6;
$YPos = $this->GArea_Y2 - (($Value-$this->VMin) * $this->DivisionRatio);
if ( $XLast != -1 && !isset($Missing[floor($X)]) && !isset($Missing[floor($X+1)]) )
$this->drawLine($XLast,$YLast,$XPos,$YPos,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE);
$XLast = $XPos;
$YLast = $YPos;
$XPos = $XPos + $this->DivisionWidth * $Accuracy;
}
// Add potentialy missing values
$XPos = $XPos - $this->DivisionWidth * $Accuracy;
if ( $XPos < ($this->GArea_X2 - $this->GAreaXOffset) )
{
$YPos = $this->GArea_Y2 - (($YIn[$Index]-$this->VMin) * $this->DivisionRatio);
$this->drawLine($XLast,$YLast,$this->GArea_X2-$this->GAreaXOffset,$YPos,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE);
}
$GraphID++;
}
}
}
/* This function draw a filled cubic curve */
function drawFilledCubicCurve($Data,$DataDescription,$Accuracy=.1,$Alpha=100,$AroundZero=FALSE)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawFilledCubicCurve",$DataDescription);
$this->validateData("drawFilledCubicCurve",$Data);
$LayerWidth = $this->GArea_X2-$this->GArea_X1;
$LayerHeight = $this->GArea_Y2-$this->GArea_Y1;
$YZero = $LayerHeight - ((0-$this->VMin) * $this->DivisionRatio);
if ( $YZero > $LayerHeight ) { $YZero = $LayerHeight; }
$GraphID = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$XIn = ""; $Yin = ""; $Yt = ""; $U = "";
$XIn[0] = 0; $YIn[0] = 0;
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }
$Index = 1;
$XLast = -1; $Missing = "";
foreach ( $Data as $Key => $Values )
{
$Value = $Data[$Key][$ColName];
$XIn[$Index] = $Index;
$YIn[$Index] = $Value;
if ( !is_numeric($Value) ) { $Missing[$Index] = TRUE; }
$Index++;
}
$Index--;
$Yt[0] = 0;
$Yt[1] = 0;
$U[1] = 0;
for($i=2;$i<=$Index-1;$i++)
{
$Sig = ($XIn[$i] - $XIn[$i-1]) / ($XIn[$i+1] - $XIn[$i-1]);
$p = $Sig * $Yt[$i-1] + 2;
$Yt[$i] = ($Sig - 1) / $p;
$U[$i] = ($YIn[$i+1] - $YIn[$i]) / ($XIn[$i+1] - $XIn[$i]) - ($YIn[$i] - $YIn[$i-1]) / ($XIn[$i] - $XIn[$i-1]);
$U[$i] = (6 * $U[$i] / ($XIn[$i+1] - $XIn[$i-1]) - $Sig * $U[$i-1]) / $p;
}
$qn = 0;
$un = 0;
$Yt[$Index] = ($un - $qn * $U[$Index-1]) / ($qn * $Yt[$Index-1] + 1);
for($k=$Index-1;$k>=1;$k--)
$Yt[$k] = $Yt[$k] * $Yt[$k+1] + $U[$k];
$Points = "";
$Points[] = $this->GAreaXOffset;
$Points[] = $LayerHeight;
$this->Layers[0] = imagecreatetruecolor($LayerWidth,$LayerHeight);
$C_White =$this->AllocateColor($this->Layers[0],255,255,255);
imagefilledrectangle($this->Layers[0],0,0,$LayerWidth,$LayerHeight,$C_White);
imagecolortransparent($this->Layers[0],$C_White);
$YLast = NULL;
$XPos = $this->GAreaXOffset; $PointsCount = 2;
for($X=1;$X<=$Index;$X=$X+$Accuracy)
{
$klo = 1;
$khi = $Index;
$k = $khi - $klo;
while($k > 1)
{
$k = $khi - $klo;
If ( $XIn[$k] >= $X )
$khi = $k;
else
$klo = $k;
}
$klo = $khi - 1;
$h = $XIn[$khi] - $XIn[$klo];
$a = ($XIn[$khi] - $X) / $h;
$b = ($X - $XIn[$klo]) / $h;
$Value = $a * $YIn[$klo] + $b * $YIn[$khi] + (($a*$a*$a - $a) * $Yt[$klo] + ($b*$b*$b - $b) * $Yt[$khi]) * ($h*$h) / 6;
$YPos = $LayerHeight - (($Value-$this->VMin) * $this->DivisionRatio);
if ( $YLast != NULL && $AroundZero && !isset($Missing[floor($X)]) && !isset($Missing[floor($X+1)]))
{
$aPoints = "";
$aPoints[] = $XLast;
$aPoints[] = $YLast;
$aPoints[] = $XPos;
$aPoints[] = $YPos;
$aPoints[] = $XPos;
$aPoints[] = $YZero;
$aPoints[] = $XLast;
$aPoints[] = $YZero;
$C_Graph =$this->AllocateColor($this->Layers[0],$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"]);
imagefilledpolygon($this->Layers[0],$aPoints,4,$C_Graph);
}
if ( !isset($Missing[floor($X)]) || $YLast == NULL )
{
$PointsCount++;
$Points[] = $XPos;
$Points[] = $YPos;
}
else
{
$PointsCount++; $Points[] = $XLast; $Points[] = $LayerHeight;
}
$YLast = $YPos; $XLast = $XPos;
$XPos = $XPos + $this->DivisionWidth * $Accuracy;
}
// Add potentialy missing values
$XPos = $XPos - $this->DivisionWidth * $Accuracy;
if ( $XPos < ($LayerWidth-$this->GAreaXOffset) )
{
$YPos = $LayerHeight - (($YIn[$Index]-$this->VMin) * $this->DivisionRatio);
if ( $YLast != NULL && $AroundZero )
{
$aPoints = "";
$aPoints[] = $XLast;
$aPoints[] = $YLast;
$aPoints[] = $LayerWidth-$this->GAreaXOffset;
$aPoints[] = $YPos;
$aPoints[] = $LayerWidth-$this->GAreaXOffset;
$aPoints[] = $YZero;
$aPoints[] = $XLast;
$aPoints[] = $YZero;
$C_Graph =$this->AllocateColor($this->Layers[0],$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"]);
imagefilledpolygon($this->Layers[0],$aPoints,4,$C_Graph);
}
if ( $YIn[$klo] != "" && $YIn[$khi] != "" || $YLast == NULL )
{
$PointsCount++;
$Points[] = $LayerWidth-$this->GAreaXOffset;
$Points[] = $YPos;
}
}
$Points[] = $LayerWidth-$this->GAreaXOffset;
$Points[] = $LayerHeight;
if ( !$AroundZero )
{
$C_Graph =$this->AllocateColor($this->Layers[0],$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"]);
imagefilledpolygon($this->Layers[0],$Points,$PointsCount,$C_Graph);
}
imagecopymerge($this->Picture,$this->Layers[0],$this->GArea_X1,$this->GArea_Y1,0,0,$LayerWidth,$LayerHeight,$Alpha);
imagedestroy($this->Layers[0]);
$this->drawCubicCurve($Data,$DataDescription,$Accuracy,$ColName);
$GraphID++;
}
}
/* This function draw a filled line graph */
function drawFilledLineGraph($Data,$DataDescription,$Alpha=100,$AroundZero=FALSE)
{
$Empty = -2147483647;
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawFilledLineGraph",$DataDescription);
$this->validateData("drawFilledLineGraph",$Data);
$LayerWidth = $this->GArea_X2-$this->GArea_X1;
$LayerHeight = $this->GArea_Y2-$this->GArea_Y1;
$GraphID = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }
$aPoints = "";
$aPoints[] = $this->GAreaXOffset;
$aPoints[] = $LayerHeight;
$this->Layers[0] = imagecreatetruecolor($LayerWidth,$LayerHeight);
$C_White = $this->AllocateColor($this->Layers[0],255,255,255);
imagefilledrectangle($this->Layers[0],0,0,$LayerWidth,$LayerHeight,$C_White);
imagecolortransparent($this->Layers[0],$C_White);
$XPos = $this->GAreaXOffset;
$XLast = -1; $PointsCount = 2;
$YZero = $LayerHeight - ((0-$this->VMin) * $this->DivisionRatio);
if ( $YZero > $LayerHeight ) { $YZero = $LayerHeight; }
$YLast = $Empty;
foreach ( $Data as $Key => $Values )
{
$Value = $Data[$Key][$ColName];
$YPos = $LayerHeight - (($Value-$this->VMin) * $this->DivisionRatio);
/* Save point into the image map if option activated */
if ( $this->BuildMap )
$this->addToImageMap($XPos-3,$YPos-3,$XPos+3,$YPos+3,$DataDescription["Description"][$ColName],$Data[$Key][$ColName].$DataDescription["Unit"]["Y"],"FLine");
if ( !is_numeric($Value) )
{
$PointsCount++;
$aPoints[] = $XLast;
$aPoints[] = $LayerHeight;
$YLast = $Empty;
}
else
{
$PointsCount++;
if ( $YLast <> $Empty )
{ $aPoints[] = $XPos; $aPoints[] = $YPos; }
else
{ $PointsCount++; $aPoints[] = $XPos; $aPoints[] = $LayerHeight; $aPoints[] = $XPos; $aPoints[] = $YPos; }
if ($YLast <> $Empty && $AroundZero)
{
$Points = "";
$Points[] = $XLast; $Points[] = $YLast;
$Points[] = $XPos;
$Points[] = $YPos;
$Points[] = $XPos;
$Points[] = $YZero;
$Points[] = $XLast;
$Points[] = $YZero;
$C_Graph = $this->AllocateColor($this->Layers[0],$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"]);
imagefilledpolygon($this->Layers[0],$Points,4,$C_Graph);
}
$YLast = $YPos;
}
$XLast = $XPos;
$XPos = $XPos + $this->DivisionWidth;
}
$aPoints[] = $LayerWidth - $this->GAreaXOffset;
$aPoints[] = $LayerHeight;
if ( $AroundZero == FALSE )
{
$C_Graph = $this->AllocateColor($this->Layers[0],$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"]);
imagefilledpolygon($this->Layers[0],$aPoints,$PointsCount,$C_Graph);
}
imagecopymerge($this->Picture,$this->Layers[0],$this->GArea_X1,$this->GArea_Y1,0,0,$LayerWidth,$LayerHeight,$Alpha);
imagedestroy($this->Layers[0]);
$GraphID++;
$this->drawLineGraph($Data,$DataDescription,$ColName);
}
}
/* This function draw a bar graph */
function drawOverlayBarGraph($Data,$DataDescription,$Alpha=50)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawOverlayBarGraph",$DataDescription);
$this->validateData("drawOverlayBarGraph",$Data);
$LayerWidth = $this->GArea_X2-$this->GArea_X1;
$LayerHeight = $this->GArea_Y2-$this->GArea_Y1;
$GraphID = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }
$this->Layers[$GraphID] = imagecreatetruecolor($LayerWidth,$LayerHeight);
$C_White = $this->AllocateColor($this->Layers[$GraphID],255,255,255);
$C_Graph = $this->AllocateColor($this->Layers[$GraphID],$this->Palette[$GraphID]["R"],$this->Palette[$GraphID]["G"],$this->Palette[$GraphID]["B"]);
imagefilledrectangle($this->Layers[$GraphID],0,0,$LayerWidth,$LayerHeight,$C_White);
imagecolortransparent($this->Layers[$GraphID],$C_White);
$XWidth = $this->DivisionWidth / 4;
$XPos = $this->GAreaXOffset;
$YZero = $LayerHeight - ((0-$this->VMin) * $this->DivisionRatio);
$XLast = -1; $PointsCount = 2;
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]) )
{
$Value = $Data[$Key][$ColName];
if ( is_numeric($Value) )
{
$YPos = $LayerHeight - (($Value-$this->VMin) * $this->DivisionRatio);
imagefilledrectangle($this->Layers[$GraphID],$XPos-$XWidth,$YPos,$XPos+$XWidth,$YZero,$C_Graph);
$X1 = floor($XPos - $XWidth + $this->GArea_X1); $Y1 = floor($YPos+$this->GArea_Y1) + .2;
$X2 = floor($XPos + $XWidth + $this->GArea_X1); $Y2 = $this->GArea_Y2 - ((0-$this->VMin) * $this->DivisionRatio);
if ( $X1 <= $this->GArea_X1 ) { $X1 = $this->GArea_X1 + 1; }
if ( $X2 >= $this->GArea_X2 ) { $X2 = $this->GArea_X2 - 1; }
/* Save point into the image map if option activated */
if ( $this->BuildMap )
$this->addToImageMap($X1,min($Y1,$Y2),$X2,max($Y1,$Y2),$DataDescription["Description"][$ColName],$Data[$Key][$ColName].$DataDescription["Unit"]["Y"],"oBar");
$this->drawLine($X1,$Y1,$X2,$Y1,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE);
}
}
$XPos = $XPos + $this->DivisionWidth;
}
$GraphID++;
}
for($i=0;$i<=($GraphID-1);$i++)
{
imagecopymerge($this->Picture,$this->Layers[$i],$this->GArea_X1,$this->GArea_Y1,0,0,$LayerWidth,$LayerHeight,$Alpha);
imagedestroy($this->Layers[$i]);
}
}
/* This function draw a bar graph */
function drawBarGraph($Data,$DataDescription,$Shadow=FALSE,$Alpha=100)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawBarGraph",$DataDescription);
$this->validateData("drawBarGraph",$Data);
$GraphID = 0;
$Series = count($DataDescription["Values"]);
$SeriesWidth = $this->DivisionWidth / ($Series+1);
$SerieXOffset = $this->DivisionWidth / 2 - $SeriesWidth / 2;
$YZero = $this->GArea_Y2 - ((0-$this->VMin) * $this->DivisionRatio);
if ( $YZero > $this->GArea_Y2 ) { $YZero = $this->GArea_Y2; }
$SerieID = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }
$XPos = $this->GArea_X1 + $this->GAreaXOffset - $SerieXOffset + $SeriesWidth * $SerieID;
$XLast = -1;
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
{
if ( is_numeric($Data[$Key][$ColName]) )
{
$Value = $Data[$Key][$ColName];
$YPos = $this->GArea_Y2 - (($Value-$this->VMin) * $this->DivisionRatio);
/* Save point into the image map if option activated */
if ( $this->BuildMap )
{
$this->addToImageMap($XPos+1,min($YZero,$YPos),$XPos+$SeriesWidth-1,max($YZero,$YPos),$DataDescription["Description"][$ColName],$Data[$Key][$ColName].$DataDescription["Unit"]["Y"],"Bar");
}
if ( $Shadow && $Alpha == 100 )
$this->drawRectangle($XPos+1,$YZero,$XPos+$SeriesWidth-1,$YPos,25,25,25,TRUE,$Alpha);
$this->drawFilledRectangle($XPos+1,$YZero,$XPos+$SeriesWidth-1,$YPos,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE,$Alpha);
}
}
$XPos = $XPos + $this->DivisionWidth;
}
$SerieID++;
}
}
/* This function draw a stacked bar graph */
function drawStackedBarGraph($Data,$DataDescription,$Alpha=50,$Contiguous=FALSE)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawBarGraph",$DataDescription);
$this->validateData("drawBarGraph",$Data);
$GraphID = 0;
$Series = count($DataDescription["Values"]);
if ( $Contiguous )
$SeriesWidth = $this->DivisionWidth;
else
$SeriesWidth = $this->DivisionWidth * .8;
$YZero = $this->GArea_Y2 - ((0-$this->VMin) * $this->DivisionRatio);
if ( $YZero > $this->GArea_Y2 ) { $YZero = $this->GArea_Y2; }
$SerieID = 0; $LastValue = "";
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }
$XPos = $this->GArea_X1 + $this->GAreaXOffset - $SeriesWidth / 2;
$XLast = -1;
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
{
if ( is_numeric($Data[$Key][$ColName]) )
{
$Value = $Data[$Key][$ColName];
if ( isset($LastValue[$Key]) )
{
$YPos = $this->GArea_Y2 - ((($Value+$LastValue[$Key])-$this->VMin) * $this->DivisionRatio);
$YBottom = $this->GArea_Y2 - (($LastValue[$Key]-$this->VMin) * $this->DivisionRatio);
$LastValue[$Key] += $Value;
}
else
{
$YPos = $this->GArea_Y2 - (($Value-$this->VMin) * $this->DivisionRatio);
$YBottom = $YZero;
$LastValue[$Key] = $Value;
}
/* Save point into the image map if option activated */
if ( $this->BuildMap )
$this->addToImageMap($XPos+1,min($YBottom,$YPos),$XPos+$SeriesWidth-1,max($YBottom,$YPos),$DataDescription["Description"][$ColName],$Data[$Key][$ColName].$DataDescription["Unit"]["Y"],"sBar");
$this->drawFilledRectangle($XPos+1,$YBottom,$XPos+$SeriesWidth-1,$YPos,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE,$Alpha);
}
}
$XPos = $XPos + $this->DivisionWidth;
}
$SerieID++;
}
}
/* This function draw a limits bar graphs */
function drawLimitsGraph($Data,$DataDescription,$R=0,$G=0,$B=0)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawLimitsGraph",$DataDescription);
$this->validateData("drawLimitsGraph",$Data);
$XWidth = $this->DivisionWidth / 4;
$XPos = $this->GArea_X1 + $this->GAreaXOffset;
foreach ( $Data as $Key => $Values )
{
$Min = $Data[$Key][$DataDescription["Values"][0]];
$Max = $Data[$Key][$DataDescription["Values"][0]];
$GraphID = 0; $MaxID = 0; $MinID = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
if ( isset($Data[$Key][$ColName]) )
{
if ( $Data[$Key][$ColName] > $Max && is_numeric($Data[$Key][$ColName]))
{ $Max = $Data[$Key][$ColName]; $MaxID = $GraphID; }
}
if ( isset($Data[$Key][$ColName]) && is_numeric($Data[$Key][$ColName]))
{
if ( $Data[$Key][$ColName] < $Min )
{ $Min = $Data[$Key][$ColName]; $MinID = $GraphID; }
$GraphID++;
}
}
$YPos = $this->GArea_Y2 - (($Max-$this->VMin) * $this->DivisionRatio);
$X1 = floor($XPos - $XWidth); $Y1 = floor($YPos) - .2;
$X2 = floor($XPos + $XWidth);
if ( $X1 <= $this->GArea_X1 ) { $X1 = $this->GArea_X1 + 1; }
if ( $X2 >= $this->GArea_X2 ) { $X2 = $this->GArea_X2 - 1; }
$YPos = $this->GArea_Y2 - (($Min-$this->VMin) * $this->DivisionRatio);
$Y2 = floor($YPos) + .2;
$this->drawLine(floor($XPos)-.2,$Y1+1,floor($XPos)-.2,$Y2-1,$R,$G,$B,TRUE);
$this->drawLine(floor($XPos)+.2,$Y1+1,floor($XPos)+.2,$Y2-1,$R,$G,$B,TRUE);
$this->drawLine($X1,$Y1,$X2,$Y1,$this->Palette[$MaxID]["R"],$this->Palette[$MaxID]["G"],$this->Palette[$MaxID]["B"],FALSE);
$this->drawLine($X1,$Y2,$X2,$Y2,$this->Palette[$MinID]["R"],$this->Palette[$MinID]["G"],$this->Palette[$MinID]["B"],FALSE);
$XPos = $XPos + $this->DivisionWidth;
}
}
/* This function draw radar axis centered on the graph area */
function drawRadarAxis($Data,$DataDescription,$Mosaic=TRUE,$BorderOffset=10,$A_R=60,$A_G=60,$A_B=60,$S_R=200,$S_G=200,$S_B=200,$MaxValue=-1,$valueMod=1)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawRadarAxis",$DataDescription);
$this->validateData("drawRadarAxis",$Data);
$C_TextColor = $this->AllocateColor($this->Picture,$A_R,$A_G,$A_B);
/* Draw radar axis */
$Points = count($Data);
$Radius = ( $this->GArea_Y2 - $this->GArea_Y1 ) / 2 - $BorderOffset;
$XCenter = ( $this->GArea_X2 - $this->GArea_X1 ) / 2 + $this->GArea_X1;
$YCenter = ( $this->GArea_Y2 - $this->GArea_Y1 ) / 2 + $this->GArea_Y1;
/* Search for the max value */
if ( $MaxValue == -1 )
{
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
if ( $Data[$Key][$ColName] > $MaxValue ) { $MaxValue = $Data[$Key][$ColName]; }
}
}
}
/* Draw the mosaic */
if ( $Mosaic )
{
$RadiusScale = $Radius / $MaxValue;
for ( $t=1; $t<=$MaxValue-1; $t++)
{
$TRadius = $RadiusScale * $t;
$LastX1 = -1;
for ( $i=0; $i<=$Points; $i++)
{
$Angle = -90 + $i * 360/$Points;
$X1 = cos($Angle * 3.1418 / 180 ) * $TRadius + $XCenter;
$Y1 = sin($Angle * 3.1418 / 180 ) * $TRadius + $YCenter;
$X2 = cos($Angle * 3.1418 / 180 ) * ($TRadius+$RadiusScale) + $XCenter;
$Y2 = sin($Angle * 3.1418 / 180 ) * ($TRadius+$RadiusScale) + $YCenter;
if ( $t % 2 == 1 && $LastX1 != -1)
{
$Plots = "";
$Plots[] = $X1; $Plots[] = $Y1;
$Plots[] = $X2; $Plots[] = $Y2;
$Plots[] = $LastX2; $Plots[] = $LastY2;
$Plots[] = $LastX1; $Plots[] = $LastY1;
$C_Graph = $this->AllocateColor($this->Picture,250,250,250);
imagefilledpolygon($this->Picture,$Plots,(count($Plots)+1)/2,$C_Graph);
}
$LastX1 = $X1; $LastY1= $Y1;
$LastX2 = $X2; $LastY2= $Y2;
}
}
}
/* Draw the spider web */
for ( $t=1; $t<=$MaxValue; $t++)
{
$TRadius = ( $Radius / $MaxValue ) * $t;
$LastX = -1;
for ( $i=0; $i<=$Points; $i++)
{
$Angle = -90 + $i * 360/$Points;
$X = cos($Angle * 3.1418 / 180 ) * $TRadius + $XCenter;
$Y = sin($Angle * 3.1418 / 180 ) * $TRadius + $YCenter;
if ( $LastX != -1 )
$this->drawDottedLine($LastX,$LastY,$X,$Y,4,$S_R,$S_G,$S_B);
$LastX = $X; $LastY= $Y;
}
}
/* Draw the axis */
for ( $i=0; $i<=$Points; $i++)
{
$Angle = -90 + $i * 360/$Points;
$X = cos($Angle * 3.1418 / 180 ) * $Radius + $XCenter;
$Y = sin($Angle * 3.1418 / 180 ) * $Radius + $YCenter;
$this->drawLine($XCenter,$YCenter,$X,$Y,$A_R,$A_G,$A_B);
$XOffset = 0; $YOffset = 0;
if (isset($Data[$i][$DataDescription["Position"]]))
{
$Label = $Data[$i][$DataDescription["Position"]];
$Positions = imagettfbbox($this->FontSize,0,$this->FontName,$Label);
$Width = $Positions[2] - $Positions[6];
$Height = $Positions[3] - $Positions[7];
if ( $Angle >= 0 && $Angle <= 90 )
$YOffset = $Height;
if ( $Angle > 90 && $Angle <= 180 )
{ $YOffset = $Height; $XOffset = -$Width; }
if ( $Angle > 180 && $Angle <= 270 )
{ $XOffset = -$Width; }
imagettftext($this->Picture,$this->FontSize,0,$X+$XOffset,$Y+$YOffset,$C_TextColor,$this->FontName,$Label);
if ( $this->BuildMap )
{
$vecX = $X - $XCenter;
$vecY = $Y - $YCenter;
// get a perpendicular vector
$vecXtemp = $vecX;
$vecX = -$vecY;
$vecY = $vecXtemp;
// normalization
$vecLength = sqrt($vecX * $vecX + $vecY * $vecY);
$vecX = $vecX / $vecLength;
$vecY = $vecY / $vecLength;
$tooltipValue = '';
foreach ($DataDescription['Description'] as $key => $value) {
$tooltipValue .= $value.' : '.sprintf("%.2f", $Data[$i][$key]).';';
}
$offset = 10;
$poly = array(
array($X+$vecX*-$offset,$Y+$vecY*-$offset),
array($X+$vecX*+$offset,$Y+$vecY*+$offset),
array($XCenter+$vecX*+$offset,$YCenter+$vecY*+$offset),
array($XCenter+$vecX*-$offset,$YCenter+$vecY*-$offset),
);
$this->addPolyToImageMap($poly,$Label,$tooltipValue,'Radar');
}
}
}
/* Write the values */
for ( $t=1; $t<=$MaxValue; $t++)
{
if ($t % $valueMod != 0)
{ continue; }
$TRadius = ( $Radius / $MaxValue ) * $t;
$Angle = -90 + 360 / $Points;
$X1 = $XCenter;
$Y1 = $YCenter - $TRadius;
$X2 = cos($Angle * 3.1418 / 180 ) * $TRadius + $XCenter;
$Y2 = sin($Angle * 3.1418 / 180 ) * $TRadius + $YCenter;
$XPos = floor(($X2-$X1)/2) + $X1;
$YPos = floor(($Y2-$Y1)/2) + $Y1;
$Positions = imagettfbbox($this->FontSize,0,$this->FontName,$t);
$X = $XPos - ( $X+$Positions[2] - $X+$Positions[6] ) / 2;
$Y = $YPos + $this->FontSize;
$this->drawFilledRoundedRectangle($X+$Positions[6]-2,$Y+$Positions[7]-1,$X+$Positions[2]+4,$Y+$Positions[3]+1,2,240,240,240);
$this->drawRoundedRectangle($X+$Positions[6]-2,$Y+$Positions[7]-1,$X+$Positions[2]+4,$Y+$Positions[3]+1,2,220,220,220);
imagettftext($this->Picture,$this->FontSize,0,$X,$Y,$C_TextColor,$this->FontName,$t);
}
}
/* This function draw a radar graph centered on the graph area */
function drawRadar($Data,$DataDescription,$BorderOffset=10,$MaxValue=-1)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawRadar",$DataDescription);
$this->validateData("drawRadar",$Data);
$Points = count($Data);
$Radius = ( $this->GArea_Y2 - $this->GArea_Y1 ) / 2 - $BorderOffset;
$XCenter = ( $this->GArea_X2 - $this->GArea_X1 ) / 2 + $this->GArea_X1;
$YCenter = ( $this->GArea_Y2 - $this->GArea_Y1 ) / 2 + $this->GArea_Y1;
/* Search for the max value */
if ( $MaxValue == -1 )
{
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
if ( $Data[$Key][$ColName] > $MaxValue ) { $MaxValue = $Data[$Key][$ColName]; }
}
}
}
$GraphID = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }
$Angle = -90;
$XLast = -1;
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
{
$Value = $Data[$Key][$ColName];
$Strength = ( $Radius / $MaxValue ) * $Value;
$XPos = cos($Angle * 3.1418 / 180 ) * $Strength + $XCenter;
$YPos = sin($Angle * 3.1418 / 180 ) * $Strength + $YCenter;
if ( $XLast != -1 )
$this->drawLine($XLast,$YLast,$XPos,$YPos,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"]);
if ( $XLast == -1 )
{ $FirstX = $XPos; $FirstY = $YPos; }
$Angle = $Angle + (360/$Points);
$XLast = $XPos;
$YLast = $YPos;
}
}
$this->drawLine($XPos,$YPos,$FirstX,$FirstY,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"]);
$GraphID++;
}
}
/* This function draw a radar graph centered on the graph area */
function drawFilledRadar($Data,$DataDescription,$Alpha=50,$BorderOffset=10,$MaxValue=-1)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawFilledRadar",$DataDescription);
$this->validateData("drawFilledRadar",$Data);
$Points = count($Data);
$LayerWidth = $this->GArea_X2-$this->GArea_X1;
$LayerHeight = $this->GArea_Y2-$this->GArea_Y1;
$Radius = ( $this->GArea_Y2 - $this->GArea_Y1 ) / 2 - $BorderOffset;
$XCenter = ( $this->GArea_X2 - $this->GArea_X1 ) / 2;
$YCenter = ( $this->GArea_Y2 - $this->GArea_Y1 ) / 2;
/* Search for the max value */
if ( $MaxValue == -1 )
{
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
if ( $Data[$Key][$ColName] > $MaxValue && is_numeric($Data[$Key][$ColName])) { $MaxValue = $Data[$Key][$ColName]; }
}
}
}
$GraphID = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }
$Angle = -90;
$XLast = -1;
$Plots = "";
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
{
$Value = $Data[$Key][$ColName];
if ( !is_numeric($Value) ) { $Value = 0; }
$Strength = ( $Radius / $MaxValue ) * $Value;
$XPos = cos($Angle * 3.1418 / 180 ) * $Strength + $XCenter;
$YPos = sin($Angle * 3.1418 / 180 ) * $Strength + $YCenter;
$Plots[] = $XPos;
$Plots[] = $YPos;
$Angle = $Angle + (360/$Points);
$XLast = $XPos;
$YLast = $YPos;
}
}
if (isset($Plots[0]))
{
$Plots[] = $Plots[0];
$Plots[] = $Plots[1];
$this->Layers[0] = imagecreatetruecolor($LayerWidth,$LayerHeight);
$C_White = $this->AllocateColor($this->Layers[0],255,255,255);
imagefilledrectangle($this->Layers[0],0,0,$LayerWidth,$LayerHeight,$C_White);
imagecolortransparent($this->Layers[0],$C_White);
$C_Graph = $this->AllocateColor($this->Layers[0],$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"]);
imagefilledpolygon($this->Layers[0],$Plots,(count($Plots)+1)/2,$C_Graph);
imagecopymerge($this->Picture,$this->Layers[0],$this->GArea_X1,$this->GArea_Y1,0,0,$LayerWidth,$LayerHeight,$Alpha);
imagedestroy($this->Layers[0]);
for($i=0;$i<=count($Plots)-4;$i=$i+2)
$this->drawLine($Plots[$i]+$this->GArea_X1,$Plots[$i+1]+$this->GArea_Y1,$Plots[$i+2]+$this->GArea_X1,$Plots[$i+3]+$this->GArea_Y1,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"]);
}
$GraphID++;
}
}
/* This function draw a flat pie chart */
function drawBasicPieGraph($Data,$DataDescription,$XPos,$YPos,$Radius=100,$DrawLabels=PIE_NOLABEL,$R=255,$G=255,$B=255,$Decimals=0)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawBasicPieGraph",$DataDescription,FALSE);
$this->validateData("drawBasicPieGraph",$Data);
/* Determine pie sum */
$Series = 0; $PieSum = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
if ( $ColName != $DataDescription["Position"] )
{
$Series++;
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
$PieSum = $PieSum + $Data[$Key][$ColName]; $iValues[] = $Data[$Key][$ColName]; $iLabels[] = $Data[$Key][$DataDescription["Position"]];
}
}
}
/* Validate serie */
if ( $Series != 1 )
RaiseFatal("Pie chart can only accept one serie of data.");
$SpliceRatio = 360 / $PieSum;
$SplicePercent = 100 / $PieSum;
/* Calculate all polygons */
$Angle = 0; $TopPlots = "";
foreach($iValues as $Key => $Value)
{
$TopPlots[$Key][] = $XPos;
$TopPlots[$Key][] = $YPos;
/* Process labels position & size */
$Caption = "";
if ( !($DrawLabels == PIE_NOLABEL) )
{
$TAngle = $Angle+($Value*$SpliceRatio/2);
if ($DrawLabels == PIE_PERCENTAGE)
$Caption = (round($Value * pow(10,$Decimals) * $SplicePercent)/pow(10,$Decimals))."%";
elseif ($DrawLabels == PIE_LABELS)
$Caption = $iLabels[$Key];
elseif ($DrawLabels == PIE_PERCENTAGE_LABEL)
$Caption = $iLabels[$Key]."\r\n".(round($Value * pow(10,$Decimals) * $SplicePercent)/pow(10,$Decimals))."%";
elseif ($DrawLabels == PIE_PERCENTAGE_LABEL)
$Caption = $iLabels[$Key]."\r\n".(round($Value * pow(10,$Decimals) * $SplicePercent)/pow(10,$Decimals))."%";
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Caption);
$TextWidth = $Position[2]-$Position[0];
$TextHeight = abs($Position[1])+abs($Position[3]);
$TX = cos(($TAngle) * 3.1418 / 180 ) * ($Radius+10) + $XPos;
if ( $TAngle > 0 && $TAngle < 180 )
$TY = sin(($TAngle) * 3.1418 / 180 ) * ($Radius+10) + $YPos + 4;
else
$TY = sin(($TAngle) * 3.1418 / 180 ) * ($Radius+4) + $YPos - ($TextHeight/2);
if ( $TAngle > 90 && $TAngle < 270 )
$TX = $TX - $TextWidth;
$C_TextColor = $this->AllocateColor($this->Picture,70,70,70);
imagettftext($this->Picture,$this->FontSize,0,$TX,$TY,$C_TextColor,$this->FontName,$Caption);
}
/* Process pie slices */
for($iAngle=$Angle;$iAngle<=$Angle+$Value*$SpliceRatio;$iAngle=$iAngle+.5)
{
$TopX = cos($iAngle * 3.1418 / 180 ) * $Radius + $XPos;
$TopY = sin($iAngle * 3.1418 / 180 ) * $Radius + $YPos;
$TopPlots[$Key][] = $TopX;
$TopPlots[$Key][] = $TopY;
}
$TopPlots[$Key][] = $XPos;
$TopPlots[$Key][] = $YPos;
$Angle = $iAngle;
}
$PolyPlots = $TopPlots;
/* Set array values type to float --- PHP Bug with imagefilledpolygon casting to integer */
foreach ($TopPlots as $Key => $Value)
{ foreach ($TopPlots[$Key] as $Key2 => $Value2) { settype($TopPlots[$Key][$Key2],"float"); } }
/* Draw Top polygons */
foreach ($PolyPlots as $Key => $Value)
{
$C_GraphLo = $this->AllocateColor($this->Picture,$this->Palette[$Key]["R"],$this->Palette[$Key]["G"],$this->Palette[$Key]["B"]);
imagefilledpolygon($this->Picture,$PolyPlots[$Key],(count($PolyPlots[$Key])+1)/2,$C_GraphLo);
}
$this->drawCircle($XPos-.5,$YPos-.5,$Radius,$R,$G,$B);
$this->drawCircle($XPos-.5,$YPos-.5,$Radius+.5,$R,$G,$B);
/* Draw Top polygons */
foreach ($TopPlots as $Key => $Value)
{
for($j=0;$j<=count($TopPlots[$Key])-4;$j=$j+2)
$this->drawLine($TopPlots[$Key][$j],$TopPlots[$Key][$j+1],$TopPlots[$Key][$j+2],$TopPlots[$Key][$j+3],$R,$G,$B);
}
}
function drawFlatPieGraphWithShadow($Data,$DataDescription,$XPos,$YPos,$Radius=100,$DrawLabels=PIE_NOLABEL,$SpliceDistance=0,$Decimals=0)
{
$this->drawFlatPieGraph($Data,$DataDescription,$XPos+$this->ShadowXDistance,$YPos+$this->ShadowYDistance,$Radius,PIE_NOLABEL,$SpliceDistance,$Decimals,TRUE);
$this->drawFlatPieGraph($Data,$DataDescription,$XPos,$YPos,$Radius,$DrawLabels,$SpliceDistance,$Decimals,FALSE);
}
/* This function draw a flat pie chart */
function drawFlatPieGraph($Data,$DataDescription,$XPos,$YPos,$Radius=100,$DrawLabels=PIE_NOLABEL,$SpliceDistance=0,$Decimals=0,$AllBlack=FALSE)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawFlatPieGraph",$DataDescription,FALSE);
$this->validateData("drawFlatPieGraph",$Data);
$ShadowStatus = $this->ShadowActive ; $this->ShadowActive = FALSE;
/* Determine pie sum */
$Series = 0; $PieSum = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
if ( $ColName != $DataDescription["Position"] )
{
$Series++;
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
$PieSum = $PieSum + $Data[$Key][$ColName]; $iValues[] = $Data[$Key][$ColName]; $iLabels[] = $Data[$Key][$DataDescription["Position"]];
}
}
}
/* Validate serie */
if ( $Series != 1 )
{
RaiseFatal("Pie chart can only accept one serie of data.");
return(0);
}
$SpliceRatio = 360 / $PieSum;
$SplicePercent = 100 / $PieSum;
/* Calculate all polygons */
$Angle = 0; $TopPlots = "";
foreach($iValues as $Key => $Value)
{
$XOffset = cos(($Angle+($Value/2*$SpliceRatio)) * 3.1418 / 180 ) * $SpliceDistance;
$YOffset = sin(($Angle+($Value/2*$SpliceRatio)) * 3.1418 / 180 ) * $SpliceDistance;
$TopPlots[$Key][] = round($XPos + $XOffset);
$TopPlots[$Key][] = round($YPos + $YOffset);
if ( $AllBlack )
{ $Rc = $this->ShadowRColor; $Gc = $this->ShadowGColor; $Bc = $this->ShadowBColor; }
else
{ $Rc = $this->Palette[$Key]["R"]; $Gc = $this->Palette[$Key]["G"]; $Bc = $this->Palette[$Key]["B"]; }
$XLineLast = ""; $YLineLast = "";
/* Process labels position & size */
$Caption = "";
if ( !($DrawLabels == PIE_NOLABEL) )
{
$TAngle = $Angle+($Value*$SpliceRatio/2);
if ($DrawLabels == PIE_PERCENTAGE)
$Caption = (round($Value * pow(10,$Decimals) * $SplicePercent)/pow(10,$Decimals))."%";
elseif ($DrawLabels == PIE_LABELS)
$Caption = $iLabels[$Key];
elseif ($DrawLabels == PIE_PERCENTAGE_LABEL)
$Caption = $iLabels[$Key]."\r\n".(round($Value * pow(10,$Decimals) * $SplicePercent)/pow(10,$Decimals))."%";
elseif ($DrawLabels == PIE_PERCENTAGE_LABEL)
$Caption = $iLabels[$Key]."\r\n".(round($Value * pow(10,$Decimals) * $SplicePercent)/pow(10,$Decimals))."%";
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Caption);
$TextWidth = $Position[2]-$Position[0];
$TextHeight = abs($Position[1])+abs($Position[3]);
$TX = cos(($TAngle) * 3.1418 / 180 ) * ($Radius+10+$SpliceDistance) + $XPos;
if ( $TAngle > 0 && $TAngle < 180 )
$TY = sin(($TAngle) * 3.1418 / 180 ) * ($Radius+10+$SpliceDistance) + $YPos + 4;
else
$TY = sin(($TAngle) * 3.1418 / 180 ) * ($Radius+$SpliceDistance+4) + $YPos - ($TextHeight/2);
if ( $TAngle > 90 && $TAngle < 270 )
$TX = $TX - $TextWidth;
$C_TextColor = $this->AllocateColor($this->Picture,70,70,70);
imagettftext($this->Picture,$this->FontSize,0,$TX,$TY,$C_TextColor,$this->FontName,$Caption);
}
/* Process pie slices */
if ( !$AllBlack )
$LineColor = $this->AllocateColor($this->Picture,$Rc,$Gc,$Bc);
else
$LineColor = $this->AllocateColor($this->Picture,$Rc,$Gc,$Bc);
$XLineLast = ""; $YLineLast = "";
for($iAngle=$Angle;$iAngle<=$Angle+$Value*$SpliceRatio;$iAngle=$iAngle+.5)
{
$PosX = cos($iAngle * 3.1418 / 180 ) * $Radius + $XPos + $XOffset;
$PosY = sin($iAngle * 3.1418 / 180 ) * $Radius + $YPos + $YOffset;
$TopPlots[$Key][] = round($PosX); $TopPlots[$Key][] = round($PosY);
if ( $iAngle == $Angle || $iAngle == $Angle+$Value*$SpliceRatio || $iAngle +.5 > $Angle+$Value*$SpliceRatio)
$this->drawLine($XPos+$XOffset,$YPos+$YOffset,$PosX,$PosY,$Rc,$Gc,$Bc);
if ( $XLineLast != "" )
$this->drawLine($XLineLast,$YLineLast,$PosX,$PosY,$Rc,$Gc,$Bc);
$XLineLast = $PosX; $YLineLast = $PosY;
}
$TopPlots[$Key][] = round($XPos + $XOffset); $TopPlots[$Key][] = round($YPos + $YOffset);
$Angle = $iAngle;
}
$PolyPlots = $TopPlots;
/* Draw Top polygons */
foreach ($PolyPlots as $Key => $Value)
{
if ( !$AllBlack )
$C_GraphLo = $this->AllocateColor($this->Picture,$this->Palette[$Key]["R"],$this->Palette[$Key]["G"],$this->Palette[$Key]["B"]);
else
$C_GraphLo = $this->AllocateColor($this->Picture,$this->ShadowRColor,$this->ShadowGColor,$this->ShadowBColor);
imagefilledpolygon($this->Picture,$PolyPlots[$Key],(count($PolyPlots[$Key])+1)/2,$C_GraphLo);
}
$this->ShadowActive = $ShadowStatus;
}
/* This function draw a pseudo-3D pie chart */
function drawPieGraph($Data,$DataDescription,$XPos,$YPos,$Radius=100,$DrawLabels=PIE_NOLABEL,$EnhanceColors=TRUE,$Skew=60,$SpliceHeight=20,$SpliceDistance=0,$Decimals=0)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawPieGraph",$DataDescription,FALSE);
$this->validateData("drawPieGraph",$Data);
/* Determine pie sum */
$Series = 0; $PieSum = 0; $rPieSum = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
if ( $ColName != $DataDescription["Position"] )
{
$Series++;
foreach ( $Data as $Key => $Values )
if ( isset($Data[$Key][$ColName]))
{
if ( $Data[$Key][$ColName] == 0 )
{ $iValues[] = 0; $rValues[] = 0; $iLabels[] = $Data[$Key][$DataDescription["Position"]]; }
// Removed : $PieSum++; $rValues[] = 1;
else
{ $PieSum += $Data[$Key][$ColName]; $iValues[] = $Data[$Key][$ColName]; $iLabels[] = $Data[$Key][$DataDescription["Position"]]; $rValues[] = $Data[$Key][$ColName]; $rPieSum += $Data[$Key][$ColName];}
}
}
}
/* Validate serie */
if ( $Series != 1 )
RaiseFatal("Pie chart can only accept one serie of data.");
$SpliceDistanceRatio = $SpliceDistance;
$SkewHeight = ($Radius * $Skew) / 100;
$SpliceRatio = (360 - $SpliceDistanceRatio * count($iValues) ) / $PieSum;
$SplicePercent = 100 / $PieSum;
$rSplicePercent = 100 / $rPieSum;
/* Calculate all polygons */
$Angle = 0; $CDev = 5;
$TopPlots = ""; $BotPlots = "";
$aTopPlots = ""; $aBotPlots = "";
foreach($iValues as $Key => $Value)
{
$XCenterPos = cos(($Angle-$CDev+($Value*$SpliceRatio+$SpliceDistanceRatio)/2) * 3.1418 / 180 ) * $SpliceDistance + $XPos;
$YCenterPos = sin(($Angle-$CDev+($Value*$SpliceRatio+$SpliceDistanceRatio)/2) * 3.1418 / 180 ) * $SpliceDistance + $YPos;
$XCenterPos2 = cos(($Angle+$CDev+($Value*$SpliceRatio+$SpliceDistanceRatio)/2) * 3.1418 / 180 ) * $SpliceDistance + $XPos;
$YCenterPos2 = sin(($Angle+$CDev+($Value*$SpliceRatio+$SpliceDistanceRatio)/2) * 3.1418 / 180 ) * $SpliceDistance + $YPos;
$TopPlots[$Key][] = round($XCenterPos); $BotPlots[$Key][] = round($XCenterPos);
$TopPlots[$Key][] = round($YCenterPos); $BotPlots[$Key][] = round($YCenterPos + $SpliceHeight);
$aTopPlots[$Key][] = $XCenterPos; $aBotPlots[$Key][] = $XCenterPos;
$aTopPlots[$Key][] = $YCenterPos; $aBotPlots[$Key][] = $YCenterPos + $SpliceHeight;
/* Process labels position & size */
$Caption = "";
if ( !($DrawLabels == PIE_NOLABEL) )
{
$TAngle = $Angle+($Value*$SpliceRatio/2);
if ($DrawLabels == PIE_PERCENTAGE)
$Caption = (round($rValues[$Key] * pow(10,$Decimals) * $rSplicePercent)/pow(10,$Decimals))."%";
elseif ($DrawLabels == PIE_LABELS)
$Caption = $iLabels[$Key];
elseif ($DrawLabels == PIE_PERCENTAGE_LABEL)
$Caption = $iLabels[$Key]."\r\n".(round($Value * pow(10,$Decimals) * $SplicePercent)/pow(10,$Decimals))."%";
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Caption);
$TextWidth = $Position[2]-$Position[0];
$TextHeight = abs($Position[1])+abs($Position[3]);
$TX = cos(($TAngle) * 3.1418 / 180 ) * ($Radius + 10)+ $XPos;
if ( $TAngle > 0 && $TAngle < 180 )
$TY = sin(($TAngle) * 3.1418 / 180 ) * ($SkewHeight + 10) + $YPos + $SpliceHeight + 4;
else
$TY = sin(($TAngle) * 3.1418 / 180 ) * ($SkewHeight + 4) + $YPos - ($TextHeight/2);
if ( $TAngle > 90 && $TAngle < 270 )
$TX = $TX - $TextWidth;
$C_TextColor = $this->AllocateColor($this->Picture,70,70,70);
imagettftext($this->Picture,$this->FontSize,0,$TX,$TY,$C_TextColor,$this->FontName,$Caption);
}
/* Process pie slices */
for($iAngle=$Angle;$iAngle<=$Angle+$Value*$SpliceRatio;$iAngle=$iAngle+.5)
{
$TopX = cos($iAngle * 3.1418 / 180 ) * $Radius + $XPos;
$TopY = sin($iAngle * 3.1418 / 180 ) * $SkewHeight + $YPos;
$TopPlots[$Key][] = round($TopX); $BotPlots[$Key][] = round($TopX);
$TopPlots[$Key][] = round($TopY); $BotPlots[$Key][] = round($TopY + $SpliceHeight);
$aTopPlots[$Key][] = $TopX; $aBotPlots[$Key][] = $TopX;
$aTopPlots[$Key][] = $TopY; $aBotPlots[$Key][] = $TopY + $SpliceHeight;
}
$TopPlots[$Key][] = round($XCenterPos2); $BotPlots[$Key][] = round($XCenterPos2);
$TopPlots[$Key][] = round($YCenterPos2); $BotPlots[$Key][] = round($YCenterPos2 + $SpliceHeight);
$aTopPlots[$Key][] = $XCenterPos2; $aBotPlots[$Key][] = $XCenterPos2;
$aTopPlots[$Key][] = $YCenterPos2; $aBotPlots[$Key][] = $YCenterPos2 + $SpliceHeight;
$Angle = $iAngle + $SpliceDistanceRatio;
}
/* Draw Bottom polygons */
foreach($iValues as $Key => $Value)
{
$C_GraphLo = $this->AllocateColor($this->Picture,$this->Palette[$Key]["R"],$this->Palette[$Key]["G"],$this->Palette[$Key]["B"],-20);
imagefilledpolygon($this->Picture,$BotPlots[$Key],(count($BotPlots[$Key])+1)/2,$C_GraphLo);
if ( $EnhanceColors ) { $En = -10; } else { $En = 0; }
for($j=0;$j<=count($aBotPlots[$Key])-4;$j=$j+2)
$this->drawLine($aBotPlots[$Key][$j],$aBotPlots[$Key][$j+1],$aBotPlots[$Key][$j+2],$aBotPlots[$Key][$j+3],$this->Palette[$Key]["R"]+$En,$this->Palette[$Key]["G"]+$En,$this->Palette[$Key]["B"]+$En);
}
/* Draw pie layers */
if ( $EnhanceColors ) { $ColorRatio = 30 / $SpliceHeight; } else { $ColorRatio = 25 / $SpliceHeight; }
for($i=$SpliceHeight-1;$i>=1;$i--)
{
foreach($iValues as $Key => $Value)
{
$C_GraphLo = $this->AllocateColor($this->Picture,$this->Palette[$Key]["R"],$this->Palette[$Key]["G"],$this->Palette[$Key]["B"],-10);
$Plots = ""; $Plot = 0;
foreach($TopPlots[$Key] as $Key2 => $Value2)
{
$Plot++;
if ( $Plot % 2 == 1 )
$Plots[] = $Value2;
else
$Plots[] = $Value2+$i;
}
imagefilledpolygon($this->Picture,$Plots,(count($Plots)+1)/2,$C_GraphLo);
$Index = count($Plots);
if ($EnhanceColors ) {$ColorFactor = -20 + ($SpliceHeight - $i) * $ColorRatio; } else { $ColorFactor = 0; }
$this->drawAntialiasPixel($Plots[0],$Plots[1],$this->Palette[$Key]["R"]+$ColorFactor,$this->Palette[$Key]["G"]+$ColorFactor,$this->Palette[$Key]["B"]+$ColorFactor);
$this->drawAntialiasPixel($Plots[2],$Plots[3],$this->Palette[$Key]["R"]+$ColorFactor,$this->Palette[$Key]["G"]+$ColorFactor,$this->Palette[$Key]["B"]+$ColorFactor);
$this->drawAntialiasPixel($Plots[$Index-4],$Plots[$Index-3],$this->Palette[$Key]["R"]+$ColorFactor,$this->Palette[$Key]["G"]+$ColorFactor,$this->Palette[$Key]["B"]+$ColorFactor);
}
}
if ( $this->BuildMap )
{
// Add points to Image Map.
foreach ($TopPlots as $key => $PointArr)
{
$serieName = $Data[$key][$DataDescription['Values'][1]];
$serieValue = $Data[$key][$DataDescription['Values'][0]];
// last point of the arc
$lastX = $PointArr[count($PointArr)-4];
$lastY = $PointArr[count($PointArr)-3];
// the point at the middle
$middleX = $PointArr[0];
$middleY = $PointArr[1];
// first point in the arc
$firstX = $PointArr[2];
$firstY = $PointArr[3];
// point on the first third of the arc
$firstThird = count($PointArr)/3;
$firstThirdX = $PointArr[$firstThird + ($firstThird % 2)];
$firstThirdY = $PointArr[$firstThird + ($firstThird % 2)+1];
// point on the second third of the arc
$secondThird = count($PointArr)/3*2;
$secondThirdX = $PointArr[$secondThird + ($secondThird % 2)];
$secondThirdY = $PointArr[$secondThird + ($secondThird % 2)+1];
// Will create three polygons for every piece of the pie. In such way
// no polygon will be concave. JS only works with convex polygons.
$poly = array(
array($middleX,$middleY),
array($firstX,$firstY),
array($firstThirdX,$firstThirdY),
);
$this->addPolyToImageMap($poly,$serieName,$serieValue,"Pie");
$poly = array(
array($middleX,$middleY),
array($firstThirdX,$firstThirdY),
array($secondThirdX,$secondThirdY),
);
$this->addPolyToImageMap($poly,$serieName,$serieValue,"Pie");
$poly = array(
array($middleX,$middleY),
array($secondThirdX,$secondThirdY),
array($lastX,$lastY),
);
$this->addPolyToImageMap($poly,$serieName,$serieValue,"Pie");
}
}
/* Draw Top polygons */
for($Key=count($iValues)-1;$Key>=0;$Key--)
{
$C_GraphLo = $this->AllocateColor($this->Picture,$this->Palette[$Key]["R"],$this->Palette[$Key]["G"],$this->Palette[$Key]["B"]);
imagefilledpolygon($this->Picture,$TopPlots[$Key],(count($TopPlots[$Key])+1)/2,$C_GraphLo);
if ( $EnhanceColors ) { $En = 10; } else { $En = 0; }
for($j=0;$j<=count($aTopPlots[$Key])-4;$j=$j+2)
$this->drawLine($aTopPlots[$Key][$j],$aTopPlots[$Key][$j+1],$aTopPlots[$Key][$j+2],$aTopPlots[$Key][$j+3],$this->Palette[$Key]["R"]+$En,$this->Palette[$Key]["G"]+$En,$this->Palette[$Key]["B"]+$En);
}
}
/* This function can be used to set the background color */
function drawBackground($R,$G,$B)
{
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$C_Background = $this->AllocateColor($this->Picture,$R,$G,$B);
imagefilledrectangle($this->Picture,0,0,$this->XSize,$this->YSize,$C_Background);
}
/* This function can be used to set the background color */
function drawGraphAreaGradient($R,$G,$B,$Decay,$Target=TARGET_GRAPHAREA)
{
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
if ( $Target == TARGET_GRAPHAREA ) { $X1 = $this->GArea_X1+1; $X2 = $this->GArea_X2-1; $Y1 = $this->GArea_Y1+1; $Y2 = $this->GArea_Y2; }
if ( $Target == TARGET_BACKGROUND ) { $X1 = 0; $X2 = $this->XSize; $Y1 = 0; $Y2 = $this->YSize; }
/* Positive gradient */
if ( $Decay > 0 )
{
$YStep = ($Y2 - $Y1 - 2) / $Decay;
for($i=0;$i<=$Decay;$i++)
{
$R-=1;$G-=1;$B-=1;
$Yi1 = $Y1 + ( $i * $YStep );
$Yi2 = ceil( $Yi1 + ( $i * $YStep ) + $YStep );
if ( $Yi2 >= $Yi2 ) { $Yi2 = $Y2-1; }
$C_Background = $this->AllocateColor($this->Picture,$R,$G,$B);
imagefilledrectangle($this->Picture,$X1,$Yi1,$X2,$Yi2,$C_Background);
}
}
/* Negative gradient */
if ( $Decay < 0 )
{
$YStep = ($Y2 - $Y1 - 2) / -$Decay;
$Yi1 = $Y1; $Yi2 = $Y1+$YStep;
for($i=-$Decay;$i>=0;$i--)
{
$R+=1;$G+=1;$B+=1;
$C_Background = $this->AllocateColor($this->Picture,$R,$G,$B);
imagefilledrectangle($this->Picture,$X1,$Yi1,$X2,$Yi2,$C_Background);
$Yi1+= $YStep;
$Yi2+= $YStep;
if ( $Yi2 >= $Yi2 ) { $Yi2 = $Y2-1; }
}
}
}
/* This function create a rectangle with antialias */
function drawRectangle($X1,$Y1,$X2,$Y2,$R,$G,$B)
{
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$C_Rectangle = $this->AllocateColor($this->Picture,$R,$G,$B);
$X1=$X1-.2;$Y1=$Y1-.2;
$X2=$X2+.2;$Y2=$Y2+.2;
$this->drawLine($X1,$Y1,$X2,$Y1,$R,$G,$B);
$this->drawLine($X2,$Y1,$X2,$Y2,$R,$G,$B);
$this->drawLine($X2,$Y2,$X1,$Y2,$R,$G,$B);
$this->drawLine($X1,$Y2,$X1,$Y1,$R,$G,$B);
}
/* This function create a filled rectangle with antialias */
function drawFilledRectangle($X1,$Y1,$X2,$Y2,$R,$G,$B,$DrawBorder=TRUE,$Alpha=100,$NoFallBack=FALSE)
{
if ( $X2 < $X1 ) { list($X1, $X2) = array($X2, $X1); }
if ( $Y2 < $Y1 ) { list($Y1, $Y2) = array($Y2, $Y1); }
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
if ( $Alpha == 100 )
{
/* Process shadows */
if ( $this->ShadowActive && !$NoFallBack )
{
$this->drawFilledRectangle($X1+$this->ShadowXDistance,$Y1+$this->ShadowYDistance,$X2+$this->ShadowXDistance,$Y2+$this->ShadowYDistance,$this->ShadowRColor,$this->ShadowGColor,$this->ShadowBColor,FALSE,$this->ShadowAlpha,TRUE);
if ( $this->ShadowBlur != 0 )
{
$AlphaDecay = ($this->ShadowAlpha / $this->ShadowBlur);
for($i=1; $i<=$this->ShadowBlur; $i++)
$this->drawFilledRectangle($X1+$this->ShadowXDistance-$i/2,$Y1+$this->ShadowYDistance-$i/2,$X2+$this->ShadowXDistance-$i/2,$Y2+$this->ShadowYDistance-$i/2,$this->ShadowRColor,$this->ShadowGColor,$this->ShadowBColor,FALSE,$this->ShadowAlpha-$AlphaDecay*$i,TRUE);
for($i=1; $i<=$this->ShadowBlur; $i++)
$this->drawFilledRectangle($X1+$this->ShadowXDistance+$i/2,$Y1+$this->ShadowYDistance+$i/2,$X2+$this->ShadowXDistance+$i/2,$Y2+$this->ShadowYDistance+$i/2,$this->ShadowRColor,$this->ShadowGColor,$this->ShadowBColor,FALSE,$this->ShadowAlpha-$AlphaDecay*$i,TRUE);
}
}
$C_Rectangle = $this->AllocateColor($this->Picture,$R,$G,$B);
imagefilledrectangle($this->Picture,round($X1),round($Y1),round($X2),round($Y2),$C_Rectangle);
}
else
{
$LayerWidth = abs($X2-$X1)+2;
$LayerHeight = abs($Y2-$Y1)+2;
$this->Layers[0] = imagecreatetruecolor($LayerWidth,$LayerHeight);
$C_White = $this->AllocateColor($this->Layers[0],255,255,255);
imagefilledrectangle($this->Layers[0],0,0,$LayerWidth,$LayerHeight,$C_White);
imagecolortransparent($this->Layers[0],$C_White);
$C_Rectangle = $this->AllocateColor($this->Layers[0],$R,$G,$B);
imagefilledrectangle($this->Layers[0],round(1),round(1),round($LayerWidth-1),round($LayerHeight-1),$C_Rectangle);
imagecopymerge($this->Picture,$this->Layers[0],round(min($X1,$X2)-1),round(min($Y1,$Y2)-1),0,0,$LayerWidth,$LayerHeight,$Alpha);
imagedestroy($this->Layers[0]);
}
if ( $DrawBorder )
{
$ShadowSettings = $this->ShadowActive; $this->ShadowActive = FALSE;
$this->drawRectangle($X1,$Y1,$X2,$Y2,$R,$G,$B);
$this->ShadowActive = $ShadowSettings;
}
}
/* This function create a rectangle with rounded corners and antialias */
function drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
{
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$C_Rectangle = $this->AllocateColor($this->Picture,$R,$G,$B);
$Step = 90 / ((3.1418 * $Radius)/2);
for($i=0;$i<=90;$i=$i+$Step)
{
$X = cos(($i+180)*3.1418/180) * $Radius + $X1 + $Radius;
$Y = sin(($i+180)*3.1418/180) * $Radius + $Y1 + $Radius;
$this->drawAntialiasPixel($X,$Y,$R,$G,$B);
$X = cos(($i-90)*3.1418/180) * $Radius + $X2 - $Radius;
$Y = sin(($i-90)*3.1418/180) * $Radius + $Y1 + $Radius;
$this->drawAntialiasPixel($X,$Y,$R,$G,$B);
$X = cos(($i)*3.1418/180) * $Radius + $X2 - $Radius;
$Y = sin(($i)*3.1418/180) * $Radius + $Y2 - $Radius;
$this->drawAntialiasPixel($X,$Y,$R,$G,$B);
$X = cos(($i+90)*3.1418/180) * $Radius + $X1 + $Radius;
$Y = sin(($i+90)*3.1418/180) * $Radius + $Y2 - $Radius;
$this->drawAntialiasPixel($X,$Y,$R,$G,$B);
}
$X1=$X1-.2;$Y1=$Y1-.2;
$X2=$X2+.2;$Y2=$Y2+.2;
$this->drawLine($X1+$Radius,$Y1,$X2-$Radius,$Y1,$R,$G,$B);
$this->drawLine($X2,$Y1+$Radius,$X2,$Y2-$Radius,$R,$G,$B);
$this->drawLine($X2-$Radius,$Y2,$X1+$Radius,$Y2,$R,$G,$B);
$this->drawLine($X1,$Y2-$Radius,$X1,$Y1+$Radius,$R,$G,$B);
}
/* This function create a filled rectangle with rounded corners and antialias */
function drawFilledRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
{
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$C_Rectangle = $this->AllocateColor($this->Picture,$R,$G,$B);
$Step = 90 / ((3.1418 * $Radius)/2);
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;
$Xi2 = cos(($i-90)*3.1418/180) * $Radius + $X2 - $Radius;
$Yi2 = 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;
$Xi4 = cos(($i+90)*3.1418/180) * $Radius + $X1 + $Radius;
$Yi4 = 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);
imageline($this->Picture,$X2-$Radius,$Yi3,$Xi3,$Yi3,$C_Rectangle);
imageline($this->Picture,$Xi4,$Yi4,$X1+$Radius,$Yi4,$C_Rectangle);
$this->drawAntialiasPixel($Xi1,$Yi1,$R,$G,$B);
$this->drawAntialiasPixel($Xi2,$Yi2,$R,$G,$B);
$this->drawAntialiasPixel($Xi3,$Yi3,$R,$G,$B);
$this->drawAntialiasPixel($Xi4,$Yi4,$R,$G,$B);
}
imagefilledrectangle($this->Picture,$X1,$Y1+$Radius,$X2,$Y2-$Radius,$C_Rectangle);
imagefilledrectangle($this->Picture,$X1+$Radius,$Y1,$X2-$Radius,$Y2,$C_Rectangle);
$X1=$X1-.2;$Y1=$Y1-.2;
$X2=$X2+.2;$Y2=$Y2+.2;
$this->drawLine($X1+$Radius,$Y1,$X2-$Radius,$Y1,$R,$G,$B);
$this->drawLine($X2,$Y1+$Radius,$X2,$Y2-$Radius,$R,$G,$B);
$this->drawLine($X2-$Radius,$Y2,$X1+$Radius,$Y2,$R,$G,$B);
$this->drawLine($X1,$Y2-$Radius,$X1,$Y1+$Radius,$R,$G,$B);
}
/* This function create a circle with antialias */
function drawCircle($Xc,$Yc,$Height,$R,$G,$B,$Width=0)
{
if ( $Width == 0 ) { $Width = $Height; }
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$C_Circle = $this->AllocateColor($this->Picture,$R,$G,$B);
$Step = 360 / (2 * 3.1418 * max($Width,$Height));
for($i=0;$i<=360;$i=$i+$Step)
{
$X = cos($i*3.1418/180) * $Height + $Xc;
$Y = sin($i*3.1418/180) * $Width + $Yc;
$this->drawAntialiasPixel($X,$Y,$R,$G,$B);
}
}
/* This function create a filled circle/ellipse with antialias */
function drawFilledCircle($Xc,$Yc,$Height,$R,$G,$B,$Width=0)
{
if ( $Width == 0 ) { $Width = $Height; }
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$C_Circle = $this->AllocateColor($this->Picture,$R,$G,$B);
$Step = 360 / (2 * 3.1418 * max($Width,$Height));
for($i=90;$i<=270;$i=$i+$Step)
{
$X1 = cos($i*3.1418/180) * $Height + $Xc;
$Y1 = sin($i*3.1418/180) * $Width + $Yc;
$X2 = cos((180-$i)*3.1418/180) * $Height + $Xc;
$Y2 = sin((180-$i)*3.1418/180) * $Width + $Yc;
$this->drawAntialiasPixel($X1-1,$Y1-1,$R,$G,$B);
$this->drawAntialiasPixel($X2-1,$Y2-1,$R,$G,$B);
if ( ($Y1-1) > $Yc - max($Width,$Height) )
imageline($this->Picture,$X1,$Y1-1,$X2-1,$Y2-1,$C_Circle);
}
}
/* This function will draw a filled ellipse */
function drawEllipse($Xc,$Yc,$Height,$Width,$R,$G,$B)
{ $this->drawCircle($Xc,$Yc,$Height,$R,$G,$B,$Width); }
/* This function will draw an ellipse */
function drawFilledEllipse($Xc,$Yc,$Height,$Width,$R,$G,$B)
{ $this->drawFilledCircle($Xc,$Yc,$Height,$R,$G,$B,$Width); }
/* This function create a line with antialias */
function drawLine($X1,$Y1,$X2,$Y2,$R,$G,$B,$GraphFunction=FALSE)
{
if ( $this->LineDotSize > 1 ) { $this->drawDottedLine($X1,$Y1,$X2,$Y2,$this->LineDotSize,$R,$G,$B,$GraphFunction); return(0); }
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$Distance = sqrt(($X2-$X1)*($X2-$X1)+($Y2-$Y1)*($Y2-$Y1));
if ( $Distance == 0 )
return(-1);
$XStep = ($X2-$X1) / $Distance;
$YStep = ($Y2-$Y1) / $Distance;
for($i=0;$i<=$Distance;$i++)
{
$X = $i * $XStep + $X1;
$Y = $i * $YStep + $Y1;
if ( ($X >= $this->GArea_X1 && $X <= $this->GArea_X2 && $Y >= $this->GArea_Y1 && $Y <= $this->GArea_Y2) || !$GraphFunction )
{
if ( $this->LineWidth == 1 )
$this->drawAntialiasPixel($X,$Y,$R,$G,$B);
else
{
$StartOffset = -($this->LineWidth/2); $EndOffset = ($this->LineWidth/2);
for($j=$StartOffset;$j<=$EndOffset;$j++)
$this->drawAntialiasPixel($X+$j,$Y+$j,$R,$G,$B);
}
}
}
}
/* This function create a line with antialias */
function drawDottedLine($X1,$Y1,$X2,$Y2,$DotSize,$R,$G,$B,$GraphFunction=FALSE)
{
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$Distance = sqrt(($X2-$X1)*($X2-$X1)+($Y2-$Y1)*($Y2-$Y1));
$XStep = ($X2-$X1) / $Distance;
$YStep = ($Y2-$Y1) / $Distance;
$DotIndex = 0;
for($i=0;$i<=$Distance;$i++)
{
$X = $i * $XStep + $X1;
$Y = $i * $YStep + $Y1;
if ( $DotIndex <= $DotSize)
{
if ( ($X >= $this->GArea_X1 && $X <= $this->GArea_X2 && $Y >= $this->GArea_Y1 && $Y <= $this->GArea_Y2) || !$GraphFunction )
{
if ( $this->LineWidth == 1 )
$this->drawAntialiasPixel($X,$Y,$R,$G,$B);
else
{
$StartOffset = -($this->LineWidth/2); $EndOffset = ($this->LineWidth/2);
for($j=$StartOffset;$j<=$EndOffset;$j++)
$this->drawAntialiasPixel($X+$j,$Y+$j,$R,$G,$B);
}
}
}
$DotIndex++;
if ( $DotIndex == $DotSize * 2 )
$DotIndex = 0;
}
}
/* Load a PNG file and draw it over the chart */
function drawFromPNG($FileName,$X,$Y,$Alpha=100)
{ $this->drawFromPicture(1,$FileName,$X,$Y,$Alpha); }
/* Load a GIF file and draw it over the chart */
function drawFromGIF($FileName,$X,$Y,$Alpha=100)
{ $this->drawFromPicture(2,$FileName,$X,$Y,$Alpha); }
/* Load a JPEG file and draw it over the chart */
function drawFromJPG($FileName,$X,$Y,$Alpha=100)
{ $this->drawFromPicture(3,$FileName,$X,$Y,$Alpha); }
/* Generic loader function for external pictures */
function drawFromPicture($PicType,$FileName,$X,$Y,$Alpha=100)
{
if ( file_exists($FileName))
{
$Infos = getimagesize($FileName);
$Width = $Infos[0];
$Height = $Infos[1];
if ( $PicType == 1 ) { $Raster = imagecreatefrompng($FileName); }
if ( $PicType == 2 ) { $Raster = imagecreatefromgif($FileName); }
if ( $PicType == 3 ) { $Raster = imagecreatefromjpeg($FileName); }
imagecopymerge($this->Picture,$Raster,$X,$Y,0,0,$Width,$Height,$Alpha);
imagedestroy($Raster);
}
}
/* Draw an alpha pixel */
function drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B)
{
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
if ( $X < 0 || $Y < 0 || $X >= $this->XSize || $Y >= $this->YSize )
return(-1);
$RGB2 = imagecolorat($this->Picture, $X, $Y);
$R2 = ($RGB2 >> 16) & 0xFF;
$G2 = ($RGB2 >> 8) & 0xFF;
$B2 = $RGB2 & 0xFF;
$iAlpha = (100 - $Alpha)/100;
$Alpha = $Alpha / 100;
$Ra = floor($R*$Alpha+$R2*$iAlpha);
$Ga = floor($G*$Alpha+$G2*$iAlpha);
$Ba = floor($B*$Alpha+$B2*$iAlpha);
$C_Aliased = $this->AllocateColor($this->Picture,$Ra,$Ga,$Ba);
imagesetpixel($this->Picture,$X,$Y,$C_Aliased);
}
/* Color helper */
function AllocateColor($Picture,$R,$G,$B,$Factor=0)
{
$R = $R + $Factor;
$G = $G + $Factor;
$B = $B + $Factor;
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
return(imagecolorallocate($Picture,$R,$G,$B));
}
/* Add a border to the picture */
function addBorder($Size=3,$R=0,$G=0,$B=0)
{
$Width = $this->XSize+2*$Size;
$Height = $this->YSize+2*$Size;
$Resampled = imagecreatetruecolor($Width,$Height);
$C_Background = $this->AllocateColor($Resampled,$R,$G,$B);
imagefilledrectangle($Resampled,0,0,$Width,$Height,$C_Background);
imagecopy($Resampled,$this->Picture,$Size,$Size,0,0,$this->XSize,$this->YSize);
imagedestroy($this->Picture);
$this->XSize = $Width;
$this->YSize = $Height;
$this->Picture = imagecreatetruecolor($this->XSize,$this->YSize);
$C_White = $this->AllocateColor($this->Picture,255,255,255);
imagefilledrectangle($this->Picture,0,0,$this->XSize,$this->YSize,$C_White);
imagecolortransparent($this->Picture,$C_White);
imagecopy($this->Picture,$Resampled,0,0,0,0,$this->XSize,$this->YSize);
}
/* Render the current picture to a file */
function Render($FileName)
{
if ( $this->ErrorReporting )
$this->printErrors($this->ErrorInterface);
/* Save image map if requested */
if ( $this->BuildMap )
$this->SaveImageMap();
imagepng($this->Picture,$FileName);
}
/* Render the current picture to STDOUT */
function Stroke()
{
if ( $this->ErrorReporting )
$this->printErrors("GD");
/* Save image map if requested */
if ( $this->BuildMap )
$this->SaveImageMap();
header('Content-type: image/png');
imagepng($this->Picture);
}
/* Private functions for internal processing */
function drawAntialiasPixel($X,$Y,$R,$G,$B,$Alpha=100,$NoFallBack=FALSE)
{
/* Process shadows */
if ( $this->ShadowActive && !$NoFallBack )
{
$this->drawAntialiasPixel($X+$this->ShadowXDistance,$Y+$this->ShadowYDistance,$this->ShadowRColor,$this->ShadowGColor,$this->ShadowBColor,$this->ShadowAlpha,TRUE);
if ( $this->ShadowBlur != 0 )
{
$AlphaDecay = ($this->ShadowAlpha / $this->ShadowBlur);
for($i=1; $i<=$this->ShadowBlur; $i++)
$this->drawAntialiasPixel($X+$this->ShadowXDistance-$i/2,$Y+$this->ShadowYDistance-$i/2,$this->ShadowRColor,$this->ShadowGColor,$this->ShadowBColor,$this->ShadowAlpha-$AlphaDecay*$i,TRUE);
for($i=1; $i<=$this->ShadowBlur; $i++)
$this->drawAntialiasPixel($X+$this->ShadowXDistance+$i/2,$Y+$this->ShadowYDistance+$i/2,$this->ShadowRColor,$this->ShadowGColor,$this->ShadowBColor,$this->ShadowAlpha-$AlphaDecay*$i,TRUE);
}
}
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$Plot = "";
$Xi = floor($X);
$Yi = floor($Y);
if ( $Xi == $X && $Yi == $Y)
{
if ( $Alpha == 100 )
{
$C_Aliased = $this->AllocateColor($this->Picture,$R,$G,$B);
imagesetpixel($this->Picture,$X,$Y,$C_Aliased);
}
else
$this->drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B);
}
else
{
$Alpha1 = (((1 - ($X - floor($X))) * (1 - ($Y - floor($Y))) * 100) / 100) * $Alpha;
if ( $Alpha1 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi,$Yi,$Alpha1,$R,$G,$B); }
$Alpha2 = ((($X - floor($X)) * (1 - ($Y - floor($Y))) * 100) / 100) * $Alpha;
if ( $Alpha2 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi+1,$Yi,$Alpha2,$R,$G,$B); }
$Alpha3 = (((1 - ($X - floor($X))) * ($Y - floor($Y)) * 100) / 100) * $Alpha;
if ( $Alpha3 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi,$Yi+1,$Alpha3,$R,$G,$B); }
$Alpha4 = ((($X - floor($X)) * ($Y - floor($Y)) * 100) / 100) * $Alpha;
if ( $Alpha4 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi+1,$Yi+1,$Alpha4,$R,$G,$B); }
}
}
/* Validate data contained in the description array */
function validateDataDescription($FunctionName,&$DataDescription,$DescriptionRequired=TRUE)
{
if (!isset($DataDescription["Position"]))
{
$this->Errors[] = "[Warning] ".$FunctionName." - Y Labels are not set.";
$DataDescription["Position"] = "Name";
}
if ( $DescriptionRequired )
{
if (!isset($DataDescription["Description"]))
{
$this->Errors[] = "[Warning] ".$FunctionName." - Series descriptions are not set.";
foreach($DataDescription["Values"] as $key => $Value)
{
$DataDescription["Description"][$Value] = $Value;
}
}
if (count($DataDescription["Description"]) < count($DataDescription["Values"]))
{
$this->Errors[] = "[Warning] ".$FunctionName." - Some series descriptions are not set.";
foreach($DataDescription["Values"] as $key => $Value)
{
if ( !isset($DataDescription["Description"][$Value]))
$DataDescription["Description"][$Value] = $Value;
}
}
}
}
/* Validate data contained in the data array */
function validateData($FunctionName,&$Data)
{
$DataSummary = array();
foreach($Data as $key => $Values)
{
foreach($Values as $key2 => $Value)
{
if (!isset($DataSummary[$key2]))
$DataSummary[$key2] = 1;
else
$DataSummary[$key2]++;
}
}
if ( max($DataSummary) == 0 )
$this->Errors[] = "[Warning] ".$FunctionName." - No data set.";
foreach($DataSummary as $key => $Value)
{
if ($Value < max($DataSummary))
{
$this->Errors[] = "[Warning] ".$FunctionName." - Missing data in serie ".$key.".";
}
}
}
/* Print all error messages on the CLI or graphically */
function printErrors($Mode="CLI")
{
if (count($this->Errors) == 0)
return(0);
if ( $Mode == "CLI" )
{
foreach($this->Errors as $key => $Value)
echo $Value."\r\n";
}
elseif ( $Mode == "GD" )
{
$this->setLineStyle($Width=1);
$MaxWidth = 0;
foreach($this->Errors as $key => $Value)
{
$Position = imageftbbox($this->ErrorFontSize,0,$this->ErrorFontName,$Value);
$TextWidth = $Position[2]-$Position[0];
if ( $TextWidth > $MaxWidth ) { $MaxWidth = $TextWidth; }
}
$this->drawFilledRoundedRectangle($this->XSize-($MaxWidth+20),$this->YSize-(20+(($this->ErrorFontSize+4)*count($this->Errors))),$this->XSize-10,$this->YSize-10,6,233,185,185);
$this->drawRoundedRectangle($this->XSize-($MaxWidth+20),$this->YSize-(20+(($this->ErrorFontSize+4)*count($this->Errors))),$this->XSize-10,$this->YSize-10,6,193,145,145);
$C_TextColor = $this->AllocateColor($this->Picture,133,85,85);
$YPos = $this->YSize - (18 + (count($this->Errors)-1) * ($this->ErrorFontSize + 4));
foreach($this->Errors as $key => $Value)
{
imagettftext($this->Picture,$this->ErrorFontSize,0,$this->XSize-($MaxWidth+15),$YPos,$C_TextColor,$this->ErrorFontName,$Value);
$YPos = $YPos + ($this->ErrorFontSize + 4);
}
}
}
/* Activate the image map creation process */
function setImageMap($Mode=TRUE,$GraphID="MyGraph")
{
$this->BuildMap = $Mode;
$this->MapID = $GraphID;
}
/* Add a box into the image map */
function addToImageMap($X1,$Y1,$X2,$Y2,$SerieName,$Value,$CallerFunction)
{
$poly = array(array($X1,$Y1),array($X2,$Y1),array($X2,$Y2),array($X1,$Y2));
$this->addPolyToImageMap($poly,$SerieName,$Value,$CallerFunction);
}
function addPolyToImageMap($poly,$SerieName,$Value,$CallerFunction)
{
if ( $this->MapFunction == NULL || $this->MapFunction == $CallerFunction)
{
$this->ImageMap[] = array(
'n' => (string)$SerieName,
'v' => (string)$Value,
'p' => $poly,
);
$this->MapFunction = $CallerFunction;
}
}
/* Draw image map to the current chart image */
function debugImageMap()
{
foreach ($this->ImageMap as $polygon)
{
$points = array();
foreach ($polygon['p'] as $point)
{
$points[] = $point[0];
$points[] = $point[1];
}
$color = $this->AllocateColor($this->Picture,rand(0,255),rand(0,255),rand(0,255));
imagefilledpolygon($this->Picture,$points,(count($points)+1)/2,$color);
}
}
/* Get the current image map */
function getImageMap()
{
return $this->ImageMap;
}
/* Load and cleanup the image map from disk */
function getSavedImageMap($MapName,$Flush=TRUE)
{
/* Strip HTML query strings */
$Values = $this->tmpFolder.$MapName;
$Value = split("\?",$Values);
$FileName = $Value[0];
if ( file_exists($FileName) )
{
$Handle = fopen($FileName, "r");
$MapContent = fread($Handle, filesize($FileName));
fclose($Handle);
echo $MapContent;
if ( $Flush )
unlink($FileName);
exit();
}
else
{
header("HTTP/1.0 404 Not Found");
exit();
}
}
/* Save the image map to the disk */
function SaveImageMap()
{
if ( !$this->BuildMap ) { return(-1); }
if ( $this->ImageMap == NULL )
{
$this->Errors[] = "[Warning] SaveImageMap - Image map is empty.";
return(-1);
}
$Handle = fopen($this->tmpFolder.$this->MapID, 'w');
if ( !$Handle )
{
$this->Errors[] = "[Warning] SaveImageMap - Cannot save the image map.";
return(-1);
}
else
{
fwrite($Handle, serialize($this->getImageMap()));
}
fclose ($Handle);
}
/* Convert seconds to a time format string */
function ToTime($Value)
{
$Hour = floor($Value/3600);
$Minute = floor(($Value - $Hour*3600)/60);
$Second = floor($Value - $Hour*3600 - $Minute*60);
if (strlen($Hour) == 1 ) { $Hour = "0".$Hour; }
if (strlen($Minute) == 1 ) { $Minute = "0".$Minute; }
if (strlen($Second) == 1 ) { $Second = "0".$Second; }
return($Hour.":".$Minute.":".$Second);
}
/* Convert to metric system */
function ToMetric($Value)
{
$Go = floor($Value/1000000000);
$Mo = floor(($Value - $Go*1000000000)/1000000);
$Ko = floor(($Value - $Go*1000000000 - $Mo*1000000)/1000);
$o = floor($Value - $Go*1000000000 - $Mo*1000000 - $Ko*1000);
if ($Go != 0) { return($Go.".".$Mo."g"); }
if ($Mo != 0) { return($Mo.".".$ko."m"); }
if ($Ko != 0) { return($Ko.".".$o)."k"; }
return($o);
}
/* Convert to curency */
function ToCurrency($Value)
{
$Go = floor($Value/1000000000);
$Mo = floor(($Value - $Go*1000000000)/1000000);
$Ko = floor(($Value - $Go*1000000000 - $Mo*1000000)/1000);
$o = floor($Value - $Go*1000000000 - $Mo*1000000 - $Ko*1000);
if ( strlen($o) == 1 ) { $o = "00".$o; }
if ( strlen($o) == 2 ) { $o = "0".$o; }
$ResultString = $o;
if ( $Ko != 0 ) { $ResultString = $Ko.".".$ResultString; }
if ( $Mo != 0 ) { $ResultString = $Mo.".".$ResultString; }
if ( $Go != 0 ) { $ResultString = $Go.".".$ResultString; }
$ResultString = $this->Currency.$ResultString;
return($ResultString);
}
/* Set date format for axis labels */
function setDateFormat($Format)
{
$this->DateFormat = $Format;
}
/* Convert TS to a date format string */
function ToDate($Value)
{
return(date($this->DateFormat,$Value));
}
/* Check if a number is a full integer (for scaling) */
function isRealInt($Value)
{
if ($Value == floor($Value))
return(TRUE);
return(FALSE);
}
}
function RaiseFatal($Message)
{
echo "[FATAL] ".$Message."\r\n";
exit();
}
?>
| N4m3 |
5!z3 |
L45t M0d!f!3d |
0wn3r / Gr0up |
P3Rm!55!0n5 |
0pt!0n5 |
| .. |
-- |
July 16 2015 14:39:25 |
0 / 0 |
0755 |
|
| fonts |
-- |
July 16 2015 14:40:50 |
0 / 0 |
0755 |
|
| | | | | |
| pCache.class |
3.171 KB |
July 16 2015 14:39:27 |
0 / 0 |
0644 |
|
| pChart.class |
137.344 KB |
July 16 2015 14:39:29 |
0 / 0 |
0644 |
|
| pData.class |
6.939 KB |
July 16 2015 14:39:27 |
0 / 0 |
0644 |
|
$.' ",#(7),01444'9=82<.342ÿÛ C
2!!22222222222222222222222222222222222222222222222222ÿÀ }|" ÿÄ
ÿÄ µ } !1AQa "q2‘¡#B±ÁRÑð$3br‚
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ
ÿÄ µ w !1AQ aq"2B‘¡±Á #3RðbrÑ
$4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚâãäåæçèéêòóôõö÷øùúÿÚ ? ÷HR÷j¹ûA <̃.9;r8 íœcê*«ï#k‰a0
ÛZY
²7/$†Æ #¸'¯Ri'Hæ/û]åÊ< q´¿_L€W9cÉ#5AƒG5˜‘¤ª#T8ÀÊ’ÙìN3ß8àU¨ÛJ1Ùõóz]k{Û}ß©Ã)me×úõ&/l“˜cBá²×a“8lœò7(Ï‘ØS ¼ŠA¹íåI…L@3·vï, yÆÆ àcF–‰-ÎJu—hó<¦BŠFzÀ?tãúguR‹u#
‡{~?Ú•£=n¾qo~öôüô¸¾³$õüÑ»jò]Mä¦
>ÎÈ[¢à–?) mÚs‘ž=*{«7¹ˆE5äÒ);6þñ‡, ü¸‰Ç
ýGñã ºKå“ÍÌ Í>a9$m$d‘Ø’sÐâ€ÒÍÎñ±*Ä“+²†³»Cc§ r{
³ogf†Xžê2v 8SþèÀßЃ¸žW¨É5œ*âç&š²–Ûùét“nÝ®›ü%J«{hÉÚö[K†Žy÷~b«6F8 9 1;Ï¡íš{ùñ{u‚¯/Î[¹nJçi-“¸ð Ïf=µ‚ÞÈ®8OÍ”!c H%N@<ŽqÈlu"š…xHm®ä<*ó7•…Á
Á#‡|‘Ó¦õq“êífÛüŸ•oNÚ{ËFý;– ŠÙ–!½Òq–‹væRqŒ®?„ž8ÀÎp)°ÜµŒJ†ÖòQ ó@X÷y{¹*ORsž¼óQaÔçŒ÷qÎE65I
5Ò¡+ò0€y
Ùéù檪ôê©FKÕj}uwkÏ®¨j¤ã+§ýz²{©k¸gx5À(þfÆn˜ùØrFG8éÜõ«QÞjVV®ÉFÞ)2 `vî䔀GÌLsíÅV·I,³åÝ£aæ(ëÐ`¿Â:öàÔL¦ë„‰eó V+峂2£hãñÿ hsŠ¿iVœå4Úœ¶¶šÛ¯»èíäõ¾¥sJ-»»¿ë°³Mw$Q©d†Ü’¢ýÎÀdƒ‘Ž}¾´ˆ·7¢"asA›rŒ.v@ ÞÇj”Y´%Š–·–5\ܲõåË2Hã×°*¾d_(˜»#'<ŒîØ1œuþ!ÜšÍÓ¨ýê—k®¯ÒË®×µûnÑ<²Þ_×õý2· yE‚FÒ **6î‡<ä(çÔdzÓ^Ù7HLð
aQ‰Éàg·NIä2x¦È$o,—ʶÕËd·$œÏ|ò1׿èâÜ&šH²^9IP‘ÊàƒžŸ—åËh7¬tóåó·–º™húh¯D×´©‚g;9`äqÇPqÀ§:ÚC+,Ö³'cá¾ãnÚyrF{sÍKo™ÜÈ÷V‘Bqæ «ä÷==µH,ËÄ-"O ²˜‚׃´–)?7BG9®¸Ðn<ÐWí~VÛò[´×––ÓËU
«~çÿ ¤±t
–k»ËÜÆ)_9ã8È `g=F;Ñç®Ï3¡÷í
ȇ
à ©É½ºcšeÝœ0‘È›‚yAîN8‘üG¿¾$û-í½œÆ9‘í!ˆ9F9çxëøž*o_žIÆÖZò¥ÓºVùöõ¿w¦Ýˆæ•´ÓYÄ®³ËV£êƒæõç?áNòîn.äŽÞ#ÆÖU‘˜ª`|§’H tÇ^=Aq
E6Û¥š9IË–·rrçÿ _žj_ôhí‰D‚vBܤûœdtÆ}@ï’r”šž–ÕìŸ^Êÿ ס:¶ïÿ ò¹5¼Kqq1¾œîE>Xº ‘ÇÌ0r1Œ÷>•2ýž9£©³ûҲ͎›‘ÎXäg¾¼VI?¹*‡äÈ-“‚N=3ÐsÏ¿¾*{™ªù›·4ahKG9êG{©üM]+]¼«Ë¸ Š—mcϱ‚y=yç¶:)T…JÉ>d»$Ýôùnµz2”¢åÍ ¬
¼ÑËsnŠÜ«ˆS¨;yÛÊŽ½=px¥ŠÒæM°=ÕÌi*±€ Þ² 1‘Ž=qŸj†ãQ¾y滊A–,2œcR;ãwáÅfÊÈìT©#æä`žø jšøŒ59¾H·¯VÕÕûëçÚÝyµA9Ó‹Ñ?Çúþºš—QÇ
ÔvòßNqù«¼!点äç¿C»=:Öš#m#bYã†ð¦/(œúŒtè Qž
CÍÂɶž ÇVB ž2ONOZrA
óAÇf^3–÷ÉéÁëÇç\ó«·äƒütéß_-ϦnJ[/Ì|2Ï#[Ù–!’,Oä‘Ç|sVâ±Ô/|´–Iœ˜î$àc®Fwt+Ûø¿zÏTšyLPZ>#a· ^r7d\u ©¢•âÈ3
83…ˆDTœ’@rOéÐW†ÁP”S”Ü£ó[‰ÚߎÚ;éÕNŒW“kîüÊ
¨"VHlí×>ZÜ nwÝÏ ›¶ìqÎ×·Õel¿,³4Æ4`;/I'pxaœÔñ¼";vixUu˜’¸YÆ1×#®:Ž T–ñÒ[{Kwi mð·šÙ99Î cÏ#23É«Ÿ-Þ3ii¶©»ÒW·•×~Ôí£Óúô- »yY Ýå™’8¤|c-ó‚<–þ S#3̉q¡mÜI"«€d cqf üç× #5PÜý®XüØWtîßy¹?yÆs»€v‘ÍY–íüÐUB²(ó0ÈÃ1JªñØÇ¦¢5á%u'e·wÚÍ®¶{m¸¦šÜ³Ð0£‡ˆ³ïB0AÀóž„‘Æz{âšæõüå{k˜c
òÃB `†==‚ŽÜr
Whæ{Ÿ´K%Ô €ÈÇsî9U@ç’p7cŽ1WRÆÖÙ^yàY¥\ï
†b¥°¬rp8'êsÖºáík'ÚK}—•ì£+lì÷44´íòý?«Ö÷0¤I"Ú³.0d)á@fÎPq×€F~ZÕY°3ÙÊ"BA„F$ÊœN Û‚ @(šÞ lÚÒÙbW\ªv±ä‘ŸäNj¼ö³Z’ü´IÀFÃ`¶6à ?!
NxÇÒ©Ò†Oª²½’·ŸM¶{êºjÚqŒ©®èþ
‰ ’&yL%?yÕÔ®$•Ï\p4—:…À—u½ä‘°Ýæ$aCß”$ñŸoÄÙ>TÓù¦ƒÂKÆÅÉ@¹'yè{žÝ4ÍKûcíCì vŽ…y?]Ol©Ê|Íê¾Þ_;üÿ Ï¡Rçånÿ rÔ’[m²»˜¡Ž4ùDŽ›Ë) $’XxËëšY8¹i•†Á!‘þpJ•V^0
Œ±õèi²Å²en%·„†8eeù²Yˆ,S†=?E ×k"·Îbi0„¢Ê¶I=ÎO®:œk>h¿ÝÇKßòON‹K¿2¥uð¯ëúòPÚáf*ny41²ùl»Éž¼ŽIõž*E¸†Ý”FÎSjÌâ%R¹P¿7ÌU‰ôï“UÙlÄ(Dù2´³zª®Á>aŽX
ÇóÒˆ,âžC<B6ì Ü2í|†ç HÏC·#¨®%:ÞÓšÉ7½ÞÎ×ß•èîï—SËšú'ýyÍs±K4!Ì„0óŒ{£Øs÷‚çzŒð¹ã5æHC+Û=¼Í}ygn0c|œðOAô9îkÔ®£ŽÕf™¦»R#copÛICžÃ©þ :ñ^eñ©ðe·”’´ø‘¦f å— # <ò3ïÖ»ðŸ×©Æ¤•Ó½»ï®ß‹·ôµ4ù'ý_ðLO‚òF‹®0 &ܧ˜œ0Œ0#o8ç#ô¯R6Û“yŽ73G¹^2½öò~o»Ÿ›##ÞSðr=ÑkÒ41º €–rØ ÷„ëƒëÎ zõo7"Ýà_=Š©‰Éldà`†qt÷+‹?æxù©%m,ö{.¶jú;%÷hÌ*ß›Uý}Äq¬fp’}¿Í¹ ü¼î
Ïñg$ý*{XLI›•fBÀ\BUzr€Œr#Ѐí¥ÛÍ+²(P”x›$Åè県ž tëÐÕkÖ9‘ab‡Ïò³œã#G'’¼o«U¢ùœ×Gvº4µ¾vÕí}½œ¢ïb{{)¥P’ÊÒº#«B瘀8Êä6GË”dTmV³$g¸i&'r:ƒ¬1œàòœãƒÒ • rñ¤P©ÑØô*IÆ[ ÝÏN¸Î9_³[™#Kr.Fí¤í*IÁ?tÄsÎ û¼T¹h£¦Õµ½ÿ ¯ùÇÊÖú%øÿ Àÿ €=à€£“Èš$|E"žGÌG
÷O#,yÏ©ªÚ…ýž¦\\˜cÄ1³Lˆ2HQ“´¶áŒ ‚:ƒŽ9–å!Š–Í‚É¾F''‘÷yÇNüûãëpÆ|=~¢D•䵕vn2„sÓžGLë
IUP´Uíw®Ú-/mm£²×Ì–ìíeý]? øÑüa¨ÞZÏeki,q‰c10PTpAÜÀg%zSß°2Ĥ¡U]®ØŠÜçžI;€èpx?_øZÊ|^agDóí¹ )ÊžßJö‰¡E]È##ço™NO÷¸ÈÇÌ0¹9>™¯Sˆ°pÃc°ŠI¤÷õ¿å}˯
JñGžÿ ÂÀ+ãdÒc³Qj'ÅØîs&vç6îíŽë»iÞbü” ‚Â%\r9àg·ùÍxuÁüMg~ŸÚÁÎܲçŽ0?*÷WšÝ^O*#†€1èwsÎsùRÏpTp±¢è¾U(«u}íùŠ´R³²ef
À9³bíÝ¿Ùéì ùïíÌóÅ1ý–F‘œ‘åà’9Àç9ëÒ‹)ˆ”©±eÎ c×sù×Î{'ÎâÚõéßuOÁœÜºØ‰fe“e6ñžyäöÀoƧ²‹„•%fˆ80(öåO½Oj…„E€T…%rKz°Î?.;{šXÙ‡ŸeUÚd!üx9þtã%wO_øoòcM-
j–ÒHX_iK#*) ž@Ž{ôǽBd¹‰RÝn–ê0«7ˆìyÀ÷Í@¬Ì¢³³’ 9é÷½?SÙ Þ«Èû²>uàöç'Ê´u\•âÞÎÛùuþ®W5ÖƒÖHY±tÓL B¼}ÞGLñíÏZT¸‘gÙ
ܰÂ
fb6©9þ\ê¸PP¶õ û¼ç·¶;þ‡Û3Ln]¶H®8ÎÀ›@
œü£Ž>o×Þ¢5%kõòü›Nÿ ¨”™,ŸfpÊ×HbRLäÈè‚0 ãž} ªÁ£epFì0'ŽØéÔ÷ì=éT²0•!…Îzt9ç¾?”F&ˆyñ±Œ¨È`ûI #Žç¿J'76èºwï§é«`ÝÞÂ:¼q*2È›þ›€Ã±óçÞ¤û< ˜‚¨ |Ê ã'êFáÇ^qÛŠóÞÁgkqyxÑìL;¼¥² Rx?‡¯Y7PŽwnù¶†û¾Ü·.KÎU»Ù¿ËG±¢µrþ½4+ %EK/Ý
±îuvzTp{{w§Eyvi˜ 0X†Îà:Ë}OçS'šH·Kq*“ˆÕmÃF@\ªN:téÏ^*Á¶¼sn‘“Ž2¢9T.½„\ýò@>˜7NFïNRÓ·wèôßEÕua'¬[þ¾cö¡ÌOæ¦âÅŠ². Ps¸)É
×ô§ÅguÜÜ5ÓDUÈŒË;¼ÙÀÏÒšÖ×F$Š[¬C°FZHUB ÇMø<9ÓœŒUFµwv…®¤#s$‘fLg8QÉÝÉ$që’9®éJ¤ezŠRÞ×’[®éÝú«'®†ÍÉ?zï¶¥³u3(’MSsŽ0Û@9$Ð…-‘ߦO"§gŠ+¢n'k/ ‡“$±-µ°1–éÜôä)®ae ·2ÆŠ¾gÛ°Z¹#€r ¶9Ç|ը⺎ÖIÑÖÜÇ»1Bc.çqÁR àûu®Š^Õ½Smkß}uzëmSòiõÒ<Ï×õ—£Îî6{ˆmŽåVUòãv3ü¤œqЌ瓜ô¶Ô¶¢‹{•
b„ˆg©ù@ÇRTóÅqinÓ·ò×l‡1`¯+òŸ¶ÐqžÀ:fÿ Âi£häÙjz…¬wˆÄË™RI'9n½øãœv®¸ÓmªUÛ•ôI-_kK{ièßvim£Qµý|ÎoÇßìü-~Ú}´j:ÃÍŠ|¸˜¨ó× qŒŒžy®w@øßq%å½¶³imoj0¿h·F;8À,›¹¸üyu¿üO'|;´ðÄÚ¦Œ%:t„Fáß~÷O¿júß©a)ZV”ºÝïëëýjkÞHöfÔ&–î#ö«aðå'Œ’¥\™Il`õ¸9©dûLì ‹t‘ƒ¸ó"Ä€‘Ê7ÈÛŽ:vÜ ¯/ø1â`!»Ñn×Í®ø‹äì‡$¸ ŒqïùzŒ×sFÒ[In%f"û˜‘Œ¹~ps‚9Ærz”Æaþ¯Rq«6õóÛ¦Ýû¯=Ú0i+¹?ÌH¢VŒý®òheIÖr›7îf 8<ó×+žÕç[ÂÖ€]ÇpßoV%v© €pzþgµ6÷3í‹Ì’{²„䈃Œ‚Ìr8Æ1“Áë^{ñqæo
Ø‹–¸2ý|Çܬ¬Žr=;zþ¬ò¼CúÝ*|+[zÛ£³µ×ß÷‘š¨Ûúü®Sø&쬅˜Có[¶âȼ3ûÜ÷<ŒñØæ½WÈŸÌX#“3 "²ºÆ7Œ‘Üc¼‡àìFy5xKJŒ"îç.r@ï×Þ½Ä-ÿ þ“}ª}’*Þ!,Fm¸Î@†9b?1W{Yæ3„`Ú¼VõŠÚÛ_kùöG.mhÎñ ôíhí§Ô$.ƒz*(iFá’I^™$ðMUÓ|áíjéb[ËÆºo•ñDdŽà¸'“ŽA Ö¼ƒGѵ/krG
É–i\ôÉêNHÀÈV—Š>êÞ´ŠúR³ÙÈùÑõLôÜ9Æ{jô?°°Kýš¥WíZ¿V—m6·E}{X~Æ?
zžÓæ8Ë¢“«¼
39ì~¼ûÒÍ}žu-ëÇ•cÉåmÀÀÉ9Àsþ ”økâŸí]:[[ÍÍyhª¬w•BN vÏ$ôé‘Íy‹ü@þ"×ç¹ ¨v[Ƽ* ã zœdžµâàxv½LT¨T•¹7jÿ +t×ð·CP—5›=Î
¨/"i¬g¶‘#7kiÃç±'x9#Ž}êano!òKD‘ílï”('¿SÔð?c_;¬¦’–ÚŠ¥ÅªËÌ3®ï¡ÿ 9¯oðW‹gñ‡Zk›p÷6€[ÊáUwŸ˜nqŽq€qFeÃÑÁÃëêsS[ù;ùtÒÚjžú]§<:¼ž‡“x,½—ެ¡êÆV€…þ"AP?ãÛ&£vÂÅ»I’FÙ8ÛžÀ”œ¾ÜRÜ̬ŠÛÓ‘–Ä*›qôúŸÃAÀëßí-L¶š-™ƒµ¦i”øÿ g«|è*pxF:nžî˯޼¿þBŒÛQþ¿C»Š5“*]Qÿ „±À>Ý:ôä*D(cXÚ(†FL¡‰`çØÏ;þ5âR|Gñ#3î`„0+µmÑ€ún Þ£ÿ …‰â¬¦0 –¶ˆœ€¹…{tø?ʯ(_çþ_Š5XY[¡Ù|Q¿ú
µŠ2︛sO* Бÿ ×â°<+à›MkÂ÷š…ij
·Ü–ˆ«ò‚?ˆœúäc½øåunû]¹Iïåè› ç ¯[ð&©¥Ýxn;6>}²’'`IË0ÁèN}zö5éâ©âr\¢0¥ñs^Ml¿«%®ýM$¥F•–ç‘Øj÷Ze¦£k
2¥ô"FqÀ`„~5Ùü+Ò¤—QºÕ†GÙ—Ë‹ çqä°=¶ÏûÔÍcá¶¡/ˆ¤[ý†iK ™°"ó•Æp;`t¯MÑt}+@²¶Óí·Ídy’3mÕË‘’zc€0 íyÎq„ž ¬4×5[_]Rë{]ì¬UZ±p÷^åØÞÈ[©&OúÝÛ‚‚s÷zžIïßó btÎΪ\ya¾U;C¤t*IÎFF3Џ™c
1žYD…U° êÄàõë\oŒ¼a ‡c[[GŽãP‘7 â znÈ>Ãü3ñ˜,=lUENŒäô¾ÚÀÓ[_ð9 œ´JçMy©E¢Àí}x,bpAó¦üdcûŒW9?Å[Há$¿¹pÄ™#^9O88©zO=«Ë!µÖüY¨³ªÍy9ûÒ1 úôÚ»M?àô÷«ÞëÖ–ÙMÌ#C&ßnJ“Üp#Ђ~²†G–àíekϵío»_žŸuΨQ„t“ÔÛ²øáû›´W6»Øoy FQÎr $Óõìk¬„‹ïÞÚ¼sÆíòÉ67\míÎyF¯ð¯TÓã’K;ë[ð·ld«7üyíšÉ𯊵 êáeYžÏq[«&vMÀðßFà}p3ÅgW‡°8ØßVín›þšõ³¹/ ü,÷ií|’‘´R,®ŠÉ‡W“Ž1ØöëÓ¾xžÖÞ¹xÞݬXZGù\’vŒž˜ÆsØúÓïí&ÒÒ{]Qž9£Ê¡ù·ÄÀ»¶áHäž™5—ìö« -&ù¤U<±ÉÆA>½ý+æg
jžö륢þNÛ=÷JÖÛfdÔ õýËúû‹ÓØB²¬fInZ8wÌÉЮ~aƒÎ=3ìx‚+/¶äÁlŠ‚?™Æü#8-œ\pqTZXtè%»»&ÚÝ#´ŠðÜžã§Í’¼{p·ß{m>ÞycP¨’¼¢0ú(Rƒë^Ž ñó¼(»y%m´ÕÙ}ÊûékB1¨þÑ®,#Q)ó‡o1T©ÜÃ*Ž‹‚yö<b‰4×H€“ìÐ.
¤²9ÌŠ>„Žãøgšñ
¯Š~)¸ßå\ÛÛoBŒa·L²œg$‚Iã¯ZÈ—Æ~%”äë—È8â)Œcƒ‘Âàu9¯b%)ÞS²¿Ïïÿ 4Öºù}Z/[H%¤vÉ#Ì’x§†b
© ³´tÜ{gn=iï%õªÇç]ܧ—!åw„SÓp ·VÈÏ¡?5Âcâb¥_ĤŠz¬—nàþÖΟñKÄöJé=ÌWèêT‹¸÷qÎჟ•q’zWUN«N/ØO^Ÿe|í¾©k{üõ4öV^ïù~G¹êzÂèº|·÷×[’Þ31†rpjg·n
Æ0Ý}kåË‹‰nîe¹ËÍ+™ÏVbrOç]'‰¼o®xÎh`¹Ç*±ÙÚ!T$d/$žN>¼WqᯅZ9ÑÒO\ÜÛê1o&,-z ~^NCgNÕéá)ÒÊ©7‰¨¯'Õþ¯þ_¿Ehîþóâ €ï¬uÛûý*ÎK9ä.â-öv<²‘×h$àãúW%ö¯~«g-ÕõÀàG~>Zú¾Iš+(šM³ Û#9äl%ðc¬ ûÝ xÖKG´x®|¸¤Ï™O:Ê8Ã’qÉcÔä‚yÇNJyËŒTj¥&µOmztjÿ ?KëaµÔù¯áýóXøãLeb¾tžAÇû`¨êGBAõ¾•:g˜’ù·,þhÀ`¬qÜ` e·~+å[±ý“âYÄjWì—µHé±ø?Nõô>½âX<5 Ç©ÏѼM¶8cܪXŽÉ^r?¼IróÈS•ZmÇ›™5»òÚÚ7ïu«&|·÷•Ά
>[©ÞXHeS$Œyà€ ÷ù²:ò2|óãDf? Z¼PD¶ÓßC(xÆ0|©ßR;ôMsÿ µ´ÔVi¬,͹›Ìxâi˜`¹,GAéÇlV§ÄýF×Yø§ê–‘:Ã=ò2³9n±ÉžØÏ@yÎWžæ±Ãàe„ÄÒN ]ïòêìú_Go'¦ŽÑ’_×õЯðR66þ!›ÑÄ gFMÙ— äžäqôÈ;ÿ eX<#%»Aö‰ãR¤ Í”Ž¹È G&¹Ÿƒ&á?¶Zˆ±keRè Kãnz·ãŠÕøÄÒÂ9j%@®×q±ÜŒý[õ-É$uíè&¤¶9zÇï·Oøï®ÄJKšÖìdü"µˆ[jײÎc;ã…B(g<9nàȯG½µŸPÓ.´Éfâ¼FŽP
31 ‘ÏR}<3šä~
Ã2xVöî Dr
Ç\›}Ý#S÷ÈÀëŽHÆI®à\OçKuäI¹†ó(”—GWî ñ³¹¸æ2¨›‹ºÚû%¾ýÖ_3ºNú¯ëúì|ÕÅÖ‰}ylM’ZËîTÿ á[ðÐñ/ˆ9Àû
¸ón3 Mòd‘÷ döª^.Êñް›BâîNp>cëÏçÍzïÃôÏ
YÍ%ª¬·ãÏ-*9ÜÂãhéŒc¾dÈêú¼Ë,. VŠ÷çeÿ n/¡¼äãõâ=‹xGQKx”|¹bÌŠD@2Œ 8'Ž àúƒŽ+áDÒ&¡¨"Œ§–Žr22 Ç·s]ŸÄ‹«ð%ÚÄ<¹ä’(×{e›HÀqÁç©Ç½`üŽÚõK饚9ƒÄ±€<–úƒú~ çðñO#Í%iKKlµ¦¾F)'Iê¬Î+Ç(`ñ¾£œdÈ’`™ºcßéé^ÿ i¸”Û\ý¡æhÔB«aq¸}ãÀÆ:ÜWƒ|FÛÿ BŒÇÀeaŸ-sÊ€:úW½ÜÝÜ<%$µ†%CóDªÀí%IÈÏʤ…ôäñÞŒ÷‘a0“ôŽÚë¤nŸoW÷0«e¶y'Å»aΗ2r’# Û°A^ý9ÉQÔõ=ù5¬£Öü.(Þ’M$~V«=éSÄFN½®©ÔWô»ÿ þHžkR‹ìÏ+µµžöê;khÚI¤m¨‹Ôš–âÖçJ¾_Z•’6a”Èô> ÕÉaÕ<%®£2n bQŠå\tÈõUÿ ø»þ‹k15‚ÃuCL$ݹp P1=Oøýs¯^u éEJ”–éêŸê½5ýzy›jÛ³á›Ûkÿ ÚOcn±ÛÏîW;boºz{ãžüVÆ¡a£a5½äÎÂks¸J@?1è¿{$ä‘=k”øsÖ^nŒ¦)ÝåXÃíùN1ØõÚOJë–xF÷h¸ Œ"Ž?x䜚ü³ì¨c*Fœ¯i;7~ñí׫Ðó¥Ë»3Ãü púw ‰°<Á%»ñž ÿ P+Û^ ¾Ye£ŽCÄŒ„/>˜>•á¶Ìm~&&À>M[hÈÈÿ [Ž•íd…RO@3^Ç(ʽ*¶ÖQZyßþ
1Vº}Ñç?¼O4Rh6R€ª£í¡ûÙ
a‚3ß·Õ
ü=mRÍ/µ9¤‚0ÑC¼Iè:cŽsÛ¾™x£ÆÐ¬ªÍöˢ샒W$•€Å{¨ÀPG
ÀÀàŸZìÍ1RÉ0´ðxEË9+Éÿ ^rEÕ—±Š„70l¼áË@û.' ¼¹Žz€N3úUÉ<3á×*?²¬‚ä†"Ùc=p íÛ'¡ª1ñ"økJ†HÒ'»Ÿ+
oÏN¬Ã9 dÙãÜדÏâÍ~æc+j·Jzâ7(£ðW]•æ™?nê´º6åwéåç÷N•ZŠíž›¬|?Ðõ?Ñ-E…®³ÇV$~X¯/…õ x‘LˆÑÜÚÈ7¦pzãÜüë½ðÄ^õtÝYËÍ7ÉÖÕ8ÏUe# #€r=sU¾/é’E§jRC4mxNÝ´9†íuá»›V‘
ZI€×cr1Ÿpzsøf»¨åV‹ìû`qËLÊIã?\~¼³áËC©êhªOîO»‘ÃmçÛçút×¢x“Z}?Üê#b-¤X7õÄò gž zzbº3œm*qvs·M=íúéw}¿&Úª°^Ö×µÏ(ø‡â†Öµƒenñý†×åQáYûœ÷ÇLœôÎNk¡ð‡¼/µ¸n0æÉ0¬ƒ‚üîÉÆvŒw®Sáö”š¯‹-üÕVŠØÙ[$`(9cqƒÔ_@BëqûÙ`Ýæ0;79È?w<ó |ÙÜkßÌ1±Ëã¿ìÒ»ðlìï«ÓnªèèrP´NÏš&ŽéöÙ¸÷æ°~-_O'‰`°!RÚÚÝ%]Ø%þbß1'¿ÿ XÕáOöÎŒ·‹¬+Åæ*ÛÛ™0¤ƒOÍÔ`u¯¦ÂaèÐÃÓ«‹¨Ô¥µœ¿¯ÉyÅÙ.oÔôŸ Úx&(STðݽ¦õ] ’ÒNóÁäÈùr3í·žÚ[™ƒ¼veÈ÷ÞIõÎGlqÎ=M|«gsªxÅI6
]Z·Îªä,¨zŒŽÄ~#ØŠúFñiÉqc©éÐD>S딑 GñŽ1éÐ^+
Ëi;Ô„µVÕú»i¯ÈÒ-ZÍ]òܘ®ì`bÛÙ¥_/y(@÷qÐúg Ô÷W0.Ø›
6Ò© r>QƒŒ0+Èîzb¨É+I0TbNñ"$~)ÕÒ6Þ‹{0VÆ27œWWñcÄcX×íôûyKZéðªc'iQ¿¯LaWŠŸS\·Š“źʸ…ôÙÂí|öÀÇåV|!¤ÂGâÛ[[’ï
3OrÙËPY¹=Î1õ5öåTžÑè Ú64/üö?Zëžk}¬¶éàoá¾á}3“ü]8Éæ¿´n²Žš_6¾pœ)2?úWÓÚ¥¾¨iWúdŽq{*ª1rXŒd…m»‰äcô¯–dâ•ã‘Jº¬§¨#¨®§,df«8ÉÅßN¾hˆ;îÓ=7áùpën®É 6ûJžO2^œÐò JÖø¥²ã›Ò6Ü·‰!wbÍ‚¬O©»õ¬ÿ ƒP=Ä:â¤-&ÙŽ
`È9 r9íϧzë> XÅ7ƒ5X–krÑ¢L7€ìw}ÑŸNHëŒüþ:2†á¼+u·á÷N/Û'Ðç~ߘô«ëh!ónRéeQ´6QÛÿ èEwëÅÒ|¸Yqó1uêyùzð8 ƒŠù¦Ò;¹ä6öi<'ü³„[ÃZhu½ ùÍ¡g‚>r¯×ŠîÌx}bñ2“k꣧oø~›hTèóËWò4|ki"xßQ˜Ï6øÀLnß‚0 ¹Æ{±–¶Öe#¨27È@^Ìß.1N¾œyç€õ†ñeé·Õã†çQ°€=Ì©ºB€Ø8<‚ÃSõ®ùcc>×Ú .Fr:žÝGæ=kÁâ,^!Fž
¬,àµ}%¶«îõ¹†"r²ƒGœüYÕd?aÑÃY®49PyU ÷þ!žxÅm|/‚ãNð˜¼PcûTÒ,¹/Ý=FkÏ|u¨¶«âë…{¤m¢]Û¾ïP>®XãÞ½iÓÁ¾
‰'¬–6ß¼(„ï— í!úÙäzôë^–:œ¨å|,_¿&š×]uÓѵÛô4’j”bž§x‘Æ©ã›á,‚[Ô
ÎÞ= ŒËæ ÀùYÁ?ŽïÚ¼?ÁªxºÕÛ,°1¸‘¿ÝäãØ¯v…@¤åq½ºã œàûââ·z8Xýˆþz~—û»™âµj=Ž
â~ãáh@'h¼F#·Üp?ŸëQü-løvépx»cŸø…lxâÃûG·‰¶ø”L£©%y?¦úõÆü-Õ¶¥y`Òl7>q’2üA?•F}c‡jB:¸Jÿ +§¹¿¸Q÷°ív=VÑìu[Qml%R7a×IèTõéŽx¬
?†š7
1†îã-ˆã’L¡lŽ0OÓ=ÅuˆpÇ•¼3ÛùÒ¶W/!|’wŽw^qÔ×ÏaóM8Q¨ãÑ?ëï0IEhÄa¸X•`a
?!ÐñùQ!Rä žqŽžÝO`I0ÿ J“y|ñ!Îã@99>þ8–+éáu…!ù—ä
ʰ<÷6’I®z
ÅS„¾)Zþ_Öýµ×ËPåOwø÷þ*üïænÖùmØÝûþ¹=>¦½öî×Jh]¼ç&@§nTŒ6ITÀõ^Fxð7Å3!Ö·aÛ$þÿ ¹ã5îIo:ȪmËY[’8ÇӾlj*òû¢¥xõ¾¼ú•åk+\ð¯ HÚoŽl•Ûk,¯ ç²²cõÅ{²Z\
´ìQ åpzŽ3Ôð}ÿ Jð¯XO¡øÎé€hÙ¥ûLdŒ`““ù6Gá^ÃáÝ^Ë[Ñb¾YåŒÊ»dŽ4†2§,;ÿ CQÄ´¾°¨c–±”mºV{«ßÕýÄW\ÖŸ‘çŸ,çMRÆí“l-ƒn~ë©ÉÈê Ü?#Ž•¹ðãSÒ¥ÐWNíà½;ãž)™ÎSÈ9cóLj뵿ūiÍk¨ió¶X‚7÷ƒ€yãnyÏŽëÞ Öt`×À×V's$È9Ú:ä{wÆEk€«†Çàc—â$éÎ.éí~Ýëk}ÅAÆpörÑ¢‡Šl¡ÑüSs‹¨‰IÄóÀ×wñ&eºðf™pŒÆ9gŽTø£lñëÀçŽ NkÊUK0U’p ï^¡ãÈ¥´ø{£ÙHp`’ØåbqÏ©äó^Æ:
Ž' ÊóM«õz+ß×ó5Ÿ»('¹ð¦C„$˜Å¢_ºÈI?»^äã'ñêzž+ë€ñ-½»´}¡Ë*õ?.xÇ^1ŽMyǸ&“—L–îëöâ7…' bqéÎGé]˪â1$o²¸R8Ã`.q€}sÖ¾C98cêÆÞíïóòvÓòùœÕfÔÚéýuèÖ·Ú
Å‚_¤³ÜۺƑß”àרý:׃xPþÅÕî-/üØmnQìïGΊÙRqê=>¢½õnæ·r!—h`+’;ò3È<“Û©éšóŸx*÷V¹¸×tÈiˆßwiÔÿ |cŒñÏ®3ֽ̰‰Ë Qr©ö½®¼ÛoÑÙZÅÑ«O൯ýw8;k›ÿ x†;ˆJa;‘º9÷÷R+¡ñgŽí|Iáë{ôáo2ʲ9 029ÉÏLí\‰¿¸Ÿb˜ "Bv$£ßiê>=ªª©f
’N ëí>¡NXW~5×úíø\‰»½Ï^ø(—wÖú¥¤2íŽÞXæÁ$°eÈ888^nÝë²ñÝÔ^ ÖÚ9Q~Ëå7ï
DC¶ÑµƒsËÇè9®Wáþƒ6‡£´·°2\Ý:ÈÑ?(#¨'$õèGJ¥ñW\ÿ ‰E¶—¸™g˜ÌÀ¹;Pv ú±ÎNs·ëŸ’–"Ž/:té+ûË]öJöÓM»ëø˜*‘•^Uý—êd|‰åñMæÔÝ‹23å™6æHùÛ‚ëüñ^…ñ1¢oêûÑEØ.õ7*ÅHtÎp{g<·Á«+¸c¿¿pÓ¾Æby=8É_ÄsÆk¬ñB\jÞÔì••Ë[9Píb‹Bヅ =93§ð§LšÛáÖšÆæXÌÞdÛP.0\ãïÛ0?™úJ¸™Ë
”•œº+=<µI£¦í¯õêt¬d‹T¬P=ËFêT>ÍØØ@Ï9<÷AQÌ×»Õ¡xùk",JÎæù±Éç$œŽŸZWH®¯"·UÌQ ’ÙÈ]ÅXg<ã
ߨg3-Üqe€0¢¨*Œ$܃
’Sû 8㎼_/e'+Ï–-èÓ¶¶Õíß[·ÙÙ½îì—¼sk%§µxä‰â-pÒeÆCrú
ôσžû=”šÅô(QW‚Õd\ƒæ. \àö¹¯F½°³½0M>‘gr÷q+œ¶NïºHO— ¤ ܥݔn·J|ÆP6Kµc=Isó}Ò çGš)a=—#vK›åoK§ßóÙ¤¶¿õú…ÄRÚ[ËsöÙ¼Ë•Ë ópw®qœŒ·Ø
ùÇâ‹ý‡ãKèS&ÞvûDAù‘É9ŒîqÅ}
$SnIV[]Ñ´Ó}ØÜ¾A Ü|½kÅþÓ|EMuR¼.I¼¶däò‚ÃkÆ}ðy¹vciUœZ…Õõ»z¾÷¿n¦*j-É/àœHã\y5 Û ß™ó0—äŸnzôã#Ô¯,†¥ÚeÔ÷ÜÅ´„“'c…<íÝ€<·SŠ¥k§Ã¢éÆÆÙna‚8–=«Êª[Ÿ™°pNî02z“ÔÙ–K8.È’Þî(vƒ2®@ äÈûãçžxäÇf¯ˆu¹yUÕîýWšÙ|›ëÒ%Q^í[æ|éo5ZY•^{96ˆY‚§v*x>âº_|U¹Ö´©tûMÒÂ9PÇ#«£#€ éÉñ‘ƒÍz/‰´-į¹°dd,Б›p03ƒœ{ç9=+
Ûᧇ¬¦[‡‚ê婺¸#±ß=³ý¿•Õµjñ½HÙh›Û[§ÚýÊöô÷{˜?ô÷·Ô.u©–_%còcAÀ˜’
}0x9Î>žñÇáÍ9,ahï¦Ì2òÓ ñÛAäry$V²Nð
]=$Ž
‚#Ù‚1ƒƒødõMax‡ÂÖ^!±KkÛ‘
«“Çó²FN8+ëÎ{Ò¼oí§[«ÕMRoËeç×[_m/¦¦k.kôgŽxsSÓ´ý`êzªÜÜKo‰cPC9ÎY‰#§^üý9¹âïÞx£Ë·Ú`±‰‹¤;³–=ÏaôÕAð‚÷kêÁNBéÎælcõö®£Fð†ô2Ò¬]ßÂK$ÓÜ®•”/ÊHàã$ä¸÷ëf¹Oµúâ“”’²øè´µþöjçNü÷üÌ¿ xNïFÒd»¼·h®îT9ŽAµÖ>qÁçÔœtïÒ»\ȶÎîcÞäîó3¶@#ÉIÎ ÔñW.<´’¥–ÑÑ€ÕšA‚ ;†qÓë‚2q
ÒÂó$# Çí‡
!Ë}Õ9ÈÎÑÉã=;ŒÇÎuñ+ÉûÏ¥öíeÙ+$úíÜ娯'+êZH4ƒq¶FV‹gïŒ208ÆÌ)íб>M|÷âÍã¾"iì‹¥£Jd´™OÝç;sÈúr+ÜäˆË)DŒ¥šF°*3Õ”d{zÔwºQ¿·UžÉf†~>I+ŒqÔ`ð3œ“Ü×f]œTÁÔn4“ƒø’Ýßõ_«*5šzGCÊ,þ+ê1ò÷O¶¸cœºb2yÇ;cùÕ£ñh¬›áÑŠr¤ÝäNBk¥—á—†gxšX/쑘hŸ*Tçn =ûã¦2|(ð¿e·ºÖ$
ýìŸ!'åΰyîî+×öœ=Y:²¦ÓÞ×iü’—ü
-BK™£˜›âÆ¡&véðõ-ûÉY¹=Onj¹ø¯¯yf4·±T Pó`çœ7={×mÃ/¢˜ZÚòK…G½¥b„’G AãÜœ*í¯Ã¿ IoæI¦NU8‘RwÈã;·€ Û×ëÒ”1Y
•£E»ÿ Oyto¢<£Áö·šï,䉧ûA¼sû»Nò}¹üE{ÜÖªò1’õÞr0â}ÎØ#>à/8ïéÎ~—áÍ#ñÎlí§³2f'h”?C÷YËdð:qëõÓ·‚ïeÄ©
ÔÈØÜRL+žAÎ3¼g=åšó³Œt3
ÑQ¦ùRÙßE®¼±w_;þhš’Sirÿ ^ˆã¼iੇ|RòO„m°J/“$·l“ ÇÓ¿ÿ [ÑŠÆ“„†Õø>cFÆ6Ø1ƒ– àz7Ldòxäüwá‹ÝAXùO•Úý’é®ähm •NÀ±ÌTÈç
ƒ‘I$pGž:‚ÄbêW¢®œ´|¦nÍ>¶ÖÏ¢§ÎÜ¢ºö¹•%ÄqL^öÛKpNA<ã¡ …î==ª¸óffËF‡yÌcÉ ©ç$ð=ñÏYþÊ’Ú]—¥‚¬‚eDïÎH>Ÿ_ÌTP™a‰ch['çÆÜò7a‡?w°Ïn§âÎ5”’¨¹uÚÛ|´ÓÓc§{O—ü1•ªxsÃZ…ÊÏy¡Ã3¸Ë2Èé» ‘ƒÎ äžÜðA§cáOéúÛ4ý5-fŒï„ù¬ûô.Ç Üsž•Ò¾•wo<¶Ÿ"¬¡º|£
î2sÇ¡éE²ÉFѱrU°dÜ6œ¨ mc†Îxë׺Þ'0²¡Rr„{j¾í·è›µ÷)º·å–‹î2|I®Y¼ºÍË·–ÃÆàã£'óÆxƒOÆÞ&>\lóÌxP Xc¸ì Sþ5§qà/ê>#žÞW¸if$\3 ® ûÄ“ùŽÕê¾ð<Ó‹H¶óÏ" å·( á‘€:ã†8Ï=+ꨬUA×ÃËÚT’ÑÞöù¥¢]{»ms¥F0\ÑÕ—ô}&ÛB´ƒOŽÚ+›xíÄÀ1
,v± žIëíZ0ǧ™3í2®0ทp9öÝÔž)ÓZËoq/Ú“‘L ²ŒmùŽï‘Ó9§[Û#Ä‘\ÞB¬Çs [;à à«g‚2ôòªœÝV§»·¯/[uó½õÛï¾
/šÍ}öüÿ «=x»HŸÂÞ.™ ÌQùŸh´‘#a$‚'¡u<Š›Æ>2>+ƒLSiöwµFó1!eg`£åœ ÷ëÛö}Á¿ÛVÙêv $¬ƒ|,s÷z€ð΃¨x÷ÅD\ÜŒÞmåÔ„ ˆ o| :{ÇÓ¶–òÁn!´0Ål€, ƒ ( ÛŒŒc¶rsšæ,4‹MÛOH!@¢ ÇŽ„`å²9ÝÃw;AÍt0®¤¡…¯ØÄ.Àìí´ƒ‘ßñ5Í,Óëu-ÈÔc¢KÃÓ£òÖ̺U.õL¯0…%2È—"~x
‚[`có±nHàŽyàö™¥keˆìŒÛFç{(Ø©†`Jã#Žwg<“:ÚÉ;M
^\yhûX‡vB·÷zrF?§BÊÔ/s<ÐÈB)Û± ·ÍÔwç5Âã:så§e{mѤï«Òíh—]Wm4âí¿ùþW4bC3¶ª¾Ùr$pw`àädzt!yŠI„hÂîàM)!edŒm'æ>Ç?wzºKìcŒ´¯Ìq6fp$)ãw¡éUl`µ»ARAˆÝÕgr:äŒgƒéé[Ôö±”iYs5Ýï«ÙG—K=þF’æMG«óÿ `ŠKɦuOQ!ÕåŒ/ÎGÞ`@ËqÕzdõâ«Ê/Ö(ƒK´%ŽbMüåÜŸö—>¤óŒŒV‘°„I¢Yž#™¥ùÏÊ@8
œgqöö5ª4vד[¬(q cò¨À!FGaÁõõ¯?§†¥ÏU½í¿WªZ$úyú½Žz×§Éþ?>Ã×È•6°{™™ŽÙ.$`ÎUœ…çè ' ¤r$1Ø(y7 ðV<ž:È ÁÎMw¾Â'Øb§øxb7gãО½óÉÊë²,i„Fȹ£§8ãä½k¹¥¦ê/ç{ïê驪2œ/«ü?¯Ô›ìñÜ$þeýœRIåŒg9Ác’zrrNO bÚi¢
ѺË/$,“ª¯Ýä;Œ× ´<ÛÑn³IvŸb™¥ nm–ÄŸ—nÝÀãŽ3ëÍG,.öó³˜Ù£¹uÊÌrŠ[<±!@Æ:c9ÅZh
ì’M5ÄìÌ-‚¼ëÉùqŽGì9¬á ;¨A-ž—évþÖ–^ON·Ô”ŸEý}ú×PO&e[]ÒG¸˜Ûp ƒÃà/Ë·8ûÀ€1ž@¿ÚB*²¼ñì8@p™8Q“žÆH'8«I-%¸‚
F»“åó6°Uù|¶Ú¸ã ò^Äw¥ŠÖK–1ÜÝK,Žddlí²0PÀü“×ükG…¯U«·¶–´w¶ŽÍ¾©yÞú[Zös•¯Á[™6°
¨¼ÉVæq·,#
ìãï‘×8îry®A››¨,ãc66»Ë´ã'æÉù?t}¢æH--Òá"›|ˆ¬[í 7¶ö#¸9«––‹$,+Ëqœ\Êøc€yê^ݸÄa°«™B-9%«×®‹V´w~vÜTéꢷþ¼ˆ%·¹• ’[xç•÷2gØS?6åÀÚ õ9É#š@÷bT¸º²C*3Bá¤òÎA9 =úU§Ó"2Ãlá0iÝIc‚2Î@%öç94ùô»'»HÄ¥Ô¾@à Tp£šíx:úÊ:5eºßMý×wµ›Ó_+šº3Ýyvÿ "ºÇ<ÂI>Õ1G·Ë«È«É# àÈÇ øp Jv·šæDûE¿›†Ë’NFr2qŸ½ÇAÜšu•´éí#Ħ8£2”Ú2Ã/€[ÎTr;qŠz*ý’Îþ(≠;¡TÆâ›;ºÿ àçœk‘Þ8¾Uª¾íé{^×IZéwÓkXÉûÑZo¯_øo×È¡¬ â–ÞR§2„‚Àœü½ùç® SVa†Âüª¼±D‘ŒísŸàä|ä2 æ[‹z”¯s{wn„ÆmáóCO+†GO8Ïeçåº`¯^¼ðG5f{Xžä,k‰<á y™¥voÆ éÛõëI=œ1‹éíÔÀÑ)R#;AÂncäŽ:tÏ#¶TkB.0Œ-ÖÞZÛgumß}fÎJÉ+#2êÔP£žùÈÅi¢%œ3P*Yƒò‚A쓎2r:ƒÐúñiRUQq‰H9!”={~¼“JŽV¥»×²m.ÛߺiYl¾òk˜gL³·rT•
’…wHÁ6ä`–Î3ùÌ4Øe³†&òL‘•%clyîAÂäà0 žüç$[3uŘpNOÀÉ=† cï{rYK
ååä~FÁ
•a»"Lär1Ó¯2Äõæ<™C•.fÕ»è¥~½-¿g½Â4¡{[ør¨¶·Žõäx¥’l®qpwÇ»8ärF \cޏܯÓ-g‚yciÏÀ¾rÎwèØÈ#o°Á9ã5¢šfÔxÞæfGusÏÌJÿ µ×œ/LtãÅT7²¶w,l
ɳ;”eúà·¨çîŒsÜgTÃS¦^ '~‹®›¯+k÷ZÖd©Æ*Ó[Ü«%Œk0ŽXƒ”$k#Ȩ P2bv‘ƒŸáÇ™ÆÕb)m$É*8óLE‘8'–ÜN Úyàúô+{uº±I'wvš4fÜr íì½=úuú
sFlìV$‘ö†HÑù€$§ õ=½¸«Ž]
:Ž+•¦ïmRþ½l´îÊT#nkiøÿ _ðÆT¶7Ò½ºÒ£Î¸d\ã8=yãŽÜäR{x]ZâÚé#¸r²#»ÎHÆ6õ ç® ÎFkr;sºÄ.&;só±Ç9êH÷ýSšÕtÐU¢-n Ì| vqœ„{gŒt§S.P‹’މ_[;m¥ÞZýRûÂX{+¥úü¼ú•-àÓ7!„G"“´‹žƒnrYXã¸îp éœ!ÓoPÌtÑ (‰Þ¹é€sÓ#GLçÕšÑnJý¡!‘Tä#“ß?îýp}xÇ‚I¥Õn#·¸–y'qó@r[ Êô÷<ÔWÃÓ¢áN¥4Ô’I&ݼ¬¬¼ÞºvéÆ
FQV~_ÒüJÖÚt¥¦Xá3BÄP^%ÈÎW-×c¡ú©¤·Iþèk¥š?–UQåIR[’O 5x\ÉhÆI¶K4«2ùªŠŒ<¼óœçØ`u«‚Í.VHä€ Ëgfx''9ÆI#±®Z8
sISºku¢ßÞ]úk»Jößl¡B.Ü»ÿ MWe
°·Ž%šêɆ¼»Âù³´œ O¿cÐÓÄh©"ÛÜÏ.ÖV’3nüÄmnq[ŒòznšÖ>J¬òˆæ…qýØP Ž:ä7^0yëWšÍ_79äoaÈ °#q0{ää×mœy”R{vÒÞ¶ÚÏe¥“ÚÆÐ¥Ì®—õýjR •íç›Ìb„+JyÜØÙ•Ç]¿Ôd þËOL²”9-Œ—õÃc'æÝלçÚ²ìejP“½
âù°¨†ðqòädЃÉäÖÜj÷PÇp“ÍšŠå«‘î
<iWNsmª»¶vÓz5»ûì:Rs\Ðßôû×uÔÿÙ