Completed
Pull Request — master (#2634)
by Christian
10:35
created
default/boinc/modules/boincstats/includes/pchart/class/pSplit.class.php 1 patch
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pSplit - class to draw spline splitted charts
4 4
 
5 5
      Version     : 2.1.3
@@ -13,119 +13,119 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- define("TEXT_POS_TOP"		, 690001);
17
- define("TEXT_POS_RIGHT"	, 690002);
16
+    define("TEXT_POS_TOP"		, 690001);
17
+    define("TEXT_POS_RIGHT"	, 690002);
18 18
 
19
- /* pSplit class definition */
20
- class pSplit
21
-  {
22
-   var $pChartObject;
19
+    /* pSplit class definition */
20
+    class pSplit
21
+    {
22
+    var $pChartObject;
23 23
 
24
-   /* Class creator */
25
-   function pSplit()
24
+    /* Class creator */
25
+    function pSplit()
26 26
     { }
27 27
 
28
-   /* Create the encoded string */
29
-   function drawSplitPath($Object,$Values,$Format="")
28
+    /* Create the encoded string */
29
+    function drawSplitPath($Object,$Values,$Format="")
30 30
     {
31
-     $this->pChartObject = $Object;
32
-
33
-     $Spacing		= isset($Format["Spacing"]) ? $Format["Spacing"] : 20;
34
-     $TextPadding	= isset($Format["TextPadding"]) ? $Format["TextPadding"] : 2;
35
-     $TextPos		= isset($Format["TextPos"]) ? $Format["TextPos"] : TEXT_POS_TOP;
36
-     $Surrounding       = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
37
-     $Force		= isset($Format["Force"]) ? $Format["Force"] : 70;
38
-     $Segments		= isset($Format["Segments"]) ? $Format["Segments"] : 15;
39
-     $FontSize		= $Object->FontSize;
40
-     $X1		= $Object->GraphAreaX1;
41
-     $Y1		= $Object->GraphAreaY1;
42
-     $X2		= $Object->GraphAreaX2;
43
-     $Y2		= $Object->GraphAreaY2;
44
-
45
-     /* Data Processing */
46
-     $Data    = $Values->getData();
47
-     $Palette = $Values->getPalette();
48
-
49
-     $LabelSerie = $Data["Abscissa"];
50
-     $DataSerie  = "";
51
-
52
-     foreach($Data["Series"] as $SerieName => $Value)
53
-      { if ( $SerieName != $LabelSerie && $DataSerie == "" ) { $DataSerie = $SerieName; } }
54
-
55
-     $DataSerieSum   = array_sum($Data["Series"][$DataSerie]["Data"]);
56
-     $DataSerieCount = count($Data["Series"][$DataSerie]["Data"]);
57
-
58
-     /* Scale Processing */
59
-     if ( $TextPos == TEXT_POS_RIGHT )
60
-      $YScale     = (($Y2-$Y1) - (($DataSerieCount+1)*$Spacing)) / $DataSerieSum;
61
-     else
62
-      $YScale     = (($Y2-$Y1) - ($DataSerieCount*$Spacing)) / $DataSerieSum;
63
-     $LeftHeight = $DataSerieSum * $YScale;
64
-
65
-     /* Re-compute graph width depending of the text mode choosen */
66
-     if ( $TextPos == TEXT_POS_RIGHT )
67
-      {
68
-       $MaxWidth = 0;
69
-       foreach($Data["Series"][$LabelSerie]["Data"] as $Key => $Label)
31
+        $this->pChartObject = $Object;
32
+
33
+        $Spacing		= isset($Format["Spacing"]) ? $Format["Spacing"] : 20;
34
+        $TextPadding	= isset($Format["TextPadding"]) ? $Format["TextPadding"] : 2;
35
+        $TextPos		= isset($Format["TextPos"]) ? $Format["TextPos"] : TEXT_POS_TOP;
36
+        $Surrounding       = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
37
+        $Force		= isset($Format["Force"]) ? $Format["Force"] : 70;
38
+        $Segments		= isset($Format["Segments"]) ? $Format["Segments"] : 15;
39
+        $FontSize		= $Object->FontSize;
40
+        $X1		= $Object->GraphAreaX1;
41
+        $Y1		= $Object->GraphAreaY1;
42
+        $X2		= $Object->GraphAreaX2;
43
+        $Y2		= $Object->GraphAreaY2;
44
+
45
+        /* Data Processing */
46
+        $Data    = $Values->getData();
47
+        $Palette = $Values->getPalette();
48
+
49
+        $LabelSerie = $Data["Abscissa"];
50
+        $DataSerie  = "";
51
+
52
+        foreach($Data["Series"] as $SerieName => $Value)
53
+        { if ( $SerieName != $LabelSerie && $DataSerie == "" ) { $DataSerie = $SerieName; } }
54
+
55
+        $DataSerieSum   = array_sum($Data["Series"][$DataSerie]["Data"]);
56
+        $DataSerieCount = count($Data["Series"][$DataSerie]["Data"]);
57
+
58
+        /* Scale Processing */
59
+        if ( $TextPos == TEXT_POS_RIGHT )
60
+        $YScale     = (($Y2-$Y1) - (($DataSerieCount+1)*$Spacing)) / $DataSerieSum;
61
+        else
62
+        $YScale     = (($Y2-$Y1) - ($DataSerieCount*$Spacing)) / $DataSerieSum;
63
+        $LeftHeight = $DataSerieSum * $YScale;
64
+
65
+        /* Re-compute graph width depending of the text mode choosen */
66
+        if ( $TextPos == TEXT_POS_RIGHT )
67
+        {
68
+        $MaxWidth = 0;
69
+        foreach($Data["Series"][$LabelSerie]["Data"] as $Key => $Label)
70 70
         {
71
-         $Boundardies = $Object->getTextBox(0,0,$Object->FontName,$Object->FontSize,0,$Label);
72
-         if ( $Boundardies[1]["X"] > $MaxWidth ) { $MaxWidth = $Boundardies[1]["X"] + $TextPadding*2; }
71
+            $Boundardies = $Object->getTextBox(0,0,$Object->FontName,$Object->FontSize,0,$Label);
72
+            if ( $Boundardies[1]["X"] > $MaxWidth ) { $MaxWidth = $Boundardies[1]["X"] + $TextPadding*2; }
73
+        }
74
+        $X2 = $X2 - $MaxWidth;
73 75
         }
74
-       $X2 = $X2 - $MaxWidth;
75
-      }
76 76
 
77
-     /* Drawing */
78
-     $LeftY    = ((($Y2-$Y1) / 2) + $Y1) - ($LeftHeight/2);
79
-     $RightY   = $Y1;
80
-     $VectorX  = (($X2-$X1) / 2);
77
+        /* Drawing */
78
+        $LeftY    = ((($Y2-$Y1) / 2) + $Y1) - ($LeftHeight/2);
79
+        $RightY   = $Y1;
80
+        $VectorX  = (($X2-$X1) / 2);
81 81
 
82
-     foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
83
-      {
84
-       if ( isset($Data["Series"][$LabelSerie]["Data"][$Key]) )
82
+        foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
83
+        {
84
+        if ( isset($Data["Series"][$LabelSerie]["Data"][$Key]) )
85 85
         $Label = $Data["Series"][$LabelSerie]["Data"][$Key];
86
-       else
86
+        else
87 87
         $Label = "-";
88 88
 
89
-       $LeftY1 = $LeftY;
90
-       $LeftY2 = $LeftY + $Value * $YScale;
89
+        $LeftY1 = $LeftY;
90
+        $LeftY2 = $LeftY + $Value * $YScale;
91 91
 
92
-       $RightY1 = $RightY + $Spacing;
93
-       $RightY2 = $RightY + $Spacing + $Value * $YScale;;
92
+        $RightY1 = $RightY + $Spacing;
93
+        $RightY2 = $RightY + $Spacing + $Value * $YScale;;
94 94
 
95
-       $Settings = array("R"=>$Palette[$Key]["R"],"G"=>$Palette[$Key]["G"],"B"=>$Palette[$Key]["B"],"Alpha"=>$Palette[$Key]["Alpha"],"NoDraw"=>TRUE,"Segments"=>$Segments,"Surrounding"=>$Surrounding);
95
+        $Settings = array("R"=>$Palette[$Key]["R"],"G"=>$Palette[$Key]["G"],"B"=>$Palette[$Key]["B"],"Alpha"=>$Palette[$Key]["Alpha"],"NoDraw"=>TRUE,"Segments"=>$Segments,"Surrounding"=>$Surrounding);
96 96
 
97
-       $PolyGon = "";
97
+        $PolyGon = "";
98 98
 
99
-       $Angle    = $Object->getAngle($X2,$RightY1,$X1,$LeftY1);
100
-       $VectorX1 = cos(deg2rad($Angle+90)) * $Force + ($X2-$X1)/2 + $X1;
101
-       $VectorY1 = sin(deg2rad($Angle+90)) * $Force + ($RightY1-$LeftY1)/2 + $LeftY1;
102
-       $VectorX2 = cos(deg2rad($Angle-90)) * $Force + ($X2-$X1)/2 + $X1;
103
-       $VectorY2 = sin(deg2rad($Angle-90)) * $Force + ($RightY1-$LeftY1)/2 + $LeftY1;
99
+        $Angle    = $Object->getAngle($X2,$RightY1,$X1,$LeftY1);
100
+        $VectorX1 = cos(deg2rad($Angle+90)) * $Force + ($X2-$X1)/2 + $X1;
101
+        $VectorY1 = sin(deg2rad($Angle+90)) * $Force + ($RightY1-$LeftY1)/2 + $LeftY1;
102
+        $VectorX2 = cos(deg2rad($Angle-90)) * $Force + ($X2-$X1)/2 + $X1;
103
+        $VectorY2 = sin(deg2rad($Angle-90)) * $Force + ($RightY1-$LeftY1)/2 + $LeftY1;
104 104
 
105
-       $Points = $Object->drawBezier($X1,$LeftY1,$X2,$RightY1,$VectorX1,$VectorY1,$VectorX2,$VectorY2,$Settings);
106
-       foreach($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
105
+        $Points = $Object->drawBezier($X1,$LeftY1,$X2,$RightY1,$VectorX1,$VectorY1,$VectorX2,$VectorY2,$Settings);
106
+        foreach($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
107 107
 
108 108
 
109
-       $Angle    = $Object->getAngle($X2,$RightY2,$X1,$LeftY2);
110
-       $VectorX1 = cos(deg2rad($Angle+90)) * $Force + ($X2-$X1)/2 +$X1;
111
-       $VectorY1 = sin(deg2rad($Angle+90)) * $Force + ($RightY2-$LeftY2)/2 + $LeftY2;
112
-       $VectorX2 = cos(deg2rad($Angle-90)) * $Force + ($X2-$X1)/2 +$X1;
113
-       $VectorY2 = sin(deg2rad($Angle-90)) * $Force + ($RightY2-$LeftY2)/2 + $LeftY2;
109
+        $Angle    = $Object->getAngle($X2,$RightY2,$X1,$LeftY2);
110
+        $VectorX1 = cos(deg2rad($Angle+90)) * $Force + ($X2-$X1)/2 +$X1;
111
+        $VectorY1 = sin(deg2rad($Angle+90)) * $Force + ($RightY2-$LeftY2)/2 + $LeftY2;
112
+        $VectorX2 = cos(deg2rad($Angle-90)) * $Force + ($X2-$X1)/2 +$X1;
113
+        $VectorY2 = sin(deg2rad($Angle-90)) * $Force + ($RightY2-$LeftY2)/2 + $LeftY2;
114 114
 
115
-       $Points = $Object->drawBezier($X1,$LeftY2,$X2,$RightY2,$VectorX1,$VectorY1,$VectorX2,$VectorY2,$Settings);
116
-       $Points = array_reverse($Points);
117
-       foreach($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
115
+        $Points = $Object->drawBezier($X1,$LeftY2,$X2,$RightY2,$VectorX1,$VectorY1,$VectorX2,$VectorY2,$Settings);
116
+        $Points = array_reverse($Points);
117
+        foreach($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
118 118
 
119
-       $Object->drawPolygon($PolyGon,$Settings);
119
+        $Object->drawPolygon($PolyGon,$Settings);
120 120
 
121
-       if ( $TextPos == TEXT_POS_RIGHT )
121
+        if ( $TextPos == TEXT_POS_RIGHT )
122 122
         $Object->drawText($X2+$TextPadding,($RightY2-$RightY1)/2+$RightY1,$Label,array("Align"=>TEXT_ALIGN_MIDDLELEFT));
123
-       else
123
+        else
124 124
         $Object->drawText($X2,$RightY1-$TextPadding,$Label,array("Align"=>TEXT_ALIGN_BOTTOMRIGHT));
125 125
 
126
-       $LeftY  = $LeftY2;
127
-       $RightY = $RightY2;
128
-      }
126
+        $LeftY  = $LeftY2;
127
+        $RightY = $RightY2;
128
+        }
129
+    }
129 130
     }
130
-  }
131 131
 ?>
132 132
\ No newline at end of file
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pImage.class.php 1 patch
Indentation   +361 added lines, -361 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pDraw - pChart core class
4 4
 
5 5
      Version     : 2.1.3
@@ -13,460 +13,460 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- /* The GD extension is mandatory */
17
- if (!extension_loaded('gd') && !extension_loaded('gd2'))
18
-  {
19
-   echo "GD extension must be loaded. \r\n";
20
-   exit();
21
-  }
22
-
23
- /* Image map handling */
24
- define("IMAGE_MAP_STORAGE_FILE"	, 680001);
25
- define("IMAGE_MAP_STORAGE_SESSION"	, 680002);
26
-
27
- /* Last generated chart layout */
28
- define("CHART_LAST_LAYOUT_REGULAR"	, 680011);
29
- define("CHART_LAST_LAYOUT_STACKED"	, 680012);
30
-
31
- /* ImageMap string delimiter */
32
- define("IMAGE_MAP_DELIMITER"		, chr(1));
33
-
34
- class pImage extends pDraw
35
-  {
36
-   /* Image settings, size, quality, .. */
37
-   var $XSize		= NULL;				// Width of the picture
38
-   var $YSize		= NULL;				// Height of the picture
39
-   var $Picture		= NULL;				// GD picture object
40
-   var $Antialias	= TRUE;				// Turn antialias on or off
41
-   var $AntialiasQuality  = 0;				// Quality of the antialiasing implementation (0-1)
42
-   var $Mask		= "";				// Already drawn pixels mask (Filled circle implementation)
43
-   var $TransparentBackground = FALSE;			// Just to know if we need to flush the alpha channels when rendering
44
-
45
-   /* Graph area settings */
46
-   var $GraphAreaX1	= NULL;				// Graph area X origin
47
-   var $GraphAreaY1	= NULL;				// Graph area Y origin
48
-   var $GraphAreaX2	= NULL;				// Graph area bottom right X position
49
-   var $GraphAreaY2	= NULL;				// Graph area bottom right Y position
50
-
51
-   /* Scale settings */
52
-   var $ScaleMinDivHeight = 20;				// Minimum height for scame divs
53
-
54
-   /* Font properties */
55
-   var $FontName	= "sites/all/libraries/fonts/DejaVuSans.ttf";	// Default font file
56
-   var $FontSize	= 12;				// Default font size
57
-   var $FontBox		= NULL;				// Return the bounding box of the last written string
58
-   var $FontColorR	= 0;				// Default color settings
59
-   var $FontColorG	= 0;				// Default color settings
60
-   var $FontColorB	= 0;				// Default color settings
61
-   var $FontColorA	= 100;				// Default transparency
62
-
63
-   /* Shadow properties */
64
-   var $Shadow		= FALSE;			// Turn shadows on or off
65
-   var $ShadowX		= NULL;				// X Offset of the shadow
66
-   var $ShadowY		= NULL;				// Y Offset of the shadow
67
-   var $ShadowR		= NULL;				// R component of the shadow
68
-   var $ShadowG		= NULL;				// G component of the shadow
69
-   var $ShadowB		= NULL;				// B component of the shadow
70
-   var $Shadowa		= NULL;				// Alpha level of the shadow
71
-
72
-   /* Image map */
73
-   var $ImageMap	= NULL;				// Aray containing the image map
74
-   var $ImageMapIndex	= "pChart";			// Name of the session array
75
-   var $ImageMapStorageMode = NULL;			// Save the current imagemap storage mode
76
-   var $ImageMapAutoDelete  = TRUE;			// Automatic deletion of the image map temp files
77
-
78
-   /* Data Set */
79
-   var $DataSet		= NULL;				// Attached dataset
80
-
81
-   /* Last generated chart info */
82
-   var $LastChartLayout	= CHART_LAST_LAYOUT_REGULAR;	// Last layout : regular or stacked
83
-
84
-   /* Class constructor */
85
-   function pImage($XSize,$YSize,$DataSet=NULL,$TransparentBackground=FALSE)
16
+    /* The GD extension is mandatory */
17
+    if (!extension_loaded('gd') && !extension_loaded('gd2'))
86 18
     {
87
-     $this->TransparentBackground = $TransparentBackground;
88
-
89
-     if ( $DataSet != NULL ) { $this->DataSet = $DataSet; }
90
-
91
-     $this->XSize   = $XSize;
92
-     $this->YSize   = $YSize;
93
-     $this->Picture = imagecreatetruecolor($XSize,$YSize);
94
-
95
-     if ( $this->TransparentBackground )
96
-      {
97
-       imagealphablending($this->Picture,FALSE);
98
-       imagefilledrectangle($this->Picture, 0,0,$XSize, $YSize, imagecolorallocatealpha($this->Picture, 255, 255, 255, 127));
99
-       imagealphablending($this->Picture,TRUE);
100
-       imagesavealpha($this->Picture,true); 
101
-      }
102
-     else
103
-      {
104
-       $C_White = $this->AllocateColor($this->Picture,255,255,255);
105
-       imagefilledrectangle($this->Picture,0,0,$XSize,$YSize,$C_White);
106
-      }
19
+    echo "GD extension must be loaded. \r\n";
20
+    exit();
107 21
     }
108 22
 
109
-   /* Enable / Disable and set shadow properties */
110
-   function setShadow($Enabled=TRUE,$Format="")
23
+    /* Image map handling */
24
+    define("IMAGE_MAP_STORAGE_FILE"	, 680001);
25
+    define("IMAGE_MAP_STORAGE_SESSION"	, 680002);
26
+
27
+    /* Last generated chart layout */
28
+    define("CHART_LAST_LAYOUT_REGULAR"	, 680011);
29
+    define("CHART_LAST_LAYOUT_STACKED"	, 680012);
30
+
31
+    /* ImageMap string delimiter */
32
+    define("IMAGE_MAP_DELIMITER"		, chr(1));
33
+
34
+    class pImage extends pDraw
35
+    {
36
+    /* Image settings, size, quality, .. */
37
+    var $XSize		= NULL;				// Width of the picture
38
+    var $YSize		= NULL;				// Height of the picture
39
+    var $Picture		= NULL;				// GD picture object
40
+    var $Antialias	= TRUE;				// Turn antialias on or off
41
+    var $AntialiasQuality  = 0;				// Quality of the antialiasing implementation (0-1)
42
+    var $Mask		= "";				// Already drawn pixels mask (Filled circle implementation)
43
+    var $TransparentBackground = FALSE;			// Just to know if we need to flush the alpha channels when rendering
44
+
45
+    /* Graph area settings */
46
+    var $GraphAreaX1	= NULL;				// Graph area X origin
47
+    var $GraphAreaY1	= NULL;				// Graph area Y origin
48
+    var $GraphAreaX2	= NULL;				// Graph area bottom right X position
49
+    var $GraphAreaY2	= NULL;				// Graph area bottom right Y position
50
+
51
+    /* Scale settings */
52
+    var $ScaleMinDivHeight = 20;				// Minimum height for scame divs
53
+
54
+    /* Font properties */
55
+    var $FontName	= "sites/all/libraries/fonts/DejaVuSans.ttf";	// Default font file
56
+    var $FontSize	= 12;				// Default font size
57
+    var $FontBox		= NULL;				// Return the bounding box of the last written string
58
+    var $FontColorR	= 0;				// Default color settings
59
+    var $FontColorG	= 0;				// Default color settings
60
+    var $FontColorB	= 0;				// Default color settings
61
+    var $FontColorA	= 100;				// Default transparency
62
+
63
+    /* Shadow properties */
64
+    var $Shadow		= FALSE;			// Turn shadows on or off
65
+    var $ShadowX		= NULL;				// X Offset of the shadow
66
+    var $ShadowY		= NULL;				// Y Offset of the shadow
67
+    var $ShadowR		= NULL;				// R component of the shadow
68
+    var $ShadowG		= NULL;				// G component of the shadow
69
+    var $ShadowB		= NULL;				// B component of the shadow
70
+    var $Shadowa		= NULL;				// Alpha level of the shadow
71
+
72
+    /* Image map */
73
+    var $ImageMap	= NULL;				// Aray containing the image map
74
+    var $ImageMapIndex	= "pChart";			// Name of the session array
75
+    var $ImageMapStorageMode = NULL;			// Save the current imagemap storage mode
76
+    var $ImageMapAutoDelete  = TRUE;			// Automatic deletion of the image map temp files
77
+
78
+    /* Data Set */
79
+    var $DataSet		= NULL;				// Attached dataset
80
+
81
+    /* Last generated chart info */
82
+    var $LastChartLayout	= CHART_LAST_LAYOUT_REGULAR;	// Last layout : regular or stacked
83
+
84
+    /* Class constructor */
85
+    function pImage($XSize,$YSize,$DataSet=NULL,$TransparentBackground=FALSE)
111 86
     {
112
-     $X	    = isset($Format["X"]) ? $Format["X"] : 2;
113
-     $Y	    = isset($Format["Y"]) ? $Format["Y"] : 2;
114
-     $R	    = isset($Format["R"]) ? $Format["R"] : 0;
115
-     $G	    = isset($Format["G"]) ? $Format["G"] : 0;
116
-     $B	    = isset($Format["B"]) ? $Format["B"] : 0;
117
-     $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 10;
118
-
119
-     $this->Shadow  = $Enabled;
120
-     $this->ShadowX = $X;
121
-     $this->ShadowY = $Y;
122
-     $this->ShadowR = $R;
123
-     $this->ShadowG = $G;
124
-     $this->ShadowB = $B;
125
-     $this->Shadowa = $Alpha;
87
+        $this->TransparentBackground = $TransparentBackground;
88
+
89
+        if ( $DataSet != NULL ) { $this->DataSet = $DataSet; }
90
+
91
+        $this->XSize   = $XSize;
92
+        $this->YSize   = $YSize;
93
+        $this->Picture = imagecreatetruecolor($XSize,$YSize);
94
+
95
+        if ( $this->TransparentBackground )
96
+        {
97
+        imagealphablending($this->Picture,FALSE);
98
+        imagefilledrectangle($this->Picture, 0,0,$XSize, $YSize, imagecolorallocatealpha($this->Picture, 255, 255, 255, 127));
99
+        imagealphablending($this->Picture,TRUE);
100
+        imagesavealpha($this->Picture,true); 
101
+        }
102
+        else
103
+        {
104
+        $C_White = $this->AllocateColor($this->Picture,255,255,255);
105
+        imagefilledrectangle($this->Picture,0,0,$XSize,$YSize,$C_White);
106
+        }
126 107
     }
127 108
 
128
-   /* Set the graph area position */
129
-   function setGraphArea($X1,$Y1,$X2,$Y2)
109
+    /* Enable / Disable and set shadow properties */
110
+    function setShadow($Enabled=TRUE,$Format="")
130 111
     {
131
-     if ( $X2 < $X1 || $X1 == $X2 || $Y2 < $Y1 || $Y1 == $Y2 ) { return(-1); }
112
+        $X	    = isset($Format["X"]) ? $Format["X"] : 2;
113
+        $Y	    = isset($Format["Y"]) ? $Format["Y"] : 2;
114
+        $R	    = isset($Format["R"]) ? $Format["R"] : 0;
115
+        $G	    = isset($Format["G"]) ? $Format["G"] : 0;
116
+        $B	    = isset($Format["B"]) ? $Format["B"] : 0;
117
+        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 10;
118
+
119
+        $this->Shadow  = $Enabled;
120
+        $this->ShadowX = $X;
121
+        $this->ShadowY = $Y;
122
+        $this->ShadowR = $R;
123
+        $this->ShadowG = $G;
124
+        $this->ShadowB = $B;
125
+        $this->Shadowa = $Alpha;
126
+    }
132 127
 
133
-     $this->GraphAreaX1 = $X1; $this->DataSet->Data["GraphArea"]["X1"] = $X1;
134
-     $this->GraphAreaY1 = $Y1; $this->DataSet->Data["GraphArea"]["Y1"] = $Y1;
135
-     $this->GraphAreaX2 = $X2; $this->DataSet->Data["GraphArea"]["X2"] = $X2;
136
-     $this->GraphAreaY2 = $Y2; $this->DataSet->Data["GraphArea"]["Y2"] = $Y2;
128
+    /* Set the graph area position */
129
+    function setGraphArea($X1,$Y1,$X2,$Y2)
130
+    {
131
+        if ( $X2 < $X1 || $X1 == $X2 || $Y2 < $Y1 || $Y1 == $Y2 ) { return(-1); }
132
+
133
+        $this->GraphAreaX1 = $X1; $this->DataSet->Data["GraphArea"]["X1"] = $X1;
134
+        $this->GraphAreaY1 = $Y1; $this->DataSet->Data["GraphArea"]["Y1"] = $Y1;
135
+        $this->GraphAreaX2 = $X2; $this->DataSet->Data["GraphArea"]["X2"] = $X2;
136
+        $this->GraphAreaY2 = $Y2; $this->DataSet->Data["GraphArea"]["Y2"] = $Y2;
137 137
     }
138 138
 
139
-   /* Return the width of the picture */
140
-   function getWidth()
139
+    /* Return the width of the picture */
140
+    function getWidth()
141 141
     { return($this->XSize); }
142 142
 
143
-   /* Return the heigth of the picture */
144
-   function getHeight()
143
+    /* Return the heigth of the picture */
144
+    function getHeight()
145 145
     { return($this->YSize); }
146 146
 
147
-   /* Render the picture to a file */
148
-   function render($FileName)
147
+    /* Render the picture to a file */
148
+    function render($FileName)
149 149
     {
150
-     if ( $this->TransparentBackground ) { imagealphablending($this->Picture,false); imagesavealpha($this->Picture,true); }
151
-     imagepng($this->Picture,$FileName);
150
+        if ( $this->TransparentBackground ) { imagealphablending($this->Picture,false); imagesavealpha($this->Picture,true); }
151
+        imagepng($this->Picture,$FileName);
152 152
     }
153 153
 
154
-   /* Render the picture to a web browser stream */
155
-   function stroke($BrowserExpire=FALSE)
154
+    /* Render the picture to a web browser stream */
155
+    function stroke($BrowserExpire=FALSE)
156 156
     {
157
-     if ( $this->TransparentBackground ) { imagealphablending($this->Picture,false); imagesavealpha($this->Picture,true); }
157
+        if ( $this->TransparentBackground ) { imagealphablending($this->Picture,false); imagesavealpha($this->Picture,true); }
158 158
 
159
-     if ( $BrowserExpire )
160
-      {
161
-       header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
162
-       header("Cache-Control: no-cache");
163
-       header("Pragma: no-cache");
164
-      }
159
+        if ( $BrowserExpire )
160
+        {
161
+        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
162
+        header("Cache-Control: no-cache");
163
+        header("Pragma: no-cache");
164
+        }
165 165
 
166
-     header('Content-type: image/png');
167
-     imagepng($this->Picture);
166
+        header('Content-type: image/png');
167
+        imagepng($this->Picture);
168 168
     }
169 169
 
170
-   /* Automatic output method based on the calling interface */
171
-   function autoOutput($FileName="output.png")
170
+    /* Automatic output method based on the calling interface */
171
+    function autoOutput($FileName="output.png")
172 172
     {
173
-     if (php_sapi_name() == "cli")
174
-      $this->Render($FileName);
175
-     else
176
-      $this->Stroke();
173
+        if (php_sapi_name() == "cli")
174
+        $this->Render($FileName);
175
+        else
176
+        $this->Stroke();
177 177
     }
178 178
 
179
-   /* Return the length between two points */
180
-   function getLength($X1,$Y1,$X2,$Y2)
179
+    /* Return the length between two points */
180
+    function getLength($X1,$Y1,$X2,$Y2)
181 181
     { return(sqrt(pow(max($X1,$X2)-min($X1,$X2),2)+pow(max($Y1,$Y2)-min($Y1,$Y2),2))); }
182 182
 
183
-   /* Return the orientation of a line */
184
-   function getAngle($X1,$Y1,$X2,$Y2)
183
+    /* Return the orientation of a line */
184
+    function getAngle($X1,$Y1,$X2,$Y2)
185 185
     {
186
-     $Opposite = $Y2 - $Y1; $Adjacent = $X2 - $X1;$Angle = rad2deg(atan2($Opposite,$Adjacent));
187
-     if ($Angle > 0) { return($Angle); } else { return(360-abs($Angle)); }
186
+        $Opposite = $Y2 - $Y1; $Adjacent = $X2 - $X1;$Angle = rad2deg(atan2($Opposite,$Adjacent));
187
+        if ($Angle > 0) { return($Angle); } else { return(360-abs($Angle)); }
188 188
     }
189 189
 
190
-   /* Return the surrounding box of text area */
191
-   function getTextBox_deprecated($X,$Y,$FontName,$FontSize,$Angle,$Text)
190
+    /* Return the surrounding box of text area */
191
+    function getTextBox_deprecated($X,$Y,$FontName,$FontSize,$Angle,$Text)
192 192
     {
193
-     $Size    = imagettfbbox($FontSize,$Angle,$FontName,$Text);
194
-     $Width   = $this->getLength($Size[0],$Size[1],$Size[2],$Size[3])+1;
195
-     $Height  = $this->getLength($Size[2],$Size[3],$Size[4],$Size[5])+1;
193
+        $Size    = imagettfbbox($FontSize,$Angle,$FontName,$Text);
194
+        $Width   = $this->getLength($Size[0],$Size[1],$Size[2],$Size[3])+1;
195
+        $Height  = $this->getLength($Size[2],$Size[3],$Size[4],$Size[5])+1;
196 196
 
197
-     $RealPos[0]["X"] = $X; $RealPos[0]["Y"] = $Y;
198
-     $RealPos[1]["X"] = cos((360-$Angle)*PI/180)*$Width + $RealPos[0]["X"]; $RealPos[1]["Y"] = sin((360-$Angle)*PI/180)*$Width + $RealPos[0]["Y"];
199
-     $RealPos[2]["X"] = cos((270-$Angle)*PI/180)*$Height + $RealPos[1]["X"]; $RealPos[2]["Y"] = sin((270-$Angle)*PI/180)*$Height + $RealPos[1]["Y"];
200
-     $RealPos[3]["X"] = cos((180-$Angle)*PI/180)*$Width + $RealPos[2]["X"]; $RealPos[3]["Y"] = sin((180-$Angle)*PI/180)*$Width + $RealPos[2]["Y"];
197
+        $RealPos[0]["X"] = $X; $RealPos[0]["Y"] = $Y;
198
+        $RealPos[1]["X"] = cos((360-$Angle)*PI/180)*$Width + $RealPos[0]["X"]; $RealPos[1]["Y"] = sin((360-$Angle)*PI/180)*$Width + $RealPos[0]["Y"];
199
+        $RealPos[2]["X"] = cos((270-$Angle)*PI/180)*$Height + $RealPos[1]["X"]; $RealPos[2]["Y"] = sin((270-$Angle)*PI/180)*$Height + $RealPos[1]["Y"];
200
+        $RealPos[3]["X"] = cos((180-$Angle)*PI/180)*$Width + $RealPos[2]["X"]; $RealPos[3]["Y"] = sin((180-$Angle)*PI/180)*$Width + $RealPos[2]["Y"];
201 201
 
202
-     $RealPos[TEXT_ALIGN_BOTTOMLEFT]["X"] = $RealPos[0]["X"];	$RealPos[TEXT_ALIGN_BOTTOMLEFT]["Y"] = $RealPos[0]["Y"];
203
-     $RealPos[TEXT_ALIGN_BOTTOMRIGHT]["X"] = $RealPos[1]["X"];	$RealPos[TEXT_ALIGN_BOTTOMRIGHT]["Y"] = $RealPos[1]["Y"];
202
+        $RealPos[TEXT_ALIGN_BOTTOMLEFT]["X"] = $RealPos[0]["X"];	$RealPos[TEXT_ALIGN_BOTTOMLEFT]["Y"] = $RealPos[0]["Y"];
203
+        $RealPos[TEXT_ALIGN_BOTTOMRIGHT]["X"] = $RealPos[1]["X"];	$RealPos[TEXT_ALIGN_BOTTOMRIGHT]["Y"] = $RealPos[1]["Y"];
204 204
 
205
-     return($RealPos);
205
+        return($RealPos);
206 206
     }
207 207
 
208
-   /* Return the surrounding box of text area */
209
-   function getTextBox($X,$Y,$FontName,$FontSize,$Angle,$Text)
208
+    /* Return the surrounding box of text area */
209
+    function getTextBox($X,$Y,$FontName,$FontSize,$Angle,$Text)
210 210
     {
211
-     $coords = imagettfbbox($FontSize, 0, $FontName, $Text);
212
-
213
-     $a = deg2rad($Angle); $ca = cos($a); $sa = sin($a); $RealPos = array();
214
-     for($i = 0; $i < 7; $i += 2)
215
-      {
216
-       $RealPos[$i/2]["X"] = $X + round($coords[$i] * $ca + $coords[$i+1] * $sa);
217
-       $RealPos[$i/2]["Y"] = $Y + round($coords[$i+1] * $ca - $coords[$i] * $sa);
218
-      }
219
-
220
-     $RealPos[TEXT_ALIGN_BOTTOMLEFT]["X"]	= $RealPos[0]["X"];	$RealPos[TEXT_ALIGN_BOTTOMLEFT]["Y"]	= $RealPos[0]["Y"];
221
-     $RealPos[TEXT_ALIGN_BOTTOMRIGHT]["X"]	= $RealPos[1]["X"];	$RealPos[TEXT_ALIGN_BOTTOMRIGHT]["Y"]	= $RealPos[1]["Y"];
222
-     $RealPos[TEXT_ALIGN_TOPLEFT]["X"]		= $RealPos[3]["X"];	$RealPos[TEXT_ALIGN_TOPLEFT]["Y"]	= $RealPos[3]["Y"];
223
-     $RealPos[TEXT_ALIGN_TOPRIGHT]["X"]		= $RealPos[2]["X"];	$RealPos[TEXT_ALIGN_TOPRIGHT]["Y"]	= $RealPos[2]["Y"];
224
-     $RealPos[TEXT_ALIGN_BOTTOMMIDDLE]["X"]	= ($RealPos[1]["X"]-$RealPos[0]["X"])/2+$RealPos[0]["X"];	$RealPos[TEXT_ALIGN_BOTTOMMIDDLE]["Y"]	= ($RealPos[0]["Y"]-$RealPos[1]["Y"])/2+$RealPos[1]["Y"];
225
-     $RealPos[TEXT_ALIGN_TOPMIDDLE]["X"]	= ($RealPos[2]["X"]-$RealPos[3]["X"])/2+$RealPos[3]["X"];	$RealPos[TEXT_ALIGN_TOPMIDDLE]["Y"]	= ($RealPos[3]["Y"]-$RealPos[2]["Y"])/2+$RealPos[2]["Y"];
226
-     $RealPos[TEXT_ALIGN_MIDDLELEFT]["X"]	= ($RealPos[0]["X"]-$RealPos[3]["X"])/2+$RealPos[3]["X"];	$RealPos[TEXT_ALIGN_MIDDLELEFT]["Y"]	= ($RealPos[0]["Y"]-$RealPos[3]["Y"])/2+$RealPos[3]["Y"];
227
-     $RealPos[TEXT_ALIGN_MIDDLERIGHT]["X"]	= ($RealPos[1]["X"]-$RealPos[2]["X"])/2+$RealPos[2]["X"];	$RealPos[TEXT_ALIGN_MIDDLERIGHT]["Y"]	= ($RealPos[1]["Y"]-$RealPos[2]["Y"])/2+$RealPos[2]["Y"];
228
-     $RealPos[TEXT_ALIGN_MIDDLEMIDDLE]["X"]	= ($RealPos[1]["X"]-$RealPos[3]["X"])/2+$RealPos[3]["X"];	$RealPos[TEXT_ALIGN_MIDDLEMIDDLE]["Y"]	= ($RealPos[0]["Y"]-$RealPos[2]["Y"])/2+$RealPos[2]["Y"];
229
-
230
-     return($RealPos);
211
+        $coords = imagettfbbox($FontSize, 0, $FontName, $Text);
212
+
213
+        $a = deg2rad($Angle); $ca = cos($a); $sa = sin($a); $RealPos = array();
214
+        for($i = 0; $i < 7; $i += 2)
215
+        {
216
+        $RealPos[$i/2]["X"] = $X + round($coords[$i] * $ca + $coords[$i+1] * $sa);
217
+        $RealPos[$i/2]["Y"] = $Y + round($coords[$i+1] * $ca - $coords[$i] * $sa);
218
+        }
219
+
220
+        $RealPos[TEXT_ALIGN_BOTTOMLEFT]["X"]	= $RealPos[0]["X"];	$RealPos[TEXT_ALIGN_BOTTOMLEFT]["Y"]	= $RealPos[0]["Y"];
221
+        $RealPos[TEXT_ALIGN_BOTTOMRIGHT]["X"]	= $RealPos[1]["X"];	$RealPos[TEXT_ALIGN_BOTTOMRIGHT]["Y"]	= $RealPos[1]["Y"];
222
+        $RealPos[TEXT_ALIGN_TOPLEFT]["X"]		= $RealPos[3]["X"];	$RealPos[TEXT_ALIGN_TOPLEFT]["Y"]	= $RealPos[3]["Y"];
223
+        $RealPos[TEXT_ALIGN_TOPRIGHT]["X"]		= $RealPos[2]["X"];	$RealPos[TEXT_ALIGN_TOPRIGHT]["Y"]	= $RealPos[2]["Y"];
224
+        $RealPos[TEXT_ALIGN_BOTTOMMIDDLE]["X"]	= ($RealPos[1]["X"]-$RealPos[0]["X"])/2+$RealPos[0]["X"];	$RealPos[TEXT_ALIGN_BOTTOMMIDDLE]["Y"]	= ($RealPos[0]["Y"]-$RealPos[1]["Y"])/2+$RealPos[1]["Y"];
225
+        $RealPos[TEXT_ALIGN_TOPMIDDLE]["X"]	= ($RealPos[2]["X"]-$RealPos[3]["X"])/2+$RealPos[3]["X"];	$RealPos[TEXT_ALIGN_TOPMIDDLE]["Y"]	= ($RealPos[3]["Y"]-$RealPos[2]["Y"])/2+$RealPos[2]["Y"];
226
+        $RealPos[TEXT_ALIGN_MIDDLELEFT]["X"]	= ($RealPos[0]["X"]-$RealPos[3]["X"])/2+$RealPos[3]["X"];	$RealPos[TEXT_ALIGN_MIDDLELEFT]["Y"]	= ($RealPos[0]["Y"]-$RealPos[3]["Y"])/2+$RealPos[3]["Y"];
227
+        $RealPos[TEXT_ALIGN_MIDDLERIGHT]["X"]	= ($RealPos[1]["X"]-$RealPos[2]["X"])/2+$RealPos[2]["X"];	$RealPos[TEXT_ALIGN_MIDDLERIGHT]["Y"]	= ($RealPos[1]["Y"]-$RealPos[2]["Y"])/2+$RealPos[2]["Y"];
228
+        $RealPos[TEXT_ALIGN_MIDDLEMIDDLE]["X"]	= ($RealPos[1]["X"]-$RealPos[3]["X"])/2+$RealPos[3]["X"];	$RealPos[TEXT_ALIGN_MIDDLEMIDDLE]["Y"]	= ($RealPos[0]["Y"]-$RealPos[2]["Y"])/2+$RealPos[2]["Y"];
229
+
230
+        return($RealPos);
231 231
     }
232 232
 
233
-   /* Set current font properties */
234
-   function setFontProperties($Format="")
233
+    /* Set current font properties */
234
+    function setFontProperties($Format="")
235 235
     {
236
-     $R		= isset($Format["R"]) ? $Format["R"] : -1;
237
-     $G		= isset($Format["G"]) ? $Format["G"] : -1;
238
-     $B		= isset($Format["B"]) ? $Format["B"] : -1;
239
-     $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
240
-     $FontName	= isset($Format["FontName"]) ? $Format["FontName"] : NULL;
241
-     $FontSize	= isset($Format["FontSize"]) ? $Format["FontSize"] : NULL;
242
-
243
-     if ( $R != -1)       {  $this->FontColorR = $R; }
244
-     if ( $G != -1)       {  $this->FontColorG = $G; }
245
-     if ( $B != -1)       {  $this->FontColorB = $B; }
246
-     if ( $Alpha != NULL) {  $this->FontColorA = $Alpha; }
247
-
248
-     if ( $FontName != NULL  )
249
-      $this->FontName = $FontName;
236
+        $R		= isset($Format["R"]) ? $Format["R"] : -1;
237
+        $G		= isset($Format["G"]) ? $Format["G"] : -1;
238
+        $B		= isset($Format["B"]) ? $Format["B"] : -1;
239
+        $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
240
+        $FontName	= isset($Format["FontName"]) ? $Format["FontName"] : NULL;
241
+        $FontSize	= isset($Format["FontSize"]) ? $Format["FontSize"] : NULL;
242
+
243
+        if ( $R != -1)       {  $this->FontColorR = $R; }
244
+        if ( $G != -1)       {  $this->FontColorG = $G; }
245
+        if ( $B != -1)       {  $this->FontColorB = $B; }
246
+        if ( $Alpha != NULL) {  $this->FontColorA = $Alpha; }
247
+
248
+        if ( $FontName != NULL  )
249
+        $this->FontName = $FontName;
250 250
  
251
-     if ( $FontSize != NULL  )
252
-      $this->FontSize = $FontSize;
251
+        if ( $FontSize != NULL  )
252
+        $this->FontSize = $FontSize;
253 253
     }
254 254
 
255
-   /* Returns the 1st decimal values (used to correct AA bugs) */
256
-   function getFirstDecimal($Value)
255
+    /* Returns the 1st decimal values (used to correct AA bugs) */
256
+    function getFirstDecimal($Value)
257 257
     {
258
-     $Values = preg_split("/\./",$Value);
259
-     if ( isset($Values[1]) ) { return(substr($Values[1],0,1)); } else { return(0); }
258
+        $Values = preg_split("/\./",$Value);
259
+        if ( isset($Values[1]) ) { return(substr($Values[1],0,1)); } else { return(0); }
260 260
     }
261 261
 
262
-   /* Attach a dataset to your pChart Object */
263
-   function setDataSet(&$DataSet)
262
+    /* Attach a dataset to your pChart Object */
263
+    function setDataSet(&$DataSet)
264 264
     { $this->DataSet = $DataSet; }
265 265
 
266
-   /* Print attached dataset contents to STDOUT */
267
-   function printDataSet()
266
+    /* Print attached dataset contents to STDOUT */
267
+    function printDataSet()
268 268
     { print_r($this->DataSet); }
269 269
 
270
-   /* Initialise the image map methods */
271
-   function initialiseImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp")
270
+    /* Initialise the image map methods */
271
+    function initialiseImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp")
272 272
     {
273
-     $this->ImageMapIndex 		= $Name;
274
-     $this->ImageMapStorageMode		= $StorageMode;
275
-
276
-     if ($StorageMode == IMAGE_MAP_STORAGE_SESSION)
277
-      {
278
-       if(!isset($_SESSION)) { session_start(); }
279
-       $_SESSION[$this->ImageMapIndex]    = NULL;
280
-      }
281
-     elseif($StorageMode == IMAGE_MAP_STORAGE_FILE)
282
-      {
283
-       $this->ImageMapFileName 		= $UniqueID;
284
-       $this->ImageMapStorageFolder	= $StorageFolder;
285
-
286
-       if (file_exists($StorageFolder."/".$UniqueID.".map")) { unlink($StorageFolder."/".$UniqueID.".map"); }
287
-      }
273
+        $this->ImageMapIndex 		= $Name;
274
+        $this->ImageMapStorageMode		= $StorageMode;
275
+
276
+        if ($StorageMode == IMAGE_MAP_STORAGE_SESSION)
277
+        {
278
+        if(!isset($_SESSION)) { session_start(); }
279
+        $_SESSION[$this->ImageMapIndex]    = NULL;
280
+        }
281
+        elseif($StorageMode == IMAGE_MAP_STORAGE_FILE)
282
+        {
283
+        $this->ImageMapFileName 		= $UniqueID;
284
+        $this->ImageMapStorageFolder	= $StorageFolder;
285
+
286
+        if (file_exists($StorageFolder."/".$UniqueID.".map")) { unlink($StorageFolder."/".$UniqueID.".map"); }
287
+        }
288 288
     }
289 289
 
290
-   /* Add a zone to the image map */
291
-   function addToImageMap($Type,$Plots,$Color=NULL,$Title=NULL,$Message=NULL,$HTMLEncode=FALSE)
290
+    /* Add a zone to the image map */
291
+    function addToImageMap($Type,$Plots,$Color=NULL,$Title=NULL,$Message=NULL,$HTMLEncode=FALSE)
292 292
     {
293
-     if ( $this->ImageMapStorageMode == NULL ) { $this->initialiseImageMap(); }
294
-
295
-     /* Encode the characters in the imagemap in HTML standards */
296
-     $Title   = str_replace("&#8364;","\u20AC",$Title);
297
-     $Title   = htmlentities($Title,ENT_QUOTES,"ISO-8859-15");
298
-     if ( $HTMLEncode )
299
-      {
300
-       $Message = htmlentities($Message,ENT_QUOTES,"ISO-8859-15");
301
-       $Message = str_replace("&lt;","<",$Message);
302
-       $Message = str_replace("&gt;",">",$Message);
303
-      }
304
-
305
-     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
306
-      {
307
-       if(!isset($_SESSION)) { $this->initialiseImageMap(); }
308
-       $_SESSION[$this->ImageMapIndex][] = array($Type,$Plots,$Color,$Title,$Message);
309
-      }
310
-     elseif($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE)
311
-      {
312
-       $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'a');
313
-       fwrite($Handle, $Type.IMAGE_MAP_DELIMITER.$Plots.IMAGE_MAP_DELIMITER.$Color.IMAGE_MAP_DELIMITER.$Title.IMAGE_MAP_DELIMITER.$Message."\r\n");
314
-       fclose($Handle);
315
-      }
293
+        if ( $this->ImageMapStorageMode == NULL ) { $this->initialiseImageMap(); }
294
+
295
+        /* Encode the characters in the imagemap in HTML standards */
296
+        $Title   = str_replace("&#8364;","\u20AC",$Title);
297
+        $Title   = htmlentities($Title,ENT_QUOTES,"ISO-8859-15");
298
+        if ( $HTMLEncode )
299
+        {
300
+        $Message = htmlentities($Message,ENT_QUOTES,"ISO-8859-15");
301
+        $Message = str_replace("&lt;","<",$Message);
302
+        $Message = str_replace("&gt;",">",$Message);
303
+        }
304
+
305
+        if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
306
+        {
307
+        if(!isset($_SESSION)) { $this->initialiseImageMap(); }
308
+        $_SESSION[$this->ImageMapIndex][] = array($Type,$Plots,$Color,$Title,$Message);
309
+        }
310
+        elseif($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE)
311
+        {
312
+        $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'a');
313
+        fwrite($Handle, $Type.IMAGE_MAP_DELIMITER.$Plots.IMAGE_MAP_DELIMITER.$Color.IMAGE_MAP_DELIMITER.$Title.IMAGE_MAP_DELIMITER.$Message."\r\n");
314
+        fclose($Handle);
315
+        }
316 316
     }
317 317
 
318
-   /* Remove VOID values from an imagemap custom values array */
319
-   function removeVOIDFromArray($SerieName, $Values)
318
+    /* Remove VOID values from an imagemap custom values array */
319
+    function removeVOIDFromArray($SerieName, $Values)
320 320
     {
321
-     if ( !isset($this->DataSet->Data["Series"][$SerieName]) ) { return(-1); }
321
+        if ( !isset($this->DataSet->Data["Series"][$SerieName]) ) { return(-1); }
322 322
 
323
-     $Result = "";
324
-     foreach($this->DataSet->Data["Series"][$SerieName]["Data"] as $Key => $Value)
325
-      { if ( $Value != VOID && isset($Values[$Key]) ) { $Result[] = $Values[$Key]; } }
326
-     return($Result);
323
+        $Result = "";
324
+        foreach($this->DataSet->Data["Series"][$SerieName]["Data"] as $Key => $Value)
325
+        { if ( $Value != VOID && isset($Values[$Key]) ) { $Result[] = $Values[$Key]; } }
326
+        return($Result);
327 327
     }
328 328
 
329
-   /* Replace the title of one image map serie */
330
-   function replaceImageMapTitle($OldTitle, $NewTitle)
329
+    /* Replace the title of one image map serie */
330
+    function replaceImageMapTitle($OldTitle, $NewTitle)
331 331
     {
332
-     if ( $this->ImageMapStorageMode == NULL ) { return(-1); }
332
+        if ( $this->ImageMapStorageMode == NULL ) { return(-1); }
333 333
 
334
-     if ( is_array($NewTitle) ) { $NewTitle = $this->removeVOIDFromArray($OldTitle, $NewTitle); }
334
+        if ( is_array($NewTitle) ) { $NewTitle = $this->removeVOIDFromArray($OldTitle, $NewTitle); }
335 335
  
336
-     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
337
-      {
338
-       if(!isset($_SESSION)) { return(-1); }
339
-       if ( is_array($NewTitle) )
336
+        if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
337
+        {
338
+        if(!isset($_SESSION)) { return(-1); }
339
+        if ( is_array($NewTitle) )
340 340
         { $ID = 0; foreach($_SESSION[$this->ImageMapIndex] as $Key => $Settings) { if ( $Settings[3] == $OldTitle && isset($NewTitle[$ID])) { $_SESSION[$this->ImageMapIndex][$Key][3] = $NewTitle[$ID]; $ID++; } } }
341
-       else
341
+        else
342 342
         { foreach($_SESSION[$this->ImageMapIndex] as $Key => $Settings) { if ( $Settings[3] == $OldTitle ) { $_SESSION[$this->ImageMapIndex][$Key][3] = $NewTitle; } } }
343
-      }
344
-     elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE )
345
-      {
346
-       $TempArray = "";
347
-       $Handle    = @fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", "r");
348
-       if ($Handle)
343
+        }
344
+        elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE )
345
+        {
346
+        $TempArray = "";
347
+        $Handle    = @fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", "r");
348
+        if ($Handle)
349 349
         {
350
-         while (($Buffer = fgets($Handle, 4096)) !== false)
351
-          {
352
-           $Fields      = split(IMAGE_MAP_DELIMITER,str_replace(array(chr(10),chr(13)),"",$Buffer));
353
-           $TempArray[] = array($Fields[0],$Fields[1],$Fields[2],$Fields[3],$Fields[4]);
354
-          }
355
-         fclose($Handle);
356
-
357
-         if ( is_array($NewTitle) )
358
-          { $ID = 0; foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $OldTitle && isset($NewTitle[$ID]) ) { $TempArray[$Key][3] = $NewTitle[$ID]; $ID++; } } }
359
-         else
360
-          { foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $OldTitle ) { $TempArray[$Key][3] = $NewTitle; } } }
361
-
362
-         $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'w');
363
-         foreach($TempArray as $Key => $Settings)
364
-          { fwrite($Handle, $Settings[0].IMAGE_MAP_DELIMITER.$Settings[1].IMAGE_MAP_DELIMITER.$Settings[2].IMAGE_MAP_DELIMITER.$Settings[3].IMAGE_MAP_DELIMITER.$Settings[4]."\r\n"); }
365
-         fclose($Handle);
350
+            while (($Buffer = fgets($Handle, 4096)) !== false)
351
+            {
352
+            $Fields      = split(IMAGE_MAP_DELIMITER,str_replace(array(chr(10),chr(13)),"",$Buffer));
353
+            $TempArray[] = array($Fields[0],$Fields[1],$Fields[2],$Fields[3],$Fields[4]);
354
+            }
355
+            fclose($Handle);
356
+
357
+            if ( is_array($NewTitle) )
358
+            { $ID = 0; foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $OldTitle && isset($NewTitle[$ID]) ) { $TempArray[$Key][3] = $NewTitle[$ID]; $ID++; } } }
359
+            else
360
+            { foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $OldTitle ) { $TempArray[$Key][3] = $NewTitle; } } }
361
+
362
+            $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'w');
363
+            foreach($TempArray as $Key => $Settings)
364
+            { fwrite($Handle, $Settings[0].IMAGE_MAP_DELIMITER.$Settings[1].IMAGE_MAP_DELIMITER.$Settings[2].IMAGE_MAP_DELIMITER.$Settings[3].IMAGE_MAP_DELIMITER.$Settings[4]."\r\n"); }
365
+            fclose($Handle);
366
+        }
366 367
         }
367
-      }
368 368
     }
369 369
 
370
-   /* Replace the values of the image map contents */
371
-   function replaceImageMapValues($Title, $Values)
370
+    /* Replace the values of the image map contents */
371
+    function replaceImageMapValues($Title, $Values)
372 372
     {
373
-     if ( $this->ImageMapStorageMode == NULL ) { return(-1); }
374
-
375
-     $Values = $this->removeVOIDFromArray($Title, $Values);
376
-     $ID = 0; 
377
-     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
378
-      {
379
-       if(!isset($_SESSION)) { return(-1); }
380
-       foreach($_SESSION[$this->ImageMapIndex] as $Key => $Settings) { if ( $Settings[3] == $Title ) { if ( isset($Values[$ID]) ) { $_SESSION[$this->ImageMapIndex][$Key][4] = $Values[$ID]; } $ID++; } }
381
-      }
382
-     elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE )
383
-      {
384
-       $TempArray = "";
385
-       $Handle    = @fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", "r");
386
-       if ($Handle)
373
+        if ( $this->ImageMapStorageMode == NULL ) { return(-1); }
374
+
375
+        $Values = $this->removeVOIDFromArray($Title, $Values);
376
+        $ID = 0; 
377
+        if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
378
+        {
379
+        if(!isset($_SESSION)) { return(-1); }
380
+        foreach($_SESSION[$this->ImageMapIndex] as $Key => $Settings) { if ( $Settings[3] == $Title ) { if ( isset($Values[$ID]) ) { $_SESSION[$this->ImageMapIndex][$Key][4] = $Values[$ID]; } $ID++; } }
381
+        }
382
+        elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE )
387 383
         {
388
-         while (($Buffer = fgets($Handle, 4096)) !== false)
389
-          {
390
-           $Fields      = split(IMAGE_MAP_DELIMITER,str_replace(array(chr(10),chr(13)),"",$Buffer));
391
-           $TempArray[] = array($Fields[0],$Fields[1],$Fields[2],$Fields[3],$Fields[4]);
392
-          }
393
-         fclose($Handle);
394
-
395
-         foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $Title ) { if ( isset($Values[$ID]) ) { $TempArray[$Key][4] = $Values[$ID]; } $ID++; } }
396
-
397
-         $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'w');
398
-         foreach($TempArray as $Key => $Settings)
399
-          { fwrite($Handle, $Settings[0].IMAGE_MAP_DELIMITER.$Settings[1].IMAGE_MAP_DELIMITER.$Settings[2].IMAGE_MAP_DELIMITER.$Settings[3].IMAGE_MAP_DELIMITER.$Settings[4]."\r\n"); }
400
-         fclose($Handle);
384
+        $TempArray = "";
385
+        $Handle    = @fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", "r");
386
+        if ($Handle)
387
+        {
388
+            while (($Buffer = fgets($Handle, 4096)) !== false)
389
+            {
390
+            $Fields      = split(IMAGE_MAP_DELIMITER,str_replace(array(chr(10),chr(13)),"",$Buffer));
391
+            $TempArray[] = array($Fields[0],$Fields[1],$Fields[2],$Fields[3],$Fields[4]);
392
+            }
393
+            fclose($Handle);
394
+
395
+            foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $Title ) { if ( isset($Values[$ID]) ) { $TempArray[$Key][4] = $Values[$ID]; } $ID++; } }
396
+
397
+            $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'w');
398
+            foreach($TempArray as $Key => $Settings)
399
+            { fwrite($Handle, $Settings[0].IMAGE_MAP_DELIMITER.$Settings[1].IMAGE_MAP_DELIMITER.$Settings[2].IMAGE_MAP_DELIMITER.$Settings[3].IMAGE_MAP_DELIMITER.$Settings[4]."\r\n"); }
400
+            fclose($Handle);
401
+        }
401 402
         }
402
-      }
403 403
     }
404 404
 
405
-   /* Dump the image map */
406
-   function dumpImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp")
405
+    /* Dump the image map */
406
+    function dumpImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp")
407 407
     {
408
-     $this->ImageMapIndex 		= $Name;
409
-     $this->ImageMapStorageMode		= $StorageMode;
408
+        $this->ImageMapIndex 		= $Name;
409
+        $this->ImageMapStorageMode		= $StorageMode;
410 410
 
411
-     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
412
-      {
413
-       if(!isset($_SESSION)) { session_start(); }
414
-       if ( $_SESSION[$Name] != NULL )
411
+        if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
412
+        {
413
+        if(!isset($_SESSION)) { session_start(); }
414
+        if ( $_SESSION[$Name] != NULL )
415 415
         {
416
-         foreach($_SESSION[$Name] as $Key => $Params)
417
-          { echo $Params[0].IMAGE_MAP_DELIMITER.$Params[1].IMAGE_MAP_DELIMITER.$Params[2].IMAGE_MAP_DELIMITER.$Params[3].IMAGE_MAP_DELIMITER.$Params[4]."\r\n"; }
416
+            foreach($_SESSION[$Name] as $Key => $Params)
417
+            { echo $Params[0].IMAGE_MAP_DELIMITER.$Params[1].IMAGE_MAP_DELIMITER.$Params[2].IMAGE_MAP_DELIMITER.$Params[3].IMAGE_MAP_DELIMITER.$Params[4]."\r\n"; }
418 418
         }
419
-      }
420
-     elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE )
421
-      {
422
-       if (file_exists($StorageFolder."/".$UniqueID.".map"))
419
+        }
420
+        elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE )
421
+        {
422
+        if (file_exists($StorageFolder."/".$UniqueID.".map"))
423 423
         {
424
-         $Handle = @fopen($StorageFolder."/".$UniqueID.".map", "r");
425
-         if ($Handle) { while (($Buffer = fgets($Handle, 4096)) !== false) { echo $Buffer; } }
426
-         fclose($Handle);
424
+            $Handle = @fopen($StorageFolder."/".$UniqueID.".map", "r");
425
+            if ($Handle) { while (($Buffer = fgets($Handle, 4096)) !== false) { echo $Buffer; } }
426
+            fclose($Handle);
427 427
 
428
-         if ( $this->ImageMapAutoDelete ) { unlink($StorageFolder."/".$UniqueID.".map"); }
428
+            if ( $this->ImageMapAutoDelete ) { unlink($StorageFolder."/".$UniqueID.".map"); }
429
+        }
429 430
         }
430
-      }
431 431
 
432
-     /* When the image map is returned to the client, the script ends */
433
-     exit();
432
+        /* When the image map is returned to the client, the script ends */
433
+        exit();
434 434
     }
435 435
 
436
-   /* Return the HTML converted color from the RGB composite values */
437
-   function toHTMLColor($R,$G,$B)
436
+    /* Return the HTML converted color from the RGB composite values */
437
+    function toHTMLColor($R,$G,$B)
438 438
     {
439
-     $R=intval($R); $G=intval($G); $B=intval($B);
440
-     $R=dechex($R<0?0:($R>255?255:$R)); $G=dechex($G<0?0:($G>255?255:$G));$B=dechex($B<0?0:($B>255?255:$B));
441
-     $Color="#".(strlen($R) < 2?'0':'').$R; $Color.=(strlen($G) < 2?'0':'').$G; $Color.= (strlen($B) < 2?'0':'').$B;
442
-     return($Color);
439
+        $R=intval($R); $G=intval($G); $B=intval($B);
440
+        $R=dechex($R<0?0:($R>255?255:$R)); $G=dechex($G<0?0:($G>255?255:$G));$B=dechex($B<0?0:($B>255?255:$B));
441
+        $Color="#".(strlen($R) < 2?'0':'').$R; $Color.=(strlen($G) < 2?'0':'').$G; $Color.= (strlen($B) < 2?'0':'').$B;
442
+        return($Color);
443 443
     }
444 444
 
445
-   /* Reverse an array of points */
446
-   function reversePlots($Plots)
445
+    /* Reverse an array of points */
446
+    function reversePlots($Plots)
447 447
     {
448
-     $Result = "";
449
-     for($i=count($Plots)-2;$i>=0;$i=$i-2) { $Result[] = $Plots[$i]; $Result[] = $Plots[$i+1]; }
450
-     return($Result);
448
+        $Result = "";
449
+        for($i=count($Plots)-2;$i>=0;$i=$i-2) { $Result[] = $Plots[$i]; $Result[] = $Plots[$i+1]; }
450
+        return($Result);
451 451
     }
452 452
 
453
-   /* Mirror Effect */
454
-   function drawAreaMirror($X,$Y,$Width,$Height,$Format="")
453
+    /* Mirror Effect */
454
+    function drawAreaMirror($X,$Y,$Width,$Height,$Format="")
455 455
     {
456
-     $StartAlpha	= isset($Format["StartAlpha"]) ? $Format["StartAlpha"] : 80;
457
-     $EndAlpha		= isset($Format["EndAlpha"]) ? $Format["EndAlpha"] : 0;
456
+        $StartAlpha	= isset($Format["StartAlpha"]) ? $Format["StartAlpha"] : 80;
457
+        $EndAlpha		= isset($Format["EndAlpha"]) ? $Format["EndAlpha"] : 0;
458 458
 
459
-     $AlphaStep = ($StartAlpha-$EndAlpha)/$Height;
459
+        $AlphaStep = ($StartAlpha-$EndAlpha)/$Height;
460 460
 
461
-     $Picture = imagecreatetruecolor($this->XSize,$this->YSize);
462
-     imagecopy($Picture,$this->Picture,0,0,0,0,$this->XSize,$this->YSize);
461
+        $Picture = imagecreatetruecolor($this->XSize,$this->YSize);
462
+        imagecopy($Picture,$this->Picture,0,0,0,0,$this->XSize,$this->YSize);
463 463
      
464
-     for($i=1;$i<=$Height;$i++)
465
-      {
466
-       if ( $Y+($i-1) < $this->YSize && $Y-$i > 0 ) { imagecopymerge($Picture,$this->Picture,$X,$Y+($i-1),$X,$Y-$i,$Width,1,$StartAlpha-$AlphaStep*$i); }
467
-      }
464
+        for($i=1;$i<=$Height;$i++)
465
+        {
466
+        if ( $Y+($i-1) < $this->YSize && $Y-$i > 0 ) { imagecopymerge($Picture,$this->Picture,$X,$Y+($i-1),$X,$Y-$i,$Width,1,$StartAlpha-$AlphaStep*$i); }
467
+        }
468 468
 
469
-     imagecopy($this->Picture,$Picture,0,0,0,0,$this->XSize,$this->YSize);
469
+        imagecopy($this->Picture,$Picture,0,0,0,0,$this->XSize,$this->YSize);
470
+    }
470 471
     }
471
-  }
472 472
 ?>
473 473
\ No newline at end of file
Please login to merge, or discard this patch.
sites/default/boinc/modules/boincstats/includes/pchart/class/pPie.class.php 1 patch
Indentation   +1208 added lines, -1208 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pPie - class to draw pie charts
4 4
 
5 5
      Version     : 2.1.3
@@ -13,1488 +13,1488 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- /* Class return codes */
17
- define("PIE_NO_ABSCISSA"	, 140001);
18
- define("PIE_NO_DATASERIE"	, 140002);
19
- define("PIE_SUMISNULL"		, 140003);
20
- define("PIE_RENDERED"		, 140000);
16
+    /* Class return codes */
17
+    define("PIE_NO_ABSCISSA"	, 140001);
18
+    define("PIE_NO_DATASERIE"	, 140002);
19
+    define("PIE_SUMISNULL"		, 140003);
20
+    define("PIE_RENDERED"		, 140000);
21 21
 
22
- define("PIE_LABEL_COLOR_AUTO"	, 140010);
23
- define("PIE_LABEL_COLOR_MANUAL", 140011);
22
+    define("PIE_LABEL_COLOR_AUTO"	, 140010);
23
+    define("PIE_LABEL_COLOR_MANUAL", 140011);
24 24
 
25
- define("PIE_VALUE_NATURAL"	, 140020);
26
- define("PIE_VALUE_PERCENTAGE"	, 140021);
25
+    define("PIE_VALUE_NATURAL"	, 140020);
26
+    define("PIE_VALUE_PERCENTAGE"	, 140021);
27 27
 
28
- define("PIE_VALUE_INSIDE"      , 140030);
29
- define("PIE_VALUE_OUTSIDE"     , 140031);
28
+    define("PIE_VALUE_INSIDE"      , 140030);
29
+    define("PIE_VALUE_OUTSIDE"     , 140031);
30 30
 
31
- /* pPie class definition */
32
- class pPie
33
-  {
34
-   var $pChartObject;
35
-   var $pDataObject;
36
-   var $LabelPos = "" ;
31
+    /* pPie class definition */
32
+    class pPie
33
+    {
34
+    var $pChartObject;
35
+    var $pDataObject;
36
+    var $LabelPos = "" ;
37 37
 
38
-   /* Class creator */
39
-   function pPie($Object,$pDataObject)
38
+    /* Class creator */
39
+    function pPie($Object,$pDataObject)
40 40
     {
41
-     /* Cache the pChart object reference */
42
-     $this->pChartObject = $Object;
41
+        /* Cache the pChart object reference */
42
+        $this->pChartObject = $Object;
43 43
 
44
-     /* Cache the pData object reference */
45
-     $this->pDataObject  = $pDataObject;
44
+        /* Cache the pData object reference */
45
+        $this->pDataObject  = $pDataObject;
46 46
     }
47 47
 
48
-   /* Draw a pie chart */
49
-   function draw2DPie($X,$Y,$Format="")
48
+    /* Draw a pie chart */
49
+    function draw2DPie($X,$Y,$Format="")
50 50
     {
51
-     $Radius		= isset($Format["Radius"]) ? $Format["Radius"] : 60;
52
-     $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
53
-     $DataGapAngle	= isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 0;
54
-     $DataGapRadius	= isset($Format["DataGapRadius"]) ? $Format["DataGapRadius"] : 0;
55
-     $SecondPass	= isset($Format["SecondPass"]) ? $Format["SecondPass"] : TRUE;
56
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
57
-     $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
58
-     $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
59
-     $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
60
-     $Shadow		= isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
61
-     $DrawLabels	= isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : FALSE;
62
-     $LabelStacked	= isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
63
-     $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
64
-     $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
65
-     $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
66
-     $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
67
-     $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
68
-     $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : NULL;
69
-     $ValuePosition	= isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_OUTSIDE;
70
-     $ValuePadding	= isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 15;
71
-     $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
72
-     $ValueR		= isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
73
-     $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
74
-     $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
75
-     $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
76
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
77
-
78
-     /* Data Processing */
79
-     $Data    = $this->pDataObject->getData();
80
-     $Palette = $this->pDataObject->getPalette();
81
-
82
-     /* Do we have an abscissa serie defined? */
83
-     if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
84
-
85
-     /* Try to find the data serie */
86
-     $DataSerie = "";
87
-     foreach ($Data["Series"] as $SerieName => $SerieData)
88
-      { if ( $SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
89
-
90
-     /* Do we have data to compute? */
91
-     if ( $DataSerie == "" ) { return(PIE_NO_DATASERIE); }
92
-
93
-     /* Remove unused data */
94
-     list($Data,$Palette) = $this->clean0Values($Data,$Palette,$DataSerie,$Data["Abscissa"]);
95
-
96
-     /* Compute the pie sum */
97
-     $SerieSum = $this->pDataObject->getSum($DataSerie);
98
-
99
-     /* Do we have data to draw? */
100
-     if ( $SerieSum == 0 ) { return(PIE_SUMISNULL); }
101
-
102
-     /* Dump the real number of data to draw */
103
-     $Values = "";
104
-     foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
105
-      { if ($Value != 0) { $Values[] = $Value; } }
106
-
107
-     /* Compute the wasted angular space between series */
108
-     if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = count($Values) * $DataGapAngle; }
109
-
110
-     /* Compute the scale */
111
-     $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
112
-
113
-     $RestoreShadow = $this->pChartObject->Shadow;
114
-     if ( $this->pChartObject->Shadow )
115
-      {
116
-       $this->pChartObject->Shadow = FALSE;
117
-
118
-       $ShadowFormat = $Format; $ShadowFormat["Shadow"] = TRUE;
119
-       $this->draw2DPie($X+$this->pChartObject->ShadowX,$Y+$this->pChartObject->ShadowY,$ShadowFormat);
120
-      }
121
-
122
-     /* Draw the polygon pie elements */
123
-     $Step = 360 / (2 * PI * $Radius);
124
-     $Offset = 0; $ID = 0;
125
-     foreach($Values as $Key => $Value)
126
-      {
127
-       if ( $Shadow )
51
+        $Radius		= isset($Format["Radius"]) ? $Format["Radius"] : 60;
52
+        $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
53
+        $DataGapAngle	= isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 0;
54
+        $DataGapRadius	= isset($Format["DataGapRadius"]) ? $Format["DataGapRadius"] : 0;
55
+        $SecondPass	= isset($Format["SecondPass"]) ? $Format["SecondPass"] : TRUE;
56
+        $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
57
+        $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
58
+        $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
59
+        $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
60
+        $Shadow		= isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
61
+        $DrawLabels	= isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : FALSE;
62
+        $LabelStacked	= isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
63
+        $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
64
+        $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
65
+        $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
66
+        $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
67
+        $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
68
+        $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : NULL;
69
+        $ValuePosition	= isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_OUTSIDE;
70
+        $ValuePadding	= isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 15;
71
+        $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
72
+        $ValueR		= isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
73
+        $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
74
+        $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
75
+        $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
76
+        $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
77
+
78
+        /* Data Processing */
79
+        $Data    = $this->pDataObject->getData();
80
+        $Palette = $this->pDataObject->getPalette();
81
+
82
+        /* Do we have an abscissa serie defined? */
83
+        if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
84
+
85
+        /* Try to find the data serie */
86
+        $DataSerie = "";
87
+        foreach ($Data["Series"] as $SerieName => $SerieData)
88
+        { if ( $SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
89
+
90
+        /* Do we have data to compute? */
91
+        if ( $DataSerie == "" ) { return(PIE_NO_DATASERIE); }
92
+
93
+        /* Remove unused data */
94
+        list($Data,$Palette) = $this->clean0Values($Data,$Palette,$DataSerie,$Data["Abscissa"]);
95
+
96
+        /* Compute the pie sum */
97
+        $SerieSum = $this->pDataObject->getSum($DataSerie);
98
+
99
+        /* Do we have data to draw? */
100
+        if ( $SerieSum == 0 ) { return(PIE_SUMISNULL); }
101
+
102
+        /* Dump the real number of data to draw */
103
+        $Values = "";
104
+        foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
105
+        { if ($Value != 0) { $Values[] = $Value; } }
106
+
107
+        /* Compute the wasted angular space between series */
108
+        if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = count($Values) * $DataGapAngle; }
109
+
110
+        /* Compute the scale */
111
+        $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
112
+
113
+        $RestoreShadow = $this->pChartObject->Shadow;
114
+        if ( $this->pChartObject->Shadow )
115
+        {
116
+        $this->pChartObject->Shadow = FALSE;
117
+
118
+        $ShadowFormat = $Format; $ShadowFormat["Shadow"] = TRUE;
119
+        $this->draw2DPie($X+$this->pChartObject->ShadowX,$Y+$this->pChartObject->ShadowY,$ShadowFormat);
120
+        }
121
+
122
+        /* Draw the polygon pie elements */
123
+        $Step = 360 / (2 * PI * $Radius);
124
+        $Offset = 0; $ID = 0;
125
+        foreach($Values as $Key => $Value)
126
+        {
127
+        if ( $Shadow )
128 128
         $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
129
-       else
129
+        else
130 130
         {
131
-         if ( !isset($Palette[$ID]["R"]) ) { $Color = $this->pChartObject->getRandomColor(); $Palette[$ID] = $Color; $this->pDataObject->savePalette($ID,$Color); }
132
-         $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
131
+            if ( !isset($Palette[$ID]["R"]) ) { $Color = $this->pChartObject->getRandomColor(); $Palette[$ID] = $Color; $this->pDataObject->savePalette($ID,$Color); }
132
+            $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
133 133
         }
134 134
 
135
-       if ( !$SecondPass && !$Shadow )
135
+        if ( !$SecondPass && !$Shadow )
136 136
         {
137
-         if ( !$Border )
138
-          $Settings["Surrounding"] = 10;
139
-         else
140
-          { $Settings["BorderR"] = $BorderR; $Settings["BorderG"] = $BorderG; $Settings["BorderB"] = $BorderB; }
137
+            if ( !$Border )
138
+            $Settings["Surrounding"] = 10;
139
+            else
140
+            { $Settings["BorderR"] = $BorderR; $Settings["BorderG"] = $BorderG; $Settings["BorderB"] = $BorderB; }
141 141
         }
142 142
 
143
-       $Plots = "";
144
-       $EndAngle = $Offset+($Value*$ScaleFactor); if ( $EndAngle > 360 ) { $EndAngle = 360; }
143
+        $Plots = "";
144
+        $EndAngle = $Offset+($Value*$ScaleFactor); if ( $EndAngle > 360 ) { $EndAngle = 360; }
145 145
 
146
-       $Angle = ($EndAngle - $Offset)/2 + $Offset;
147
-       if ($DataGapAngle == 0)
146
+        $Angle = ($EndAngle - $Offset)/2 + $Offset;
147
+        if ($DataGapAngle == 0)
148 148
         { $X0 = $X; $Y0 = $Y; }
149
-       else
149
+        else
150 150
         {
151
-         $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
152
-         $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius + $Y;
151
+            $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
152
+            $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius + $Y;
153 153
         }
154 154
 
155
-       $Plots[] = $X0; $Plots[] = $Y0;
155
+        $Plots[] = $X0; $Plots[] = $Y0;
156 156
 
157 157
 
158
-       for($i=$Offset;$i<=$EndAngle;$i=$i+$Step)
158
+        for($i=$Offset;$i<=$EndAngle;$i=$i+$Step)
159 159
         {
160
-         $Xc = cos(($i-90)*PI/180) * $Radius + $X;
161
-         $Yc = sin(($i-90)*PI/180) * $Radius + $Y;
160
+            $Xc = cos(($i-90)*PI/180) * $Radius + $X;
161
+            $Yc = sin(($i-90)*PI/180) * $Radius + $Y;
162 162
 
163
-         if ( $SecondPass && ( $i<90 )) { $Yc++; }
164
-         if ( $SecondPass && ( $i>180 && $i<270 )) { $Xc++; }
165
-         if ( $SecondPass && ( $i>=270 )) { $Xc++; $Yc++; }
163
+            if ( $SecondPass && ( $i<90 )) { $Yc++; }
164
+            if ( $SecondPass && ( $i>180 && $i<270 )) { $Xc++; }
165
+            if ( $SecondPass && ( $i>=270 )) { $Xc++; $Yc++; }
166 166
 
167
-         $Plots[] = $Xc; $Plots[] = $Yc;
167
+            $Plots[] = $Xc; $Plots[] = $Yc;
168 168
         }
169 169
 
170
-       $this->pChartObject->drawPolygon($Plots,$Settings);
171
-       if ( $RecordImageMap && !$Shadow ) { $this->pChartObject->addToImageMap("POLY",$this->arraySerialize($Plots),$this->pChartObject->toHTMLColor($Palette[$ID]["R"],$Palette[$ID]["G"],$Palette[$ID]["B"]),$Data["Series"][$Data["Abscissa"]]["Data"][$Key],$Value); }
170
+        $this->pChartObject->drawPolygon($Plots,$Settings);
171
+        if ( $RecordImageMap && !$Shadow ) { $this->pChartObject->addToImageMap("POLY",$this->arraySerialize($Plots),$this->pChartObject->toHTMLColor($Palette[$ID]["R"],$Palette[$ID]["G"],$Palette[$ID]["B"]),$Data["Series"][$Data["Abscissa"]]["Data"][$Key],$Value); }
172 172
 
173
-       if ( $DrawLabels && !$Shadow && !$SecondPass )
173
+        if ( $DrawLabels && !$Shadow && !$SecondPass )
174 174
         {
175
-         if ( $LabelColor == PIE_LABEL_COLOR_AUTO )
176
-          { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);}
177
-         else
178
-          { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
175
+            if ( $LabelColor == PIE_LABEL_COLOR_AUTO )
176
+            { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);}
177
+            else
178
+            { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
179 179
 
180
-         $Angle = ($EndAngle - $Offset)/2 + $Offset;
181
-         $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
182
-         $Yc = sin(($Angle-90)*PI/180) * $Radius + $Y;
180
+            $Angle = ($EndAngle - $Offset)/2 + $Offset;
181
+            $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
182
+            $Yc = sin(($Angle-90)*PI/180) * $Radius + $Y;
183 183
 
184
-         $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
184
+            $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
185 185
 
186
-         if ( $LabelStacked )
187
-          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$Radius);
188
-         else
189
-          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
186
+            if ( $LabelStacked )
187
+            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$Radius);
188
+            else
189
+            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
190 190
         }
191 191
 
192
-       $Offset = $i + $DataGapAngle; $ID++;
193
-      }
192
+        $Offset = $i + $DataGapAngle; $ID++;
193
+        }
194 194
 
195
-     /* Second pass to smooth the angles */
196
-     if ( $SecondPass )
197
-      {
198
-       $Step = 360 / (2 * PI * $Radius);
199
-       $Offset = 0; $ID = 0;
200
-       foreach($Values as $Key => $Value)
195
+        /* Second pass to smooth the angles */
196
+        if ( $SecondPass )
197
+        {
198
+        $Step = 360 / (2 * PI * $Radius);
199
+        $Offset = 0; $ID = 0;
200
+        foreach($Values as $Key => $Value)
201 201
         {
202
-         $FirstPoint = TRUE;
203
-         if ( $Shadow )
204
-          $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
205
-         else
206
-          {
207
-           if ( $Border )
202
+            $FirstPoint = TRUE;
203
+            if ( $Shadow )
204
+            $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
205
+            else
206
+            {
207
+            if ( $Border )
208 208
             $Settings = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB);
209
-           else
209
+            else
210 210
             $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
211
-          }
212
-
213
-         $EndAngle = $Offset+($Value*$ScaleFactor); if ( $EndAngle > 360 ) { $EndAngle = 360; }
214
-
215
-         if ($DataGapAngle == 0)
216
-          { $X0 = $X; $Y0 = $Y; }
217
-         else
218
-          {
219
-           $Angle = ($EndAngle - $Offset)/2 + $Offset;
220
-           $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
221
-           $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius + $Y;
222
-          }
223
-         $Plots[] = $X0; $Plots[] = $Y0;
224
-
225
-         for($i=$Offset;$i<=$EndAngle;$i=$i+$Step)
226
-          {
227
-           $Xc = cos(($i-90)*PI/180) * $Radius + $X;
228
-           $Yc = sin(($i-90)*PI/180) * $Radius + $Y;
229
-
230
-           if ( $FirstPoint ) { $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); } { $FirstPoint = FALSE; }
211
+            }
212
+
213
+            $EndAngle = $Offset+($Value*$ScaleFactor); if ( $EndAngle > 360 ) { $EndAngle = 360; }
214
+
215
+            if ($DataGapAngle == 0)
216
+            { $X0 = $X; $Y0 = $Y; }
217
+            else
218
+            {
219
+            $Angle = ($EndAngle - $Offset)/2 + $Offset;
220
+            $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
221
+            $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius + $Y;
222
+            }
223
+            $Plots[] = $X0; $Plots[] = $Y0;
224
+
225
+            for($i=$Offset;$i<=$EndAngle;$i=$i+$Step)
226
+            {
227
+            $Xc = cos(($i-90)*PI/180) * $Radius + $X;
228
+            $Yc = sin(($i-90)*PI/180) * $Radius + $Y;
229
+
230
+            if ( $FirstPoint ) { $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); } { $FirstPoint = FALSE; }
231 231
   
232
-           $this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
233
-          }
234
-         $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings);
232
+            $this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
233
+            }
234
+            $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings);
235 235
 
236
-         if ( $DrawLabels && !$Shadow )
237
-          {
238
-           if ( $LabelColor == PIE_LABEL_COLOR_AUTO )
236
+            if ( $DrawLabels && !$Shadow )
237
+            {
238
+            if ( $LabelColor == PIE_LABEL_COLOR_AUTO )
239 239
             { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);}
240
-           else
240
+            else
241 241
             { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
242 242
 
243
-           $Angle = ($EndAngle - $Offset)/2 + $Offset;
244
-           $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
245
-           $Yc = sin(($Angle-90)*PI/180) * $Radius + $Y;
243
+            $Angle = ($EndAngle - $Offset)/2 + $Offset;
244
+            $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
245
+            $Yc = sin(($Angle-90)*PI/180) * $Radius + $Y;
246 246
 
247
-           $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
247
+            $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
248 248
 
249
-           if ( $LabelStacked )
249
+            if ( $LabelStacked )
250 250
             $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$Radius);
251
-           else
251
+            else
252 252
             $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
253
-          }
253
+            }
254 254
   
255
-         $Offset = $i + $DataGapAngle; $ID++;
255
+            $Offset = $i + $DataGapAngle; $ID++;
256
+        }
256 257
         }
257
-      }
258 258
 
259
-     if ( $WriteValues != NULL && !$Shadow )
260
-      {
261
-       $Step = 360 / (2 * PI * $Radius);
262
-       $Offset = 0; $ID = count($Values)-1;
263
-       $Settings = array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"R"=>$ValueR,"G"=>$ValueG,"B"=>$ValueB,"Alpha"=>$ValueAlpha);
264
-       foreach($Values as $Key => $Value)
259
+        if ( $WriteValues != NULL && !$Shadow )
260
+        {
261
+        $Step = 360 / (2 * PI * $Radius);
262
+        $Offset = 0; $ID = count($Values)-1;
263
+        $Settings = array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"R"=>$ValueR,"G"=>$ValueG,"B"=>$ValueB,"Alpha"=>$ValueAlpha);
264
+        foreach($Values as $Key => $Value)
265 265
         {
266
-         $EndAngle = ($Value*$ScaleFactor) + $Offset; if ( $EndAngle > 360 ) { $EndAngle = 0; }
267
-         $Angle    = ($EndAngle - $Offset)/2 + $Offset;
266
+            $EndAngle = ($Value*$ScaleFactor) + $Offset; if ( $EndAngle > 360 ) { $EndAngle = 0; }
267
+            $Angle    = ($EndAngle - $Offset)/2 + $Offset;
268 268
 
269
-         if ( $ValuePosition == PIE_VALUE_OUTSIDE )
270
-          {
271
-           $Xc = cos(($Angle-90)*PI/180) * ($Radius+$ValuePadding) + $X;
272
-           $Yc = sin(($Angle-90)*PI/180) * ($Radius+$ValuePadding) + $Y;
273
-          }
274
-         else
275
-          {
276
-           $Xc = cos(($Angle-90)*PI/180) * ($Radius)/2 + $X;
277
-           $Yc = sin(($Angle-90)*PI/180) * ($Radius)/2 + $Y;
278
-          }
269
+            if ( $ValuePosition == PIE_VALUE_OUTSIDE )
270
+            {
271
+            $Xc = cos(($Angle-90)*PI/180) * ($Radius+$ValuePadding) + $X;
272
+            $Yc = sin(($Angle-90)*PI/180) * ($Radius+$ValuePadding) + $Y;
273
+            }
274
+            else
275
+            {
276
+            $Xc = cos(($Angle-90)*PI/180) * ($Radius)/2 + $X;
277
+            $Yc = sin(($Angle-90)*PI/180) * ($Radius)/2 + $Y;
278
+            }
279 279
 
280
-         if ( $WriteValues == PIE_VALUE_PERCENTAGE )
281
-          $Display = round(( 100 / $SerieSum ) * $Value,$Precision)."%";
282
-         elseif ( $WriteValues == PIE_VALUE_NATURAL )
283
-          $Display = $Value.$ValueSuffix;
280
+            if ( $WriteValues == PIE_VALUE_PERCENTAGE )
281
+            $Display = round(( 100 / $SerieSum ) * $Value,$Precision)."%";
282
+            elseif ( $WriteValues == PIE_VALUE_NATURAL )
283
+            $Display = $Value.$ValueSuffix;
284 284
 
285
-         $this->pChartObject->drawText($Xc,$Yc,$Display,$Settings);
285
+            $this->pChartObject->drawText($Xc,$Yc,$Display,$Settings);
286 286
 
287
-         $Offset = $EndAngle + $DataGapAngle; $ID--;
287
+            $Offset = $EndAngle + $DataGapAngle; $ID--;
288
+        }
288 289
         }
289
-      }
290 290
 
291
-     if ( $DrawLabels && $LabelStacked ) { $this->writeShiftedLabels(); }
291
+        if ( $DrawLabels && $LabelStacked ) { $this->writeShiftedLabels(); }
292 292
 
293
-     $this->pChartObject->Shadow = $RestoreShadow;
293
+        $this->pChartObject->Shadow = $RestoreShadow;
294 294
 
295
-     return(PIE_RENDERED);
295
+        return(PIE_RENDERED);
296 296
     }
297 297
 
298
-   /* Draw a 3D pie chart */
299
-   function draw3DPie($X,$Y,$Format="")
298
+    /* Draw a 3D pie chart */
299
+    function draw3DPie($X,$Y,$Format="")
300 300
     {
301
-     /* Rendering layout */
302
-     $Radius		= isset($Format["Radius"]) ? $Format["Radius"] : 80;
303
-     $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
304
-     $SkewFactor	= isset($Format["SkewFactor"]) ? $Format["SkewFactor"] : .5;
305
-     $SliceHeight	= isset($Format["SliceHeight"]) ? $Format["SliceHeight"] : 20;
306
-     $DataGapAngle	= isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 0;
307
-     $DataGapRadius	= isset($Format["DataGapRadius"]) ? $Format["DataGapRadius"] : 0;
308
-     $SecondPass	= isset($Format["SecondPass"]) ? $Format["SecondPass"] : TRUE;
309
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
310
-     $Shadow		= isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
311
-     $DrawLabels	= isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : FALSE;
312
-     $LabelStacked	= isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
313
-     $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
314
-     $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
315
-     $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
316
-     $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
317
-     $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
318
-     $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : NULL; //PIE_VALUE_PERCENTAGE
319
-     $ValuePosition	= isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_INSIDE;
320
-     $ValuePadding	= isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 15;
321
-     $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
322
-     $ValueR		= isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
323
-     $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
324
-     $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
325
-     $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
326
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
327
-
328
-     /* Error correction for overlaying rounded corners */
329
-     if ( $SkewFactor < .5 ) { $SkewFactor = .5; }
330
-
331
-     /* Data Processing */
332
-     $Data    = $this->pDataObject->getData();
333
-     $Palette = $this->pDataObject->getPalette();
334
-
335
-     /* Do we have an abscissa serie defined? */
336
-     if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
337
-
338
-     /* Try to find the data serie */
339
-     $DataSerie = "";
340
-     foreach ($Data["Series"] as $SerieName => $SerieData)
341
-      { if ( $SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
342
-
343
-     /* Do we have data to compute? */
344
-     if ( $DataSerie == "" ) { return(PIE_NO_DATASERIE); }
345
-
346
-     /* Remove unused data */
347
-     list($Data,$Palette) = $this->clean0Values($Data,$Palette,$DataSerie,$Data["Abscissa"]);
348
-
349
-     /* Compute the pie sum */
350
-     $SerieSum = $this->pDataObject->getSum($DataSerie);
351
-
352
-     /* Do we have data to draw? */
353
-     if ( $SerieSum == 0 ) { return(PIE_SUMISNULL); }
354
-
355
-     /* Dump the real number of data to draw */
356
-     $Values = "";
357
-     foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
358
-      { if ($Value != 0) { $Values[] = $Value; } }
359
-
360
-     /* Compute the wasted angular space between series */
361
-     if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = count($Values) * $DataGapAngle; }
362
-
363
-     /* Compute the scale */
364
-     $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
365
-
366
-     $RestoreShadow = $this->pChartObject->Shadow;
367
-     if ( $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = FALSE; }
368
-
369
-     /* Draw the polygon pie elements */
370
-     $Step   = 360 / (2 * PI * $Radius);
371
-     $Offset = 360; $ID = count($Values)-1;
372
-     $Values = array_reverse($Values);
373
-     $Slice  = 0; $Slices = ""; $SliceColors = ""; $Visible = ""; $SliceAngle = "";
374
-     foreach($Values as $Key => $Value)
375
-      {
376
-       if ( !isset($Palette[$ID]["R"]) ) { $Color = $this->pChartObject->getRandomColor(); $Palette[$ID] = $Color; $this->pDataObject->savePalette($ID,$Color); }
377
-       $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
378
-
379
-       $SliceColors[$Slice] = $Settings;
380
-
381
-       $StartAngle = $Offset;
382
-       $EndAngle   = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
383
-
384
-       if ( $StartAngle > 180 ) { $Visible[$Slice]["Start"] = TRUE; } else { $Visible[$Slice]["Start"] = TRUE; }
385
-       if ( $EndAngle < 180 )   { $Visible[$Slice]["End"] = FALSE; } else { $Visible[$Slice]["End"] = TRUE; }
386
-
387
-       if ($DataGapAngle == 0)
301
+        /* Rendering layout */
302
+        $Radius		= isset($Format["Radius"]) ? $Format["Radius"] : 80;
303
+        $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
304
+        $SkewFactor	= isset($Format["SkewFactor"]) ? $Format["SkewFactor"] : .5;
305
+        $SliceHeight	= isset($Format["SliceHeight"]) ? $Format["SliceHeight"] : 20;
306
+        $DataGapAngle	= isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 0;
307
+        $DataGapRadius	= isset($Format["DataGapRadius"]) ? $Format["DataGapRadius"] : 0;
308
+        $SecondPass	= isset($Format["SecondPass"]) ? $Format["SecondPass"] : TRUE;
309
+        $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
310
+        $Shadow		= isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
311
+        $DrawLabels	= isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : FALSE;
312
+        $LabelStacked	= isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
313
+        $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
314
+        $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
315
+        $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
316
+        $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
317
+        $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
318
+        $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : NULL; //PIE_VALUE_PERCENTAGE
319
+        $ValuePosition	= isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_INSIDE;
320
+        $ValuePadding	= isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 15;
321
+        $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
322
+        $ValueR		= isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
323
+        $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
324
+        $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
325
+        $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
326
+        $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
327
+
328
+        /* Error correction for overlaying rounded corners */
329
+        if ( $SkewFactor < .5 ) { $SkewFactor = .5; }
330
+
331
+        /* Data Processing */
332
+        $Data    = $this->pDataObject->getData();
333
+        $Palette = $this->pDataObject->getPalette();
334
+
335
+        /* Do we have an abscissa serie defined? */
336
+        if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
337
+
338
+        /* Try to find the data serie */
339
+        $DataSerie = "";
340
+        foreach ($Data["Series"] as $SerieName => $SerieData)
341
+        { if ( $SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
342
+
343
+        /* Do we have data to compute? */
344
+        if ( $DataSerie == "" ) { return(PIE_NO_DATASERIE); }
345
+
346
+        /* Remove unused data */
347
+        list($Data,$Palette) = $this->clean0Values($Data,$Palette,$DataSerie,$Data["Abscissa"]);
348
+
349
+        /* Compute the pie sum */
350
+        $SerieSum = $this->pDataObject->getSum($DataSerie);
351
+
352
+        /* Do we have data to draw? */
353
+        if ( $SerieSum == 0 ) { return(PIE_SUMISNULL); }
354
+
355
+        /* Dump the real number of data to draw */
356
+        $Values = "";
357
+        foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
358
+        { if ($Value != 0) { $Values[] = $Value; } }
359
+
360
+        /* Compute the wasted angular space between series */
361
+        if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = count($Values) * $DataGapAngle; }
362
+
363
+        /* Compute the scale */
364
+        $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
365
+
366
+        $RestoreShadow = $this->pChartObject->Shadow;
367
+        if ( $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = FALSE; }
368
+
369
+        /* Draw the polygon pie elements */
370
+        $Step   = 360 / (2 * PI * $Radius);
371
+        $Offset = 360; $ID = count($Values)-1;
372
+        $Values = array_reverse($Values);
373
+        $Slice  = 0; $Slices = ""; $SliceColors = ""; $Visible = ""; $SliceAngle = "";
374
+        foreach($Values as $Key => $Value)
375
+        {
376
+        if ( !isset($Palette[$ID]["R"]) ) { $Color = $this->pChartObject->getRandomColor(); $Palette[$ID] = $Color; $this->pDataObject->savePalette($ID,$Color); }
377
+        $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
378
+
379
+        $SliceColors[$Slice] = $Settings;
380
+
381
+        $StartAngle = $Offset;
382
+        $EndAngle   = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
383
+
384
+        if ( $StartAngle > 180 ) { $Visible[$Slice]["Start"] = TRUE; } else { $Visible[$Slice]["Start"] = TRUE; }
385
+        if ( $EndAngle < 180 )   { $Visible[$Slice]["End"] = FALSE; } else { $Visible[$Slice]["End"] = TRUE; }
386
+
387
+        if ($DataGapAngle == 0)
388 388
         { $X0 = $X; $Y0 = $Y; }
389
-       else
389
+        else
390 390
         {
391
-         $Angle = ($EndAngle - $Offset)/2 + $Offset;
392
-         $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
393
-         $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius*$SkewFactor + $Y;
391
+            $Angle = ($EndAngle - $Offset)/2 + $Offset;
392
+            $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
393
+            $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius*$SkewFactor + $Y;
394 394
         }
395
-       $Slices[$Slice][] = $X0; $Slices[$Slice][] = $Y0; $SliceAngle[$Slice][] = 0;
395
+        $Slices[$Slice][] = $X0; $Slices[$Slice][] = $Y0; $SliceAngle[$Slice][] = 0;
396 396
 
397
-       for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
397
+        for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
398 398
         {
399
-         $Xc = cos(($i-90)*PI/180) * $Radius + $X;
400
-         $Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y;
399
+            $Xc = cos(($i-90)*PI/180) * $Radius + $X;
400
+            $Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y;
401 401
 
402
-         if ( ($SecondPass || $RestoreShadow ) && ( $i<90 )) { $Yc++; }
403
-         if ( ($SecondPass || $RestoreShadow ) && ( $i>90 && $i<180 )) { $Xc++; }
404
-         if ( ($SecondPass || $RestoreShadow ) && ( $i>180 && $i<270 )) { $Xc++; }
405
-         if ( ($SecondPass || $RestoreShadow ) && ( $i>=270 )) { $Xc++; $Yc++; }
402
+            if ( ($SecondPass || $RestoreShadow ) && ( $i<90 )) { $Yc++; }
403
+            if ( ($SecondPass || $RestoreShadow ) && ( $i>90 && $i<180 )) { $Xc++; }
404
+            if ( ($SecondPass || $RestoreShadow ) && ( $i>180 && $i<270 )) { $Xc++; }
405
+            if ( ($SecondPass || $RestoreShadow ) && ( $i>=270 )) { $Xc++; $Yc++; }
406 406
 
407
-         $Slices[$Slice][] = $Xc; $Slices[$Slice][] = $Yc; $SliceAngle[$Slice][] = $i;
407
+            $Slices[$Slice][] = $Xc; $Slices[$Slice][] = $Yc; $SliceAngle[$Slice][] = $i;
408 408
         }
409 409
 
410
-       $Offset = $i - $DataGapAngle; $ID--; $Slice++;
411
-      }
410
+        $Offset = $i - $DataGapAngle; $ID--; $Slice++;
411
+        }
412 412
 
413
-     /* Draw the bottom shadow if needed */
414
-     if ( $RestoreShadow && ($this->pChartObject->ShadowX != 0 || $this->pChartObject->ShadowY !=0 ))
415
-      {
416
-       foreach($Slices as $SliceID => $Plots)
413
+        /* Draw the bottom shadow if needed */
414
+        if ( $RestoreShadow && ($this->pChartObject->ShadowX != 0 || $this->pChartObject->ShadowY !=0 ))
415
+        {
416
+        foreach($Slices as $SliceID => $Plots)
417 417
         {
418
-         $ShadowPie = "";
419
-         for($i=0;$i<count($Plots);$i=$i+2)
420
-          { $ShadowPie[] = $Plots[$i]+$this->pChartObject->ShadowX; $ShadowPie[] = $Plots[$i+1]+$this->pChartObject->ShadowY; }
418
+            $ShadowPie = "";
419
+            for($i=0;$i<count($Plots);$i=$i+2)
420
+            { $ShadowPie[] = $Plots[$i]+$this->pChartObject->ShadowX; $ShadowPie[] = $Plots[$i+1]+$this->pChartObject->ShadowY; }
421 421
 
422
-         $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa,"NoBorder"=>TRUE);
423
-         $this->pChartObject->drawPolygon($ShadowPie,$Settings);
422
+            $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa,"NoBorder"=>TRUE);
423
+            $this->pChartObject->drawPolygon($ShadowPie,$Settings);
424 424
         }
425 425
 
426
-       $Step = 360 / (2 * PI * $Radius);
427
-       $Offset = 360;
428
-       foreach($Values as $Key => $Value)
426
+        $Step = 360 / (2 * PI * $Radius);
427
+        $Offset = 360;
428
+        foreach($Values as $Key => $Value)
429 429
         {
430
-         $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
430
+            $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
431 431
 
432
-         for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
433
-          {
434
-           $Xc = cos(($i-90)*PI/180) * $Radius + $X + $this->pChartObject->ShadowX;
435
-           $Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y + $this->pChartObject->ShadowY;
432
+            for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
433
+            {
434
+            $Xc = cos(($i-90)*PI/180) * $Radius + $X + $this->pChartObject->ShadowX;
435
+            $Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y + $this->pChartObject->ShadowY;
436 436
 
437
-           $this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
438
-          }
437
+            $this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
438
+            }
439 439
 
440
-         $Offset = $i - $DataGapAngle; $ID--;
440
+            $Offset = $i - $DataGapAngle; $ID--;
441
+        }
441 442
         }
442
-      }
443 443
 
444
-     /* Draw the bottom pie splice */
445
-     foreach($Slices as $SliceID => $Plots)
446
-      {
447
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
448
-       $this->pChartObject->drawPolygon($Plots,$Settings);
444
+        /* Draw the bottom pie splice */
445
+        foreach($Slices as $SliceID => $Plots)
446
+        {
447
+        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
448
+        $this->pChartObject->drawPolygon($Plots,$Settings);
449 449
 
450
-       if ( $SecondPass )
450
+        if ( $SecondPass )
451 451
         {
452
-         $Settings = $SliceColors[$SliceID];
453
-         if ( $Border )
454
-          { $Settings["R"]+= 30; $Settings["G"]+= 30; $Settings["B"]+= 30;; }
452
+            $Settings = $SliceColors[$SliceID];
453
+            if ( $Border )
454
+            { $Settings["R"]+= 30; $Settings["G"]+= 30; $Settings["B"]+= 30;; }
455 455
   
456
-         if ( isset($SliceAngle[$SliceID][1]) ) /* Empty error handling */
457
-          {
458
-           $Angle = $SliceAngle[$SliceID][1];
459
-           $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
460
-           $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y;
461
-           $this->pChartObject->drawLine($Plots[0],$Plots[1],$Xc,$Yc,$Settings);
462
-
463
-           $Angle = $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1];
464
-           $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
465
-           $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y;
466
-           $this->pChartObject->drawLine($Plots[0],$Plots[1],$Xc,$Yc,$Settings);
467
-          }
468
-        }
469
-      }
470
-
471
-     /* Draw the two vertical edges */
472
-     $Slices      = array_reverse($Slices);
473
-     $SliceColors = array_reverse($SliceColors);
474
-     foreach($Slices as $SliceID => $Plots)
475
-      {
476
-       $Settings = $SliceColors[$SliceID];
477
-       $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
478
-
479
-       if ( $Visible[$SliceID]["Start"] && isset($Plots[2])) /* Empty error handling */
480
-        {
481
-         $this->pChartObject->drawLine($Plots[2],$Plots[3],$Plots[2],$Plots[3]- $SliceHeight,array("R"=>$Settings["R"],"G"=>$Settings["G"],"B"=>$Settings["B"]));
482
-         $Border = "";
483
-         $Border[] = $Plots[0]; $Border[] = $Plots[1]; $Border[] = $Plots[0]; $Border[] = $Plots[1] - $SliceHeight;
484
-         $Border[] = $Plots[2]; $Border[] = $Plots[3] - $SliceHeight; $Border[] = $Plots[2]; $Border[] = $Plots[3]; 
485
-         $this->pChartObject->drawPolygon($Border,$Settings);
486
-        }
487
-      }
488
-
489
-     $Slices      = array_reverse($Slices);
490
-     $SliceColors = array_reverse($SliceColors);
491
-     foreach($Slices as $SliceID => $Plots)
492
-      {
493
-       $Settings = $SliceColors[$SliceID];
494
-       $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
495
-       if ( $Visible[$SliceID]["End"] )
496
-        {
497
-         $this->pChartObject->drawLine($Plots[count($Plots)-2],$Plots[count($Plots)-1],$Plots[count($Plots)-2],$Plots[count($Plots)-1]- $SliceHeight,array("R"=>$Settings["R"],"G"=>$Settings["G"],"B"=>$Settings["B"]));
498
-
499
-         $Border = "";
500
-         $Border[] = $Plots[0]; $Border[] = $Plots[1]; $Border[] = $Plots[0]; $Border[] = $Plots[1] - $SliceHeight;
501
-         $Border[] = $Plots[count($Plots)-2]; $Border[] = $Plots[count($Plots)-1] - $SliceHeight; $Border[] = $Plots[count($Plots)-2]; $Border[] = $Plots[count($Plots)-1]; 
502
-         $this->pChartObject->drawPolygon($Border,$Settings);
503
-        }
504
-      }
505
-
506
-     /* Draw the rounded edges */
507
-     foreach($Slices as $SliceID => $Plots)
508
-      {
509
-       $Settings = $SliceColors[$SliceID];
510
-       $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
511
-
512
-       for ($j=2;$j<count($Plots)-2;$j=$j+2)
513
-        {
514
-         $Angle = $SliceAngle[$SliceID][$j/2];
515
-         if ( $Angle < 270 && $Angle > 90 )
516
-          {
517
-           $Border = "";
518
-           $Border[] = $Plots[$j];   $Border[] = $Plots[$j+1];
519
-           $Border[] = $Plots[$j+2]; $Border[] = $Plots[$j+3];
520
-           $Border[] = $Plots[$j+2]; $Border[] = $Plots[$j+3] - $SliceHeight;
521
-           $Border[] = $Plots[$j];   $Border[] = $Plots[$j+1] - $SliceHeight;
522
-           $this->pChartObject->drawPolygon($Border,$Settings);
523
-          }
524
-        }
525
-
526
-       if ( $SecondPass )
527
-        {
528
-         $Settings = $SliceColors[$SliceID];
529
-         if ( $Border )
530
-          { $Settings["R"]+= 30; $Settings["G"]+= 30; $Settings["B"]+= 30; }
456
+            if ( isset($SliceAngle[$SliceID][1]) ) /* Empty error handling */
457
+            {
458
+            $Angle = $SliceAngle[$SliceID][1];
459
+            $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
460
+            $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y;
461
+            $this->pChartObject->drawLine($Plots[0],$Plots[1],$Xc,$Yc,$Settings);
462
+
463
+            $Angle = $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1];
464
+            $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
465
+            $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y;
466
+            $this->pChartObject->drawLine($Plots[0],$Plots[1],$Xc,$Yc,$Settings);
467
+            }
468
+        }
469
+        }
470
+
471
+        /* Draw the two vertical edges */
472
+        $Slices      = array_reverse($Slices);
473
+        $SliceColors = array_reverse($SliceColors);
474
+        foreach($Slices as $SliceID => $Plots)
475
+        {
476
+        $Settings = $SliceColors[$SliceID];
477
+        $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
478
+
479
+        if ( $Visible[$SliceID]["Start"] && isset($Plots[2])) /* Empty error handling */
480
+        {
481
+            $this->pChartObject->drawLine($Plots[2],$Plots[3],$Plots[2],$Plots[3]- $SliceHeight,array("R"=>$Settings["R"],"G"=>$Settings["G"],"B"=>$Settings["B"]));
482
+            $Border = "";
483
+            $Border[] = $Plots[0]; $Border[] = $Plots[1]; $Border[] = $Plots[0]; $Border[] = $Plots[1] - $SliceHeight;
484
+            $Border[] = $Plots[2]; $Border[] = $Plots[3] - $SliceHeight; $Border[] = $Plots[2]; $Border[] = $Plots[3]; 
485
+            $this->pChartObject->drawPolygon($Border,$Settings);
486
+        }
487
+        }
488
+
489
+        $Slices      = array_reverse($Slices);
490
+        $SliceColors = array_reverse($SliceColors);
491
+        foreach($Slices as $SliceID => $Plots)
492
+        {
493
+        $Settings = $SliceColors[$SliceID];
494
+        $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
495
+        if ( $Visible[$SliceID]["End"] )
496
+        {
497
+            $this->pChartObject->drawLine($Plots[count($Plots)-2],$Plots[count($Plots)-1],$Plots[count($Plots)-2],$Plots[count($Plots)-1]- $SliceHeight,array("R"=>$Settings["R"],"G"=>$Settings["G"],"B"=>$Settings["B"]));
498
+
499
+            $Border = "";
500
+            $Border[] = $Plots[0]; $Border[] = $Plots[1]; $Border[] = $Plots[0]; $Border[] = $Plots[1] - $SliceHeight;
501
+            $Border[] = $Plots[count($Plots)-2]; $Border[] = $Plots[count($Plots)-1] - $SliceHeight; $Border[] = $Plots[count($Plots)-2]; $Border[] = $Plots[count($Plots)-1]; 
502
+            $this->pChartObject->drawPolygon($Border,$Settings);
503
+        }
504
+        }
505
+
506
+        /* Draw the rounded edges */
507
+        foreach($Slices as $SliceID => $Plots)
508
+        {
509
+        $Settings = $SliceColors[$SliceID];
510
+        $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
511
+
512
+        for ($j=2;$j<count($Plots)-2;$j=$j+2)
513
+        {
514
+            $Angle = $SliceAngle[$SliceID][$j/2];
515
+            if ( $Angle < 270 && $Angle > 90 )
516
+            {
517
+            $Border = "";
518
+            $Border[] = $Plots[$j];   $Border[] = $Plots[$j+1];
519
+            $Border[] = $Plots[$j+2]; $Border[] = $Plots[$j+3];
520
+            $Border[] = $Plots[$j+2]; $Border[] = $Plots[$j+3] - $SliceHeight;
521
+            $Border[] = $Plots[$j];   $Border[] = $Plots[$j+1] - $SliceHeight;
522
+            $this->pChartObject->drawPolygon($Border,$Settings);
523
+            }
524
+        }
525
+
526
+        if ( $SecondPass )
527
+        {
528
+            $Settings = $SliceColors[$SliceID];
529
+            if ( $Border )
530
+            { $Settings["R"]+= 30; $Settings["G"]+= 30; $Settings["B"]+= 30; }
531 531
   
532
-         if ( isset($SliceAngle[$SliceID][1]) ) /* Empty error handling */
533
-          {
534
-           $Angle = $SliceAngle[$SliceID][1];
535
-           if ( $Angle < 270 && $Angle > 90 )
532
+            if ( isset($SliceAngle[$SliceID][1]) ) /* Empty error handling */
533
+            {
534
+            $Angle = $SliceAngle[$SliceID][1];
535
+            if ( $Angle < 270 && $Angle > 90 )
536
+            {
537
+                $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
538
+                $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y;
539
+                $this->pChartObject->drawLine($Xc,$Yc,$Xc,$Yc-$SliceHeight,$Settings);
540
+            }
541
+            }
542
+
543
+            $Angle = $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1];
544
+            if ( $Angle < 270 && $Angle > 90 )
545
+            {
546
+            $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
547
+            $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y;
548
+            $this->pChartObject->drawLine($Xc,$Yc,$Xc,$Yc-$SliceHeight,$Settings);
549
+            }
550
+
551
+            if ( isset($SliceAngle[$SliceID][1]) && $SliceAngle[$SliceID][1] > 270 && $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1] < 270 )
552
+            {
553
+            $Xc = cos((270-90)*PI/180) * $Radius + $X;
554
+            $Yc = sin((270-90)*PI/180) * $Radius*$SkewFactor + $Y;
555
+            $this->pChartObject->drawLine($Xc,$Yc,$Xc,$Yc-$SliceHeight,$Settings);
556
+            }
557
+
558
+            if ( isset($SliceAngle[$SliceID][1]) && $SliceAngle[$SliceID][1] > 90 && $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1] < 90 )
536 559
             {
537
-             $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
538
-             $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y;
539
-             $this->pChartObject->drawLine($Xc,$Yc,$Xc,$Yc-$SliceHeight,$Settings);
560
+            $Xc = cos((0)*PI/180) * $Radius + $X;
561
+            $Yc = sin((0)*PI/180) * $Radius*$SkewFactor + $Y;
562
+            $this->pChartObject->drawLine($Xc,$Yc,$Xc,$Yc-$SliceHeight,$Settings);
540 563
             }
541
-          }
542
-
543
-         $Angle = $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1];
544
-         if ( $Angle < 270 && $Angle > 90 )
545
-          {
546
-           $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
547
-           $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y;
548
-           $this->pChartObject->drawLine($Xc,$Yc,$Xc,$Yc-$SliceHeight,$Settings);
549
-          }
550
-
551
-         if ( isset($SliceAngle[$SliceID][1]) && $SliceAngle[$SliceID][1] > 270 && $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1] < 270 )
552
-          {
553
-           $Xc = cos((270-90)*PI/180) * $Radius + $X;
554
-           $Yc = sin((270-90)*PI/180) * $Radius*$SkewFactor + $Y;
555
-           $this->pChartObject->drawLine($Xc,$Yc,$Xc,$Yc-$SliceHeight,$Settings);
556
-          }
557
-
558
-         if ( isset($SliceAngle[$SliceID][1]) && $SliceAngle[$SliceID][1] > 90 && $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1] < 90 )
559
-          {
560
-           $Xc = cos((0)*PI/180) * $Radius + $X;
561
-           $Yc = sin((0)*PI/180) * $Radius*$SkewFactor + $Y;
562
-           $this->pChartObject->drawLine($Xc,$Yc,$Xc,$Yc-$SliceHeight,$Settings);
563
-          }
564
-
565
-        }
566
-      }
567
-
568
-     /* Draw the top splice */
569
-     foreach($Slices as $SliceID => $Plots)
570
-      {
571
-       $Settings = $SliceColors[$SliceID];
572
-       $Settings["R"]+= 20; $Settings["G"]+= 20; $Settings["B"]+= 20;
573
-
574
-       $Top = "";
575
-       for($j=0;$j<count($Plots);$j=$j+2) { $Top[] = $Plots[$j]; $Top[] = $Plots[$j+1]- $SliceHeight; }
576
-       $this->pChartObject->drawPolygon($Top,$Settings);
577
-
578
-       if ( $RecordImageMap && !$Shadow ) { $this->pChartObject->addToImageMap("POLY",$this->arraySerialize($Top),$this->pChartObject->toHTMLColor($Settings["R"],$Settings["G"],$Settings["B"]),$Data["Series"][$Data["Abscissa"]]["Data"][count($Slices)-$SliceID-1],$Values[$SliceID]); }
579
-      }
580
-
581
-
582
-     /* Second pass to smooth the angles */
583
-     if ( $SecondPass )
584
-      {
585
-       $Step = 360 / (2 * PI * $Radius);
586
-       $Offset = 360; $ID = count($Values)-1;
587
-       foreach($Values as $Key => $Value)
588
-        {
589
-         $FirstPoint = TRUE;
590
-         if ( $Shadow )
591
-          $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
592
-         else
593
-          {
594
-           if ( $Border )
564
+
565
+        }
566
+        }
567
+
568
+        /* Draw the top splice */
569
+        foreach($Slices as $SliceID => $Plots)
570
+        {
571
+        $Settings = $SliceColors[$SliceID];
572
+        $Settings["R"]+= 20; $Settings["G"]+= 20; $Settings["B"]+= 20;
573
+
574
+        $Top = "";
575
+        for($j=0;$j<count($Plots);$j=$j+2) { $Top[] = $Plots[$j]; $Top[] = $Plots[$j+1]- $SliceHeight; }
576
+        $this->pChartObject->drawPolygon($Top,$Settings);
577
+
578
+        if ( $RecordImageMap && !$Shadow ) { $this->pChartObject->addToImageMap("POLY",$this->arraySerialize($Top),$this->pChartObject->toHTMLColor($Settings["R"],$Settings["G"],$Settings["B"]),$Data["Series"][$Data["Abscissa"]]["Data"][count($Slices)-$SliceID-1],$Values[$SliceID]); }
579
+        }
580
+
581
+
582
+        /* Second pass to smooth the angles */
583
+        if ( $SecondPass )
584
+        {
585
+        $Step = 360 / (2 * PI * $Radius);
586
+        $Offset = 360; $ID = count($Values)-1;
587
+        foreach($Values as $Key => $Value)
588
+        {
589
+            $FirstPoint = TRUE;
590
+            if ( $Shadow )
591
+            $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
592
+            else
593
+            {
594
+            if ( $Border )
595 595
             { $Settings = array("R"=>$Palette[$ID]["R"]+30,"G"=>$Palette[$ID]["G"]+30,"B"=>$Palette[$ID]["B"]+30,"Alpha"=>$Palette[$ID]["Alpha"]); }
596
-           else
596
+            else
597 597
             $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
598
-          }
599
-
600
-         $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
601
-
602
-         if ($DataGapAngle == 0)
603
-          { $X0 = $X; $Y0 = $Y- $SliceHeight; }
604
-         else
605
-          {
606
-           $Angle = ($EndAngle - $Offset)/2 + $Offset;
607
-           $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
608
-           $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius*$SkewFactor + $Y - $SliceHeight;
609
-          }
610
-         $Plots[] = $X0; $Plots[] = $Y0;
611
-
612
-         for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
613
-          {
614
-           $Xc = cos(($i-90)*PI/180) * $Radius + $X;
615
-           $Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y - $SliceHeight;
616
-
617
-           if ( $FirstPoint ) { $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); } { $FirstPoint = FALSE; }
598
+            }
599
+
600
+            $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
601
+
602
+            if ($DataGapAngle == 0)
603
+            { $X0 = $X; $Y0 = $Y- $SliceHeight; }
604
+            else
605
+            {
606
+            $Angle = ($EndAngle - $Offset)/2 + $Offset;
607
+            $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
608
+            $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius*$SkewFactor + $Y - $SliceHeight;
609
+            }
610
+            $Plots[] = $X0; $Plots[] = $Y0;
611
+
612
+            for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
613
+            {
614
+            $Xc = cos(($i-90)*PI/180) * $Radius + $X;
615
+            $Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y - $SliceHeight;
616
+
617
+            if ( $FirstPoint ) { $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); } { $FirstPoint = FALSE; }
618 618
   
619
-           $this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
620
-           if ($i < 270 && $i > 90 ) { $this->pChartObject->drawAntialiasPixel($Xc,$Yc+$SliceHeight,$Settings); }
621
-          }
622
-         $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings);
619
+            $this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
620
+            if ($i < 270 && $i > 90 ) { $this->pChartObject->drawAntialiasPixel($Xc,$Yc+$SliceHeight,$Settings); }
621
+            }
622
+            $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings);
623 623
 
624
-         $Offset = $i - $DataGapAngle; $ID--;
624
+            $Offset = $i - $DataGapAngle; $ID--;
625
+        }
625 626
         }
626
-      }
627 627
 
628
-     if ( $WriteValues != NULL )
629
-      {
630
-       $Step = 360 / (2 * PI * $Radius);
631
-       $Offset = 360; $ID = count($Values)-1;
632
-       $Settings = array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"R"=>$ValueR,"G"=>$ValueG,"B"=>$ValueB,"Alpha"=>$ValueAlpha);
633
-       foreach($Values as $Key => $Value)
628
+        if ( $WriteValues != NULL )
634 629
         {
635
-         $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
630
+        $Step = 360 / (2 * PI * $Radius);
631
+        $Offset = 360; $ID = count($Values)-1;
632
+        $Settings = array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"R"=>$ValueR,"G"=>$ValueG,"B"=>$ValueB,"Alpha"=>$ValueAlpha);
633
+        foreach($Values as $Key => $Value)
634
+        {
635
+            $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
636 636
 
637
-         $Angle = ($EndAngle - $Offset)/2 + $Offset;
637
+            $Angle = ($EndAngle - $Offset)/2 + $Offset;
638 638
 
639
-         if ( $ValuePosition == PIE_VALUE_OUTSIDE )
640
-          {
641
-           $Xc = cos(($Angle-90)*PI/180) * ($Radius+$ValuePadding) + $X;
642
-           $Yc = sin(($Angle-90)*PI/180) * (($Radius*$SkewFactor)+$ValuePadding) + $Y - $SliceHeight;
643
-          }
644
-         else
645
-          {
646
-           $Xc = cos(($Angle-90)*PI/180) * ($Radius)/2 + $X;
647
-           $Yc = sin(($Angle-90)*PI/180) * ($Radius*$SkewFactor)/2 + $Y - $SliceHeight;
648
-          }
639
+            if ( $ValuePosition == PIE_VALUE_OUTSIDE )
640
+            {
641
+            $Xc = cos(($Angle-90)*PI/180) * ($Radius+$ValuePadding) + $X;
642
+            $Yc = sin(($Angle-90)*PI/180) * (($Radius*$SkewFactor)+$ValuePadding) + $Y - $SliceHeight;
643
+            }
644
+            else
645
+            {
646
+            $Xc = cos(($Angle-90)*PI/180) * ($Radius)/2 + $X;
647
+            $Yc = sin(($Angle-90)*PI/180) * ($Radius*$SkewFactor)/2 + $Y - $SliceHeight;
648
+            }
649 649
 
650
-         if ( $WriteValues == PIE_VALUE_PERCENTAGE )
651
-          $Display = round(( 100 / $SerieSum ) * $Value,$Precision)."%";
652
-         elseif ( $WriteValues == PIE_VALUE_NATURAL )
653
-          $Display = $Value.$ValueSuffix;
650
+            if ( $WriteValues == PIE_VALUE_PERCENTAGE )
651
+            $Display = round(( 100 / $SerieSum ) * $Value,$Precision)."%";
652
+            elseif ( $WriteValues == PIE_VALUE_NATURAL )
653
+            $Display = $Value.$ValueSuffix;
654 654
 
655
-         $this->pChartObject->drawText($Xc,$Yc,$Display,$Settings);
655
+            $this->pChartObject->drawText($Xc,$Yc,$Display,$Settings);
656 656
 
657
-         $Offset = $EndAngle - $DataGapAngle; $ID--;
657
+            $Offset = $EndAngle - $DataGapAngle; $ID--;
658
+        }
658 659
         }
659
-      }
660 660
 
661
-     if ( $DrawLabels )
662
-      {
663
-       $Step = 360 / (2 * PI * $Radius);
664
-       $Offset = 360; $ID = count($Values)-1;
665
-       foreach($Values as $Key => $Value)
661
+        if ( $DrawLabels )
666 662
         {
667
-         if ( $LabelColor == PIE_LABEL_COLOR_AUTO )
668
-          { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);}
669
-         else
670
-          { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
663
+        $Step = 360 / (2 * PI * $Radius);
664
+        $Offset = 360; $ID = count($Values)-1;
665
+        foreach($Values as $Key => $Value)
666
+        {
667
+            if ( $LabelColor == PIE_LABEL_COLOR_AUTO )
668
+            { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);}
669
+            else
670
+            { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
671 671
 
672
-         $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
672
+            $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
673 673
 
674
-         $Angle = ($EndAngle - $Offset)/2 + $Offset;
675
-         $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
676
-         $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y - $SliceHeight;
674
+            $Angle = ($EndAngle - $Offset)/2 + $Offset;
675
+            $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
676
+            $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y - $SliceHeight;
677 677
 
678
-         if ( isset($Data["Series"][$Data["Abscissa"]]["Data"][$ID]) )
679
-          {
680
-           $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$ID];
678
+            if ( isset($Data["Series"][$Data["Abscissa"]]["Data"][$ID]) )
679
+            {
680
+            $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$ID];
681 681
 
682
-           if ( $LabelStacked )
682
+            if ( $LabelStacked )
683 683
             $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$Radius,TRUE);
684
-           else
684
+            else
685 685
             $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
686
-          }
686
+            }
687 687
 
688
-         $Offset = $EndAngle - $DataGapAngle; $ID--;
688
+            $Offset = $EndAngle - $DataGapAngle; $ID--;
689
+        }
689 690
         }
690
-      }
691 691
 
692
-     if ( $DrawLabels && $LabelStacked ) { $this->writeShiftedLabels(); }
692
+        if ( $DrawLabels && $LabelStacked ) { $this->writeShiftedLabels(); }
693 693
 
694
-     $this->pChartObject->Shadow = $RestoreShadow;
694
+        $this->pChartObject->Shadow = $RestoreShadow;
695 695
 
696
-     return(PIE_RENDERED);
696
+        return(PIE_RENDERED);
697 697
     }
698 698
 
699
-   /* Draw the legend of pie chart */
700
-   function drawPieLegend($X,$Y,$Format="")
699
+    /* Draw the legend of pie chart */
700
+    function drawPieLegend($X,$Y,$Format="")
701 701
     {
702
-     $FontName		= isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
703
-     $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
704
-     $FontR		= isset($Format["FontR"]) ? $Format["FontR"] : $this->pChartObject->FontColorR;
705
-     $FontG		= isset($Format["FontG"]) ? $Format["FontG"] : $this->pChartObject->FontColorG;
706
-     $FontB		= isset($Format["FontB"]) ? $Format["FontB"] : $this->pChartObject->FontColorB;
707
-     $BoxSize		= isset($Format["BoxSize"]) ? $Format["BoxSize"] : 5;
708
-     $Margin		= isset($Format["Margin"]) ? $Format["Margin"] : 5;
709
-     $R			= isset($Format["R"]) ? $Format["R"] : 200;
710
-     $G			= isset($Format["G"]) ? $Format["G"] : 200;
711
-     $B			= isset($Format["B"]) ? $Format["B"] : 200;
712
-     $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
713
-     $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
714
-     $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
715
-     $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
716
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
717
-     $Style		= isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND;
718
-     $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
719
-
720
-     if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
721
-
722
-     $YStep = max($this->pChartObject->FontSize,$BoxSize) + 5;
723
-     $XStep = $BoxSize + 5;
724
-
725
-     /* Data Processing */
726
-     $Data    = $this->pDataObject->getData();
727
-     $Palette = $this->pDataObject->getPalette();
728
-
729
-     /* Do we have an abscissa serie defined? */
730
-     if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
731
-
732
-     $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
733
-     foreach($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $Value)
734
-      {
735
-       $BoxArray = $this->pChartObject->getTextBox($vX+$BoxSize+4,$vY+$BoxSize/2,$FontName,$FontSize,0,$Value);
736
-
737
-       if ( $Mode == LEGEND_VERTICAL )
738
-        {
739
-         if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$BoxSize/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$BoxSize/2; }
740
-         if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
741
-         if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$BoxSize/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$BoxSize/2; }
742
-         $vY=$vY+$YStep;
743
-        }
744
-       elseif ( $Mode == LEGEND_HORIZONTAL )
745
-        {
746
-         if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$BoxSize/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$BoxSize/2; }
747
-         if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
748
-         if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$BoxSize/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$BoxSize/2; }
749
-         $vX=$Boundaries["R"]+$XStep;
750
-        }
751
-      }
752
-     $vY=$vY-$YStep; $vX=$vX-$XStep;
753
-
754
-     $TopOffset  = $Y - $Boundaries["T"];
755
-     if ( $Boundaries["B"]-($vY+$BoxSize) < $TopOffset ) { $Boundaries["B"] = $vY+$BoxSize+$TopOffset; }
756
-
757
-     if ( $Style == LEGEND_ROUND )
758
-      $this->pChartObject->drawRoundedFilledRectangle($Boundaries["L"]-$Margin,$Boundaries["T"]-$Margin,$Boundaries["R"]+$Margin,$Boundaries["B"]+$Margin,$Margin,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"BorderR"=>$BorderR,"BorderG"=>$BorderG,"BorderB"=>$BorderB));
759
-     elseif ( $Style == LEGEND_BOX )
760
-      $this->pChartObject->drawFilledRectangle($Boundaries["L"]-$Margin,$Boundaries["T"]-$Margin,$Boundaries["R"]+$Margin,$Boundaries["B"]+$Margin,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"BorderR"=>$BorderR,"BorderG"=>$BorderG,"BorderB"=>$BorderB));
761
-
762
-     $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE;
763
-     foreach($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $Value)
764
-      {
765
-       $R = $Palette[$Key]["R"]; $G = $Palette[$Key]["G"]; $B = $Palette[$Key]["B"];
766
-
767
-       $this->pChartObject->drawFilledRectangle($X+1,$Y+1,$X+$BoxSize+1,$Y+$BoxSize+1,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
768
-       $this->pChartObject->drawFilledRectangle($X,$Y,$X+$BoxSize,$Y+$BoxSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
769
-       if ( $Mode == LEGEND_VERTICAL )
770
-        {
771
-         $this->pChartObject->drawText($X+$BoxSize+4,$Y+$BoxSize/2,$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT,"FontName"=>$FontName,"FontSize"=>$FontSize));
772
-         $Y=$Y+$YStep;
773
-        }
774
-       elseif ( $Mode == LEGEND_HORIZONTAL )
775
-        {
776
-         $BoxArray = $this->pChartObject->drawText($X+$BoxSize+4,$Y+$BoxSize/2,$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT,"FontName"=>$FontName,"FontSize"=>$FontSize));
777
-         $X=$BoxArray[1]["X"]+2+$XStep;
778
-        }
779
-      }
780
-
781
-     $this->Shadow = $RestoreShadow;
702
+        $FontName		= isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
703
+        $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
704
+        $FontR		= isset($Format["FontR"]) ? $Format["FontR"] : $this->pChartObject->FontColorR;
705
+        $FontG		= isset($Format["FontG"]) ? $Format["FontG"] : $this->pChartObject->FontColorG;
706
+        $FontB		= isset($Format["FontB"]) ? $Format["FontB"] : $this->pChartObject->FontColorB;
707
+        $BoxSize		= isset($Format["BoxSize"]) ? $Format["BoxSize"] : 5;
708
+        $Margin		= isset($Format["Margin"]) ? $Format["Margin"] : 5;
709
+        $R			= isset($Format["R"]) ? $Format["R"] : 200;
710
+        $G			= isset($Format["G"]) ? $Format["G"] : 200;
711
+        $B			= isset($Format["B"]) ? $Format["B"] : 200;
712
+        $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
713
+        $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
714
+        $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
715
+        $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
716
+        $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
717
+        $Style		= isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND;
718
+        $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
719
+
720
+        if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
721
+
722
+        $YStep = max($this->pChartObject->FontSize,$BoxSize) + 5;
723
+        $XStep = $BoxSize + 5;
724
+
725
+        /* Data Processing */
726
+        $Data    = $this->pDataObject->getData();
727
+        $Palette = $this->pDataObject->getPalette();
728
+
729
+        /* Do we have an abscissa serie defined? */
730
+        if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
731
+
732
+        $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
733
+        foreach($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $Value)
734
+        {
735
+        $BoxArray = $this->pChartObject->getTextBox($vX+$BoxSize+4,$vY+$BoxSize/2,$FontName,$FontSize,0,$Value);
736
+
737
+        if ( $Mode == LEGEND_VERTICAL )
738
+        {
739
+            if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$BoxSize/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$BoxSize/2; }
740
+            if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
741
+            if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$BoxSize/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$BoxSize/2; }
742
+            $vY=$vY+$YStep;
743
+        }
744
+        elseif ( $Mode == LEGEND_HORIZONTAL )
745
+        {
746
+            if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$BoxSize/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$BoxSize/2; }
747
+            if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
748
+            if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$BoxSize/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$BoxSize/2; }
749
+            $vX=$Boundaries["R"]+$XStep;
750
+        }
751
+        }
752
+        $vY=$vY-$YStep; $vX=$vX-$XStep;
753
+
754
+        $TopOffset  = $Y - $Boundaries["T"];
755
+        if ( $Boundaries["B"]-($vY+$BoxSize) < $TopOffset ) { $Boundaries["B"] = $vY+$BoxSize+$TopOffset; }
756
+
757
+        if ( $Style == LEGEND_ROUND )
758
+        $this->pChartObject->drawRoundedFilledRectangle($Boundaries["L"]-$Margin,$Boundaries["T"]-$Margin,$Boundaries["R"]+$Margin,$Boundaries["B"]+$Margin,$Margin,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"BorderR"=>$BorderR,"BorderG"=>$BorderG,"BorderB"=>$BorderB));
759
+        elseif ( $Style == LEGEND_BOX )
760
+        $this->pChartObject->drawFilledRectangle($Boundaries["L"]-$Margin,$Boundaries["T"]-$Margin,$Boundaries["R"]+$Margin,$Boundaries["B"]+$Margin,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"BorderR"=>$BorderR,"BorderG"=>$BorderG,"BorderB"=>$BorderB));
761
+
762
+        $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE;
763
+        foreach($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $Value)
764
+        {
765
+        $R = $Palette[$Key]["R"]; $G = $Palette[$Key]["G"]; $B = $Palette[$Key]["B"];
766
+
767
+        $this->pChartObject->drawFilledRectangle($X+1,$Y+1,$X+$BoxSize+1,$Y+$BoxSize+1,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
768
+        $this->pChartObject->drawFilledRectangle($X,$Y,$X+$BoxSize,$Y+$BoxSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
769
+        if ( $Mode == LEGEND_VERTICAL )
770
+        {
771
+            $this->pChartObject->drawText($X+$BoxSize+4,$Y+$BoxSize/2,$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT,"FontName"=>$FontName,"FontSize"=>$FontSize));
772
+            $Y=$Y+$YStep;
773
+        }
774
+        elseif ( $Mode == LEGEND_HORIZONTAL )
775
+        {
776
+            $BoxArray = $this->pChartObject->drawText($X+$BoxSize+4,$Y+$BoxSize/2,$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT,"FontName"=>$FontName,"FontSize"=>$FontSize));
777
+            $X=$BoxArray[1]["X"]+2+$XStep;
778
+        }
779
+        }
780
+
781
+        $this->Shadow = $RestoreShadow;
782 782
     }
783 783
 
784
-   /* Set the color of the specified slice */
785
-   function setSliceColor($SliceID,$Format="")
784
+    /* Set the color of the specified slice */
785
+    function setSliceColor($SliceID,$Format="")
786 786
     {
787
-     $R		= isset($Format["R"]) ? $Format["R"] : 0;
788
-     $G		= isset($Format["G"]) ? $Format["G"] : 0;
789
-     $B		= isset($Format["B"]) ? $Format["B"] : 0;
790
-     $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
791
-
792
-     $this->pDataObject->Palette[$SliceID]["R"]     = $R;
793
-     $this->pDataObject->Palette[$SliceID]["G"]     = $G;
794
-     $this->pDataObject->Palette[$SliceID]["B"]     = $B;
795
-     $this->pDataObject->Palette[$SliceID]["Alpha"] = $Alpha;
787
+        $R		= isset($Format["R"]) ? $Format["R"] : 0;
788
+        $G		= isset($Format["G"]) ? $Format["G"] : 0;
789
+        $B		= isset($Format["B"]) ? $Format["B"] : 0;
790
+        $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
791
+
792
+        $this->pDataObject->Palette[$SliceID]["R"]     = $R;
793
+        $this->pDataObject->Palette[$SliceID]["G"]     = $G;
794
+        $this->pDataObject->Palette[$SliceID]["B"]     = $B;
795
+        $this->pDataObject->Palette[$SliceID]["Alpha"] = $Alpha;
796 796
     }
797 797
 
798
-   /* Internally used compute the label positions */
799
-   function writePieLabel($X,$Y,$Label,$Angle,$Settings,$Stacked,$Xc=0,$Yc=0,$Radius=0,$Reversed=FALSE)
798
+    /* Internally used compute the label positions */
799
+    function writePieLabel($X,$Y,$Label,$Angle,$Settings,$Stacked,$Xc=0,$Yc=0,$Radius=0,$Reversed=FALSE)
800 800
     {
801
-     $LabelOffset	= 30;
802
-     $FontName		= $this->pChartObject->FontName;
803
-     $FontSize		= $this->pChartObject->FontSize;
804
-
805
-     if ( !$Stacked )
806
-      {
807
-       $Settings["Angle"]  = 360-$Angle;
808
-       $Settings["Length"] = 25;
809
-       $Settings["Size"]   = 8;
810
-
811
-       $this->pChartObject->drawArrowLabel($X,$Y," ".$Label." ",$Settings);
812
-      }
813
-     else
814
-      {
815
-       $X2 = cos(deg2rad($Angle-90))*20+$X;
816
-       $Y2 = sin(deg2rad($Angle-90))*20+$Y;
817
-
818
-       $TxtPos = $this->pChartObject->getTextBox($X,$Y,$FontName,$FontSize,0,$Label);
819
-       $Height = $TxtPos[0]["Y"] - $TxtPos[2]["Y"];
820
-       $YTop    = $Y2 - $Height/2 - 2;
821
-       $YBottom = $Y2 + $Height/2 + 2;
822
-
823
-       if ( $this->LabelPos != "" )
824
-        {
825
-         $Done = FALSE;
826
-         foreach($this->LabelPos as $Key => $Settings)
827
-          {
828
-           if ( !$Done )
801
+        $LabelOffset	= 30;
802
+        $FontName		= $this->pChartObject->FontName;
803
+        $FontSize		= $this->pChartObject->FontSize;
804
+
805
+        if ( !$Stacked )
806
+        {
807
+        $Settings["Angle"]  = 360-$Angle;
808
+        $Settings["Length"] = 25;
809
+        $Settings["Size"]   = 8;
810
+
811
+        $this->pChartObject->drawArrowLabel($X,$Y," ".$Label." ",$Settings);
812
+        }
813
+        else
814
+        {
815
+        $X2 = cos(deg2rad($Angle-90))*20+$X;
816
+        $Y2 = sin(deg2rad($Angle-90))*20+$Y;
817
+
818
+        $TxtPos = $this->pChartObject->getTextBox($X,$Y,$FontName,$FontSize,0,$Label);
819
+        $Height = $TxtPos[0]["Y"] - $TxtPos[2]["Y"];
820
+        $YTop    = $Y2 - $Height/2 - 2;
821
+        $YBottom = $Y2 + $Height/2 + 2;
822
+
823
+        if ( $this->LabelPos != "" )
824
+        {
825
+            $Done = FALSE;
826
+            foreach($this->LabelPos as $Key => $Settings)
827
+            {
828
+            if ( !$Done )
829 829
             {
830
-             if ( $Angle <= 90 && (($YTop >= $Settings["YTop"] && $YTop <= $Settings["YBottom"]) || ($YBottom >= $Settings["YTop"] && $YBottom <= $Settings["YBottom"])))
831
-              { $this->shift(0,180,-($Height+2),$Reversed); $Done = TRUE; }
832
-             if ( $Angle > 90 && $Angle <= 180 && (($YTop >= $Settings["YTop"] && $YTop <= $Settings["YBottom"]) || ($YBottom >= $Settings["YTop"] && $YBottom <= $Settings["YBottom"])))
833
-              { $this->shift(0,180,-($Height+2),$Reversed); $Done = TRUE; }
834
-             if ( $Angle > 180 && $Angle <= 270 && (($YTop >= $Settings["YTop"] && $YTop <= $Settings["YBottom"]) || ($YBottom >= $Settings["YTop"] && $YBottom <= $Settings["YBottom"])))
835
-              { $this->shift(180,360,($Height+2),$Reversed); $Done = TRUE; }
836
-             if ( $Angle > 270 && $Angle <= 360 && (($YTop >= $Settings["YTop"] && $YTop <= $Settings["YBottom"]) || ($YBottom >= $Settings["YTop"] && $YBottom <= $Settings["YBottom"])))
837
-              { $this->shift(180,360,($Height+2),$Reversed); $Done = TRUE; }
830
+                if ( $Angle <= 90 && (($YTop >= $Settings["YTop"] && $YTop <= $Settings["YBottom"]) || ($YBottom >= $Settings["YTop"] && $YBottom <= $Settings["YBottom"])))
831
+                { $this->shift(0,180,-($Height+2),$Reversed); $Done = TRUE; }
832
+                if ( $Angle > 90 && $Angle <= 180 && (($YTop >= $Settings["YTop"] && $YTop <= $Settings["YBottom"]) || ($YBottom >= $Settings["YTop"] && $YBottom <= $Settings["YBottom"])))
833
+                { $this->shift(0,180,-($Height+2),$Reversed); $Done = TRUE; }
834
+                if ( $Angle > 180 && $Angle <= 270 && (($YTop >= $Settings["YTop"] && $YTop <= $Settings["YBottom"]) || ($YBottom >= $Settings["YTop"] && $YBottom <= $Settings["YBottom"])))
835
+                { $this->shift(180,360,($Height+2),$Reversed); $Done = TRUE; }
836
+                if ( $Angle > 270 && $Angle <= 360 && (($YTop >= $Settings["YTop"] && $YTop <= $Settings["YBottom"]) || ($YBottom >= $Settings["YTop"] && $YBottom <= $Settings["YBottom"])))
837
+                { $this->shift(180,360,($Height+2),$Reversed); $Done = TRUE; }
838
+            }
838 839
             }
839
-          }
840 840
         }
841 841
 
842
-       $LabelSettings = array("YTop"=>$YTop,"YBottom"=>$YBottom,"Label"=>$Label,"Angle"=>$Angle,"X1"=>$X,"Y1"=>$Y,"X2"=>$X2,"Y2"=>$Y2);
843
-       if ( $Angle <= 180 ) { $LabelSettings["X3"] = $Xc+$Radius+$LabelOffset; }
844
-       if ( $Angle > 180 )  { $LabelSettings["X3"] = $Xc-$Radius-$LabelOffset; }
845
-       $this->LabelPos[] = $LabelSettings;
846
-      }
842
+        $LabelSettings = array("YTop"=>$YTop,"YBottom"=>$YBottom,"Label"=>$Label,"Angle"=>$Angle,"X1"=>$X,"Y1"=>$Y,"X2"=>$X2,"Y2"=>$Y2);
843
+        if ( $Angle <= 180 ) { $LabelSettings["X3"] = $Xc+$Radius+$LabelOffset; }
844
+        if ( $Angle > 180 )  { $LabelSettings["X3"] = $Xc-$Radius-$LabelOffset; }
845
+        $this->LabelPos[] = $LabelSettings;
846
+        }
847 847
     }
848 848
 
849
-   /* Internally used to shift label positions */
850
-   function shift($StartAngle,$EndAngle,$Offset,$Reversed)
849
+    /* Internally used to shift label positions */
850
+    function shift($StartAngle,$EndAngle,$Offset,$Reversed)
851 851
     {
852
-     if ( $Reversed ) { $Offset = -$Offset; }
853
-     foreach($this->LabelPos as $Key => $Settings)
854
-      {
855
-       if ( $Settings["Angle"] > $StartAngle && $Settings["Angle"] <= $EndAngle ) { $this->LabelPos[$Key]["YTop"] = $Settings["YTop"] + $Offset; $this->LabelPos[$Key]["YBottom"] = $Settings["YBottom"] + $Offset; $this->LabelPos[$Key]["Y2"] = $Settings["Y2"] + $Offset; }
856
-      }
852
+        if ( $Reversed ) { $Offset = -$Offset; }
853
+        foreach($this->LabelPos as $Key => $Settings)
854
+        {
855
+        if ( $Settings["Angle"] > $StartAngle && $Settings["Angle"] <= $EndAngle ) { $this->LabelPos[$Key]["YTop"] = $Settings["YTop"] + $Offset; $this->LabelPos[$Key]["YBottom"] = $Settings["YBottom"] + $Offset; $this->LabelPos[$Key]["Y2"] = $Settings["Y2"] + $Offset; }
856
+        }
857 857
     }
858 858
 
859
-   /* Internally used to write the re-computed labels */
860
-   function writeShiftedLabels()
859
+    /* Internally used to write the re-computed labels */
860
+    function writeShiftedLabels()
861 861
     {
862
-     if ( $this->LabelPos == "" ) { return(0); }
863
-     foreach($this->LabelPos as $Key => $Settings)
864
-      {
865
-       $X1 = $Settings["X1"]; $Y1 = $Settings["Y1"];
866
-       $X2 = $Settings["X2"]; $Y2 = $Settings["Y2"];
867
-       $X3 = $Settings["X3"];
868
-       $Angle = $Settings["Angle"];
869
-       $Label = $Settings["Label"];
870
-
871
-       $this->pChartObject->drawArrow($X2,$Y2,$X1,$Y1,array("Size"=>8));
872
-       if ( $Angle <= 180 )
862
+        if ( $this->LabelPos == "" ) { return(0); }
863
+        foreach($this->LabelPos as $Key => $Settings)
873 864
         {
874
-         $this->pChartObject->drawLine($X2,$Y2,$X3,$Y2);
875
-         $this->pChartObject->drawText($X3+2,$Y2,$Label,array("Align"=>TEXT_ALIGN_MIDDLELEFT));
865
+        $X1 = $Settings["X1"]; $Y1 = $Settings["Y1"];
866
+        $X2 = $Settings["X2"]; $Y2 = $Settings["Y2"];
867
+        $X3 = $Settings["X3"];
868
+        $Angle = $Settings["Angle"];
869
+        $Label = $Settings["Label"];
870
+
871
+        $this->pChartObject->drawArrow($X2,$Y2,$X1,$Y1,array("Size"=>8));
872
+        if ( $Angle <= 180 )
873
+        {
874
+            $this->pChartObject->drawLine($X2,$Y2,$X3,$Y2);
875
+            $this->pChartObject->drawText($X3+2,$Y2,$Label,array("Align"=>TEXT_ALIGN_MIDDLELEFT));
876 876
         }
877
-       else
877
+        else
878 878
         {
879
-         $this->pChartObject->drawLine($X2,$Y2,$X3,$Y2);
880
-         $this->pChartObject->drawText($X3-2,$Y2,$Label,array("Align"=>TEXT_ALIGN_MIDDLERIGHT));
879
+            $this->pChartObject->drawLine($X2,$Y2,$X3,$Y2);
880
+            $this->pChartObject->drawText($X3-2,$Y2,$Label,array("Align"=>TEXT_ALIGN_MIDDLERIGHT));
881
+        }
881 882
         }
882
-      }
883 883
     }
884 884
 
885
-   /* Draw a ring chart */
886
-   function draw2DRing($X,$Y,$Format="")
885
+    /* Draw a ring chart */
886
+    function draw2DRing($X,$Y,$Format="")
887 887
     {
888
-     $OuterRadius	= isset($Format["Radius"]) ? $Format["Radius"] : 60;
889
-     $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
890
-     $InnerRadius	= isset($Format["Radius"]) ? $Format["Radius"] : 30;
891
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
892
-     $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
893
-     $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
894
-     $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
895
-     $BorderAlpha	= isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 100;
896
-     $Shadow		= isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
897
-     $DrawLabels	= isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : FALSE;
898
-     $LabelStacked	= isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
899
-     $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
900
-     $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
901
-     $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
902
-     $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
903
-     $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
904
-     $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : NULL; //PIE_VALUE_PERCENTAGE
905
-     $ValuePadding	= isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 5;
906
-     $ValuePosition	= isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_OUTSIDE;
907
-     $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
908
-     $ValueR		= isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
909
-     $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
910
-     $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
911
-     $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
912
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
913
-
914
-     /* Data Processing */
915
-     $Data    = $this->pDataObject->getData();
916
-     $Palette = $this->pDataObject->getPalette();
888
+        $OuterRadius	= isset($Format["Radius"]) ? $Format["Radius"] : 60;
889
+        $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
890
+        $InnerRadius	= isset($Format["Radius"]) ? $Format["Radius"] : 30;
891
+        $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
892
+        $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
893
+        $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
894
+        $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
895
+        $BorderAlpha	= isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 100;
896
+        $Shadow		= isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
897
+        $DrawLabels	= isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : FALSE;
898
+        $LabelStacked	= isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
899
+        $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
900
+        $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
901
+        $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
902
+        $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
903
+        $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
904
+        $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : NULL; //PIE_VALUE_PERCENTAGE
905
+        $ValuePadding	= isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 5;
906
+        $ValuePosition	= isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_OUTSIDE;
907
+        $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
908
+        $ValueR		= isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
909
+        $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
910
+        $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
911
+        $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
912
+        $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
913
+
914
+        /* Data Processing */
915
+        $Data    = $this->pDataObject->getData();
916
+        $Palette = $this->pDataObject->getPalette();
917
+
918
+        /* Do we have an abscissa serie defined? */
919
+        if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
920
+
921
+        /* Try to find the data serie */
922
+        $DataSerie = "";
923
+        foreach ($Data["Series"] as $SerieName => $SerieData)
924
+        { if ( $SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
925
+
926
+        /* Do we have data to compute? */
927
+        if ( $DataSerie == "" ) { return(PIE_NO_DATASERIE); }
928
+
929
+        /* Remove unused data */
930
+        list($Data,$Palette) = $this->clean0Values($Data,$Palette,$DataSerie,$Data["Abscissa"]);
931
+
932
+        /* Compute the pie sum */
933
+        $SerieSum = $this->pDataObject->getSum($DataSerie);
934
+
935
+        /* Do we have data to draw? */
936
+        if ( $SerieSum == 0 ) { return(PIE_SUMISNULL); }
937
+
938
+        /* Dump the real number of data to draw */
939
+        $Values = "";
940
+        foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
941
+        { if ($Value != 0) { $Values[] = $Value; } }
942
+
943
+        /* Compute the wasted angular space between series */
944
+        if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = 0; } // count($Values)
945
+
946
+        /* Compute the scale */
947
+        $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
948
+
949
+        $RestoreShadow = $this->pChartObject->Shadow;
950
+        if ( $this->pChartObject->Shadow )
951
+        {
952
+        $this->pChartObject->Shadow = FALSE;
917 953
 
918
-     /* Do we have an abscissa serie defined? */
919
-     if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
954
+        $ShadowFormat = $Format; $ShadowFormat["Shadow"] = TRUE;
955
+        $this->draw2DRing($X+$this->pChartObject->ShadowX,$Y+$this->pChartObject->ShadowY,$ShadowFormat);
956
+        }
920 957
 
921
-     /* Try to find the data serie */
922
-     $DataSerie = "";
923
-     foreach ($Data["Series"] as $SerieName => $SerieData)
924
-      { if ( $SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
958
+        /* Draw the polygon pie elements */
959
+        $Step = 360 / (2 * PI * $OuterRadius);
960
+        $Offset = 0; $ID = 0;
961
+        foreach($Values as $Key => $Value)
962
+        {
963
+        if ( $Shadow )
964
+        {
965
+            $Settings    = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
966
+            $BorderColor = $Settings;
967
+        }
968
+        else
969
+        {
970
+            if ( !isset($Palette[$ID]["R"]) ) { $Color = $this->pChartObject->getRandomColor(); $Palette[$ID] = $Color; $this->pDataObject->savePalette($ID,$Color); }
971
+            $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
925 972
 
926
-     /* Do we have data to compute? */
927
-     if ( $DataSerie == "" ) { return(PIE_NO_DATASERIE); }
973
+            if ( $Border )
974
+            $BorderColor = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
975
+            else
976
+            $BorderColor = $Settings;
977
+        }
928 978
 
929
-     /* Remove unused data */
930
-     list($Data,$Palette) = $this->clean0Values($Data,$Palette,$DataSerie,$Data["Abscissa"]);
931
-
932
-     /* Compute the pie sum */
933
-     $SerieSum = $this->pDataObject->getSum($DataSerie);
979
+        $Plots = ""; $Boundaries = ""; $AAPixels = "";
980
+        $EndAngle = $Offset+($Value*$ScaleFactor); if ( $EndAngle > 360 ) { $EndAngle = 360; }
981
+        for($i=$Offset;$i<=$EndAngle;$i=$i+$Step)
982
+        {
983
+            $Xc = cos(($i-90)*PI/180) * $OuterRadius + $X;
984
+            $Yc = sin(($i-90)*PI/180) * $OuterRadius + $Y;
934 985
 
935
-     /* Do we have data to draw? */
936
-     if ( $SerieSum == 0 ) { return(PIE_SUMISNULL); }
986
+            if ( !isset($Boundaries[0]["X1"]) ) { $Boundaries[0]["X1"] = $Xc; $Boundaries[0]["Y1"] = $Yc; }
987
+            $AAPixels[] = array($Xc,$Yc);
937 988
 
938
-     /* Dump the real number of data to draw */
939
-     $Values = "";
940
-     foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
941
-      { if ($Value != 0) { $Values[] = $Value; } }
989
+            if ( $i<90 ) { $Yc++; }
990
+            if ( $i>180 && $i<270 ) { $Xc++; }
991
+            if ( $i>=270 ) { $Xc++; $Yc++; }
942 992
 
943
-     /* Compute the wasted angular space between series */
944
-     if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = 0; } // count($Values)
993
+            $Plots[] = $Xc; $Plots[] = $Yc;
994
+        }
995
+        $Boundaries[1]["X1"] = $Xc; $Boundaries[1]["Y1"] = $Yc;
996
+        $Lasti = $EndAngle;
945 997
 
946
-     /* Compute the scale */
947
-     $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
998
+        for($i=$EndAngle;$i>=$Offset;$i=$i-$Step)
999
+        {
1000
+            $Xc = cos(($i-90)*PI/180) * ($InnerRadius-1) + $X;
1001
+            $Yc = sin(($i-90)*PI/180) * ($InnerRadius-1) + $Y;
948 1002
 
949
-     $RestoreShadow = $this->pChartObject->Shadow;
950
-     if ( $this->pChartObject->Shadow )
951
-      {
952
-       $this->pChartObject->Shadow = FALSE;
1003
+            if ( !isset($Boundaries[1]["X2"]) ) { $Boundaries[1]["X2"] = $Xc; $Boundaries[1]["Y2"] = $Yc; }
1004
+            $AAPixels[] = array($Xc,$Yc);
953 1005
 
954
-       $ShadowFormat = $Format; $ShadowFormat["Shadow"] = TRUE;
955
-       $this->draw2DRing($X+$this->pChartObject->ShadowX,$Y+$this->pChartObject->ShadowY,$ShadowFormat);
956
-      }
1006
+            $Xc = cos(($i-90)*PI/180) * $InnerRadius + $X;
1007
+            $Yc = sin(($i-90)*PI/180) * $InnerRadius + $Y;
957 1008
 
958
-     /* Draw the polygon pie elements */
959
-     $Step = 360 / (2 * PI * $OuterRadius);
960
-     $Offset = 0; $ID = 0;
961
-     foreach($Values as $Key => $Value)
962
-      {
963
-       if ( $Shadow )
964
-        {
965
-         $Settings    = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
966
-         $BorderColor = $Settings;
967
-        }
968
-       else
969
-        {
970
-         if ( !isset($Palette[$ID]["R"]) ) { $Color = $this->pChartObject->getRandomColor(); $Palette[$ID] = $Color; $this->pDataObject->savePalette($ID,$Color); }
971
-         $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
972
-
973
-         if ( $Border )
974
-          $BorderColor = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
975
-         else
976
-          $BorderColor = $Settings;
977
-        }
978
-
979
-       $Plots = ""; $Boundaries = ""; $AAPixels = "";
980
-       $EndAngle = $Offset+($Value*$ScaleFactor); if ( $EndAngle > 360 ) { $EndAngle = 360; }
981
-       for($i=$Offset;$i<=$EndAngle;$i=$i+$Step)
982
-        {
983
-         $Xc = cos(($i-90)*PI/180) * $OuterRadius + $X;
984
-         $Yc = sin(($i-90)*PI/180) * $OuterRadius + $Y;
985
-
986
-         if ( !isset($Boundaries[0]["X1"]) ) { $Boundaries[0]["X1"] = $Xc; $Boundaries[0]["Y1"] = $Yc; }
987
-         $AAPixels[] = array($Xc,$Yc);
988
-
989
-         if ( $i<90 ) { $Yc++; }
990
-         if ( $i>180 && $i<270 ) { $Xc++; }
991
-         if ( $i>=270 ) { $Xc++; $Yc++; }
1009
+            if ( $i<90 ) { $Yc++; }
1010
+            if ( $i>180 && $i<270 ) { $Xc++; }
1011
+            if ( $i>=270 ) { $Xc++; $Yc++; }
992 1012
 
993
-         $Plots[] = $Xc; $Plots[] = $Yc;
1013
+            $Plots[] = $Xc; $Plots[] = $Yc;
994 1014
         }
995
-       $Boundaries[1]["X1"] = $Xc; $Boundaries[1]["Y1"] = $Yc;
996
-       $Lasti = $EndAngle;
1015
+        $Boundaries[0]["X2"] = $Xc; $Boundaries[0]["Y2"] = $Yc;
997 1016
 
998
-       for($i=$EndAngle;$i>=$Offset;$i=$i-$Step)
999
-        {
1000
-         $Xc = cos(($i-90)*PI/180) * ($InnerRadius-1) + $X;
1001
-         $Yc = sin(($i-90)*PI/180) * ($InnerRadius-1) + $Y;
1017
+        /* Draw the polygon */
1018
+        $this->pChartObject->drawPolygon($Plots,$Settings);
1019
+        if ( $RecordImageMap && !$Shadow ) { $this->pChartObject->addToImageMap("POLY",$this->arraySerialize($Plots),$this->pChartObject->toHTMLColor($Palette[$ID]["R"],$Palette[$ID]["G"],$Palette[$ID]["B"]),$Data["Series"][$Data["Abscissa"]]["Data"][$Key],$Value); }
1020
+
1021
+        /* Smooth the edges using AA */
1022
+        foreach($AAPixels as $iKey => $Pos ) { $this->pChartObject->drawAntialiasPixel($Pos[0],$Pos[1],$BorderColor); }
1023
+        $this->pChartObject->drawLine($Boundaries[0]["X1"],$Boundaries[0]["Y1"],$Boundaries[0]["X2"],$Boundaries[0]["Y2"],$BorderColor);
1024
+        $this->pChartObject->drawLine($Boundaries[1]["X1"],$Boundaries[1]["Y1"],$Boundaries[1]["X2"],$Boundaries[1]["Y2"],$BorderColor);
1002 1025
 
1003
-         if ( !isset($Boundaries[1]["X2"]) ) { $Boundaries[1]["X2"] = $Xc; $Boundaries[1]["Y2"] = $Yc; }
1004
-         $AAPixels[] = array($Xc,$Yc);
1026
+        if ( $DrawLabels && !$Shadow )
1027
+        {
1028
+            if ( $LabelColor == PIE_LABEL_COLOR_AUTO )
1029
+            { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);}
1030
+            else
1031
+            { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
1005 1032
 
1006
-         $Xc = cos(($i-90)*PI/180) * $InnerRadius + $X;
1007
-         $Yc = sin(($i-90)*PI/180) * $InnerRadius + $Y;
1033
+            $Angle = ($EndAngle - $Offset)/2 + $Offset;
1034
+            $Xc = cos(($Angle-90)*PI/180) * $OuterRadius + $X;
1035
+            $Yc = sin(($Angle-90)*PI/180) * $OuterRadius + $Y;
1008 1036
 
1009
-         if ( $i<90 ) { $Yc++; }
1010
-         if ( $i>180 && $i<270 ) { $Xc++; }
1011
-         if ( $i>=270 ) { $Xc++; $Yc++; }
1037
+            $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
1012 1038
 
1013
-         $Plots[] = $Xc; $Plots[] = $Yc;
1039
+            if ( $LabelStacked )
1040
+            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$OuterRadius);
1041
+            else
1042
+            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
1014 1043
         }
1015
-       $Boundaries[0]["X2"] = $Xc; $Boundaries[0]["Y2"] = $Yc;
1016 1044
 
1017
-       /* Draw the polygon */
1018
-       $this->pChartObject->drawPolygon($Plots,$Settings);
1019
-       if ( $RecordImageMap && !$Shadow ) { $this->pChartObject->addToImageMap("POLY",$this->arraySerialize($Plots),$this->pChartObject->toHTMLColor($Palette[$ID]["R"],$Palette[$ID]["G"],$Palette[$ID]["B"]),$Data["Series"][$Data["Abscissa"]]["Data"][$Key],$Value); }
1045
+        $Offset = $Lasti; $ID++;
1046
+        }
1020 1047
 
1021
-       /* Smooth the edges using AA */
1022
-       foreach($AAPixels as $iKey => $Pos ) { $this->pChartObject->drawAntialiasPixel($Pos[0],$Pos[1],$BorderColor); }
1023
-       $this->pChartObject->drawLine($Boundaries[0]["X1"],$Boundaries[0]["Y1"],$Boundaries[0]["X2"],$Boundaries[0]["Y2"],$BorderColor);
1024
-       $this->pChartObject->drawLine($Boundaries[1]["X1"],$Boundaries[1]["Y1"],$Boundaries[1]["X2"],$Boundaries[1]["Y2"],$BorderColor);
1048
+        if ( $DrawLabels && $LabelStacked ) { $this->writeShiftedLabels(); }
1025 1049
 
1026
-       if ( $DrawLabels && !$Shadow )
1050
+        if ( $WriteValues && !$Shadow )
1051
+        {
1052
+        $Step = 360 / (2 * PI * $OuterRadius);
1053
+        $Offset = 0;
1054
+        foreach($Values as $Key => $Value)
1027 1055
         {
1028
-         if ( $LabelColor == PIE_LABEL_COLOR_AUTO )
1029
-          { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);}
1030
-         else
1031
-          { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
1056
+            $EndAngle = $Offset+($Value*$ScaleFactor);
1057
+            if ( $EndAngle > 360 ) { $EndAngle = 360; }
1032 1058
 
1033
-         $Angle = ($EndAngle - $Offset)/2 + $Offset;
1034
-         $Xc = cos(($Angle-90)*PI/180) * $OuterRadius + $X;
1035
-         $Yc = sin(($Angle-90)*PI/180) * $OuterRadius + $Y;
1059
+            $Angle = $Offset+($Value*$ScaleFactor)/2;
1060
+            if ( $ValuePosition == PIE_VALUE_OUTSIDE )
1061
+            {
1062
+            $Xc = cos(($Angle-90)*PI/180) * ($OuterRadius+$ValuePadding) + $X;
1063
+            $Yc = sin(($Angle-90)*PI/180) * ($OuterRadius+$ValuePadding) + $Y;
1064
+            if ( $Angle >=0 && $Angle <= 90 ) { $Align = TEXT_ALIGN_BOTTOMLEFT; }
1065
+            if ( $Angle > 90 && $Angle <= 180 ) { $Align = TEXT_ALIGN_TOPLEFT; }
1066
+            if ( $Angle > 180 && $Angle <= 270 ) { $Align = TEXT_ALIGN_TOPRIGHT; }
1067
+            if ( $Angle > 270 ) { $Align = TEXT_ALIGN_BOTTOMRIGHT; }
1068
+            }
1069
+            else
1070
+            {
1071
+            $Xc = cos(($Angle-90)*PI/180) * (($OuterRadius-$InnerRadius)/2+$InnerRadius) + $X;
1072
+            $Yc = sin(($Angle-90)*PI/180) * (($OuterRadius-$InnerRadius)/2+$InnerRadius) + $Y;
1073
+            $Align = TEXT_ALIGN_MIDDLEMIDDLE;
1074
+            }
1036 1075
 
1037
-         $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
1076
+            if ( $WriteValues == PIE_VALUE_PERCENTAGE )
1077
+            $Display = round(( 100 / $SerieSum ) * $Value,$Precision)."%";
1078
+            elseif ( $WriteValues == PIE_VALUE_NATURAL )
1079
+            $Display = $Value.$ValueSuffix;
1080
+            else
1081
+            $Label = "";
1038 1082
 
1039
-         if ( $LabelStacked )
1040
-          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$OuterRadius);
1041
-         else
1042
-          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
1083
+            $this->pChartObject->drawText($Xc,$Yc,$Display,array("Align"=>$Align,"R"=>$ValueR,"G"=>$ValueG,"B"=>$ValueB));
1084
+            $Offset = $EndAngle;
1085
+        }
1043 1086
         }
1044 1087
 
1045
-       $Offset = $Lasti; $ID++;
1046
-      }
1088
+        $this->pChartObject->Shadow = $RestoreShadow;
1047 1089
 
1048
-     if ( $DrawLabels && $LabelStacked ) { $this->writeShiftedLabels(); }
1090
+        return(PIE_RENDERED);
1091
+    }
1049 1092
 
1050
-     if ( $WriteValues && !$Shadow )
1051
-      {
1052
-       $Step = 360 / (2 * PI * $OuterRadius);
1053
-       $Offset = 0;
1054
-       foreach($Values as $Key => $Value)
1093
+    /* Draw a 3D ring chart */
1094
+    function draw3DRing($X,$Y,$Format="")
1095
+    {
1096
+        $OuterRadius	= isset($Format["OuterRadius"]) ? $Format["OuterRadius"] : 100;
1097
+        $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
1098
+        $InnerRadius	= isset($Format["InnerRadius"]) ? $Format["InnerRadius"] : 30;
1099
+        $SkewFactor	= isset($Format["SkewFactor"]) ? $Format["SkewFactor"] : .6;
1100
+        $SliceHeight	= isset($Format["SliceHeight"]) ? $Format["SliceHeight"] : 10;
1101
+        $DataGapAngle	= isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 10;
1102
+        $DataGapRadius	= isset($Format["DataGapRadius"]) ? $Format["DataGapRadius"] : 10;
1103
+        $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
1104
+        $Shadow		= isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
1105
+        $DrawLabels	= isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : FALSE;
1106
+        $LabelStacked	= isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
1107
+        $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
1108
+        $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
1109
+        $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
1110
+        $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
1111
+        $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
1112
+        $Cf		= isset($Format["Cf"]) ? $Format["Cf"] : 20;
1113
+        $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : PIE_VALUE_NATURAL;
1114
+        $ValuePadding	= isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : $SliceHeight + 15;
1115
+        $ValuePosition	= isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_OUTSIDE;
1116
+        $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
1117
+        $ValueR		= isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
1118
+        $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
1119
+        $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
1120
+        $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
1121
+        $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
1122
+
1123
+        /* Error correction for overlaying rounded corners */
1124
+        if ( $SkewFactor < .5 ) { $SkewFactor = .5; }
1125
+
1126
+        /* Data Processing */
1127
+        $Data    = $this->pDataObject->getData();
1128
+        $Palette = $this->pDataObject->getPalette();
1129
+
1130
+        /* Do we have an abscissa serie defined? */
1131
+        if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
1132
+
1133
+        /* Try to find the data serie */
1134
+        $DataSerie = "";
1135
+        foreach ($Data["Series"] as $SerieName => $SerieData)
1136
+        { if ( $SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
1137
+
1138
+        /* Do we have data to compute? */
1139
+        if ( $DataSerie == "" ) { return(PIE_NO_DATASERIE); }
1140
+
1141
+        /* Remove unused data */
1142
+        list($Data,$Palette) = $this->clean0Values($Data,$Palette,$DataSerie,$Data["Abscissa"]);
1143
+
1144
+        /* Compute the pie sum */
1145
+        $SerieSum = $this->pDataObject->getSum($DataSerie);
1146
+
1147
+        /* Do we have data to draw? */
1148
+        if ( $SerieSum == 0 ) { return(PIE_SUMISNULL); }
1149
+
1150
+        /* Dump the real number of data to draw */
1151
+        $Values = "";
1152
+        foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
1153
+        { if ($Value != 0) { $Values[] = $Value; } }
1154
+
1155
+        /* Compute the wasted angular space between series */
1156
+        if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = count($Values) * $DataGapAngle; }
1157
+
1158
+        /* Compute the scale */
1159
+        $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
1160
+
1161
+        $RestoreShadow = $this->pChartObject->Shadow;
1162
+        if ( $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = FALSE; }
1163
+
1164
+        /* Draw the polygon ring elements */
1165
+        $Offset = 360; $ID = count($Values)-1;
1166
+        $Values = array_reverse($Values);
1167
+        $Slice  = 0; $Slices = ""; $SliceColors = ""; $Visible = ""; $SliceAngle = "";
1168
+        foreach($Values as $Key => $Value)
1055 1169
         {
1056
-         $EndAngle = $Offset+($Value*$ScaleFactor);
1057
-         if ( $EndAngle > 360 ) { $EndAngle = 360; }
1170
+        if ( !isset($Palette[$ID]["R"]) ) { $Color = $this->pChartObject->getRandomColor(); $Palette[$ID] = $Color; $this->pDataObject->savePalette($ID,$Color); }
1171
+        $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
1058 1172
 
1059
-         $Angle = $Offset+($Value*$ScaleFactor)/2;
1060
-         if ( $ValuePosition == PIE_VALUE_OUTSIDE )
1061
-          {
1062
-           $Xc = cos(($Angle-90)*PI/180) * ($OuterRadius+$ValuePadding) + $X;
1063
-           $Yc = sin(($Angle-90)*PI/180) * ($OuterRadius+$ValuePadding) + $Y;
1064
-           if ( $Angle >=0 && $Angle <= 90 ) { $Align = TEXT_ALIGN_BOTTOMLEFT; }
1065
-           if ( $Angle > 90 && $Angle <= 180 ) { $Align = TEXT_ALIGN_TOPLEFT; }
1066
-           if ( $Angle > 180 && $Angle <= 270 ) { $Align = TEXT_ALIGN_TOPRIGHT; }
1067
-           if ( $Angle > 270 ) { $Align = TEXT_ALIGN_BOTTOMRIGHT; }
1068
-          }
1069
-         else
1070
-          {
1071
-           $Xc = cos(($Angle-90)*PI/180) * (($OuterRadius-$InnerRadius)/2+$InnerRadius) + $X;
1072
-           $Yc = sin(($Angle-90)*PI/180) * (($OuterRadius-$InnerRadius)/2+$InnerRadius) + $Y;
1073
-           $Align = TEXT_ALIGN_MIDDLEMIDDLE;
1074
-          }
1173
+        $SliceColors[$Slice] = $Settings;
1075 1174
 
1076
-         if ( $WriteValues == PIE_VALUE_PERCENTAGE )
1077
-          $Display = round(( 100 / $SerieSum ) * $Value,$Precision)."%";
1078
-         elseif ( $WriteValues == PIE_VALUE_NATURAL )
1079
-          $Display = $Value.$ValueSuffix;
1080
-         else
1081
-          $Label = "";
1175
+        $StartAngle = $Offset;
1176
+        $EndAngle   = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
1082 1177
 
1083
-         $this->pChartObject->drawText($Xc,$Yc,$Display,array("Align"=>$Align,"R"=>$ValueR,"G"=>$ValueG,"B"=>$ValueB));
1084
-         $Offset = $EndAngle;
1085
-        }
1086
-      }
1178
+        if ( $StartAngle > 180 ) { $Visible[$Slice]["Start"] = TRUE; } else { $Visible[$Slice]["Start"] = TRUE; }
1179
+        if ( $EndAngle < 180 )   { $Visible[$Slice]["End"] = FALSE; } else { $Visible[$Slice]["End"] = TRUE; }
1087 1180
 
1088
-     $this->pChartObject->Shadow = $RestoreShadow;
1181
+        $Step   = (360 / (2 * PI * $OuterRadius))/2;
1182
+        $OutX1 = VOID; $OutY1 = VOID;
1183
+        for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
1184
+        {
1185
+            $Xc = cos(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius-2) + $X;
1186
+            $Yc = sin(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius-2)*$SkewFactor + $Y;
1187
+            $Slices[$Slice]["AA"][] = array($Xc,$Yc);
1089 1188
 
1090
-     return(PIE_RENDERED);
1091
-    }
1189
+            $Xc = cos(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius-1) + $X;
1190
+            $Yc = sin(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius-1)*$SkewFactor + $Y;
1191
+            $Slices[$Slice]["AA"][] = array($Xc,$Yc);
1092 1192
 
1093
-   /* Draw a 3D ring chart */
1094
-   function draw3DRing($X,$Y,$Format="")
1095
-    {
1096
-     $OuterRadius	= isset($Format["OuterRadius"]) ? $Format["OuterRadius"] : 100;
1097
-     $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
1098
-     $InnerRadius	= isset($Format["InnerRadius"]) ? $Format["InnerRadius"] : 30;
1099
-     $SkewFactor	= isset($Format["SkewFactor"]) ? $Format["SkewFactor"] : .6;
1100
-     $SliceHeight	= isset($Format["SliceHeight"]) ? $Format["SliceHeight"] : 10;
1101
-     $DataGapAngle	= isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 10;
1102
-     $DataGapRadius	= isset($Format["DataGapRadius"]) ? $Format["DataGapRadius"] : 10;
1103
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
1104
-     $Shadow		= isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
1105
-     $DrawLabels	= isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : FALSE;
1106
-     $LabelStacked	= isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
1107
-     $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
1108
-     $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
1109
-     $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
1110
-     $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
1111
-     $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
1112
-     $Cf		= isset($Format["Cf"]) ? $Format["Cf"] : 20;
1113
-     $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : PIE_VALUE_NATURAL;
1114
-     $ValuePadding	= isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : $SliceHeight + 15;
1115
-     $ValuePosition	= isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_OUTSIDE;
1116
-     $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
1117
-     $ValueR		= isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
1118
-     $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
1119
-     $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
1120
-     $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
1121
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
1122
-
1123
-     /* Error correction for overlaying rounded corners */
1124
-     if ( $SkewFactor < .5 ) { $SkewFactor = .5; }
1125
-
1126
-     /* Data Processing */
1127
-     $Data    = $this->pDataObject->getData();
1128
-     $Palette = $this->pDataObject->getPalette();
1129
-
1130
-     /* Do we have an abscissa serie defined? */
1131
-     if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
1132
-
1133
-     /* Try to find the data serie */
1134
-     $DataSerie = "";
1135
-     foreach ($Data["Series"] as $SerieName => $SerieData)
1136
-      { if ( $SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
1137
-
1138
-     /* Do we have data to compute? */
1139
-     if ( $DataSerie == "" ) { return(PIE_NO_DATASERIE); }
1140
-
1141
-     /* Remove unused data */
1142
-     list($Data,$Palette) = $this->clean0Values($Data,$Palette,$DataSerie,$Data["Abscissa"]);
1143
-
1144
-     /* Compute the pie sum */
1145
-     $SerieSum = $this->pDataObject->getSum($DataSerie);
1146
-
1147
-     /* Do we have data to draw? */
1148
-     if ( $SerieSum == 0 ) { return(PIE_SUMISNULL); }
1149
-
1150
-     /* Dump the real number of data to draw */
1151
-     $Values = "";
1152
-     foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
1153
-      { if ($Value != 0) { $Values[] = $Value; } }
1154
-
1155
-     /* Compute the wasted angular space between series */
1156
-     if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = count($Values) * $DataGapAngle; }
1157
-
1158
-     /* Compute the scale */
1159
-     $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
1160
-
1161
-     $RestoreShadow = $this->pChartObject->Shadow;
1162
-     if ( $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = FALSE; }
1163
-
1164
-     /* Draw the polygon ring elements */
1165
-     $Offset = 360; $ID = count($Values)-1;
1166
-     $Values = array_reverse($Values);
1167
-     $Slice  = 0; $Slices = ""; $SliceColors = ""; $Visible = ""; $SliceAngle = "";
1168
-     foreach($Values as $Key => $Value)
1169
-      {
1170
-       if ( !isset($Palette[$ID]["R"]) ) { $Color = $this->pChartObject->getRandomColor(); $Palette[$ID] = $Color; $this->pDataObject->savePalette($ID,$Color); }
1171
-       $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
1172
-
1173
-       $SliceColors[$Slice] = $Settings;
1174
-
1175
-       $StartAngle = $Offset;
1176
-       $EndAngle   = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
1177
-
1178
-       if ( $StartAngle > 180 ) { $Visible[$Slice]["Start"] = TRUE; } else { $Visible[$Slice]["Start"] = TRUE; }
1179
-       if ( $EndAngle < 180 )   { $Visible[$Slice]["End"] = FALSE; } else { $Visible[$Slice]["End"] = TRUE; }
1180
-
1181
-       $Step   = (360 / (2 * PI * $OuterRadius))/2;
1182
-       $OutX1 = VOID; $OutY1 = VOID;
1183
-       for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
1184
-        {
1185
-         $Xc = cos(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius-2) + $X;
1186
-         $Yc = sin(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius-2)*$SkewFactor + $Y;
1187
-         $Slices[$Slice]["AA"][] = array($Xc,$Yc);
1188
-
1189
-         $Xc = cos(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius-1) + $X;
1190
-         $Yc = sin(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius-1)*$SkewFactor + $Y;
1191
-         $Slices[$Slice]["AA"][] = array($Xc,$Yc);
1192
-
1193
-         $Xc = cos(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius) + $X;
1194
-         $Yc = sin(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius)*$SkewFactor + $Y;
1195
-         $this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
1196
-
1197
-         if ( $OutX1 == VOID ) { $OutX1 = $Xc; $OutY1 = $Yc; }
1198
-
1199
-         if ( $i<90 ) { $Yc++; }
1200
-         if ( $i>90 && $i<180 ) { $Xc++; }
1201
-         if ( $i>180 && $i<270 ) { $Xc++; }
1202
-         if ( $i>=270 ) { $Xc++; $Yc++; }
1203
-
1204
-         $Slices[$Slice]["BottomPoly"][] = floor($Xc); $Slices[$Slice]["BottomPoly"][] = floor($Yc);
1205
-         $Slices[$Slice]["TopPoly"][] = floor($Xc); $Slices[$Slice]["TopPoly"][] = floor($Yc)-$SliceHeight;
1206
-         $Slices[$Slice]["Angle"][] = $i;
1193
+            $Xc = cos(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius) + $X;
1194
+            $Yc = sin(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius)*$SkewFactor + $Y;
1195
+            $this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
1196
+
1197
+            if ( $OutX1 == VOID ) { $OutX1 = $Xc; $OutY1 = $Yc; }
1198
+
1199
+            if ( $i<90 ) { $Yc++; }
1200
+            if ( $i>90 && $i<180 ) { $Xc++; }
1201
+            if ( $i>180 && $i<270 ) { $Xc++; }
1202
+            if ( $i>=270 ) { $Xc++; $Yc++; }
1203
+
1204
+            $Slices[$Slice]["BottomPoly"][] = floor($Xc); $Slices[$Slice]["BottomPoly"][] = floor($Yc);
1205
+            $Slices[$Slice]["TopPoly"][] = floor($Xc); $Slices[$Slice]["TopPoly"][] = floor($Yc)-$SliceHeight;
1206
+            $Slices[$Slice]["Angle"][] = $i;
1207 1207
         }
1208
-       $OutX2 = $Xc; $OutY2 = $Yc;
1208
+        $OutX2 = $Xc; $OutY2 = $Yc;
1209 1209
 
1210
-       $Slices[$Slice]["Angle"][] = VOID;
1211
-       $Lasti = $i;
1210
+        $Slices[$Slice]["Angle"][] = VOID;
1211
+        $Lasti = $i;
1212 1212
 
1213
-       $Step   = (360 / (2 * PI * $InnerRadius))/2;
1214
-       $InX1 = VOID; $InY1 = VOID;
1215
-       for($i=$EndAngle;$i<=$Offset;$i=$i+$Step)
1213
+        $Step   = (360 / (2 * PI * $InnerRadius))/2;
1214
+        $InX1 = VOID; $InY1 = VOID;
1215
+        for($i=$EndAngle;$i<=$Offset;$i=$i+$Step)
1216 1216
         {
1217
-         $Xc = cos(($i-90)*PI/180) * ($InnerRadius+$DataGapRadius-1) + $X;
1218
-         $Yc = sin(($i-90)*PI/180) * ($InnerRadius+$DataGapRadius-1)*$SkewFactor + $Y;
1219
-         $Slices[$Slice]["AA"][] = array($Xc,$Yc);
1217
+            $Xc = cos(($i-90)*PI/180) * ($InnerRadius+$DataGapRadius-1) + $X;
1218
+            $Yc = sin(($i-90)*PI/180) * ($InnerRadius+$DataGapRadius-1)*$SkewFactor + $Y;
1219
+            $Slices[$Slice]["AA"][] = array($Xc,$Yc);
1220 1220
 
1221
-         $Xc = cos(($i-90)*PI/180) * ($InnerRadius+$DataGapRadius) + $X;
1222
-         $Yc = sin(($i-90)*PI/180) * ($InnerRadius+$DataGapRadius)*$SkewFactor + $Y;
1223
-         $Slices[$Slice]["AA"][] = array($Xc,$Yc);
1221
+            $Xc = cos(($i-90)*PI/180) * ($InnerRadius+$DataGapRadius) + $X;
1222
+            $Yc = sin(($i-90)*PI/180) * ($InnerRadius+$DataGapRadius)*$SkewFactor + $Y;
1223
+            $Slices[$Slice]["AA"][] = array($Xc,$Yc);
1224 1224
 
1225
-         if ( $InX1 == VOID ) { $InX1 = $Xc; $InY1 = $Yc; }
1225
+            if ( $InX1 == VOID ) { $InX1 = $Xc; $InY1 = $Yc; }
1226 1226
 
1227
-         if ( $i<90 ) { $Yc++; }
1228
-         if ( $i>90 && $i<180 ) { $Xc++; }
1229
-         if ( $i>180 && $i<270 ) { $Xc++; }
1230
-         if ( $i>=270 ) { $Xc++; $Yc++; }
1227
+            if ( $i<90 ) { $Yc++; }
1228
+            if ( $i>90 && $i<180 ) { $Xc++; }
1229
+            if ( $i>180 && $i<270 ) { $Xc++; }
1230
+            if ( $i>=270 ) { $Xc++; $Yc++; }
1231 1231
 
1232
-         $Slices[$Slice]["BottomPoly"][] = floor($Xc); $Slices[$Slice]["BottomPoly"][] = floor($Yc);
1233
-         $Slices[$Slice]["TopPoly"][] = floor($Xc); $Slices[$Slice]["TopPoly"][] = floor($Yc)-$SliceHeight;
1234
-         $Slices[$Slice]["Angle"][] = $i;
1232
+            $Slices[$Slice]["BottomPoly"][] = floor($Xc); $Slices[$Slice]["BottomPoly"][] = floor($Yc);
1233
+            $Slices[$Slice]["TopPoly"][] = floor($Xc); $Slices[$Slice]["TopPoly"][] = floor($Yc)-$SliceHeight;
1234
+            $Slices[$Slice]["Angle"][] = $i;
1235 1235
         }
1236
-       $InX2 = $Xc; $InY2 = $Yc;
1236
+        $InX2 = $Xc; $InY2 = $Yc;
1237 1237
 
1238
-       $Slices[$Slice]["InX1"] = $InX1;   $Slices[$Slice]["InY1"] = $InY1;
1239
-       $Slices[$Slice]["InX2"] = $InX2;   $Slices[$Slice]["InY2"] = $InY2;
1240
-       $Slices[$Slice]["OutX1"] = $OutX1; $Slices[$Slice]["OutY1"] = $OutY1;
1241
-       $Slices[$Slice]["OutX2"] = $OutX2; $Slices[$Slice]["OutY2"] = $OutY2;
1238
+        $Slices[$Slice]["InX1"] = $InX1;   $Slices[$Slice]["InY1"] = $InY1;
1239
+        $Slices[$Slice]["InX2"] = $InX2;   $Slices[$Slice]["InY2"] = $InY2;
1240
+        $Slices[$Slice]["OutX1"] = $OutX1; $Slices[$Slice]["OutY1"] = $OutY1;
1241
+        $Slices[$Slice]["OutX2"] = $OutX2; $Slices[$Slice]["OutY2"] = $OutY2;
1242 1242
 
1243
-       $Offset = $Lasti - $DataGapAngle; $ID--; $Slice++;
1244
-      }
1243
+        $Offset = $Lasti - $DataGapAngle; $ID--; $Slice++;
1244
+        }
1245 1245
 
1246
-     /* Draw the bottom pie splice */
1247
-     foreach($Slices as $SliceID => $Plots)
1248
-      {
1249
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1250
-       $this->pChartObject->drawPolygon($Plots["BottomPoly"],$Settings);
1246
+        /* Draw the bottom pie splice */
1247
+        foreach($Slices as $SliceID => $Plots)
1248
+        {
1249
+        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1250
+        $this->pChartObject->drawPolygon($Plots["BottomPoly"],$Settings);
1251 1251
 
1252
-       foreach($Plots["AA"] as $Key => $Pos)
1252
+        foreach($Plots["AA"] as $Key => $Pos)
1253 1253
         $this->pChartObject->drawAntialiasPixel($Pos[0],$Pos[1],$Settings);
1254 1254
 
1255
-       $this->pChartObject->drawLine($Plots["InX1"],$Plots["InY1"],$Plots["OutX2"],$Plots["OutY2"],$Settings);
1256
-       $this->pChartObject->drawLine($Plots["InX2"],$Plots["InY2"],$Plots["OutX1"],$Plots["OutY1"],$Settings);
1257
-      }
1255
+        $this->pChartObject->drawLine($Plots["InX1"],$Plots["InY1"],$Plots["OutX2"],$Plots["OutY2"],$Settings);
1256
+        $this->pChartObject->drawLine($Plots["InX2"],$Plots["InY2"],$Plots["OutX1"],$Plots["OutY1"],$Settings);
1257
+        }
1258 1258
 
1259
-     $Slices      = array_reverse($Slices);
1260
-     $SliceColors = array_reverse($SliceColors);
1259
+        $Slices      = array_reverse($Slices);
1260
+        $SliceColors = array_reverse($SliceColors);
1261 1261
 
1262
-     /* Draw the vertical edges (semi-visible) */
1263
-     foreach($Slices as $SliceID => $Plots)
1264
-      {
1265
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1266
-       $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1262
+        /* Draw the vertical edges (semi-visible) */
1263
+        foreach($Slices as $SliceID => $Plots)
1264
+        {
1265
+        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1266
+        $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1267 1267
 
1268
-       $StartAngle = $Plots["Angle"][0];
1269
-       foreach($Plots["Angle"] as $Key =>$Angle) { if ($Angle == VOID) { $EndAngle = $Plots["Angle"][$Key-1]; } }
1268
+        $StartAngle = $Plots["Angle"][0];
1269
+        foreach($Plots["Angle"] as $Key =>$Angle) { if ($Angle == VOID) { $EndAngle = $Plots["Angle"][$Key-1]; } }
1270 1270
 
1271
-       if ( $StartAngle >= 270 || $StartAngle <= 90 )
1271
+        if ( $StartAngle >= 270 || $StartAngle <= 90 )
1272 1272
         $this->pChartObject->drawLine($Plots["OutX1"],$Plots["OutY1"],$Plots["OutX1"],$Plots["OutY1"]-$SliceHeight,$Settings);
1273
-       if ( $StartAngle >= 270 || $StartAngle <= 90 )
1273
+        if ( $StartAngle >= 270 || $StartAngle <= 90 )
1274 1274
         $this->pChartObject->drawLine($Plots["OutX2"],$Plots["OutY2"],$Plots["OutX2"],$Plots["OutY2"]-$SliceHeight,$Settings);
1275 1275
 
1276 1276
         $this->pChartObject->drawLine($Plots["InX1"],$Plots["InY1"],$Plots["InX1"],$Plots["InY1"]-$SliceHeight,$Settings);
1277 1277
         $this->pChartObject->drawLine($Plots["InX2"],$Plots["InY2"],$Plots["InX2"],$Plots["InY2"]-$SliceHeight,$Settings);
1278
-      }
1279
-
1280
-     /* Draw the inner vertical slices */
1281
-     foreach($Slices as $SliceID => $Plots)
1282
-      {
1283
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1284
-       $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1285
-
1286
-       $Outer = TRUE; $Inner = FALSE;
1287
-       $InnerPlotsA = ""; $InnerPlotsB = "";
1288
-       foreach($Plots["Angle"] as $ID => $Angle)
1289
-        {
1290
-         if ( $Angle == VOID )
1291
-          { $Outer = FALSE; $Inner = TRUE; }
1292
-         elseif( $Inner )
1293
-          {
1294
-           if (( $Angle < 90 || $Angle > 270 ) && isset($Plots["BottomPoly"][$ID*2]) )
1278
+        }
1279
+
1280
+        /* Draw the inner vertical slices */
1281
+        foreach($Slices as $SliceID => $Plots)
1282
+        {
1283
+        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1284
+        $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1285
+
1286
+        $Outer = TRUE; $Inner = FALSE;
1287
+        $InnerPlotsA = ""; $InnerPlotsB = "";
1288
+        foreach($Plots["Angle"] as $ID => $Angle)
1289
+        {
1290
+            if ( $Angle == VOID )
1291
+            { $Outer = FALSE; $Inner = TRUE; }
1292
+            elseif( $Inner )
1295 1293
             {
1296
-             $Xo = $Plots["BottomPoly"][$ID*2];
1297
-             $Yo = $Plots["BottomPoly"][$ID*2+1];
1294
+            if (( $Angle < 90 || $Angle > 270 ) && isset($Plots["BottomPoly"][$ID*2]) )
1295
+            {
1296
+                $Xo = $Plots["BottomPoly"][$ID*2];
1297
+                $Yo = $Plots["BottomPoly"][$ID*2+1];
1298 1298
 
1299
-             $InnerPlotsA[] = $Xo; $InnerPlotsA[] = $Yo;
1300
-             $InnerPlotsB[] = $Xo; $InnerPlotsB[] = $Yo-$SliceHeight;
1299
+                $InnerPlotsA[] = $Xo; $InnerPlotsA[] = $Yo;
1300
+                $InnerPlotsB[] = $Xo; $InnerPlotsB[] = $Yo-$SliceHeight;
1301
+            }
1301 1302
             }
1302
-          }
1303 1303
         }
1304 1304
 
1305
-       if ( $InnerPlotsA != "" )
1305
+        if ( $InnerPlotsA != "" )
1306 1306
         { $InnerPlots = array_merge($InnerPlotsA,$this->arrayReverse($InnerPlotsB)); $this->pChartObject->drawPolygon($InnerPlots,$Settings); }
1307
-      }
1307
+        }
1308 1308
 
1309
-     /* Draw the splice top and left poly */
1310
-     foreach($Slices as $SliceID => $Plots)
1311
-      {
1312
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1313
-       $Settings["R"] = $Settings["R"]+$Cf*1.5; $Settings["G"] = $Settings["G"]+$Cf*1.5; $Settings["B"] = $Settings["B"]+$Cf*1.5;
1309
+        /* Draw the splice top and left poly */
1310
+        foreach($Slices as $SliceID => $Plots)
1311
+        {
1312
+        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1313
+        $Settings["R"] = $Settings["R"]+$Cf*1.5; $Settings["G"] = $Settings["G"]+$Cf*1.5; $Settings["B"] = $Settings["B"]+$Cf*1.5;
1314 1314
 
1315
-       $StartAngle = $Plots["Angle"][0];
1316
-       foreach($Plots["Angle"] as $Key =>$Angle) { if ($Angle == VOID) { $EndAngle = $Plots["Angle"][$Key-1]; } }
1315
+        $StartAngle = $Plots["Angle"][0];
1316
+        foreach($Plots["Angle"] as $Key =>$Angle) { if ($Angle == VOID) { $EndAngle = $Plots["Angle"][$Key-1]; } }
1317 1317
 
1318
-       if ( $StartAngle < 180 )
1318
+        if ( $StartAngle < 180 )
1319 1319
         {
1320
-         $Points = "";
1321
-         $Points[] = $Plots["InX2"];
1322
-         $Points[] = $Plots["InY2"];
1323
-         $Points[] = $Plots["InX2"];
1324
-         $Points[] = $Plots["InY2"]-$SliceHeight;
1325
-         $Points[] = $Plots["OutX1"];
1326
-         $Points[] = $Plots["OutY1"]-$SliceHeight;
1327
-         $Points[] = $Plots["OutX1"];
1328
-         $Points[] = $Plots["OutY1"];
1329
-
1330
-         $this->pChartObject->drawPolygon($Points,$Settings);
1320
+            $Points = "";
1321
+            $Points[] = $Plots["InX2"];
1322
+            $Points[] = $Plots["InY2"];
1323
+            $Points[] = $Plots["InX2"];
1324
+            $Points[] = $Plots["InY2"]-$SliceHeight;
1325
+            $Points[] = $Plots["OutX1"];
1326
+            $Points[] = $Plots["OutY1"]-$SliceHeight;
1327
+            $Points[] = $Plots["OutX1"];
1328
+            $Points[] = $Plots["OutY1"];
1329
+
1330
+            $this->pChartObject->drawPolygon($Points,$Settings);
1331 1331
         }
1332 1332
 
1333
-       if ( $EndAngle > 180 )
1333
+        if ( $EndAngle > 180 )
1334 1334
         {
1335
-         $Points = "";
1336
-         $Points[] = $Plots["InX1"];
1337
-         $Points[] = $Plots["InY1"];
1338
-         $Points[] = $Plots["InX1"];
1339
-         $Points[] = $Plots["InY1"]-$SliceHeight;
1340
-         $Points[] = $Plots["OutX2"];
1341
-         $Points[] = $Plots["OutY2"]-$SliceHeight;
1342
-         $Points[] = $Plots["OutX2"];
1343
-         $Points[] = $Plots["OutY2"];
1344
-
1345
-         $this->pChartObject->drawPolygon($Points,$Settings);
1335
+            $Points = "";
1336
+            $Points[] = $Plots["InX1"];
1337
+            $Points[] = $Plots["InY1"];
1338
+            $Points[] = $Plots["InX1"];
1339
+            $Points[] = $Plots["InY1"]-$SliceHeight;
1340
+            $Points[] = $Plots["OutX2"];
1341
+            $Points[] = $Plots["OutY2"]-$SliceHeight;
1342
+            $Points[] = $Plots["OutX2"];
1343
+            $Points[] = $Plots["OutY2"];
1344
+
1345
+            $this->pChartObject->drawPolygon($Points,$Settings);
1346
+        }
1346 1347
         }
1347
-      }
1348 1348
 
1349 1349
 
1350
-     /* Draw the vertical edges (visible) */
1351
-     foreach($Slices as $SliceID => $Plots)
1352
-      {
1353
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1354
-       $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1350
+        /* Draw the vertical edges (visible) */
1351
+        foreach($Slices as $SliceID => $Plots)
1352
+        {
1353
+        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1354
+        $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1355 1355
 
1356
-       $StartAngle = $Plots["Angle"][0];
1357
-       foreach($Plots["Angle"] as $Key =>$Angle) { if ($Angle == VOID) { $EndAngle = $Plots["Angle"][$Key-1]; } }
1356
+        $StartAngle = $Plots["Angle"][0];
1357
+        foreach($Plots["Angle"] as $Key =>$Angle) { if ($Angle == VOID) { $EndAngle = $Plots["Angle"][$Key-1]; } }
1358 1358
 
1359
-       if ( $StartAngle <= 270 && $StartAngle >= 90 )
1359
+        if ( $StartAngle <= 270 && $StartAngle >= 90 )
1360 1360
         $this->pChartObject->drawLine($Plots["OutX1"],$Plots["OutY1"],$Plots["OutX1"],$Plots["OutY1"]-$SliceHeight,$Settings);
1361
-       if ( $EndAngle <= 270 && $EndAngle >= 90 )
1361
+        if ( $EndAngle <= 270 && $EndAngle >= 90 )
1362 1362
         $this->pChartObject->drawLine($Plots["OutX2"],$Plots["OutY2"],$Plots["OutX2"],$Plots["OutY2"]-$SliceHeight,$Settings);
1363
-      }
1363
+        }
1364 1364
 
1365 1365
 
1366
-     /* Draw the outer vertical slices */
1367
-     foreach($Slices as $SliceID => $Plots)
1368
-      {
1369
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1370
-       $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1366
+        /* Draw the outer vertical slices */
1367
+        foreach($Slices as $SliceID => $Plots)
1368
+        {
1369
+        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1370
+        $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1371 1371
 
1372
-       $Outer = TRUE; $Inner = FALSE;
1373
-       $OuterPlotsA = ""; $OuterPlotsB = ""; $InnerPlotsA = ""; $InnerPlotsB = "";
1374
-       foreach($Plots["Angle"] as $ID => $Angle)
1372
+        $Outer = TRUE; $Inner = FALSE;
1373
+        $OuterPlotsA = ""; $OuterPlotsB = ""; $InnerPlotsA = ""; $InnerPlotsB = "";
1374
+        foreach($Plots["Angle"] as $ID => $Angle)
1375 1375
         {
1376
-         if ( $Angle == VOID )
1377
-          { $Outer = FALSE; $Inner = TRUE; }
1378
-         elseif( $Outer )
1379
-          {
1380
-           if ( ( $Angle > 90 && $Angle < 270 ) && isset($Plots["BottomPoly"][$ID*2]) )
1376
+            if ( $Angle == VOID )
1377
+            { $Outer = FALSE; $Inner = TRUE; }
1378
+            elseif( $Outer )
1381 1379
             {
1382
-             $Xo = $Plots["BottomPoly"][$ID*2];
1383
-             $Yo = $Plots["BottomPoly"][$ID*2+1];
1380
+            if ( ( $Angle > 90 && $Angle < 270 ) && isset($Plots["BottomPoly"][$ID*2]) )
1381
+            {
1382
+                $Xo = $Plots["BottomPoly"][$ID*2];
1383
+                $Yo = $Plots["BottomPoly"][$ID*2+1];
1384 1384
 
1385
-             $OuterPlotsA[] = $Xo; $OuterPlotsA[] = $Yo;
1386
-             $OuterPlotsB[] = $Xo; $OuterPlotsB[] = $Yo-$SliceHeight;
1385
+                $OuterPlotsA[] = $Xo; $OuterPlotsA[] = $Yo;
1386
+                $OuterPlotsB[] = $Xo; $OuterPlotsB[] = $Yo-$SliceHeight;
1387
+            }
1387 1388
             }
1388
-          }
1389 1389
         }
1390
-       if ( $OuterPlotsA != "" )
1390
+        if ( $OuterPlotsA != "" )
1391 1391
         { $OuterPlots = array_merge($OuterPlotsA,$this->arrayReverse($OuterPlotsB)); $this->pChartObject->drawPolygon($OuterPlots,$Settings); }
1392
-      }
1392
+        }
1393 1393
 
1394
-     $Slices      = array_reverse($Slices);
1395
-     $SliceColors = array_reverse($SliceColors);
1394
+        $Slices      = array_reverse($Slices);
1395
+        $SliceColors = array_reverse($SliceColors);
1396 1396
 
1397 1397
 
1398
-     /* Draw the top pie splice */
1399
-     foreach($Slices as $SliceID => $Plots)
1400
-      {
1401
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1402
-       $Settings["R"] = $Settings["R"]+$Cf*2; $Settings["G"] = $Settings["G"]+$Cf*2; $Settings["B"] = $Settings["B"]+$Cf*2;
1398
+        /* Draw the top pie splice */
1399
+        foreach($Slices as $SliceID => $Plots)
1400
+        {
1401
+        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1402
+        $Settings["R"] = $Settings["R"]+$Cf*2; $Settings["G"] = $Settings["G"]+$Cf*2; $Settings["B"] = $Settings["B"]+$Cf*2;
1403 1403
  
1404
-       $this->pChartObject->drawPolygon($Plots["TopPoly"],$Settings);
1404
+        $this->pChartObject->drawPolygon($Plots["TopPoly"],$Settings);
1405 1405
 
1406
-       if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("POLY",$this->arraySerialize($Plots["TopPoly"]),$this->pChartObject->toHTMLColor($Settings["R"],$Settings["G"],$Settings["B"]),$Data["Series"][$Data["Abscissa"]]["Data"][$SliceID],$Data["Series"][$DataSerie]["Data"][count($Slices)-$SliceID-1]); }
1406
+        if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("POLY",$this->arraySerialize($Plots["TopPoly"]),$this->pChartObject->toHTMLColor($Settings["R"],$Settings["G"],$Settings["B"]),$Data["Series"][$Data["Abscissa"]]["Data"][$SliceID],$Data["Series"][$DataSerie]["Data"][count($Slices)-$SliceID-1]); }
1407 1407
 
1408
-       foreach($Plots["AA"] as $Key => $Pos)
1408
+        foreach($Plots["AA"] as $Key => $Pos)
1409 1409
         $this->pChartObject->drawAntialiasPixel($Pos[0],$Pos[1]-$SliceHeight,$Settings);
1410 1410
 
1411
-       $this->pChartObject->drawLine($Plots["InX1"],$Plots["InY1"]-$SliceHeight,$Plots["OutX2"],$Plots["OutY2"]-$SliceHeight,$Settings);
1412
-       $this->pChartObject->drawLine($Plots["InX2"],$Plots["InY2"]-$SliceHeight,$Plots["OutX1"],$Plots["OutY1"]-$SliceHeight,$Settings);
1413
-      }
1411
+        $this->pChartObject->drawLine($Plots["InX1"],$Plots["InY1"]-$SliceHeight,$Plots["OutX2"],$Plots["OutY2"]-$SliceHeight,$Settings);
1412
+        $this->pChartObject->drawLine($Plots["InX2"],$Plots["InY2"]-$SliceHeight,$Plots["OutX1"],$Plots["OutY1"]-$SliceHeight,$Settings);
1413
+        }
1414 1414
 
1415
-     if ( $DrawLabels )
1416
-      {
1417
-       $Offset = 360;
1418
-       foreach($Values as $Key => $Value)
1415
+        if ( $DrawLabels )
1416
+        {
1417
+        $Offset = 360;
1418
+        foreach($Values as $Key => $Value)
1419 1419
         {
1420
-         $StartAngle = $Offset;
1421
-         $EndAngle   = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
1420
+            $StartAngle = $Offset;
1421
+            $EndAngle   = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
1422 1422
 
1423
-         if ( $LabelColor == PIE_LABEL_COLOR_AUTO )
1424
-          { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);}
1425
-         else
1426
-          { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
1423
+            if ( $LabelColor == PIE_LABEL_COLOR_AUTO )
1424
+            { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);}
1425
+            else
1426
+            { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
1427 1427
 
1428
-         $Angle = ($EndAngle - $Offset)/2 + $Offset;
1429
-         $Xc = cos(($Angle-90)*PI/180) * ($OuterRadius+$DataGapRadius) + $X;
1430
-         $Yc = sin(($Angle-90)*PI/180) * ($OuterRadius+$DataGapRadius)*$SkewFactor + $Y;
1428
+            $Angle = ($EndAngle - $Offset)/2 + $Offset;
1429
+            $Xc = cos(($Angle-90)*PI/180) * ($OuterRadius+$DataGapRadius) + $X;
1430
+            $Yc = sin(($Angle-90)*PI/180) * ($OuterRadius+$DataGapRadius)*$SkewFactor + $Y;
1431 1431
 
1432
-         if ( $WriteValues == PIE_VALUE_PERCENTAGE )
1433
-          $Label = $Display = round(( 100 / $SerieSum ) * $Value,$Precision)."%";
1434
-         elseif ( $WriteValues == PIE_VALUE_NATURAL )
1435
-          $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
1436
-         else
1437
-          $Label = "";
1432
+            if ( $WriteValues == PIE_VALUE_PERCENTAGE )
1433
+            $Label = $Display = round(( 100 / $SerieSum ) * $Value,$Precision)."%";
1434
+            elseif ( $WriteValues == PIE_VALUE_NATURAL )
1435
+            $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
1436
+            else
1437
+            $Label = "";
1438 1438
 
1439
-         if ( $LabelStacked )
1440
-          $this->writePieLabel($Xc,$Yc-$SliceHeight,$Label,$Angle,$Settings,TRUE,$X,$Y,$OuterRadius);
1441
-         else
1442
-          $this->writePieLabel($Xc,$Yc-$SliceHeight,$Label,$Angle,$Settings,FALSE);
1439
+            if ( $LabelStacked )
1440
+            $this->writePieLabel($Xc,$Yc-$SliceHeight,$Label,$Angle,$Settings,TRUE,$X,$Y,$OuterRadius);
1441
+            else
1442
+            $this->writePieLabel($Xc,$Yc-$SliceHeight,$Label,$Angle,$Settings,FALSE);
1443 1443
 
1444
-         $Offset = $EndAngle - $DataGapAngle; $ID--; $Slice++;
1444
+            $Offset = $EndAngle - $DataGapAngle; $ID--; $Slice++;
1445
+        }
1445 1446
         }
1446
-      }
1447
-     if ( $DrawLabels && $LabelStacked ) { $this->writeShiftedLabels(); }
1447
+        if ( $DrawLabels && $LabelStacked ) { $this->writeShiftedLabels(); }
1448 1448
 
1449
-     $this->pChartObject->Shadow = $RestoreShadow;
1449
+        $this->pChartObject->Shadow = $RestoreShadow;
1450 1450
 
1451
-     return(PIE_RENDERED);
1451
+        return(PIE_RENDERED);
1452 1452
     }
1453 1453
 
1454
-  /* Serialize an array */
1455
-  function arraySerialize($Data)
1456
-   {
1454
+    /* Serialize an array */
1455
+    function arraySerialize($Data)
1456
+    {
1457 1457
     $Result = "";
1458 1458
     foreach($Data as $Key => $Value)
1459
-     { if ($Result == "") { $Result = floor($Value); } else { $Result = $Result.",".floor($Value); } }
1459
+        { if ($Result == "") { $Result = floor($Value); } else { $Result = $Result.",".floor($Value); } }
1460 1460
 
1461 1461
     return($Result);
1462
-   }
1462
+    }
1463 1463
 
1464
-  /* Reverse an array */
1465
-  function arrayReverse($Plots)
1466
-   {
1464
+    /* Reverse an array */
1465
+    function arrayReverse($Plots)
1466
+    {
1467 1467
     $Result = "";
1468 1468
 
1469 1469
     for($i=count($Plots)-1;$i>=0;$i=$i-2)
1470
-     { $Result[] = $Plots[$i-1]; $Result[] = $Plots[$i]; }
1470
+        { $Result[] = $Plots[$i-1]; $Result[] = $Plots[$i]; }
1471 1471
 
1472 1472
     return($Result);
1473
-   }
1473
+    }
1474 1474
 
1475
-  /* Remove unused series & values */
1476
-  function clean0Values($Data,$Palette,$DataSerie,$AbscissaSerie)
1477
-   {
1475
+    /* Remove unused series & values */
1476
+    function clean0Values($Data,$Palette,$DataSerie,$AbscissaSerie)
1477
+    {
1478 1478
     $NewPalette = ""; $NewData = ""; $NewAbscissa = "";
1479 1479
 
1480 1480
     /* Remove unused series */
1481 1481
     foreach($Data["Series"] as $SerieName => $SerieSettings)
1482
-     { if ( $SerieName != $DataSerie && $SerieName != $AbscissaSerie ) { unset($Data["Series"][$SerieName]); } }
1482
+        { if ( $SerieName != $DataSerie && $SerieName != $AbscissaSerie ) { unset($Data["Series"][$SerieName]); } }
1483 1483
 
1484 1484
     /* Remove NULL values */
1485 1485
     foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
1486
-     {
1487
-      if ($Value != 0 )
1488
-       {
1486
+        {
1487
+        if ($Value != 0 )
1488
+        {
1489 1489
         $NewData[]     = $Value;
1490 1490
         $NewAbscissa[] = $Data["Series"][$AbscissaSerie]["Data"][$Key];
1491 1491
         if ( isset($Palette[$Key]) ) { $NewPalette[]  = $Palette[$Key]; }
1492
-       }
1493
-     }
1492
+        }
1493
+        }
1494 1494
     $Data["Series"][$DataSerie]["Data"]     = $NewData;
1495 1495
     $Data["Series"][$AbscissaSerie]["Data"] = $NewAbscissa;
1496 1496
 
1497 1497
     return(array($Data,$NewPalette));
1498
-   }
1499
-  }
1498
+    }
1499
+    }
1500 1500
 ?>
1501 1501
\ No newline at end of file
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pStock.class.php 1 patch
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pStock - class to draw stock charts
4 4
 
5 5
      Version     : 2.1.3
@@ -13,204 +13,204 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- define("STOCK_MISSING_SERIE"	, 180001);
16
+    define("STOCK_MISSING_SERIE"	, 180001);
17 17
 
18
- /* pStock class definition */
19
- class pStock
20
-  {
21
-   var $pChartObject;
22
-   var $pDataObject;
18
+    /* pStock class definition */
19
+    class pStock
20
+    {
21
+    var $pChartObject;
22
+    var $pDataObject;
23 23
 
24
-   /* Class creator */
25
-   function pStock($pChartObject,$pDataObject)
24
+    /* Class creator */
25
+    function pStock($pChartObject,$pDataObject)
26 26
     {
27
-     $this->pChartObject = $pChartObject;
28
-     $this->pDataObject  = $pDataObject;
27
+        $this->pChartObject = $pChartObject;
28
+        $this->pDataObject  = $pDataObject;
29 29
     }
30 30
 
31
-   /* Draw a stock chart */
32
-   function drawStockChart($Format="")
31
+    /* Draw a stock chart */
32
+    function drawStockChart($Format="")
33 33
     {
34
-     $SerieOpen		= isset($Format["SerieOpen"]) ? $Format["SerieOpen"] : "Open";
35
-     $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36
-     $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
37
-     $SerieMax		= isset($Format["SerieMax"]) ? $Format["SerieMax"] : "Max";
38
-     $SerieMedian	= isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : NULL;
39
-     $LineWidth		= isset($Format["LineWidth"]) ? $Format["LineWidth"] : 1;
40
-     $LineR		= isset($Format["LineR"]) ? $Format["LineR"] : 0;
41
-     $LineG		= isset($Format["LineG"]) ? $Format["LineG"] : 0;
42
-     $LineB		= isset($Format["LineB"]) ? $Format["LineB"] : 0;
43
-     $LineAlpha		= isset($Format["LineAlpha"]) ? $Format["LineAlpha"] : 100;
44
-     $ExtremityWidth	= isset($Format["ExtremityWidth"]) ? $Format["ExtremityWidth"] : 1;
45
-     $ExtremityLength	= isset($Format["ExtremityLength"]) ? $Format["ExtremityLength"] : 3;
46
-     $ExtremityR	= isset($Format["ExtremityR"]) ? $Format["ExtremityR"] : 0;
47
-     $ExtremityG	= isset($Format["ExtremityG"]) ? $Format["ExtremityG"] : 0;
48
-     $ExtremityB	= isset($Format["ExtremityB"]) ? $Format["ExtremityB"] : 0;
49
-     $ExtremityAlpha	= isset($Format["ExtremityAlpha"]) ? $Format["ExtremityAlpha"] : 100;
50
-     $BoxWidth		= isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 8;
51
-     $BoxUpR		= isset($Format["BoxUpR"]) ? $Format["BoxUpR"] : 188;
52
-     $BoxUpG		= isset($Format["BoxUpG"]) ? $Format["BoxUpG"] : 224;
53
-     $BoxUpB		= isset($Format["BoxUpB"]) ? $Format["BoxUpB"] : 46;
54
-     $BoxUpAlpha	= isset($Format["BoxUpAlpha"]) ? $Format["BoxUpAlpha"] : 100;
55
-     $BoxUpSurrounding	= isset($Format["BoxUpSurrounding"]) ? $Format["BoxUpSurrounding"] : NULL;
56
-     $BoxUpBorderR	= isset($Format["BoxUpBorderR"]) ? $Format["BoxUpBorderR"] : $BoxUpR-20;
57
-     $BoxUpBorderG	= isset($Format["BoxUpBorderG"]) ? $Format["BoxUpBorderG"] : $BoxUpG-20;
58
-     $BoxUpBorderB	= isset($Format["BoxUpBorderB"]) ? $Format["BoxUpBorderB"] : $BoxUpB-20;
59
-     $BoxUpBorderAlpha	= isset($Format["BoxUpBorderAlpha"]) ? $Format["BoxUpBorderAlpha"] : 100;
60
-     $BoxDownR		= isset($Format["BoxDownR"]) ? $Format["BoxDownR"] : 224;
61
-     $BoxDownG		= isset($Format["BoxDownG"]) ? $Format["BoxDownG"] : 100;
62
-     $BoxDownB		= isset($Format["BoxDownB"]) ? $Format["BoxDownB"] : 46;
63
-     $BoxDownAlpha	= isset($Format["BoxDownAlpha"]) ? $Format["BoxDownAlpha"] : 100;
64
-     $BoxDownSurrounding= isset($Format["BoxDownSurrounding"]) ? $Format["BoxDownSurrounding"] : NULL;
65
-     $BoxDownBorderR	= isset($Format["BoxDownBorderR"]) ? $Format["BoxDownBorderR"] : $BoxDownR-20;
66
-     $BoxDownBorderG	= isset($Format["BoxDownBorderG"]) ? $Format["BoxDownBorderG"] : $BoxDownG-20;
67
-     $BoxDownBorderB	= isset($Format["BoxDownBorderB"]) ? $Format["BoxDownBorderB"] : $BoxDownB-20;
68
-     $BoxDownBorderAlpha= isset($Format["BoxDownBorderAlpha"]) ? $Format["BoxDownBorderAlpha"] : 100;
69
-     $ShadowOnBoxesOnly	= isset($Format["ShadowOnBoxesOnly"]) ? $Format["ShadowOnBoxesOnly"] : TRUE;
70
-     $MedianR		= isset($Format["MedianR"]) ? $Format["MedianR"] : 255;
71
-     $MedianG		= isset($Format["MedianG"]) ? $Format["MedianG"] : 0;
72
-     $MedianB		= isset($Format["MedianB"]) ? $Format["MedianB"] : 0;
73
-     $MedianAlpha	= isset($Format["MedianAlpha"]) ? $Format["MedianAlpha"] : 100;
74
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
75
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : "Stock Chart";
76
-
77
-
78
-     /* Data Processing */
79
-     $Data    = $this->pDataObject->getData();
80
-     $Palette = $this->pDataObject->getPalette();
81
-
82
-     if ( $BoxUpSurrounding != NULL )	{ $BoxUpBorderR = $BoxUpR + $BoxUpSurrounding; $BoxUpBorderG = $BoxUpG + $BoxUpSurrounding; $BoxUpBorderB = $BoxUpB + $BoxUpSurrounding; }
83
-     if ( $BoxDownSurrounding != NULL )	{ $BoxDownBorderR = $BoxDownR + $BoxDownSurrounding; $BoxDownBorderG = $BoxDownG + $BoxDownSurrounding; $BoxDownBorderB = $BoxDownB + $BoxDownSurrounding; }
84
-
85
-     if ( $LineWidth != 1 ) { $LineOffset = $LineWidth / 2; }
86
-     $BoxOffset = $BoxWidth / 2;
87
-
88
-     $Data = $this->pChartObject->DataSet->getData();
89
-     list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
90
-
91
-     if ( !isset($Data["Series"][$SerieOpen]) || !isset($Data["Series"][$SerieClose]) || !isset($Data["Series"][$SerieMin]) || !isset($Data["Series"][$SerieMax]) )
92
-      return(STOCK_MISSING_SERIE);
93
-
94
-     $Plots = "";
95
-     foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
96
-      {
97
-       $Point = "";
98
-       if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) )
34
+        $SerieOpen		= isset($Format["SerieOpen"]) ? $Format["SerieOpen"] : "Open";
35
+        $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36
+        $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
37
+        $SerieMax		= isset($Format["SerieMax"]) ? $Format["SerieMax"] : "Max";
38
+        $SerieMedian	= isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : NULL;
39
+        $LineWidth		= isset($Format["LineWidth"]) ? $Format["LineWidth"] : 1;
40
+        $LineR		= isset($Format["LineR"]) ? $Format["LineR"] : 0;
41
+        $LineG		= isset($Format["LineG"]) ? $Format["LineG"] : 0;
42
+        $LineB		= isset($Format["LineB"]) ? $Format["LineB"] : 0;
43
+        $LineAlpha		= isset($Format["LineAlpha"]) ? $Format["LineAlpha"] : 100;
44
+        $ExtremityWidth	= isset($Format["ExtremityWidth"]) ? $Format["ExtremityWidth"] : 1;
45
+        $ExtremityLength	= isset($Format["ExtremityLength"]) ? $Format["ExtremityLength"] : 3;
46
+        $ExtremityR	= isset($Format["ExtremityR"]) ? $Format["ExtremityR"] : 0;
47
+        $ExtremityG	= isset($Format["ExtremityG"]) ? $Format["ExtremityG"] : 0;
48
+        $ExtremityB	= isset($Format["ExtremityB"]) ? $Format["ExtremityB"] : 0;
49
+        $ExtremityAlpha	= isset($Format["ExtremityAlpha"]) ? $Format["ExtremityAlpha"] : 100;
50
+        $BoxWidth		= isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 8;
51
+        $BoxUpR		= isset($Format["BoxUpR"]) ? $Format["BoxUpR"] : 188;
52
+        $BoxUpG		= isset($Format["BoxUpG"]) ? $Format["BoxUpG"] : 224;
53
+        $BoxUpB		= isset($Format["BoxUpB"]) ? $Format["BoxUpB"] : 46;
54
+        $BoxUpAlpha	= isset($Format["BoxUpAlpha"]) ? $Format["BoxUpAlpha"] : 100;
55
+        $BoxUpSurrounding	= isset($Format["BoxUpSurrounding"]) ? $Format["BoxUpSurrounding"] : NULL;
56
+        $BoxUpBorderR	= isset($Format["BoxUpBorderR"]) ? $Format["BoxUpBorderR"] : $BoxUpR-20;
57
+        $BoxUpBorderG	= isset($Format["BoxUpBorderG"]) ? $Format["BoxUpBorderG"] : $BoxUpG-20;
58
+        $BoxUpBorderB	= isset($Format["BoxUpBorderB"]) ? $Format["BoxUpBorderB"] : $BoxUpB-20;
59
+        $BoxUpBorderAlpha	= isset($Format["BoxUpBorderAlpha"]) ? $Format["BoxUpBorderAlpha"] : 100;
60
+        $BoxDownR		= isset($Format["BoxDownR"]) ? $Format["BoxDownR"] : 224;
61
+        $BoxDownG		= isset($Format["BoxDownG"]) ? $Format["BoxDownG"] : 100;
62
+        $BoxDownB		= isset($Format["BoxDownB"]) ? $Format["BoxDownB"] : 46;
63
+        $BoxDownAlpha	= isset($Format["BoxDownAlpha"]) ? $Format["BoxDownAlpha"] : 100;
64
+        $BoxDownSurrounding= isset($Format["BoxDownSurrounding"]) ? $Format["BoxDownSurrounding"] : NULL;
65
+        $BoxDownBorderR	= isset($Format["BoxDownBorderR"]) ? $Format["BoxDownBorderR"] : $BoxDownR-20;
66
+        $BoxDownBorderG	= isset($Format["BoxDownBorderG"]) ? $Format["BoxDownBorderG"] : $BoxDownG-20;
67
+        $BoxDownBorderB	= isset($Format["BoxDownBorderB"]) ? $Format["BoxDownBorderB"] : $BoxDownB-20;
68
+        $BoxDownBorderAlpha= isset($Format["BoxDownBorderAlpha"]) ? $Format["BoxDownBorderAlpha"] : 100;
69
+        $ShadowOnBoxesOnly	= isset($Format["ShadowOnBoxesOnly"]) ? $Format["ShadowOnBoxesOnly"] : TRUE;
70
+        $MedianR		= isset($Format["MedianR"]) ? $Format["MedianR"] : 255;
71
+        $MedianG		= isset($Format["MedianG"]) ? $Format["MedianG"] : 0;
72
+        $MedianB		= isset($Format["MedianB"]) ? $Format["MedianB"] : 0;
73
+        $MedianAlpha	= isset($Format["MedianAlpha"]) ? $Format["MedianAlpha"] : 100;
74
+        $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
75
+        $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : "Stock Chart";
76
+
77
+
78
+        /* Data Processing */
79
+        $Data    = $this->pDataObject->getData();
80
+        $Palette = $this->pDataObject->getPalette();
81
+
82
+        if ( $BoxUpSurrounding != NULL )	{ $BoxUpBorderR = $BoxUpR + $BoxUpSurrounding; $BoxUpBorderG = $BoxUpG + $BoxUpSurrounding; $BoxUpBorderB = $BoxUpB + $BoxUpSurrounding; }
83
+        if ( $BoxDownSurrounding != NULL )	{ $BoxDownBorderR = $BoxDownR + $BoxDownSurrounding; $BoxDownBorderG = $BoxDownG + $BoxDownSurrounding; $BoxDownBorderB = $BoxDownB + $BoxDownSurrounding; }
84
+
85
+        if ( $LineWidth != 1 ) { $LineOffset = $LineWidth / 2; }
86
+        $BoxOffset = $BoxWidth / 2;
87
+
88
+        $Data = $this->pChartObject->DataSet->getData();
89
+        list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
90
+
91
+        if ( !isset($Data["Series"][$SerieOpen]) || !isset($Data["Series"][$SerieClose]) || !isset($Data["Series"][$SerieMin]) || !isset($Data["Series"][$SerieMax]) )
92
+        return(STOCK_MISSING_SERIE);
93
+
94
+        $Plots = "";
95
+        foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
96
+        {
97
+        $Point = "";
98
+        if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) )
99 99
         $Point = array($Value,$Data["Series"][$SerieClose]["Data"][$Key],$Data["Series"][$SerieMin]["Data"][$Key],$Data["Series"][$SerieMax]["Data"][$Key]);
100
-       if ( $SerieMedian != NULL && isset($Data["Series"][$SerieMedian]["Data"][$Key]) )
100
+        if ( $SerieMedian != NULL && isset($Data["Series"][$SerieMedian]["Data"][$Key]) )
101 101
         $Point[] = $Data["Series"][$SerieMedian]["Data"][$Key];
102 102
 
103
-       $Plots[] = $Point;
104
-      }
103
+        $Plots[] = $Point;
104
+        }
105 105
 
106
-     $AxisID	= $Data["Series"][$SerieOpen]["Axis"];
107
-     $Mode	= $Data["Axis"][$AxisID]["Display"];
108
-     $Format	= $Data["Axis"][$AxisID]["Format"];
109
-     $Unit	= $Data["Axis"][$AxisID]["Unit"];
106
+        $AxisID	= $Data["Series"][$SerieOpen]["Axis"];
107
+        $Mode	= $Data["Axis"][$AxisID]["Display"];
108
+        $Format	= $Data["Axis"][$AxisID]["Format"];
109
+        $Unit	= $Data["Axis"][$AxisID]["Unit"];
110 110
 
111
-     $YZero	= $this->pChartObject->scaleComputeY(0,array("AxisID"=>$AxisID));
112
-     $XStep	= ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
111
+        $YZero	= $this->pChartObject->scaleComputeY(0,array("AxisID"=>$AxisID));
112
+        $XStep	= ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
113 113
 
114
-     $X = $this->pChartObject->GraphAreaX1 + $XMargin;
115
-     $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
114
+        $X = $this->pChartObject->GraphAreaX1 + $XMargin;
115
+        $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
116 116
 
117
-     $LineSettings	= array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha);
118
-     $ExtremitySettings	= array("R"=>$ExtremityR,"G"=>$ExtremityG,"B"=>$ExtremityB,"Alpha"=>$ExtremityAlpha);
119
-     $BoxUpSettings	= array("R"=>$BoxUpR,"G"=>$BoxUpG,"B"=>$BoxUpB,"Alpha"=>$BoxUpAlpha,"BorderR"=>$BoxUpBorderR,"BorderG"=>$BoxUpBorderG,"BorderB"=>$BoxUpBorderB,"BorderAlpha"=>$BoxUpBorderAlpha);
120
-     $BoxDownSettings	= array("R"=>$BoxDownR,"G"=>$BoxDownG,"B"=>$BoxDownB,"Alpha"=>$BoxDownAlpha,"BorderR"=>$BoxDownBorderR,"BorderG"=>$BoxDownBorderG,"BorderB"=>$BoxDownBorderB,"BorderAlpha"=>$BoxDownBorderAlpha);
121
-     $MedianSettings	= array("R"=>$MedianR,"G"=>$MedianG,"B"=>$MedianB,"Alpha"=>$MedianAlpha);
117
+        $LineSettings	= array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha);
118
+        $ExtremitySettings	= array("R"=>$ExtremityR,"G"=>$ExtremityG,"B"=>$ExtremityB,"Alpha"=>$ExtremityAlpha);
119
+        $BoxUpSettings	= array("R"=>$BoxUpR,"G"=>$BoxUpG,"B"=>$BoxUpB,"Alpha"=>$BoxUpAlpha,"BorderR"=>$BoxUpBorderR,"BorderG"=>$BoxUpBorderG,"BorderB"=>$BoxUpBorderB,"BorderAlpha"=>$BoxUpBorderAlpha);
120
+        $BoxDownSettings	= array("R"=>$BoxDownR,"G"=>$BoxDownG,"B"=>$BoxDownB,"Alpha"=>$BoxDownAlpha,"BorderR"=>$BoxDownBorderR,"BorderG"=>$BoxDownBorderG,"BorderB"=>$BoxDownBorderB,"BorderAlpha"=>$BoxDownBorderAlpha);
121
+        $MedianSettings	= array("R"=>$MedianR,"G"=>$MedianG,"B"=>$MedianB,"Alpha"=>$MedianAlpha);
122 122
 
123
-     foreach($Plots as $Key =>$Points)
124
-      {
125
-       $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
123
+        foreach($Plots as $Key =>$Points)
124
+        {
125
+        $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
126 126
 
127
-       $Values = "Open :".$Data["Series"][$SerieOpen]["Data"][$Key]."<BR>Close : ".$Data["Series"][$SerieClose]["Data"][$Key]."<BR>Min : ".$Data["Series"][$SerieMin]["Data"][$Key]."<BR>Max : ".$Data["Series"][$SerieMax]["Data"][$Key]."<BR>";
128
-       if ( $SerieMedian != NULL ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129
-       if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } 
127
+        $Values = "Open :".$Data["Series"][$SerieOpen]["Data"][$Key]."<BR>Close : ".$Data["Series"][$SerieClose]["Data"][$Key]."<BR>Min : ".$Data["Series"][$SerieMin]["Data"][$Key]."<BR>Max : ".$Data["Series"][$SerieMax]["Data"][$Key]."<BR>";
128
+        if ( $SerieMedian != NULL ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129
+        if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } 
130 130
 
131
-       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
131
+        if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
132 132
         {
133
-         if ( $YZero > $this->pChartObject->GraphAreaY2-1 ) { $YZero = $this->pChartObject->GraphAreaY2-1; }
134
-         if ( $YZero < $this->pChartObject->GraphAreaY1+1 ) { $YZero = $this->pChartObject->GraphAreaY1+1; }
133
+            if ( $YZero > $this->pChartObject->GraphAreaY2-1 ) { $YZero = $this->pChartObject->GraphAreaY2-1; }
134
+            if ( $YZero < $this->pChartObject->GraphAreaY1+1 ) { $YZero = $this->pChartObject->GraphAreaY1+1; }
135 135
 
136
-         if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
136
+            if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
137 137
 
138
-         if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
138
+            if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
139 139
 
140
-         if ( $LineWidth == 1 )
141
-          $this->pChartObject->drawLine($X,$PosArray[2],$X,$PosArray[3],$LineSettings);
142
-         else
143
-          $this->pChartObject->drawFilledRectangle($X-$LineOffset,$PosArray[2],$X+$LineOffset,$PosArray[3],$LineSettings);
140
+            if ( $LineWidth == 1 )
141
+            $this->pChartObject->drawLine($X,$PosArray[2],$X,$PosArray[3],$LineSettings);
142
+            else
143
+            $this->pChartObject->drawFilledRectangle($X-$LineOffset,$PosArray[2],$X+$LineOffset,$PosArray[3],$LineSettings);
144 144
 
145
-         if ( $ExtremityWidth == 1 )
146
-          {
147
-           $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2],$ExtremitySettings);
148
-           $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3],$ExtremitySettings);
145
+            if ( $ExtremityWidth == 1 )
146
+            {
147
+            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2],$ExtremitySettings);
148
+            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3],$ExtremitySettings);
149 149
 
150
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]).",".floor($X+$ExtremityLength).",".floor($PosArray[3]),$ImageMapColor,$ImageMapTitle,$Values); }
151
-          }
152
-         else
153
-          {
154
-           $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2]-$ExtremityWidth,$ExtremitySettings);
155
-           $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3]+$ExtremityWidth,$ExtremitySettings);
150
+            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]).",".floor($X+$ExtremityLength).",".floor($PosArray[3]),$ImageMapColor,$ImageMapTitle,$Values); }
151
+            }
152
+            else
153
+            {
154
+            $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2]-$ExtremityWidth,$ExtremitySettings);
155
+            $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3]+$ExtremityWidth,$ExtremitySettings);
156 156
 
157
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]-$ExtremityWidth).",".floor($X+$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth),$ImageMapColor,$ImageMapTitle,$Values); }
158
-          }
157
+            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]-$ExtremityWidth).",".floor($X+$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth),$ImageMapColor,$ImageMapTitle,$Values); }
158
+            }
159 159
 
160
-         if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
160
+            if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
161 161
 
162
-         if ( $PosArray[0] > $PosArray[1] )
163
-          $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxUpSettings);
164
-         else
165
-          $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxDownSettings);
162
+            if ( $PosArray[0] > $PosArray[1] )
163
+            $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxUpSettings);
164
+            else
165
+            $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxDownSettings);
166 166
 
167
-         if ( isset($PosArray[4]) )
168
-          $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[4],$X+$ExtremityLength,$PosArray[4],$MedianSettings);
167
+            if ( isset($PosArray[4]) )
168
+            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[4],$X+$ExtremityLength,$PosArray[4],$MedianSettings);
169 169
 
170
-         $X = $X + $XStep;
170
+            $X = $X + $XStep;
171 171
         }
172
-       elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
172
+        elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
173 173
         {
174
-         if ( $YZero > $this->pChartObject->GraphAreaX2-1 ) { $YZero = $this->pChartObject->GraphAreaX2-1; }
175
-         if ( $YZero < $this->pChartObject->GraphAreaX1+1 ) { $YZero = $this->pChartObject->GraphAreaX1+1; }
174
+            if ( $YZero > $this->pChartObject->GraphAreaX2-1 ) { $YZero = $this->pChartObject->GraphAreaX2-1; }
175
+            if ( $YZero < $this->pChartObject->GraphAreaX1+1 ) { $YZero = $this->pChartObject->GraphAreaX1+1; }
176 176
 
177
-         if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
177
+            if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
178 178
 
179
-         if ( $LineWidth == 1 )
180
-          $this->pChartObject->drawLine($PosArray[2],$Y,$PosArray[3],$Y,$LineSettings);
181
-         else
182
-          $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$LineOffset,$PosArray[3],$Y+$LineOffset,$LineSettings);
179
+            if ( $LineWidth == 1 )
180
+            $this->pChartObject->drawLine($PosArray[2],$Y,$PosArray[3],$Y,$LineSettings);
181
+            else
182
+            $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$LineOffset,$PosArray[3],$Y+$LineOffset,$LineSettings);
183 183
 
184
-         if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
184
+            if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
185 185
 
186
-         if ( $ExtremityWidth == 1 )
187
-          {
188
-           $this->pChartObject->drawLine($PosArray[2],$Y-$ExtremityLength,$PosArray[2],$Y+$ExtremityLength,$ExtremitySettings);
189
-           $this->pChartObject->drawLine($PosArray[3],$Y-$ExtremityLength,$PosArray[3],$Y+$ExtremityLength,$ExtremitySettings);
186
+            if ( $ExtremityWidth == 1 )
187
+            {
188
+            $this->pChartObject->drawLine($PosArray[2],$Y-$ExtremityLength,$PosArray[2],$Y+$ExtremityLength,$ExtremitySettings);
189
+            $this->pChartObject->drawLine($PosArray[3],$Y-$ExtremityLength,$PosArray[3],$Y+$ExtremityLength,$ExtremitySettings);
190 190
 
191
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
192
-          }
193
-         else
194
-          {
195
-           $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$ExtremityLength,$PosArray[2]-$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
196
-           $this->pChartObject->drawFilledRectangle($PosArray[3],$Y-$ExtremityLength,$PosArray[3]+$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
191
+            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
192
+            }
193
+            else
194
+            {
195
+            $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$ExtremityLength,$PosArray[2]-$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
196
+            $this->pChartObject->drawFilledRectangle($PosArray[3],$Y-$ExtremityLength,$PosArray[3]+$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
197 197
 
198
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]-$ExtremityWidth).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
199
-          }
198
+            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]-$ExtremityWidth).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
199
+            }
200 200
 
201
-         if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
201
+            if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
202 202
 
203
-         if ( $PosArray[0] < $PosArray[1] )
204
-          $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxUpSettings);
205
-         else
206
-          $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxDownSettings);
203
+            if ( $PosArray[0] < $PosArray[1] )
204
+            $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxUpSettings);
205
+            else
206
+            $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxDownSettings);
207 207
 
208
-         if ( isset($PosArray[4]) )
209
-          $this->pChartObject->drawLine($PosArray[4],$Y-$ExtremityLength,$PosArray[4],$Y+$ExtremityLength,$MedianSettings);
208
+            if ( isset($PosArray[4]) )
209
+            $this->pChartObject->drawLine($PosArray[4],$Y-$ExtremityLength,$PosArray[4],$Y+$ExtremityLength,$MedianSettings);
210 210
 
211
-         $Y = $Y + $XStep;
211
+            $Y = $Y + $XStep;
212
+        }
212 213
         }
213
-      }
214 214
     }
215
-  }
215
+    }
216 216
 ?>
217 217
\ No newline at end of file
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pCache.class.php 1 patch
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pCache - speed up the rendering by caching up the pictures
4 4
 
5 5
      Version     : 2.1.3
@@ -13,268 +13,268 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- /* pData class definition */
17
- class pCache
18
-  {
19
-   var $CacheFolder;
20
-   var $CacheIndex;
21
-   var $CacheDB;
16
+    /* pData class definition */
17
+    class pCache
18
+    {
19
+    var $CacheFolder;
20
+    var $CacheIndex;
21
+    var $CacheDB;
22 22
 
23
-   /* Class creator */
24
-   function pCache($Settings="")
23
+    /* Class creator */
24
+    function pCache($Settings="")
25 25
     {
26
-     $CacheFolder	= isset($Settings["CacheFolder"]) ? $Settings["CacheFolder"] : "cache";
27
-     $CacheIndex	= isset($Settings["CacheIndex"]) ? $Settings["CacheIndex"] : "index.db";
28
-     $CacheDB		= isset($Settings["CacheDB"]) ? $Settings["CacheDB"] : "cache.db";
26
+        $CacheFolder	= isset($Settings["CacheFolder"]) ? $Settings["CacheFolder"] : "cache";
27
+        $CacheIndex	= isset($Settings["CacheIndex"]) ? $Settings["CacheIndex"] : "index.db";
28
+        $CacheDB		= isset($Settings["CacheDB"]) ? $Settings["CacheDB"] : "cache.db";
29 29
 
30
-     $this->CacheFolder	= $CacheFolder;
31
-     $this->CacheIndex	= $CacheIndex;
32
-     $this->CacheDB	= $CacheDB;
30
+        $this->CacheFolder	= $CacheFolder;
31
+        $this->CacheIndex	= $CacheIndex;
32
+        $this->CacheDB	= $CacheDB;
33 33
 
34
-     if (!file_exists($this->CacheFolder."/".$this->CacheIndex)) { touch($this->CacheFolder."/".$this->CacheIndex); }
35
-     if (!file_exists($this->CacheFolder."/".$this->CacheDB))    { touch($this->CacheFolder."/".$this->CacheDB); }
34
+        if (!file_exists($this->CacheFolder."/".$this->CacheIndex)) { touch($this->CacheFolder."/".$this->CacheIndex); }
35
+        if (!file_exists($this->CacheFolder."/".$this->CacheDB))    { touch($this->CacheFolder."/".$this->CacheDB); }
36 36
     }
37 37
 
38
-   /* Flush the cache contents */
39
-   function flush()
38
+    /* Flush the cache contents */
39
+    function flush()
40 40
     {
41
-     if (file_exists($this->CacheFolder."/".$this->CacheIndex)) { unlink($this->CacheFolder."/".$this->CacheIndex); touch($this->CacheFolder."/".$this->CacheIndex); }
42
-     if (file_exists($this->CacheFolder."/".$this->CacheDB))    { unlink($this->CacheFolder."/".$this->CacheDB); touch($this->CacheFolder."/".$this->CacheDB); }
41
+        if (file_exists($this->CacheFolder."/".$this->CacheIndex)) { unlink($this->CacheFolder."/".$this->CacheIndex); touch($this->CacheFolder."/".$this->CacheIndex); }
42
+        if (file_exists($this->CacheFolder."/".$this->CacheDB))    { unlink($this->CacheFolder."/".$this->CacheDB); touch($this->CacheFolder."/".$this->CacheDB); }
43 43
     }
44 44
 
45
-   /* Return the MD5 of the data array to clearly identify the chart */
46
-   function getHash($Data,$Marker="")
45
+    /* Return the MD5 of the data array to clearly identify the chart */
46
+    function getHash($Data,$Marker="")
47 47
     { return(md5($Marker.serialize($Data->Data))); }
48 48
 
49
-   /* Write the generated picture to the cache */
50
-   function writeToCache($ID,$pChartObject)
49
+    /* Write the generated picture to the cache */
50
+    function writeToCache($ID,$pChartObject)
51 51
     {
52
-     /* Compute the paths */
53
-     $TemporaryFile = $this->CacheFolder."/tmp_".rand(0,1000).".png";
54
-     $Database      = $this->CacheFolder."/".$this->CacheDB;
55
-     $Index         = $this->CacheFolder."/".$this->CacheIndex;
56
-
57
-     /* Flush the picture to a temporary file */
58
-     imagepng($pChartObject->Picture ,$TemporaryFile);
59
-
60
-     /* Retrieve the files size */
61
-     $PictureSize = filesize($TemporaryFile);
62
-     $DBSize      = filesize($Database);
63
-
64
-     /* Save the index */
65
-     $Handle = fopen($Index,"a");
66
-     fwrite($Handle, $ID.",".$DBSize.",".$PictureSize.",".time().",0      \r\n");
67
-     fclose($Handle);
68
-
69
-     /* Get the picture raw contents */
70
-     $Handle = fopen($TemporaryFile,"r");
71
-     $Raw    = fread($Handle,$PictureSize);
72
-     fclose($Handle);
73
-
74
-     /* Save the picture in the solid database file */
75
-     $Handle = fopen($Database,"a");
76
-     fwrite($Handle, $Raw);
77
-     fclose($Handle);
78
-
79
-     /* Remove temporary file */
80
-     unlink($TemporaryFile);
52
+        /* Compute the paths */
53
+        $TemporaryFile = $this->CacheFolder."/tmp_".rand(0,1000).".png";
54
+        $Database      = $this->CacheFolder."/".$this->CacheDB;
55
+        $Index         = $this->CacheFolder."/".$this->CacheIndex;
56
+
57
+        /* Flush the picture to a temporary file */
58
+        imagepng($pChartObject->Picture ,$TemporaryFile);
59
+
60
+        /* Retrieve the files size */
61
+        $PictureSize = filesize($TemporaryFile);
62
+        $DBSize      = filesize($Database);
63
+
64
+        /* Save the index */
65
+        $Handle = fopen($Index,"a");
66
+        fwrite($Handle, $ID.",".$DBSize.",".$PictureSize.",".time().",0      \r\n");
67
+        fclose($Handle);
68
+
69
+        /* Get the picture raw contents */
70
+        $Handle = fopen($TemporaryFile,"r");
71
+        $Raw    = fread($Handle,$PictureSize);
72
+        fclose($Handle);
73
+
74
+        /* Save the picture in the solid database file */
75
+        $Handle = fopen($Database,"a");
76
+        fwrite($Handle, $Raw);
77
+        fclose($Handle);
78
+
79
+        /* Remove temporary file */
80
+        unlink($TemporaryFile);
81 81
     }
82 82
 
83
-   /* Remove object older than the specified TS */
84
-   function removeOlderThan($Expiry)
83
+    /* Remove object older than the specified TS */
84
+    function removeOlderThan($Expiry)
85 85
     { $this->dbRemoval(array("Expiry"=>$Expiry)); }
86 86
 
87
-   /* Remove an object from the cache */
88
-   function remove($ID)
87
+    /* Remove an object from the cache */
88
+    function remove($ID)
89 89
     { $this->dbRemoval(array("Name"=>$ID)); }
90 90
 
91
-   /* Remove with specified criterias */
92
-   function dbRemoval($Settings)
91
+    /* Remove with specified criterias */
92
+    function dbRemoval($Settings)
93 93
     {
94
-     $ID     = isset($Settings["Name"]) ? $Settings["Name"] : NULL;
95
-     $Expiry = isset($Settings["Expiry"]) ? $Settings["Expiry"] : -(24*60*60);
96
-     $TS     = time()-$Expiry;
97
-
98
-     /* Compute the paths */
99
-     $Database     = $this->CacheFolder."/".$this->CacheDB;
100
-     $Index        = $this->CacheFolder."/".$this->CacheIndex;
101
-     $DatabaseTemp = $this->CacheFolder."/".$this->CacheDB.".tmp";
102
-     $IndexTemp    = $this->CacheFolder."/".$this->CacheIndex.".tmp";
103
-
104
-     /* Single file removal */
105
-     if ( $ID != NULL )
106
-      {
107
-       /* Retrieve object informations */
108
-       $Object = $this->isInCache($ID,TRUE);
109
-
110
-       /* If it's not in the cache DB, go away */
111
-       if ( !$Object ) { return(0); }
112
-      }
113
-
114
-     /* Create the temporary files */
115
-     if (!file_exists($DatabaseTemp)) { touch($DatabaseTemp); }
116
-     if (!file_exists($IndexTemp))    { touch($IndexTemp); }
117
-
118
-     /* Open the file handles */
119
-     $IndexHandle     = @fopen($Index, "r");
120
-     $IndexTempHandle = @fopen($IndexTemp, "w");
121
-     $DBHandle        = @fopen($Database, "r");
122
-     $DBTempHandle    = @fopen($DatabaseTemp, "w");
123
-
124
-     /* Remove the selected ID from the database */
125
-     while (!feof($IndexHandle))
126
-      {
127
-       $Entry    = fgets($IndexHandle, 4096);
128
-       $Entry    = str_replace("\r","",$Entry);
129
-       $Entry    = str_replace("\n","",$Entry);
130
-       $Settings = preg_split("/,/",$Entry);
131
-
132
-       if ( $Entry != "" )
94
+        $ID     = isset($Settings["Name"]) ? $Settings["Name"] : NULL;
95
+        $Expiry = isset($Settings["Expiry"]) ? $Settings["Expiry"] : -(24*60*60);
96
+        $TS     = time()-$Expiry;
97
+
98
+        /* Compute the paths */
99
+        $Database     = $this->CacheFolder."/".$this->CacheDB;
100
+        $Index        = $this->CacheFolder."/".$this->CacheIndex;
101
+        $DatabaseTemp = $this->CacheFolder."/".$this->CacheDB.".tmp";
102
+        $IndexTemp    = $this->CacheFolder."/".$this->CacheIndex.".tmp";
103
+
104
+        /* Single file removal */
105
+        if ( $ID != NULL )
133 106
         {
134
-         $PicID       = $Settings[0];
135
-         $DBPos       = $Settings[1];
136
-         $PicSize     = $Settings[2];
137
-         $GeneratedTS = $Settings[3];
138
-         $Hits        = $Settings[4];
139
-
140
-         if ( $Settings[0] != $ID && $GeneratedTS > $TS)
141
-          {
142
-           $CurrentPos  = ftell($DBTempHandle);
143
-           fwrite($IndexTempHandle, $PicID.",".$CurrentPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
144
-
145
-           fseek($DBHandle,$DBPos);
146
-           $Picture = fread($DBHandle,$PicSize);
147
-           fwrite($DBTempHandle,$Picture);
148
-          }
107
+        /* Retrieve object informations */
108
+        $Object = $this->isInCache($ID,TRUE);
109
+
110
+        /* If it's not in the cache DB, go away */
111
+        if ( !$Object ) { return(0); }
112
+        }
113
+
114
+        /* Create the temporary files */
115
+        if (!file_exists($DatabaseTemp)) { touch($DatabaseTemp); }
116
+        if (!file_exists($IndexTemp))    { touch($IndexTemp); }
117
+
118
+        /* Open the file handles */
119
+        $IndexHandle     = @fopen($Index, "r");
120
+        $IndexTempHandle = @fopen($IndexTemp, "w");
121
+        $DBHandle        = @fopen($Database, "r");
122
+        $DBTempHandle    = @fopen($DatabaseTemp, "w");
123
+
124
+        /* Remove the selected ID from the database */
125
+        while (!feof($IndexHandle))
126
+        {
127
+        $Entry    = fgets($IndexHandle, 4096);
128
+        $Entry    = str_replace("\r","",$Entry);
129
+        $Entry    = str_replace("\n","",$Entry);
130
+        $Settings = preg_split("/,/",$Entry);
131
+
132
+        if ( $Entry != "" )
133
+        {
134
+            $PicID       = $Settings[0];
135
+            $DBPos       = $Settings[1];
136
+            $PicSize     = $Settings[2];
137
+            $GeneratedTS = $Settings[3];
138
+            $Hits        = $Settings[4];
139
+
140
+            if ( $Settings[0] != $ID && $GeneratedTS > $TS)
141
+            {
142
+            $CurrentPos  = ftell($DBTempHandle);
143
+            fwrite($IndexTempHandle, $PicID.",".$CurrentPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
144
+
145
+            fseek($DBHandle,$DBPos);
146
+            $Picture = fread($DBHandle,$PicSize);
147
+            fwrite($DBTempHandle,$Picture);
148
+            }
149
+        }
149 150
         }
150
-      }
151 151
 
152
-     /* Close the handles */
153
-     fclose($IndexHandle);
154
-     fclose($IndexTempHandle);
155
-     fclose($DBHandle);
156
-     fclose($DBTempHandle);
152
+        /* Close the handles */
153
+        fclose($IndexHandle);
154
+        fclose($IndexTempHandle);
155
+        fclose($DBHandle);
156
+        fclose($DBTempHandle);
157 157
 
158
-     /* Remove the prod files */
159
-     unlink($Database);
160
-     unlink($Index);
158
+        /* Remove the prod files */
159
+        unlink($Database);
160
+        unlink($Index);
161 161
 
162
-     /* Swap the temp & prod DB */
163
-     rename($DatabaseTemp,$Database);
164
-     rename($IndexTemp,$Index);
162
+        /* Swap the temp & prod DB */
163
+        rename($DatabaseTemp,$Database);
164
+        rename($IndexTemp,$Index);
165 165
     }
166 166
 
167
-   function isInCache($ID,$Verbose=FALSE,$UpdateHitsCount=FALSE)
167
+    function isInCache($ID,$Verbose=FALSE,$UpdateHitsCount=FALSE)
168 168
     {
169
-     /* Compute the paths */
170
-     $Index = $this->CacheFolder."/".$this->CacheIndex;
171
-
172
-     /* Search the picture in the index file */
173
-     $Handle = @fopen($Index, "r");
174
-     while (!feof($Handle))
175
-      {
176
-       $IndexPos = ftell($Handle);
177
-       $Entry = fgets($Handle, 4096);
178
-       if ( $Entry != "" )
169
+        /* Compute the paths */
170
+        $Index = $this->CacheFolder."/".$this->CacheIndex;
171
+
172
+        /* Search the picture in the index file */
173
+        $Handle = @fopen($Index, "r");
174
+        while (!feof($Handle))
175
+        {
176
+        $IndexPos = ftell($Handle);
177
+        $Entry = fgets($Handle, 4096);
178
+        if ( $Entry != "" )
179 179
         {
180
-         $Settings = preg_split("/,/",$Entry);
181
-         $PicID    = $Settings[0];
182
-         if ( $PicID == $ID )
183
-          {
184
-           fclose($Handle);
185
-
186
-           $DBPos       = $Settings[1];
187
-           $PicSize     = $Settings[2];
188
-           $GeneratedTS = $Settings[3];
189
-           $Hits        = intval($Settings[4]);
190
-
191
-           if ( $UpdateHitsCount )
180
+            $Settings = preg_split("/,/",$Entry);
181
+            $PicID    = $Settings[0];
182
+            if ( $PicID == $ID )
192 183
             {
193
-             $Hits++;
194
-             if ( strlen($Hits) < 7 ) { $Hits = $Hits.str_repeat(" ",7-strlen($Hits)); }
184
+            fclose($Handle);
185
+
186
+            $DBPos       = $Settings[1];
187
+            $PicSize     = $Settings[2];
188
+            $GeneratedTS = $Settings[3];
189
+            $Hits        = intval($Settings[4]);
195 190
 
196
-             $Handle = @fopen($Index, "r+");
197
-             fseek($Handle,$IndexPos);
198
-             fwrite($Handle, $PicID.",".$DBPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
199
-             fclose($Handle);
191
+            if ( $UpdateHitsCount )
192
+            {
193
+                $Hits++;
194
+                if ( strlen($Hits) < 7 ) { $Hits = $Hits.str_repeat(" ",7-strlen($Hits)); }
195
+
196
+                $Handle = @fopen($Index, "r+");
197
+                fseek($Handle,$IndexPos);
198
+                fwrite($Handle, $PicID.",".$DBPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
199
+                fclose($Handle);
200 200
             }
201 201
 
202
-           if ($Verbose)
202
+            if ($Verbose)
203 203
             { return(array("DBPos"=>$DBPos,"PicSize"=>$PicSize,"GeneratedTS"=>$GeneratedTS,"Hits"=>$Hits)); }
204
-           else
204
+            else
205 205
             { return(TRUE); }
206
-          }
206
+            }
207 207
         }
208
-      }
209
-     fclose($Handle);
208
+        }
209
+        fclose($Handle);
210 210
 
211
-     /* Picture isn't in the cache */
212
-     return(FALSE);
211
+        /* Picture isn't in the cache */
212
+        return(FALSE);
213 213
     }
214 214
 
215
-   /* Automatic output method based on the calling interface */
216
-   function autoOutput($ID,$Destination="output.png")
215
+    /* Automatic output method based on the calling interface */
216
+    function autoOutput($ID,$Destination="output.png")
217 217
     {
218
-     if (php_sapi_name() == "cli")
219
-      $this->saveFromCache($ID,$Destination);
220
-     else
221
-      $this->strokeFromCache($ID);
218
+        if (php_sapi_name() == "cli")
219
+        $this->saveFromCache($ID,$Destination);
220
+        else
221
+        $this->strokeFromCache($ID);
222 222
     }
223 223
 
224
-   function strokeFromCache($ID)
224
+    function strokeFromCache($ID)
225 225
     {
226
-     /* Get the raw picture from the cache */
227
-     $Picture = $this->getFromCache($ID);
226
+        /* Get the raw picture from the cache */
227
+        $Picture = $this->getFromCache($ID);
228 228
 
229
-     /* Do we have a hit? */
230
-     if ( $Picture == NULL ) { return(FALSE); }
229
+        /* Do we have a hit? */
230
+        if ( $Picture == NULL ) { return(FALSE); }
231 231
 
232
-     header('Content-type: image/png');
233
-     echo $Picture;
232
+        header('Content-type: image/png');
233
+        echo $Picture;
234 234
 
235
-     return(TRUE);
235
+        return(TRUE);
236 236
     }
237 237
 
238
-   function saveFromCache($ID,$Destination)
238
+    function saveFromCache($ID,$Destination)
239 239
     {
240
-     /* Get the raw picture from the cache */
241
-     $Picture = $this->getFromCache($ID);
240
+        /* Get the raw picture from the cache */
241
+        $Picture = $this->getFromCache($ID);
242 242
 
243
-     /* Do we have a hit? */
244
-     if ( $Picture == NULL ) { return(FALSE); }
243
+        /* Do we have a hit? */
244
+        if ( $Picture == NULL ) { return(FALSE); }
245 245
 
246
-     /* Flush the picture to a file */
247
-     $Handle = fopen($Destination,"w");
248
-     fwrite($Handle,$Picture);
249
-     fclose($Handle);
246
+        /* Flush the picture to a file */
247
+        $Handle = fopen($Destination,"w");
248
+        fwrite($Handle,$Picture);
249
+        fclose($Handle);
250 250
 
251
-     /* All went fine */
252
-     return(TRUE);
251
+        /* All went fine */
252
+        return(TRUE);
253 253
     }
254 254
 
255
-   function getFromCache($ID)
255
+    function getFromCache($ID)
256 256
     {
257
-     /* Compute the path */
258
-     $Database = $this->CacheFolder."/".$this->CacheDB;
257
+        /* Compute the path */
258
+        $Database = $this->CacheFolder."/".$this->CacheDB;
259 259
 
260
-     /* Lookup for the picture in the cache */
261
-     $CacheInfo = $this->isInCache($ID,TRUE,TRUE);
260
+        /* Lookup for the picture in the cache */
261
+        $CacheInfo = $this->isInCache($ID,TRUE,TRUE);
262 262
 
263
-     /* Not in the cache */
264
-     if (!$CacheInfo) { return(NULL); }
263
+        /* Not in the cache */
264
+        if (!$CacheInfo) { return(NULL); }
265 265
 
266
-     /* Get the database extended information */     
267
-     $DBPos   = $CacheInfo["DBPos"];
268
-     $PicSize = $CacheInfo["PicSize"];
266
+        /* Get the database extended information */     
267
+        $DBPos   = $CacheInfo["DBPos"];
268
+        $PicSize = $CacheInfo["PicSize"];
269 269
 
270
-     /* Extract the picture from the solid cache file */
271
-     $Handle = @fopen($Database, "r");
272
-     fseek($Handle,$DBPos);
273
-     $Picture = fread($Handle,$PicSize);
274
-     fclose($Handle);
270
+        /* Extract the picture from the solid cache file */
271
+        $Handle = @fopen($Database, "r");
272
+        fseek($Handle,$DBPos);
273
+        $Picture = fread($Handle,$PicSize);
274
+        fclose($Handle);
275 275
 
276
-     /* Return back the raw picture data */
277
-     return($Picture);
276
+        /* Return back the raw picture data */
277
+        return($Picture);
278
+    }
278 279
     }
279
-  }
280 280
 ?>
281 281
\ No newline at end of file
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pSurface.class.php 1 patch
Indentation   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pSurface - class to draw surface charts
4 4
 
5 5
      Version     : 2.1.3
@@ -13,303 +13,303 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- define("UNKNOWN"		, 0.123456789);
17
- define("IGNORED"		, -1);
16
+    define("UNKNOWN"		, 0.123456789);
17
+    define("IGNORED"		, -1);
18 18
 
19
- define("LABEL_POSITION_LEFT"	, 880001);
20
- define("LABEL_POSITION_RIGHT"	, 880002);
21
- define("LABEL_POSITION_TOP"	, 880003);
22
- define("LABEL_POSITION_BOTTOM"	, 880004);
19
+    define("LABEL_POSITION_LEFT"	, 880001);
20
+    define("LABEL_POSITION_RIGHT"	, 880002);
21
+    define("LABEL_POSITION_TOP"	, 880003);
22
+    define("LABEL_POSITION_BOTTOM"	, 880004);
23 23
 
24
- /* pStock class definition */
25
- class pSurface
26
-  {
27
-   var $pChartObject;
28
-   var $GridSizeX;
29
-   var $GridSizeY;
30
-   var $Points;
24
+    /* pStock class definition */
25
+    class pSurface
26
+    {
27
+    var $pChartObject;
28
+    var $GridSizeX;
29
+    var $GridSizeY;
30
+    var $Points;
31 31
 
32
-   /* Class creator */
33
-   function pSurface($pChartObject)
32
+    /* Class creator */
33
+    function pSurface($pChartObject)
34 34
     {
35
-     $this->pChartObject = $pChartObject;
36
-     $this->GridSize     = 10;
37
-     $this->Points       = "";
35
+        $this->pChartObject = $pChartObject;
36
+        $this->GridSize     = 10;
37
+        $this->Points       = "";
38 38
     }
39 39
 
40
-   /* Define the grid size and initialise the 2D matrix */
41
-   function setGrid($XSize=10,$YSize=10)
40
+    /* Define the grid size and initialise the 2D matrix */
41
+    function setGrid($XSize=10,$YSize=10)
42 42
     {
43
-     for($X=0; $X<=$XSize; $X++) { for($Y=0; $Y<=$YSize; $Y++) { $this->Points[$X][$Y]=UNKNOWN; } } 
43
+        for($X=0; $X<=$XSize; $X++) { for($Y=0; $Y<=$YSize; $Y++) { $this->Points[$X][$Y]=UNKNOWN; } } 
44 44
 
45
-     $this->GridSizeX = $XSize;
46
-     $this->GridSizeY = $YSize;
45
+        $this->GridSizeX = $XSize;
46
+        $this->GridSizeY = $YSize;
47 47
     }
48 48
 
49
-   /* Add a point on the grid */
50
-   function addPoint($X,$Y,$Value,$Force=TRUE)
49
+    /* Add a point on the grid */
50
+    function addPoint($X,$Y,$Value,$Force=TRUE)
51 51
     {
52
-     if ( $X < 0 || $X >$this->GridSizeX ) { return(0); }
53
-     if ( $Y < 0 || $Y >$this->GridSizeY ) { return(0); }
54
-
55
-     if ( $this->Points[$X][$Y] == UNKNOWN || $Force )
56
-      $this->Points[$X][$Y] = $Value;
57
-     elseif ( $this->Points[$X][$Y] == UNKNOWN )
58
-      $this->Points[$X][$Y] = $Value;
59
-     else
60
-      $this->Points[$X][$Y] = ($this->Points[$X][$Y] + $Value)/2;
52
+        if ( $X < 0 || $X >$this->GridSizeX ) { return(0); }
53
+        if ( $Y < 0 || $Y >$this->GridSizeY ) { return(0); }
54
+
55
+        if ( $this->Points[$X][$Y] == UNKNOWN || $Force )
56
+        $this->Points[$X][$Y] = $Value;
57
+        elseif ( $this->Points[$X][$Y] == UNKNOWN )
58
+        $this->Points[$X][$Y] = $Value;
59
+        else
60
+        $this->Points[$X][$Y] = ($this->Points[$X][$Y] + $Value)/2;
61 61
     }
62 62
 
63
-   /* Write the X labels */
64
-   function writeXLabels($Format="")
63
+    /* Write the X labels */
64
+    function writeXLabels($Format="")
65 65
     {
66
-     $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
67
-     $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
68
-     $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
69
-     $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
70
-     $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
71
-     $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
72
-     $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_TOP;
73
-     $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
74
-     $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
75
-
76
-     if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
77
-
78
-     $X0    = $this->pChartObject->GraphAreaX1;
79
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
80
-
81
-     $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
82
-     if ( $Position == LABEL_POSITION_TOP )
83
-      {
84
-       $YPos  = $this->pChartObject->GraphAreaY1 - $Padding;
85
-       if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
86
-       if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
87
-      }
88
-     elseif ( $Position == LABEL_POSITION_BOTTOM )
89
-      {
90
-       $YPos  = $this->pChartObject->GraphAreaY2 + $Padding;
91
-       if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
92
-       if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
93
-      }
94
-     else
95
-      return(-1);
96
-
97
-     for($X=0;$X<=$this->GridSizeX;$X++)
98
-      {
99
-       $XPos = floor($X0+$X*$XSize + $XSize/2);
100
-
101
-       if( $Labels == NULL || !isset($Labels[$X]) )
66
+        $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
67
+        $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
68
+        $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
69
+        $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
70
+        $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
71
+        $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
72
+        $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_TOP;
73
+        $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
74
+        $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
75
+
76
+        if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
77
+
78
+        $X0    = $this->pChartObject->GraphAreaX1;
79
+        $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
80
+
81
+        $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
82
+        if ( $Position == LABEL_POSITION_TOP )
83
+        {
84
+        $YPos  = $this->pChartObject->GraphAreaY1 - $Padding;
85
+        if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
86
+        if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
87
+        }
88
+        elseif ( $Position == LABEL_POSITION_BOTTOM )
89
+        {
90
+        $YPos  = $this->pChartObject->GraphAreaY2 + $Padding;
91
+        if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
92
+        if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
93
+        }
94
+        else
95
+        return(-1);
96
+
97
+        for($X=0;$X<=$this->GridSizeX;$X++)
98
+        {
99
+        $XPos = floor($X0+$X*$XSize + $XSize/2);
100
+
101
+        if( $Labels == NULL || !isset($Labels[$X]) )
102 102
         $Value = $X+$CountOffset;
103
-       else
103
+        else
104 104
         $Value = $Labels[$X];
105 105
 
106
-       $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
107
-      }
106
+        $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
107
+        }
108 108
     }
109 109
 
110
-   /* Write the Y labels */
111
-   function writeYLabels($Format="")
110
+    /* Write the Y labels */
111
+    function writeYLabels($Format="")
112 112
     {
113
-     $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
114
-     $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
115
-     $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
116
-     $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
117
-     $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
118
-     $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
119
-     $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_LEFT;
120
-     $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
121
-     $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
122
-
123
-     if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
124
-
125
-     $Y0    = $this->pChartObject->GraphAreaY1;
126
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
127
-
128
-     $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
129
-     if ( $Position == LABEL_POSITION_LEFT )
130
-      { $XPos  = $this->pChartObject->GraphAreaX1 - $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
131
-     elseif ( $Position == LABEL_POSITION_RIGHT )
132
-      { $XPos  = $this->pChartObject->GraphAreaX2 + $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
133
-     else
134
-      return(-1);
135
-
136
-     for($Y=0;$Y<=$this->GridSizeY;$Y++)
137
-      {
138
-       $YPos = floor($Y0+$Y*$YSize + $YSize/2);
139
-
140
-       if( $Labels == NULL || !isset($Labels[$Y]) )
113
+        $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
114
+        $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
115
+        $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
116
+        $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
117
+        $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
118
+        $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
119
+        $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_LEFT;
120
+        $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
121
+        $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
122
+
123
+        if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
124
+
125
+        $Y0    = $this->pChartObject->GraphAreaY1;
126
+        $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
127
+
128
+        $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
129
+        if ( $Position == LABEL_POSITION_LEFT )
130
+        { $XPos  = $this->pChartObject->GraphAreaX1 - $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
131
+        elseif ( $Position == LABEL_POSITION_RIGHT )
132
+        { $XPos  = $this->pChartObject->GraphAreaX2 + $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
133
+        else
134
+        return(-1);
135
+
136
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
137
+        {
138
+        $YPos = floor($Y0+$Y*$YSize + $YSize/2);
139
+
140
+        if( $Labels == NULL || !isset($Labels[$Y]) )
141 141
         $Value = $Y+$CountOffset;
142
-       else
142
+        else
143 143
         $Value = $Labels[$Y];
144 144
 
145
-       $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
146
-      }
145
+        $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
146
+        }
147 147
     }
148 148
 
149
-   /* Draw the area arround the specified Threshold */
150
-   function drawContour($Threshold,$Format="")
149
+    /* Draw the area arround the specified Threshold */
150
+    function drawContour($Threshold,$Format="")
151 151
     {
152
-     $R		= isset($Format["R"]) ? $Format["R"] : 0;
153
-     $G		= isset($Format["G"]) ? $Format["G"] : 0;
154
-     $B		= isset($Format["B"]) ? $Format["B"] : 0;
155
-     $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
156
-     $Ticks	= isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
157
-     $Padding	= isset($Format["Padding"]) ? $Format["Padding"] : 0;
158
-
159
-     $X0    = $this->pChartObject->GraphAreaX1;
160
-     $Y0    = $this->pChartObject->GraphAreaY1;
161
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
162
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
163
-
164
-     $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks);
165
-
166
-     for($X=0;$X<=$this->GridSizeX;$X++)
167
-      {
168
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
152
+        $R		= isset($Format["R"]) ? $Format["R"] : 0;
153
+        $G		= isset($Format["G"]) ? $Format["G"] : 0;
154
+        $B		= isset($Format["B"]) ? $Format["B"] : 0;
155
+        $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
156
+        $Ticks	= isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
157
+        $Padding	= isset($Format["Padding"]) ? $Format["Padding"] : 0;
158
+
159
+        $X0    = $this->pChartObject->GraphAreaX1;
160
+        $Y0    = $this->pChartObject->GraphAreaY1;
161
+        $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
162
+        $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
163
+
164
+        $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks);
165
+
166
+        for($X=0;$X<=$this->GridSizeX;$X++)
169 167
         {
170
-         $Value = $this->Points[$X][$Y];
168
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
169
+        {
170
+            $Value = $this->Points[$X][$Y];
171 171
 
172
-         if ( $Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold)
173
-          {
174
-           $X1 = floor($X0+$X*$XSize)+$Padding;
175
-           $Y1 = floor($Y0+$Y*$YSize)+$Padding;
176
-           $X2 = floor($X0+$X*$XSize+$XSize);
177
-           $Y2 = floor($Y0+$Y*$YSize+$YSize);
172
+            if ( $Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold)
173
+            {
174
+            $X1 = floor($X0+$X*$XSize)+$Padding;
175
+            $Y1 = floor($Y0+$Y*$YSize)+$Padding;
176
+            $X2 = floor($X0+$X*$XSize+$XSize);
177
+            $Y2 = floor($Y0+$Y*$YSize+$YSize);
178 178
 
179
-           if ( $X > 0 && $this->Points[$X-1][$Y] != UNKNOWN && $this->Points[$X-1][$Y] != IGNORED && $this->Points[$X-1][$Y] < $Threshold)
179
+            if ( $X > 0 && $this->Points[$X-1][$Y] != UNKNOWN && $this->Points[$X-1][$Y] != IGNORED && $this->Points[$X-1][$Y] < $Threshold)
180 180
             $this->pChartObject->drawLine($X1,$Y1,$X1,$Y2,$Color);
181
-           if ( $Y > 0 && $this->Points[$X][$Y-1] != UNKNOWN && $this->Points[$X][$Y-1] != IGNORED && $this->Points[$X][$Y-1] < $Threshold)
181
+            if ( $Y > 0 && $this->Points[$X][$Y-1] != UNKNOWN && $this->Points[$X][$Y-1] != IGNORED && $this->Points[$X][$Y-1] < $Threshold)
182 182
             $this->pChartObject->drawLine($X1,$Y1,$X2,$Y1,$Color);
183
-           if ( $X < $this->GridSizeX && $this->Points[$X+1][$Y] != UNKNOWN && $this->Points[$X+1][$Y] != IGNORED && $this->Points[$X+1][$Y] < $Threshold)
183
+            if ( $X < $this->GridSizeX && $this->Points[$X+1][$Y] != UNKNOWN && $this->Points[$X+1][$Y] != IGNORED && $this->Points[$X+1][$Y] < $Threshold)
184 184
             $this->pChartObject->drawLine($X2,$Y1,$X2,$Y2,$Color);
185
-           if ( $Y < $this->GridSizeY && $this->Points[$X][$Y+1] != UNKNOWN && $this->Points[$X][$Y+1] != IGNORED && $this->Points[$X][$Y+1] < $Threshold)
185
+            if ( $Y < $this->GridSizeY && $this->Points[$X][$Y+1] != UNKNOWN && $this->Points[$X][$Y+1] != IGNORED && $this->Points[$X][$Y+1] < $Threshold)
186 186
             $this->pChartObject->drawLine($X1,$Y2,$X2,$Y2,$Color);
187
-          }
187
+            }
188
+        }
188 189
         }
189
-      }
190 190
     }
191 191
 
192
-   /* Draw the surface chart */
193
-   function drawSurface($Format="")
192
+    /* Draw the surface chart */
193
+    function drawSurface($Format="")
194 194
     {
195
-     $Palette		= isset($Format["Palette"]) ? $Format["Palette"] : NULL;
196
-     $ShadeR1		= isset($Format["ShadeR1"]) ? $Format["ShadeR1"] : 77;
197
-     $ShadeG1		= isset($Format["ShadeG1"]) ? $Format["ShadeG1"] : 205;
198
-     $ShadeB1		= isset($Format["ShadeB1"]) ? $Format["ShadeB1"] : 21;
199
-     $ShadeA1		= isset($Format["ShadeA1"]) ? $Format["ShadeA1"] : 40;
200
-     $ShadeR2		= isset($Format["ShadeR2"]) ? $Format["ShadeR2"] : 227;
201
-     $ShadeG2		= isset($Format["ShadeG2"]) ? $Format["ShadeG2"] : 135;
202
-     $ShadeB2		= isset($Format["ShadeB2"]) ? $Format["ShadeB2"] : 61;
203
-     $ShadeA2		= isset($Format["ShadeA2"]) ? $Format["ShadeA2"] : 100;
204
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
205
-     $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
206
-     $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
207
-     $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
208
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : -1;
209
-     $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 1;
210
-
211
-     $X0    = $this->pChartObject->GraphAreaX1;
212
-     $Y0    = $this->pChartObject->GraphAreaY1;
213
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
214
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
215
-
216
-     for($X=0;$X<=$this->GridSizeX;$X++)
217
-      {
218
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
195
+        $Palette		= isset($Format["Palette"]) ? $Format["Palette"] : NULL;
196
+        $ShadeR1		= isset($Format["ShadeR1"]) ? $Format["ShadeR1"] : 77;
197
+        $ShadeG1		= isset($Format["ShadeG1"]) ? $Format["ShadeG1"] : 205;
198
+        $ShadeB1		= isset($Format["ShadeB1"]) ? $Format["ShadeB1"] : 21;
199
+        $ShadeA1		= isset($Format["ShadeA1"]) ? $Format["ShadeA1"] : 40;
200
+        $ShadeR2		= isset($Format["ShadeR2"]) ? $Format["ShadeR2"] : 227;
201
+        $ShadeG2		= isset($Format["ShadeG2"]) ? $Format["ShadeG2"] : 135;
202
+        $ShadeB2		= isset($Format["ShadeB2"]) ? $Format["ShadeB2"] : 61;
203
+        $ShadeA2		= isset($Format["ShadeA2"]) ? $Format["ShadeA2"] : 100;
204
+        $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
205
+        $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
206
+        $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
207
+        $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
208
+        $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : -1;
209
+        $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 1;
210
+
211
+        $X0    = $this->pChartObject->GraphAreaX1;
212
+        $Y0    = $this->pChartObject->GraphAreaY1;
213
+        $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
214
+        $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
215
+
216
+        for($X=0;$X<=$this->GridSizeX;$X++)
217
+        {
218
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
219 219
         {
220
-         $Value = $this->Points[$X][$Y];
220
+            $Value = $this->Points[$X][$Y];
221 221
 
222
-         if ( $Value != UNKNOWN && $Value != IGNORED )
223
-          {
224
-           $X1 = floor($X0+$X*$XSize)+$Padding;
225
-           $Y1 = floor($Y0+$Y*$YSize)+$Padding;
226
-           $X2 = floor($X0+$X*$XSize+$XSize);
227
-           $Y2 = floor($Y0+$Y*$YSize+$YSize);
222
+            if ( $Value != UNKNOWN && $Value != IGNORED )
223
+            {
224
+            $X1 = floor($X0+$X*$XSize)+$Padding;
225
+            $Y1 = floor($Y0+$Y*$YSize)+$Padding;
226
+            $X2 = floor($X0+$X*$XSize+$XSize);
227
+            $Y2 = floor($Y0+$Y*$YSize+$YSize);
228 228
 
229
-           if ( $Palette != NULL )
229
+            if ( $Palette != NULL )
230 230
             {
231
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["R"]) ) { $R = $Palette[$Value]["R"]; } else { $R = 0; }
232
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["G"]) ) { $G = $Palette[$Value]["G"]; } else { $G = 0; }
233
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["B"]) ) { $B = $Palette[$Value]["B"]; } else { $B = 0; }
234
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["Alpha"]) ) { $Alpha = $Palette[$Value]["Alpha"]; } else { $Alpha = 1000; }
231
+                if ( isset($Palette[$Value]) && isset($Palette[$Value]["R"]) ) { $R = $Palette[$Value]["R"]; } else { $R = 0; }
232
+                if ( isset($Palette[$Value]) && isset($Palette[$Value]["G"]) ) { $G = $Palette[$Value]["G"]; } else { $G = 0; }
233
+                if ( isset($Palette[$Value]) && isset($Palette[$Value]["B"]) ) { $B = $Palette[$Value]["B"]; } else { $B = 0; }
234
+                if ( isset($Palette[$Value]) && isset($Palette[$Value]["Alpha"]) ) { $Alpha = $Palette[$Value]["Alpha"]; } else { $Alpha = 1000; }
235 235
             }
236
-           else
236
+            else
237 237
             {
238
-             $R = (($ShadeR2-$ShadeR1)/100)*$Value + $ShadeR1;
239
-             $G = (($ShadeG2-$ShadeG1)/100)*$Value + $ShadeG1;
240
-             $B = (($ShadeB2-$ShadeB1)/100)*$Value + $ShadeB1;
241
-             $Alpha = (($ShadeA2-$ShadeA1)/100)*$Value + $ShadeA1;
238
+                $R = (($ShadeR2-$ShadeR1)/100)*$Value + $ShadeR1;
239
+                $G = (($ShadeG2-$ShadeG1)/100)*$Value + $ShadeG1;
240
+                $B = (($ShadeB2-$ShadeB1)/100)*$Value + $ShadeB1;
241
+                $Alpha = (($ShadeA2-$ShadeA1)/100)*$Value + $ShadeA1;
242 242
             }
243 243
 
244
-           $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
245
-           if ( $Border ) { $Settings["BorderR"] = $BorderR; $Settings["BorderG"] = $BorderG; $Settings["BorderB"] = $BorderB; }
246
-           if ( $Surrounding != -1 ) { $Settings["BorderR"] = $R+$Surrounding; $Settings["BorderG"] = $G+$Surrounding; $Settings["BorderB"] = $B+$Surrounding; }
244
+            $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
245
+            if ( $Border ) { $Settings["BorderR"] = $BorderR; $Settings["BorderG"] = $BorderG; $Settings["BorderB"] = $BorderB; }
246
+            if ( $Surrounding != -1 ) { $Settings["BorderR"] = $R+$Surrounding; $Settings["BorderG"] = $G+$Surrounding; $Settings["BorderB"] = $B+$Surrounding; }
247 247
 
248
-           $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2-1,$Y2-1,$Settings);
249
-          }
248
+            $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2-1,$Y2-1,$Settings);
249
+            }
250
+        }
250 251
         }
251
-      }
252 252
     }
253 253
 
254
-   /* Compute the missing points */
255
-   function computeMissing()
254
+    /* Compute the missing points */
255
+    function computeMissing()
256 256
     {
257
-     $Missing = "";
258
-     for($X=0;$X<=$this->GridSizeX;$X++)
259
-      {
260
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
257
+        $Missing = "";
258
+        for($X=0;$X<=$this->GridSizeX;$X++)
259
+        {
260
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
261 261
         {
262
-         if ( $this->Points[$X][$Y] == UNKNOWN )
263
-          $Missing[] = $X.",".$Y;
262
+            if ( $this->Points[$X][$Y] == UNKNOWN )
263
+            $Missing[] = $X.",".$Y;
264 264
         }
265
-      }
266
-     shuffle($Missing);
265
+        }
266
+        shuffle($Missing);
267 267
      
268
-     foreach($Missing as $Key => $Pos)
269
-      {
270
-       $Pos = preg_split("/,/",$Pos);
271
-       $X   = $Pos[0];
272
-       $Y   = $Pos[1];
268
+        foreach($Missing as $Key => $Pos)
269
+        {
270
+        $Pos = preg_split("/,/",$Pos);
271
+        $X   = $Pos[0];
272
+        $Y   = $Pos[1];
273 273
 
274
-       if ( $this->Points[$X][$Y] == UNKNOWN )
274
+        if ( $this->Points[$X][$Y] == UNKNOWN )
275 275
         {
276
-         $NearestNeighbor = $this->getNearestNeighbor($X,$Y);
276
+            $NearestNeighbor = $this->getNearestNeighbor($X,$Y);
277 277
 
278
-         $Value = 0; $Points = 0;
279
-         for($Xi=$X-$NearestNeighbor;$Xi<=$X+$NearestNeighbor;$Xi++)
280
-          {
281
-           for($Yi=$Y-$NearestNeighbor;$Yi<=$Y+$NearestNeighbor;$Yi++)
278
+            $Value = 0; $Points = 0;
279
+            for($Xi=$X-$NearestNeighbor;$Xi<=$X+$NearestNeighbor;$Xi++)
282 280
             {
283
-             if ($Xi >=0 && $Yi >= 0 && $Xi <= $this->GridSizeX && $Yi <= $this->GridSizeY && $this->Points[$Xi][$Yi] != UNKNOWN && $this->Points[$Xi][$Yi] != IGNORED)
284
-              {
285
-               $Value = $Value + $this->Points[$Xi][$Yi]; $Points++;
286
-              }
281
+            for($Yi=$Y-$NearestNeighbor;$Yi<=$Y+$NearestNeighbor;$Yi++)
282
+            {
283
+                if ($Xi >=0 && $Yi >= 0 && $Xi <= $this->GridSizeX && $Yi <= $this->GridSizeY && $this->Points[$Xi][$Yi] != UNKNOWN && $this->Points[$Xi][$Yi] != IGNORED)
284
+                {
285
+                $Value = $Value + $this->Points[$Xi][$Yi]; $Points++;
286
+                }
287
+            }
287 288
             }
288
-          }
289 289
 
290
-         if ( $Points != 0 ) { $this->Points[$X][$Y] = $Value / $Points; }
290
+            if ( $Points != 0 ) { $this->Points[$X][$Y] = $Value / $Points; }
291
+        }
291 292
         }
292
-      }
293 293
     }
294 294
 
295
-   /* Return the nearest Neighbor distance of a point */
296
-   function getNearestNeighbor($Xp,$Yp)
295
+    /* Return the nearest Neighbor distance of a point */
296
+    function getNearestNeighbor($Xp,$Yp)
297 297
     {
298
-     $Nearest = UNKNOWN;
299
-     for($X=0;$X<=$this->GridSizeX;$X++)
300
-      {
301
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
298
+        $Nearest = UNKNOWN;
299
+        for($X=0;$X<=$this->GridSizeX;$X++)
300
+        {
301
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
302 302
         {
303
-         if ( $this->Points[$X][$Y] != UNKNOWN && $this->Points[$X][$Y] != IGNORED )
304
-          {
305
-           $DistanceX = max($Xp,$X)-min($Xp,$X);
306
-           $DistanceY = max($Yp,$Y)-min($Yp,$Y);
307
-           $Distance  = max($DistanceX,$DistanceY);
308
-           if ( $Distance < $Nearest || $Nearest == UNKNOWN ) { $Nearest = $Distance; }
309
-          }
303
+            if ( $this->Points[$X][$Y] != UNKNOWN && $this->Points[$X][$Y] != IGNORED )
304
+            {
305
+            $DistanceX = max($Xp,$X)-min($Xp,$X);
306
+            $DistanceY = max($Yp,$Y)-min($Yp,$Y);
307
+            $Distance  = max($DistanceX,$DistanceY);
308
+            if ( $Distance < $Nearest || $Nearest == UNKNOWN ) { $Nearest = $Distance; }
309
+            }
310 310
         }
311
-      }
312
-     return($Nearest);
311
+        }
312
+        return($Nearest);
313
+    }
313 314
     }
314
-  }
315 315
 ?>
316 316
\ No newline at end of file
Please login to merge, or discard this patch.
boinc/modules/boincteam/includes/views_handler_argument_boincteam_id.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
  */
8 8
 
9 9
 class views_handler_argument_boincteam_id extends views_handler_argument_numeric {
10
-  function construct() {
10
+    function construct() {
11 11
     parent::construct();
12
-  }
12
+    }
13 13
 
14
-  function set_argument($arg) {
14
+    function set_argument($arg) {
15 15
     // When setting the ID argument, convert to BOINC ID
16 16
     $id = is_numeric($arg) ? $arg : 0;
17 17
     $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = %d", $id));
18 18
     $this->argument = $boinc_id;
19 19
     return $this->validate_arg($boinc_id);
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincteam/boincteam_forum.views.inc 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -13,80 +13,80 @@
 block discarded – undo
13 13
  */
14 14
 function boincteam_forum_views_data() {
15 15
   
16
-  // -----------------------------------------------------------------------------------------------
17
-  // Definition for team table
18
-  // -----------------------------------------------------------------------------------------------
16
+    // -----------------------------------------------------------------------------------------------
17
+    // Definition for team table
18
+    // -----------------------------------------------------------------------------------------------
19 19
   
20
-  $data['boincteam_forum_node']['table']['group'] = t('BOINC');
20
+    $data['boincteam_forum_node']['table']['group'] = t('BOINC');
21 21
   
22
-  $data['boincteam_forum_node']['table']['base'] = array(
23
-      'field' => 'nid',
24
-      'title' => t('BOINC team forum topic'),
25
-      'help' => t('Forum topics for a team'),
26
-  );
22
+    $data['boincteam_forum_node']['table']['base'] = array(
23
+        'field' => 'nid',
24
+        'title' => t('BOINC team forum topic'),
25
+        'help' => t('Forum topics for a team'),
26
+    );
27 27
 
28
-  // Describe each of the individual fields in this table to Views. For
29
-  // each field, you may define what field, sort, argument, and/or filter
30
-  // handlers it supports. This will determine where in the Views interface you
31
-  // may use the field.
28
+    // Describe each of the individual fields in this table to Views. For
29
+    // each field, you may define what field, sort, argument, and/or filter
30
+    // handlers it supports. This will determine where in the Views interface you
31
+    // may use the field.
32 32
   
33
-  // Primary keys allowed as arguments
33
+    // Primary keys allowed as arguments
34 34
   
35
-  $data['boincteam_forum_node']['tfid'] = array(
35
+    $data['boincteam_forum_node']['tfid'] = array(
36 36
     'title' => t('Team forum ID'),
37 37
     'help' => t('The ID of the team forum containing this topic.'),
38 38
     'field' => array(
39
-      'handler' => 'views_handler_field_numeric',
40
-      'click sortable' => TRUE
39
+        'handler' => 'views_handler_field_numeric',
40
+        'click sortable' => TRUE
41 41
     ),
42 42
     'argument' => array(
43
-      'handler' => 'views_handler_argument_numeric',
44
-      'name field' => 'title', // the field to display in the summary.
45
-      'numeric' => TRUE,
46
-      'validate type' => 'id'
43
+        'handler' => 'views_handler_argument_numeric',
44
+        'name field' => 'title', // the field to display in the summary.
45
+        'numeric' => TRUE,
46
+        'validate type' => 'id'
47 47
     ),
48 48
     'relationship' => array(
49
-      'base' => 'boincteam_forum',
50
-      'field' => 'tfid',
51
-      'handler' => 'views_handler_relationship',
52
-      'label' => t('Team Forum')
49
+        'base' => 'boincteam_forum',
50
+        'field' => 'tfid',
51
+        'handler' => 'views_handler_relationship',
52
+        'label' => t('Team Forum')
53 53
     ),
54 54
     'filter' => array(
55
-      'handler' => 'views_handler_filter_numeric'
55
+        'handler' => 'views_handler_filter_numeric'
56 56
     ),
57 57
     'sort' => array(
58
-      'handler' => 'views_handler_sort_numeric'
58
+        'handler' => 'views_handler_sort_numeric'
59 59
     )
60
-  );
60
+    );
61 61
   
62
-  // Foreign key fields
62
+    // Foreign key fields
63 63
   
64
-  $data['boincteam_forum_node']['nid'] = array(
64
+    $data['boincteam_forum_node']['nid'] = array(
65 65
     'title' => t('Team forum node'),
66 66
     'help' => t('The node containing the content of this team forum topic.'),
67 67
     // This is a foreign key to the {node} table. When the view is configured
68 68
     // with this relationship, all the fields for the related user node will be 
69 69
     // available.
70 70
     'relationship' => array(
71
-      'base' => 'node',
72
-      'field' => 'nid',
73
-      'handler' => 'views_handler_relationship',
74
-      'label' => t('Team Forum Topic Node')
71
+        'base' => 'node',
72
+        'field' => 'nid',
73
+        'handler' => 'views_handler_relationship',
74
+        'label' => t('Team Forum Topic Node')
75 75
     ),
76 76
     'field' => array(
77
-      'handler' => 'views_handler_field_numeric',
78
-      'click sortable' => TRUE
77
+        'handler' => 'views_handler_field_numeric',
78
+        'click sortable' => TRUE
79 79
     ),
80 80
     'filter' => array(
81
-      'handler' => 'views_handler_filter_numeric'
81
+        'handler' => 'views_handler_filter_numeric'
82 82
     ),
83 83
     'sort' => array(
84
-      'handler' => 'views_handler_sort_numeric'
84
+        'handler' => 'views_handler_sort_numeric'
85 85
     )
86
-  );
86
+    );
87 87
   
88
-  // Descriptions of general fields (alphabetized)
89
-  // ...
88
+    // Descriptions of general fields (alphabetized)
89
+    // ...
90 90
   
91
-  return $data;
91
+    return $data;
92 92
 }
Please login to merge, or discard this patch.
boinc/modules/boincwork/views/views_handler_argument_boincuser_id.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
  */
8 8
 
9 9
 class views_handler_argument_boincuser_id extends views_handler_argument_numeric {
10
-  function construct() {
10
+    function construct() {
11 11
     parent::construct();
12
-  }
12
+    }
13 13
 
14
-  function set_argument($arg) {
14
+    function set_argument($arg) {
15 15
     // When setting the ID argument, convert to BOINC ID
16 16
     $id = is_numeric($arg) ? $arg : 0;
17 17
     $boinc_id = db_result(db_query("SELECT boinc_id FROM {boincuser} WHERE uid = %d", $id));
18 18
     $this->argument = $boinc_id;
19 19
     return $this->validate_arg($boinc_id);
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.