Passed
Push — master ( 0f8b85...1af5ec )
by Kevin
15:29 queued 03:24
created
default/boinc/modules/boincstats/includes/pchart/class/pData.class.php 4 patches
Indentation   +524 added lines, -524 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 - class to manipulate data arrays
4 4
 
5 5
      Version     : 2.1.3
@@ -13,50 +13,50 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- /* Axis configuration */
17
- define("AXIS_FORMAT_DEFAULT"		, 680001);
18
- define("AXIS_FORMAT_TIME"		, 680002);
19
- define("AXIS_FORMAT_DATE"		, 680003);
20
- define("AXIS_FORMAT_METRIC"		, 680004);
21
- define("AXIS_FORMAT_CURRENCY"		, 680005);
22
- define("AXIS_FORMAT_CUSTOM"		, 680006);
23
-
24
- /* Axis position */
25
- define("AXIS_POSITION_LEFT"		, 681001);
26
- define("AXIS_POSITION_RIGHT"		, 681002);
27
- define("AXIS_POSITION_TOP"		, 681001);
28
- define("AXIS_POSITION_BOTTOM"		, 681002);
29
-
30
- /* Families of data points */
31
- define("SERIE_SHAPE_FILLEDCIRCLE"	, 681011);
32
- define("SERIE_SHAPE_FILLEDTRIANGLE"	, 681012);
33
- define("SERIE_SHAPE_FILLEDSQUARE"	, 681013);
34
- define("SERIE_SHAPE_FILLEDDIAMOND"	, 681017);
35
- define("SERIE_SHAPE_CIRCLE"		, 681014);
36
- define("SERIE_SHAPE_TRIANGLE"		, 681015);
37
- define("SERIE_SHAPE_SQUARE"		, 681016);
38
- define("SERIE_SHAPE_DIAMOND"		, 681018);
39
-
40
- /* Axis position */
41
- define("AXIS_X"			, 682001);
42
- define("AXIS_Y"			, 682002);
43
-
44
- /* Define value limits */
45
- define("ABSOLUTE_MIN"          	, -10000000000000);
46
- define("ABSOLUTE_MAX"          	, 10000000000000);
47
-
48
- /* Replacement to the PHP NULL keyword */
49
- define("VOID"                  	, 0.123456789);
50
-
51
- /* Euro symbol for GD fonts */
52
- define("EURO_SYMBOL"			, utf8_encode("&#8364;"));
53
-
54
- /* pData class definition */
55
- class pData
56
-  {
57
-   var $Data;
58
-
59
-   var $Palette = array("0"=>array("R"=>188,"G"=>224,"B"=>46,"Alpha"=>100),
16
+    /* Axis configuration */
17
+    define("AXIS_FORMAT_DEFAULT"		, 680001);
18
+    define("AXIS_FORMAT_TIME"		, 680002);
19
+    define("AXIS_FORMAT_DATE"		, 680003);
20
+    define("AXIS_FORMAT_METRIC"		, 680004);
21
+    define("AXIS_FORMAT_CURRENCY"		, 680005);
22
+    define("AXIS_FORMAT_CUSTOM"		, 680006);
23
+
24
+    /* Axis position */
25
+    define("AXIS_POSITION_LEFT"		, 681001);
26
+    define("AXIS_POSITION_RIGHT"		, 681002);
27
+    define("AXIS_POSITION_TOP"		, 681001);
28
+    define("AXIS_POSITION_BOTTOM"		, 681002);
29
+
30
+    /* Families of data points */
31
+    define("SERIE_SHAPE_FILLEDCIRCLE"	, 681011);
32
+    define("SERIE_SHAPE_FILLEDTRIANGLE"	, 681012);
33
+    define("SERIE_SHAPE_FILLEDSQUARE"	, 681013);
34
+    define("SERIE_SHAPE_FILLEDDIAMOND"	, 681017);
35
+    define("SERIE_SHAPE_CIRCLE"		, 681014);
36
+    define("SERIE_SHAPE_TRIANGLE"		, 681015);
37
+    define("SERIE_SHAPE_SQUARE"		, 681016);
38
+    define("SERIE_SHAPE_DIAMOND"		, 681018);
39
+
40
+    /* Axis position */
41
+    define("AXIS_X"			, 682001);
42
+    define("AXIS_Y"			, 682002);
43
+
44
+    /* Define value limits */
45
+    define("ABSOLUTE_MIN"          	, -10000000000000);
46
+    define("ABSOLUTE_MAX"          	, 10000000000000);
47
+
48
+    /* Replacement to the PHP NULL keyword */
49
+    define("VOID"                  	, 0.123456789);
50
+
51
+    /* Euro symbol for GD fonts */
52
+    define("EURO_SYMBOL"			, utf8_encode("&#8364;"));
53
+
54
+    /* pData class definition */
55
+    class pData
56
+    {
57
+    var $Data;
58
+
59
+    var $Palette = array("0"=>array("R"=>188,"G"=>224,"B"=>46,"Alpha"=>100),
60 60
                         "1"=>array("R"=>224,"G"=>100,"B"=>46,"Alpha"=>100),
61 61
                         "2"=>array("R"=>224,"G"=>214,"B"=>46,"Alpha"=>100),
62 62
                         "3"=>array("R"=>46,"G"=>151,"B"=>224,"Alpha"=>100),
@@ -65,723 +65,723 @@  discard block
 block discarded – undo
65 65
                         "6"=>array("R"=>92,"G"=>224,"B"=>46,"Alpha"=>100),
66 66
                         "7"=>array("R"=>224,"G"=>176,"B"=>46,"Alpha"=>100));
67 67
 
68
-   /* Class creator */
69
-   function pData()
68
+    /* Class creator */
69
+    function pData()
70 70
     {
71
-     $this->Data = "";
72
-     $this->Data["XAxisDisplay"]	= AXIS_FORMAT_DEFAULT;
73
-     $this->Data["XAxisFormat"]		= NULL;
74
-     $this->Data["XAxisName"]		= NULL;
75
-     $this->Data["XAxisUnit"]		= NULL;
76
-     $this->Data["Abscissa"]		= NULL;
77
-     $this->Data["AbsicssaPosition"]	= AXIS_POSITION_BOTTOM;
71
+        $this->Data = "";
72
+        $this->Data["XAxisDisplay"]	= AXIS_FORMAT_DEFAULT;
73
+        $this->Data["XAxisFormat"]		= NULL;
74
+        $this->Data["XAxisName"]		= NULL;
75
+        $this->Data["XAxisUnit"]		= NULL;
76
+        $this->Data["Abscissa"]		= NULL;
77
+        $this->Data["AbsicssaPosition"]	= AXIS_POSITION_BOTTOM;
78 78
 
79
-     $this->Data["Axis"][0]["Display"]  = AXIS_FORMAT_DEFAULT;
80
-     $this->Data["Axis"][0]["Position"] = AXIS_POSITION_LEFT;
81
-     $this->Data["Axis"][0]["Identity"] = AXIS_Y;
79
+        $this->Data["Axis"][0]["Display"]  = AXIS_FORMAT_DEFAULT;
80
+        $this->Data["Axis"][0]["Position"] = AXIS_POSITION_LEFT;
81
+        $this->Data["Axis"][0]["Identity"] = AXIS_Y;
82 82
     }
83 83
 
84
-   /* Add a single point or an array to the given serie */
85
-   function addPoints($Values,$SerieName="Serie1")
84
+    /* Add a single point or an array to the given serie */
85
+    function addPoints($Values,$SerieName="Serie1")
86 86
     {
87
-     if (!isset($this->Data["Series"][$SerieName]))
88
-      $this->initialise($SerieName);
87
+        if (!isset($this->Data["Series"][$SerieName]))
88
+        $this->initialise($SerieName);
89 89
 
90
-     if ( is_array($Values) )
91
-      {
92
-       foreach($Values as $Key => $Value)
90
+        if ( is_array($Values) )
91
+        {
92
+        foreach($Values as $Key => $Value)
93 93
         { $this->Data["Series"][$SerieName]["Data"][] = $Value; }
94
-      }
95
-     else
96
-      $this->Data["Series"][$SerieName]["Data"][] = $Values;
94
+        }
95
+        else
96
+        $this->Data["Series"][$SerieName]["Data"][] = $Values;
97 97
 
98
-     if ( $Values != VOID )
99
-      {
100
-       $StrippedData = $this->stripVOID($this->Data["Series"][$SerieName]["Data"]);
101
-       if ( empty($StrippedData) ) { $this->Data["Series"][$SerieName]["Max"] = 0; $this->Data["Series"][$SerieName]["Min"] =0; return(0); }
102
-       $this->Data["Series"][$SerieName]["Max"] = max($StrippedData);
103
-       $this->Data["Series"][$SerieName]["Min"] = min($StrippedData);
104
-      }
98
+        if ( $Values != VOID )
99
+        {
100
+        $StrippedData = $this->stripVOID($this->Data["Series"][$SerieName]["Data"]);
101
+        if ( empty($StrippedData) ) { $this->Data["Series"][$SerieName]["Max"] = 0; $this->Data["Series"][$SerieName]["Min"] =0; return(0); }
102
+        $this->Data["Series"][$SerieName]["Max"] = max($StrippedData);
103
+        $this->Data["Series"][$SerieName]["Min"] = min($StrippedData);
104
+        }
105 105
     }
106 106
 
107
-   /* Strip VOID values */
108
-   function stripVOID($Values)
107
+    /* Strip VOID values */
108
+    function stripVOID($Values)
109 109
     { if (!is_array($Values)) { return(array()); } $Result = array(); foreach($Values as $Key => $Value) { if ( $Value != VOID ) { $Result[] = $Value; } } return($Result); }
110 110
 
111
-   /* Return the number of values contained in a given serie */
112
-   function getSerieCount($Serie)
111
+    /* Return the number of values contained in a given serie */
112
+    function getSerieCount($Serie)
113 113
     { if (isset($this->Data["Series"][$Serie]["Data"])) { return(sizeof($this->Data["Series"][$Serie]["Data"])); } else { return(0); } }
114 114
 
115
-   /* Remove a serie from the pData object */
116
-   function removeSerie($Series)
115
+    /* Remove a serie from the pData object */
116
+    function removeSerie($Series)
117 117
     {
118
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
119
-     foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie])) { unset($this->Data["Series"][$Serie]); } }
118
+        if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
119
+        foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie])) { unset($this->Data["Series"][$Serie]); } }
120 120
     }
121 121
 
122
-   /* Return a value from given serie & index */
123
-   function getValueAt($Serie,$Index=0)
122
+    /* Return a value from given serie & index */
123
+    function getValueAt($Serie,$Index=0)
124 124
     { if (isset($this->Data["Series"][$Serie]["Data"][$Index])) { return($this->Data["Series"][$Serie]["Data"][$Index]); } else { return(NULL); } }
125 125
 
126
-   /* Return the values array */
127
-   function getValues($Serie)
126
+    /* Return the values array */
127
+    function getValues($Serie)
128 128
     { if (isset($this->Data["Series"][$Serie]["Data"])) { return($this->Data["Series"][$Serie]["Data"]); } else { return(NULL); } }
129 129
 
130
-   /* Reverse the values in the given serie */
131
-   function reverseSerie($Series)
130
+    /* Reverse the values in the given serie */
131
+    function reverseSerie($Series)
132 132
     {
133
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
134
-     foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]["Data"])) { $this->Data["Series"][$Serie]["Data"] = array_reverse($this->Data["Series"][$Serie]["Data"]); } }
133
+        if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
134
+        foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]["Data"])) { $this->Data["Series"][$Serie]["Data"] = array_reverse($this->Data["Series"][$Serie]["Data"]); } }
135 135
     }
136 136
 
137
-   /* Return the sum of the serie values */
138
-   function getSum($Serie)
137
+    /* Return the sum of the serie values */
138
+    function getSum($Serie)
139 139
     { if (isset($this->Data["Series"][$Serie])) { return(array_sum($this->Data["Series"][$Serie]["Data"])); } else { return(NULL); } }
140 140
 
141
-   /* Return the max value of a given serie */
142
-   function getMax($Serie)
141
+    /* Return the max value of a given serie */
142
+    function getMax($Serie)
143 143
     { if (isset($this->Data["Series"][$Serie]["Max"])) { return($this->Data["Series"][$Serie]["Max"]); } else { return(NULL); } }
144 144
 
145
-   /* Return the min value of a given serie */
146
-   function getMin($Serie)
145
+    /* Return the min value of a given serie */
146
+    function getMin($Serie)
147 147
     { if (isset($this->Data["Series"][$Serie]["Min"])) { return($this->Data["Series"][$Serie]["Min"]); } else { return(NULL); } }
148 148
 
149
-   /* Set the description of a given serie */
150
-   function setSerieShape($Series,$Shape=SERIE_SHAPE_FILLEDCIRCLE)
149
+    /* Set the description of a given serie */
150
+    function setSerieShape($Series,$Shape=SERIE_SHAPE_FILLEDCIRCLE)
151 151
     {
152
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
153
-     foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Shape"] = $Shape; } }
152
+        if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
153
+        foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Shape"] = $Shape; } }
154 154
     }
155 155
 
156
-   /* Set the description of a given serie */
157
-   function setSerieDescription($Series,$Description="My serie")
156
+    /* Set the description of a given serie */
157
+    function setSerieDescription($Series,$Description="My serie")
158 158
     {
159
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
160
-     foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Description"] = $Description; } }
159
+        if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
160
+        foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Description"] = $Description; } }
161 161
     }
162 162
 
163
-   /* Set a serie as "drawable" while calling a rendering function */
164
-   function setSerieDrawable($Series,$Drawable=TRUE)
163
+    /* Set a serie as "drawable" while calling a rendering function */
164
+    function setSerieDrawable($Series,$Drawable=TRUE)
165 165
     {
166
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
167
-     foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["isDrawable"] = $Drawable; } }
166
+        if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
167
+        foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["isDrawable"] = $Drawable; } }
168 168
     }
169 169
 
170
-   /* Set the icon associated to a given serie */
171
-   function setSeriePicture($Series,$Picture=NULL)
170
+    /* Set the icon associated to a given serie */
171
+    function setSeriePicture($Series,$Picture=NULL)
172 172
     {
173
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
174
-     foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Picture"] = $Picture; } }
173
+        if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
174
+        foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Picture"] = $Picture; } }
175 175
     }
176 176
 
177
-   /* Set the name of the X Axis */
178
-   function setXAxisName($Name)
177
+    /* Set the name of the X Axis */
178
+    function setXAxisName($Name)
179 179
     { $this->Data["XAxisName"] = $Name; }
180 180
 
181
-   /* Set the display mode of the  X Axis */
182
-   function setXAxisDisplay($Mode,$Format=NULL)
181
+    /* Set the display mode of the  X Axis */
182
+    function setXAxisDisplay($Mode,$Format=NULL)
183 183
     { $this->Data["XAxisDisplay"] = $Mode; $this->Data["XAxisFormat"]  = $Format; }
184 184
 
185
-   /* Set the unit that will be displayed on the X axis */
186
-   function setXAxisUnit($Unit)
185
+    /* Set the unit that will be displayed on the X axis */
186
+    function setXAxisUnit($Unit)
187 187
     { $this->Data["XAxisUnit"] = $Unit; }
188 188
 
189
-   /* Set the serie that will be used as abscissa */
190
-   function setAbscissa($Serie)
189
+    /* Set the serie that will be used as abscissa */
190
+    function setAbscissa($Serie)
191 191
     { if (isset($this->Data["Series"][$Serie])) { $this->Data["Abscissa"] = $Serie; } }
192 192
 
193
-   function setAbsicssaPosition($Position = AXIS_POSITION_BOTTOM)
193
+    function setAbsicssaPosition($Position = AXIS_POSITION_BOTTOM)
194 194
     { $this->Data["AbsicssaPosition"] = $Position; }
195 195
 
196
-   /* Set the name of the abscissa axis */
197
-   function setAbscissaName($Name)
196
+    /* Set the name of the abscissa axis */
197
+    function setAbscissaName($Name)
198 198
     { $this->Data["AbscissaName"] = $Name; }
199 199
 
200
-   /* Create a scatter group specifyin X and Y data series */
201
-   function setScatterSerie($SerieX,$SerieY,$ID=0)
200
+    /* Create a scatter group specifyin X and Y data series */
201
+    function setScatterSerie($SerieX,$SerieY,$ID=0)
202 202
     { if (isset($this->Data["Series"][$SerieX]) && isset($this->Data["Series"][$SerieY]) ) { $this->initScatterSerie($ID); $this->Data["ScatterSeries"][$ID]["X"] = $SerieX; $this->Data["ScatterSeries"][$ID]["Y"] = $SerieY; } }
203 203
 
204
-   /* Set the shape of a given sctatter serie */
205
-   function setScatterSerieShape($ID,$Shape=SERIE_SHAPE_FILLEDCIRCLE)
204
+    /* Set the shape of a given sctatter serie */
205
+    function setScatterSerieShape($ID,$Shape=SERIE_SHAPE_FILLEDCIRCLE)
206 206
     { if (isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Shape"] = $Shape; } }
207 207
 
208
-   /* Set the description of a given scatter serie */
209
-   function setScatterSerieDescription($ID,$Description="My serie")
208
+    /* Set the description of a given scatter serie */
209
+    function setScatterSerieDescription($ID,$Description="My serie")
210 210
     { if (isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Description"] = $Description; } }
211 211
 
212
-   /* Set the icon associated to a given scatter serie */
213
-   function setScatterSeriePicture($ID,$Picture=NULL)
212
+    /* Set the icon associated to a given scatter serie */
213
+    function setScatterSeriePicture($ID,$Picture=NULL)
214 214
     { if (isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Picture"] = $Picture; } }
215 215
 
216
-   /* Set a scatter serie as "drawable" while calling a rendering function */
217
-   function setScatterSerieDrawable($ID ,$Drawable=TRUE)
216
+    /* Set a scatter serie as "drawable" while calling a rendering function */
217
+    function setScatterSerieDrawable($ID ,$Drawable=TRUE)
218 218
     { if (isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["isDrawable"] = $Drawable; } }
219 219
 
220
-   /* Define if a scatter serie should be draw with ticks */
221
-   function setScatterSerieTicks($ID,$Width=0)
220
+    /* Define if a scatter serie should be draw with ticks */
221
+    function setScatterSerieTicks($ID,$Width=0)
222 222
     { if ( isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Ticks"] = $Width; } }
223 223
 
224
-   /* Define if a scatter serie should be draw with a special weight */
225
-   function setScatterSerieWeight($ID,$Weight=0)
224
+    /* Define if a scatter serie should be draw with a special weight */
225
+    function setScatterSerieWeight($ID,$Weight=0)
226 226
     { if ( isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Weight"] = $Weight; } }
227 227
 
228
-   /* Associate a color to a scatter serie */
229
-   function setScatterSerieColor($ID,$Format)
228
+    /* Associate a color to a scatter serie */
229
+    function setScatterSerieColor($ID,$Format)
230 230
     {
231
-     $R	    = isset($Format["R"]) ? $Format["R"] : 0;
232
-     $G	    = isset($Format["G"]) ? $Format["G"] : 0;
233
-     $B	    = isset($Format["B"]) ? $Format["B"] : 0;
234
-     $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
231
+        $R	    = isset($Format["R"]) ? $Format["R"] : 0;
232
+        $G	    = isset($Format["G"]) ? $Format["G"] : 0;
233
+        $B	    = isset($Format["B"]) ? $Format["B"] : 0;
234
+        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
235 235
 
236
-     if ( isset($this->Data["ScatterSeries"][$ID]) )
237
-      {
238
-       $this->Data["ScatterSeries"][$ID]["Color"]["R"] = $R;
239
-       $this->Data["ScatterSeries"][$ID]["Color"]["G"] = $G;
240
-       $this->Data["ScatterSeries"][$ID]["Color"]["B"] = $B;
241
-       $this->Data["ScatterSeries"][$ID]["Color"]["Alpha"] = $Alpha;
242
-      }
236
+        if ( isset($this->Data["ScatterSeries"][$ID]) )
237
+        {
238
+        $this->Data["ScatterSeries"][$ID]["Color"]["R"] = $R;
239
+        $this->Data["ScatterSeries"][$ID]["Color"]["G"] = $G;
240
+        $this->Data["ScatterSeries"][$ID]["Color"]["B"] = $B;
241
+        $this->Data["ScatterSeries"][$ID]["Color"]["Alpha"] = $Alpha;
242
+        }
243 243
     }
244 244
 
245
-   /* Compute the series limits for an individual and global point of view */
246
-   function limits()
245
+    /* Compute the series limits for an individual and global point of view */
246
+    function limits()
247 247
     {
248
-     $GlobalMin = ABSOLUTE_MAX;
249
-     $GlobalMax = ABSOLUTE_MIN;
248
+        $GlobalMin = ABSOLUTE_MAX;
249
+        $GlobalMax = ABSOLUTE_MIN;
250 250
 
251
-     foreach($this->Data["Series"] as $Key => $Value)
252
-      {
253
-       if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"] == TRUE)
251
+        foreach($this->Data["Series"] as $Key => $Value)
252
+        {
253
+        if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"] == TRUE)
254 254
         {
255
-         if ( $GlobalMin > $this->Data["Series"][$Key]["Min"] ) { $GlobalMin = $this->Data["Series"][$Key]["Min"]; }
256
-         if ( $GlobalMax < $this->Data["Series"][$Key]["Max"] ) { $GlobalMax = $this->Data["Series"][$Key]["Max"]; }
255
+            if ( $GlobalMin > $this->Data["Series"][$Key]["Min"] ) { $GlobalMin = $this->Data["Series"][$Key]["Min"]; }
256
+            if ( $GlobalMax < $this->Data["Series"][$Key]["Max"] ) { $GlobalMax = $this->Data["Series"][$Key]["Max"]; }
257 257
         }
258
-      }
259
-     $this->Data["Min"] = $GlobalMin;
260
-     $this->Data["Max"] = $GlobalMax;
258
+        }
259
+        $this->Data["Min"] = $GlobalMin;
260
+        $this->Data["Max"] = $GlobalMax;
261 261
 
262
-     return(array($GlobalMin,$GlobalMax));
262
+        return(array($GlobalMin,$GlobalMax));
263 263
     }
264 264
 
265
-   /* Mark all series as drawable */
266
-   function drawAll()
265
+    /* Mark all series as drawable */
266
+    function drawAll()
267 267
     { foreach($this->Data["Series"] as $Key => $Value) { if ( $this->Data["Abscissa"] != $Key ) { $this->Data["Series"][$Key]["isDrawable"]=TRUE; } } }    
268 268
 
269
-   /* Return the average value of the given serie */
270
-   function getSerieAverage($Serie)
269
+    /* Return the average value of the given serie */
270
+    function getSerieAverage($Serie)
271 271
     {
272
-     if ( isset($this->Data["Series"][$Serie]) )
273
-      {
274
-       $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
275
-       return(array_sum($SerieData)/sizeof($SerieData));
276
-      }
277
-     else
278
-      return(NULL);
272
+        if ( isset($this->Data["Series"][$Serie]) )
273
+        {
274
+        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
275
+        return(array_sum($SerieData)/sizeof($SerieData));
276
+        }
277
+        else
278
+        return(NULL);
279 279
     }
280 280
 
281
-   /* Return the geometric mean of the given serie */
282
-   function getGeometricMean($Serie)
281
+    /* Return the geometric mean of the given serie */
282
+    function getGeometricMean($Serie)
283 283
     {
284
-     if ( isset($this->Data["Series"][$Serie]) )
285
-      {
286
-       $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
287
-       $Seriesum  = 1; foreach($SerieData as $Key => $Value) { $Seriesum = $Seriesum * $Value; }
288
-       return(pow($Seriesum,1/sizeof($SerieData)));
289
-      }
290
-     else
291
-      return(NULL);
284
+        if ( isset($this->Data["Series"][$Serie]) )
285
+        {
286
+        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
287
+        $Seriesum  = 1; foreach($SerieData as $Key => $Value) { $Seriesum = $Seriesum * $Value; }
288
+        return(pow($Seriesum,1/sizeof($SerieData)));
289
+        }
290
+        else
291
+        return(NULL);
292 292
     }
293 293
 
294
-   /* Return the harmonic mean of the given serie */
295
-   function getHarmonicMean($Serie)
294
+    /* Return the harmonic mean of the given serie */
295
+    function getHarmonicMean($Serie)
296 296
     {
297
-     if ( isset($this->Data["Series"][$Serie]) )
298
-      {
299
-       $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
300
-       $Seriesum  = 0; foreach($SerieData as $Key => $Value) { $Seriesum = $Seriesum + 1/$Value; }
301
-       return(sizeof($SerieData)/$Seriesum);
302
-      }
303
-     else
304
-      return(NULL);
297
+        if ( isset($this->Data["Series"][$Serie]) )
298
+        {
299
+        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
300
+        $Seriesum  = 0; foreach($SerieData as $Key => $Value) { $Seriesum = $Seriesum + 1/$Value; }
301
+        return(sizeof($SerieData)/$Seriesum);
302
+        }
303
+        else
304
+        return(NULL);
305 305
     }
306 306
 
307
-   /* Return the standard deviation of the given serie */
308
-   function getStandardDeviation($Serie)
307
+    /* Return the standard deviation of the given serie */
308
+    function getStandardDeviation($Serie)
309 309
     {
310
-     if ( isset($this->Data["Series"][$Serie]) )
311
-      {
312
-       $Average   = $this->getSerieAverage($Serie);
313
-       $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
310
+        if ( isset($this->Data["Series"][$Serie]) )
311
+        {
312
+        $Average   = $this->getSerieAverage($Serie);
313
+        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
314 314
 
315
-       $DeviationSum = 0;
316
-       foreach($SerieData as $Key => $Value)
315
+        $DeviationSum = 0;
316
+        foreach($SerieData as $Key => $Value)
317 317
         $DeviationSum = $DeviationSum + ($Value-$Average)*($Value-$Average);
318 318
 
319
-       $Deviation = sqrt($DeviationSum/count($SerieData));
319
+        $Deviation = sqrt($DeviationSum/count($SerieData));
320 320
 
321
-       return($Deviation);
322
-      }
323
-     else
324
-      return(NULL);
321
+        return($Deviation);
322
+        }
323
+        else
324
+        return(NULL);
325 325
     }
326 326
 
327
-   /* Return the Coefficient of variation of the given serie */
328
-   function getCoefficientOfVariation($Serie)
327
+    /* Return the Coefficient of variation of the given serie */
328
+    function getCoefficientOfVariation($Serie)
329 329
     {
330
-     if ( isset($this->Data["Series"][$Serie]) )
331
-      {
332
-       $Average           = $this->getSerieAverage($Serie);
333
-       $StandardDeviation = $this->getStandardDeviation($Serie);
330
+        if ( isset($this->Data["Series"][$Serie]) )
331
+        {
332
+        $Average           = $this->getSerieAverage($Serie);
333
+        $StandardDeviation = $this->getStandardDeviation($Serie);
334 334
 
335
-       if ( $StandardDeviation != 0 )
335
+        if ( $StandardDeviation != 0 )
336 336
         return($StandardDeviation/$Average);
337
-       else
337
+        else
338
+        return(NULL);
339
+        }
340
+        else
338 341
         return(NULL);
339
-      }
340
-     else
341
-      return(NULL);
342 342
     }
343 343
 
344
-   /* Return the median value of the given serie */
345
-   function getSerieMedian($Serie)
344
+    /* Return the median value of the given serie */
345
+    function getSerieMedian($Serie)
346 346
     {
347
-     if ( isset($this->Data["Series"][$Serie]) )
348
-      {
349
-       $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
350
-       sort($SerieData);
351
-       $SerieCenter = floor(sizeof($SerieData)/2);
347
+        if ( isset($this->Data["Series"][$Serie]) )
348
+        {
349
+        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
350
+        sort($SerieData);
351
+        $SerieCenter = floor(sizeof($SerieData)/2);
352 352
 
353
-       if ( isset($SerieData[$SerieCenter]) )
353
+        if ( isset($SerieData[$SerieCenter]) )
354 354
         return($SerieData[$SerieCenter]);
355
-       else
355
+        else
356
+        return(NULL);
357
+        }
358
+        else
356 359
         return(NULL);
357
-      }
358
-     else
359
-      return(NULL);
360 360
     }
361 361
 
362
-   /* Return the x th percentil of the given serie */
363
-   function getSeriePercentile($Serie="Serie1",$Percentil=95)
362
+    /* Return the x th percentil of the given serie */
363
+    function getSeriePercentile($Serie="Serie1",$Percentil=95)
364 364
     {
365
-     if (!isset($this->Data["Series"][$Serie]["Data"])) { return(NULL); }
365
+        if (!isset($this->Data["Series"][$Serie]["Data"])) { return(NULL); }
366 366
 
367
-     $Values = count($this->Data["Series"][$Serie]["Data"])-1;
368
-     if ( $Values < 0 ) { $Values = 0; }
367
+        $Values = count($this->Data["Series"][$Serie]["Data"])-1;
368
+        if ( $Values < 0 ) { $Values = 0; }
369 369
 
370
-     $PercentilID  = floor(($Values/100)*$Percentil+.5);
371
-     $SortedValues = $this->Data["Series"][$Serie]["Data"];
372
-     sort($SortedValues);
370
+        $PercentilID  = floor(($Values/100)*$Percentil+.5);
371
+        $SortedValues = $this->Data["Series"][$Serie]["Data"];
372
+        sort($SortedValues);
373 373
 
374
-     if ( is_numeric($SortedValues[$PercentilID]) )
375
-      return($SortedValues[$PercentilID]);
376
-     else
377
-      return(NULL);
374
+        if ( is_numeric($SortedValues[$PercentilID]) )
375
+        return($SortedValues[$PercentilID]);
376
+        else
377
+        return(NULL);
378 378
     }
379 379
 
380
-   /* Add random values to a given serie */
381
-   function addRandomValues($SerieName="Serie1",$Options="")
380
+    /* Add random values to a given serie */
381
+    function addRandomValues($SerieName="Serie1",$Options="")
382 382
     {
383
-     $Values    = isset($Options["Values"]) ? $Options["Values"] : 20;
384
-     $Min       = isset($Options["Min"]) ? $Options["Min"] : 0;
385
-     $Max       = isset($Options["Max"]) ? $Options["Max"] : 100;
386
-     $withFloat = isset($Options["withFloat"]) ? $Options["withFloat"] : FALSE;
383
+        $Values    = isset($Options["Values"]) ? $Options["Values"] : 20;
384
+        $Min       = isset($Options["Min"]) ? $Options["Min"] : 0;
385
+        $Max       = isset($Options["Max"]) ? $Options["Max"] : 100;
386
+        $withFloat = isset($Options["withFloat"]) ? $Options["withFloat"] : FALSE;
387 387
 
388
-     for ($i=0;$i<=$Values;$i++)
389
-      {
390
-       if ( $withFloat ) { $Value = rand($Min*100,$Max*100)/100; } else { $Value = rand($Min,$Max); }
391
-       $this->addPoints($Value,$SerieName);
392
-      }
388
+        for ($i=0;$i<=$Values;$i++)
389
+        {
390
+        if ( $withFloat ) { $Value = rand($Min*100,$Max*100)/100; } else { $Value = rand($Min,$Max); }
391
+        $this->addPoints($Value,$SerieName);
392
+        }
393 393
     }
394 394
 
395
-   /* Test if we have valid data */
396
-   function containsData()
395
+    /* Test if we have valid data */
396
+    function containsData()
397 397
     {
398
-     if (!isset($this->Data["Series"])) { return(FALSE); }
398
+        if (!isset($this->Data["Series"])) { return(FALSE); }
399 399
 
400
-     $Result = FALSE;
401
-     foreach($this->Data["Series"] as $Key => $Value)
402
-      { if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"]==TRUE) { $Result=TRUE; } }
403
-     return($Result);
400
+        $Result = FALSE;
401
+        foreach($this->Data["Series"] as $Key => $Value)
402
+        { if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"]==TRUE) { $Result=TRUE; } }
403
+        return($Result);
404 404
     }
405 405
 
406
-   /* Set the display mode of an Axis */
407
-   function setAxisDisplay($AxisID,$Mode=AXIS_FORMAT_DEFAULT,$Format=NULL)
406
+    /* Set the display mode of an Axis */
407
+    function setAxisDisplay($AxisID,$Mode=AXIS_FORMAT_DEFAULT,$Format=NULL)
408 408
     {
409
-     if ( isset($this->Data["Axis"][$AxisID] ) )
410
-      {
411
-       $this->Data["Axis"][$AxisID]["Display"] = $Mode;
412
-       if ( $Format != NULL ) { $this->Data["Axis"][$AxisID]["Format"] = $Format; }
413
-      }
409
+        if ( isset($this->Data["Axis"][$AxisID] ) )
410
+        {
411
+        $this->Data["Axis"][$AxisID]["Display"] = $Mode;
412
+        if ( $Format != NULL ) { $this->Data["Axis"][$AxisID]["Format"] = $Format; }
413
+        }
414 414
     }
415 415
 
416
-   /* Set the position of an Axis */
417
-   function setAxisPosition($AxisID,$Position=AXIS_POSITION_LEFT)
416
+    /* Set the position of an Axis */
417
+    function setAxisPosition($AxisID,$Position=AXIS_POSITION_LEFT)
418 418
     { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Position"] = $Position; } }
419 419
 
420
-   /* Associate an unit to an axis */
421
-   function setAxisUnit($AxisID,$Unit)
420
+    /* Associate an unit to an axis */
421
+    function setAxisUnit($AxisID,$Unit)
422 422
     { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Unit"] = $Unit; } }
423 423
 
424
-   /* Associate a name to an axis */
425
-   function setAxisName($AxisID,$Name)
424
+    /* Associate a name to an axis */
425
+    function setAxisName($AxisID,$Name)
426 426
     { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Name"] = $Name; } }
427 427
 
428
-   /* Associate a color to an axis */
429
-   function setAxisColor($AxisID,$Format)
428
+    /* Associate a color to an axis */
429
+    function setAxisColor($AxisID,$Format)
430 430
     {
431
-     $R	    = isset($Format["R"]) ? $Format["R"] : 0;
432
-     $G	    = isset($Format["G"]) ? $Format["G"] : 0;
433
-     $B	    = isset($Format["B"]) ? $Format["B"] : 0;
434
-     $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
431
+        $R	    = isset($Format["R"]) ? $Format["R"] : 0;
432
+        $G	    = isset($Format["G"]) ? $Format["G"] : 0;
433
+        $B	    = isset($Format["B"]) ? $Format["B"] : 0;
434
+        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
435 435
 
436
-     if ( isset($this->Data["Axis"][$AxisID] ) )
437
-      {
438
-       $this->Data["Axis"][$AxisID]["Color"]["R"] = $R;
439
-       $this->Data["Axis"][$AxisID]["Color"]["G"] = $G;
440
-       $this->Data["Axis"][$AxisID]["Color"]["B"] = $B;
441
-       $this->Data["Axis"][$AxisID]["Color"]["Alpha"] = $Alpha;
442
-      }
436
+        if ( isset($this->Data["Axis"][$AxisID] ) )
437
+        {
438
+        $this->Data["Axis"][$AxisID]["Color"]["R"] = $R;
439
+        $this->Data["Axis"][$AxisID]["Color"]["G"] = $G;
440
+        $this->Data["Axis"][$AxisID]["Color"]["B"] = $B;
441
+        $this->Data["Axis"][$AxisID]["Color"]["Alpha"] = $Alpha;
442
+        }
443 443
     }
444 444
 
445 445
 
446
-   /* Design an axis as X or Y member */
447
-   function setAxisXY($AxisID,$Identity=AXIS_Y)
446
+    /* Design an axis as X or Y member */
447
+    function setAxisXY($AxisID,$Identity=AXIS_Y)
448 448
     { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Identity"] = $Identity; } }
449 449
 
450
-   /* Associate one data serie with one axis */
451
-   function setSerieOnAxis($Series,$AxisID)
450
+    /* Associate one data serie with one axis */
451
+    function setSerieOnAxis($Series,$AxisID)
452 452
     {
453
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
454
-     foreach($Series as $Key => $Serie)
455
-      {
456
-       $PreviousAxis = $this->Data["Series"][$Serie]["Axis"];
453
+        if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
454
+        foreach($Series as $Key => $Serie)
455
+        {
456
+        $PreviousAxis = $this->Data["Series"][$Serie]["Axis"];
457 457
 
458
-       /* Create missing axis */
459
-       if ( !isset($this->Data["Axis"][$AxisID] ) )
458
+        /* Create missing axis */
459
+        if ( !isset($this->Data["Axis"][$AxisID] ) )
460 460
         { $this->Data["Axis"][$AxisID]["Position"] = AXIS_POSITION_LEFT; $this->Data["Axis"][$AxisID]["Identity"] = AXIS_Y;}
461 461
 
462
-       $this->Data["Series"][$Serie]["Axis"] = $AxisID;
462
+        $this->Data["Series"][$Serie]["Axis"] = $AxisID;
463 463
 
464
-       /* Cleanup unused axis */
465
-       $Found = FALSE;
466
-       foreach($this->Data["Series"] as $SerieName => $Values) { if ( $Values["Axis"] == $PreviousAxis ) { $Found = TRUE; } }
467
-       if (!$Found) { unset($this->Data["Axis"][$PreviousAxis]); }
468
-      }
464
+        /* Cleanup unused axis */
465
+        $Found = FALSE;
466
+        foreach($this->Data["Series"] as $SerieName => $Values) { if ( $Values["Axis"] == $PreviousAxis ) { $Found = TRUE; } }
467
+        if (!$Found) { unset($this->Data["Axis"][$PreviousAxis]); }
468
+        }
469 469
     }
470 470
 
471
-   /* Define if a serie should be draw with ticks */
472
-   function setSerieTicks($Series,$Width=0)
471
+    /* Define if a serie should be draw with ticks */
472
+    function setSerieTicks($Series,$Width=0)
473 473
     {
474
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
475
-     foreach($Series as $Key => $Serie) { if ( isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Ticks"] = $Width; } }
474
+        if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
475
+        foreach($Series as $Key => $Serie) { if ( isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Ticks"] = $Width; } }
476 476
     }
477 477
 
478
-   /* Define if a serie should be draw with a special weight */
479
-   function setSerieWeight($Series,$Weight=0)
478
+    /* Define if a serie should be draw with a special weight */
479
+    function setSerieWeight($Series,$Weight=0)
480 480
     {
481
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
482
-     foreach($Series as $Key => $Serie) { if ( isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Weight"] = $Weight; } }
481
+        if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
482
+        foreach($Series as $Key => $Serie) { if ( isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Weight"] = $Weight; } }
483 483
     }
484 484
 
485
-   /* Returns the palette of the given serie */
486
-   function getSeriePalette($Serie)
485
+    /* Returns the palette of the given serie */
486
+    function getSeriePalette($Serie)
487 487
     {
488
-     if ( !isset($this->Data["Series"][$Serie]) ) { return(NULL); }
488
+        if ( !isset($this->Data["Series"][$Serie]) ) { return(NULL); }
489 489
 
490
-     $Result = "";
491
-     $Result["R"] = $this->Data["Series"][$Serie]["Color"]["R"];
492
-     $Result["G"] = $this->Data["Series"][$Serie]["Color"]["G"];
493
-     $Result["B"] = $this->Data["Series"][$Serie]["Color"]["B"];
494
-     $Result["Alpha"] = $this->Data["Series"][$Serie]["Color"]["Alpha"];
490
+        $Result = "";
491
+        $Result["R"] = $this->Data["Series"][$Serie]["Color"]["R"];
492
+        $Result["G"] = $this->Data["Series"][$Serie]["Color"]["G"];
493
+        $Result["B"] = $this->Data["Series"][$Serie]["Color"]["B"];
494
+        $Result["Alpha"] = $this->Data["Series"][$Serie]["Color"]["Alpha"];
495 495
 
496
-     return($Result);
496
+        return($Result);
497 497
     }
498 498
 
499
-   /* Set the color of one serie */
500
-   function setPalette($Series,$Format=NULL)
499
+    /* Set the color of one serie */
500
+    function setPalette($Series,$Format=NULL)
501 501
     {
502
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
503
-
504
-     foreach($Series as $Key => $Serie)
505
-      {
506
-       $R	    = isset($Format["R"]) ? $Format["R"] : 0;
507
-       $G	    = isset($Format["G"]) ? $Format["G"] : 0;
508
-       $B	    = isset($Format["B"]) ? $Format["B"] : 0;
509
-       $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
502
+        if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
510 503
 
511
-       if ( isset($this->Data["Series"][$Serie]) )
504
+        foreach($Series as $Key => $Serie)
512 505
         {
513
-         $OldR = $this->Data["Series"][$Serie]["Color"]["R"]; $OldG = $this->Data["Series"][$Serie]["Color"]["G"]; $OldB = $this->Data["Series"][$Serie]["Color"]["B"];
514
-         $this->Data["Series"][$Serie]["Color"]["R"] = $R;
515
-         $this->Data["Series"][$Serie]["Color"]["G"] = $G;
516
-         $this->Data["Series"][$Serie]["Color"]["B"] = $B;
517
-         $this->Data["Series"][$Serie]["Color"]["Alpha"] = $Alpha;
506
+        $R	    = isset($Format["R"]) ? $Format["R"] : 0;
507
+        $G	    = isset($Format["G"]) ? $Format["G"] : 0;
508
+        $B	    = isset($Format["B"]) ? $Format["B"] : 0;
509
+        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
518 510
 
519
-         /* Do reverse processing on the internal palette array */
520
-         foreach ($this->Palette as $Key => $Value)
521
-          { if ($Value["R"] == $OldR && $Value["G"] == $OldG && $Value["B"] == $OldB) { $this->Palette[$Key]["R"] = $R; $this->Palette[$Key]["G"] = $G; $this->Palette[$Key]["B"] = $B; $this->Palette[$Key]["Alpha"] = $Alpha;} }
511
+        if ( isset($this->Data["Series"][$Serie]) )
512
+        {
513
+            $OldR = $this->Data["Series"][$Serie]["Color"]["R"]; $OldG = $this->Data["Series"][$Serie]["Color"]["G"]; $OldB = $this->Data["Series"][$Serie]["Color"]["B"];
514
+            $this->Data["Series"][$Serie]["Color"]["R"] = $R;
515
+            $this->Data["Series"][$Serie]["Color"]["G"] = $G;
516
+            $this->Data["Series"][$Serie]["Color"]["B"] = $B;
517
+            $this->Data["Series"][$Serie]["Color"]["Alpha"] = $Alpha;
518
+
519
+            /* Do reverse processing on the internal palette array */
520
+            foreach ($this->Palette as $Key => $Value)
521
+            { if ($Value["R"] == $OldR && $Value["G"] == $OldG && $Value["B"] == $OldB) { $this->Palette[$Key]["R"] = $R; $this->Palette[$Key]["G"] = $G; $this->Palette[$Key]["B"] = $B; $this->Palette[$Key]["Alpha"] = $Alpha;} }
522
+        }
522 523
         }
523
-      }
524 524
     }
525 525
 
526
-   /* Load a palette file */
527
-   function loadPalette($FileName,$Overwrite=FALSE)
526
+    /* Load a palette file */
527
+    function loadPalette($FileName,$Overwrite=FALSE)
528 528
     {
529
-     if ( !file_exists($FileName) ) { return(-1); }
530
-     if ( $Overwrite ) { $this->Palette = ""; }
529
+        if ( !file_exists($FileName) ) { return(-1); }
530
+        if ( $Overwrite ) { $this->Palette = ""; }
531 531
 
532
-     $fileHandle = @fopen($FileName, "r");
533
-     if (!$fileHandle) { return(-1); }
534
-     while (!feof($fileHandle))
535
-      {
536
-       $buffer = fgets($fileHandle, 4096);
537
-       if ( preg_match("/,/",$buffer) )
532
+        $fileHandle = @fopen($FileName, "r");
533
+        if (!$fileHandle) { return(-1); }
534
+        while (!feof($fileHandle))
538 535
         {
539
-         list($R,$G,$B,$Alpha) = preg_split("/,/",$buffer);
540
-         if ( $this->Palette == "" ) { $ID = 0; } else { $ID = count($this->Palette); }
541
-         $this->Palette[$ID] = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
536
+        $buffer = fgets($fileHandle, 4096);
537
+        if ( preg_match("/,/",$buffer) )
538
+        {
539
+            list($R,$G,$B,$Alpha) = preg_split("/,/",$buffer);
540
+            if ( $this->Palette == "" ) { $ID = 0; } else { $ID = count($this->Palette); }
541
+            $this->Palette[$ID] = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
542
+        }
542 543
         }
543
-      }
544
-     fclose($fileHandle);
544
+        fclose($fileHandle);
545 545
 
546
-     /* Apply changes to current series */
547
-     $ID = 0;
548
-     if ( isset($this->Data["Series"]))
549
-      {
550
-       foreach($this->Data["Series"] as $Key => $Value)
546
+        /* Apply changes to current series */
547
+        $ID = 0;
548
+        if ( isset($this->Data["Series"]))
551 549
         {
552
-         if ( !isset($this->Palette[$ID]) )
553
-          $this->Data["Series"][$Key]["Color"] = array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>0);
554
-         else
555
-          $this->Data["Series"][$Key]["Color"] = $this->Palette[$ID];
556
-         $ID++;
550
+        foreach($this->Data["Series"] as $Key => $Value)
551
+        {
552
+            if ( !isset($this->Palette[$ID]) )
553
+            $this->Data["Series"][$Key]["Color"] = array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>0);
554
+            else
555
+            $this->Data["Series"][$Key]["Color"] = $this->Palette[$ID];
556
+            $ID++;
557
+        }
557 558
         }
558
-      }
559 559
     }
560 560
 
561
-   /* Initialise a given scatter serie */
562
-   function initScatterSerie($ID)
561
+    /* Initialise a given scatter serie */
562
+    function initScatterSerie($ID)
563 563
     {
564
-     if ( isset($this->Data["ScatterSeries"][$ID]) ) { return(0); }
564
+        if ( isset($this->Data["ScatterSeries"][$ID]) ) { return(0); }
565 565
 
566
-     $this->Data["ScatterSeries"][$ID]["Description"]	= "Scatter ".$ID;
567
-     $this->Data["ScatterSeries"][$ID]["isDrawable"]	= TRUE;
568
-     $this->Data["ScatterSeries"][$ID]["Picture"]	= NULL;
569
-     $this->Data["ScatterSeries"][$ID]["Ticks"]		= 0;
570
-     $this->Data["ScatterSeries"][$ID]["Weight"]	= 0;
566
+        $this->Data["ScatterSeries"][$ID]["Description"]	= "Scatter ".$ID;
567
+        $this->Data["ScatterSeries"][$ID]["isDrawable"]	= TRUE;
568
+        $this->Data["ScatterSeries"][$ID]["Picture"]	= NULL;
569
+        $this->Data["ScatterSeries"][$ID]["Ticks"]		= 0;
570
+        $this->Data["ScatterSeries"][$ID]["Weight"]	= 0;
571 571
 
572
-     if ( isset($this->Palette[$ID]) )
573
-      $this->Data["ScatterSeries"][$ID]["Color"] = $this->Palette[$ID];
574
-     else
575
-      {
576
-       $this->Data["ScatterSeries"][$ID]["Color"]["R"] = rand(0,255);
577
-       $this->Data["ScatterSeries"][$ID]["Color"]["G"] = rand(0,255);
578
-       $this->Data["ScatterSeries"][$ID]["Color"]["B"] = rand(0,255);
579
-       $this->Data["ScatterSeries"][$ID]["Color"]["Alpha"] = 100;
580
-      }
572
+        if ( isset($this->Palette[$ID]) )
573
+        $this->Data["ScatterSeries"][$ID]["Color"] = $this->Palette[$ID];
574
+        else
575
+        {
576
+        $this->Data["ScatterSeries"][$ID]["Color"]["R"] = rand(0,255);
577
+        $this->Data["ScatterSeries"][$ID]["Color"]["G"] = rand(0,255);
578
+        $this->Data["ScatterSeries"][$ID]["Color"]["B"] = rand(0,255);
579
+        $this->Data["ScatterSeries"][$ID]["Color"]["Alpha"] = 100;
580
+        }
581 581
     }
582 582
 
583
-   /* Initialise a given serie */
584
-   function initialise($Serie)
583
+    /* Initialise a given serie */
584
+    function initialise($Serie)
585 585
     {
586
-     if ( isset($this->Data["Series"]) ) { $ID = count($this->Data["Series"]); } else { $ID = 0; }
586
+        if ( isset($this->Data["Series"]) ) { $ID = count($this->Data["Series"]); } else { $ID = 0; }
587 587
 
588
-     $this->Data["Series"][$Serie]["Description"]	= $Serie;
589
-     $this->Data["Series"][$Serie]["isDrawable"]	= TRUE;
590
-     $this->Data["Series"][$Serie]["Picture"]		= NULL;
591
-     $this->Data["Series"][$Serie]["Max"]		= NULL;
592
-     $this->Data["Series"][$Serie]["Min"]		= NULL;
593
-     $this->Data["Series"][$Serie]["Axis"]		= 0;
594
-     $this->Data["Series"][$Serie]["Ticks"]		= 0;
595
-     $this->Data["Series"][$Serie]["Weight"]		= 0;
596
-     $this->Data["Series"][$Serie]["Shape"]		= SERIE_SHAPE_FILLEDCIRCLE;
588
+        $this->Data["Series"][$Serie]["Description"]	= $Serie;
589
+        $this->Data["Series"][$Serie]["isDrawable"]	= TRUE;
590
+        $this->Data["Series"][$Serie]["Picture"]		= NULL;
591
+        $this->Data["Series"][$Serie]["Max"]		= NULL;
592
+        $this->Data["Series"][$Serie]["Min"]		= NULL;
593
+        $this->Data["Series"][$Serie]["Axis"]		= 0;
594
+        $this->Data["Series"][$Serie]["Ticks"]		= 0;
595
+        $this->Data["Series"][$Serie]["Weight"]		= 0;
596
+        $this->Data["Series"][$Serie]["Shape"]		= SERIE_SHAPE_FILLEDCIRCLE;
597 597
 
598
-     if ( isset($this->Palette[$ID]) )
599
-      $this->Data["Series"][$Serie]["Color"] = $this->Palette[$ID];
600
-     else
601
-      {
602
-       $this->Data["Series"][$Serie]["Color"]["R"] = rand(0,255);
603
-       $this->Data["Series"][$Serie]["Color"]["G"] = rand(0,255);
604
-       $this->Data["Series"][$Serie]["Color"]["B"] = rand(0,255);
605
-       $this->Data["Series"][$Serie]["Color"]["Alpha"] = 100;
606
-      }
598
+        if ( isset($this->Palette[$ID]) )
599
+        $this->Data["Series"][$Serie]["Color"] = $this->Palette[$ID];
600
+        else
601
+        {
602
+        $this->Data["Series"][$Serie]["Color"]["R"] = rand(0,255);
603
+        $this->Data["Series"][$Serie]["Color"]["G"] = rand(0,255);
604
+        $this->Data["Series"][$Serie]["Color"]["B"] = rand(0,255);
605
+        $this->Data["Series"][$Serie]["Color"]["Alpha"] = 100;
606
+        }
607 607
     }
608 608
      
609
-   function normalize($NormalizationFactor=100,$UnitChange=NULL,$Round=1)
609
+    function normalize($NormalizationFactor=100,$UnitChange=NULL,$Round=1)
610 610
     {
611
-     $Abscissa = $this->Data["Abscissa"];
611
+        $Abscissa = $this->Data["Abscissa"];
612 612
 
613
-     $SelectedSeries = "";
614
-     $MaxVal         = 0;
615
-     foreach($this->Data["Axis"] as $AxisID => $Axis)
616
-      {
617
-       if ( $UnitChange != NULL ) { $this->Data["Axis"][$AxisID]["Unit"] = $UnitChange; }
613
+        $SelectedSeries = "";
614
+        $MaxVal         = 0;
615
+        foreach($this->Data["Axis"] as $AxisID => $Axis)
616
+        {
617
+        if ( $UnitChange != NULL ) { $this->Data["Axis"][$AxisID]["Unit"] = $UnitChange; }
618 618
 
619
-       foreach($this->Data["Series"] as $SerieName => $Serie)
619
+        foreach($this->Data["Series"] as $SerieName => $Serie)
620 620
         {
621
-         if ($Serie["Axis"] == $AxisID && $Serie["isDrawable"] == TRUE && $SerieName != $Abscissa)
622
-          {
623
-           $SelectedSeries[$SerieName] = $SerieName;
621
+            if ($Serie["Axis"] == $AxisID && $Serie["isDrawable"] == TRUE && $SerieName != $Abscissa)
622
+            {
623
+            $SelectedSeries[$SerieName] = $SerieName;
624 624
 
625
-           if ( count($Serie["Data"] ) > $MaxVal ) { $MaxVal = count($Serie["Data"]); }
626
-          }
625
+            if ( count($Serie["Data"] ) > $MaxVal ) { $MaxVal = count($Serie["Data"]); }
626
+            }
627
+        }
627 628
         }
628
-      }
629 629
 
630
-     for($i=0;$i<=$MaxVal-1;$i++)
631
-      {
632
-       $Factor = 0;
633
-       foreach ($SelectedSeries as $Key => $SerieName )
630
+        for($i=0;$i<=$MaxVal-1;$i++)
634 631
         {
635
-         $Value = $this->Data["Series"][$SerieName]["Data"][$i];
636
-         if ( $Value != VOID )
637
-          $Factor = $Factor + abs($Value);
632
+        $Factor = 0;
633
+        foreach ($SelectedSeries as $Key => $SerieName )
634
+        {
635
+            $Value = $this->Data["Series"][$SerieName]["Data"][$i];
636
+            if ( $Value != VOID )
637
+            $Factor = $Factor + abs($Value);
638 638
         }
639 639
 
640
-       if ( $Factor != 0 )
640
+        if ( $Factor != 0 )
641 641
         {
642
-         $Factor = $NormalizationFactor / $Factor;
642
+            $Factor = $NormalizationFactor / $Factor;
643 643
 
644
-         foreach ($SelectedSeries as $Key => $SerieName )
645
-          {
646
-           $Value = $this->Data["Series"][$SerieName]["Data"][$i];
644
+            foreach ($SelectedSeries as $Key => $SerieName )
645
+            {
646
+            $Value = $this->Data["Series"][$SerieName]["Data"][$i];
647 647
 
648
-           if ( $Value != VOID && $Factor != $NormalizationFactor )
648
+            if ( $Value != VOID && $Factor != $NormalizationFactor )
649 649
             $this->Data["Series"][$SerieName]["Data"][$i] = round(abs($Value)*$Factor,$Round);
650
-           elseif ( $Value == VOID || $Value == 0 )
650
+            elseif ( $Value == VOID || $Value == 0 )
651 651
             $this->Data["Series"][$SerieName]["Data"][$i] = VOID;
652
-           elseif ( $Factor == $NormalizationFactor )
652
+            elseif ( $Factor == $NormalizationFactor )
653 653
             $this->Data["Series"][$SerieName]["Data"][$i] = $NormalizationFactor;
654
-          }
654
+            }
655
+        }
655 656
         }
656
-      }
657 657
 
658
-     foreach ($SelectedSeries as $Key => $SerieName )
659
-      {
660
-       $this->Data["Series"][$SerieName]["Max"] = max($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
661
-       $this->Data["Series"][$SerieName]["Min"] = min($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
662
-      }
658
+        foreach ($SelectedSeries as $Key => $SerieName )
659
+        {
660
+        $this->Data["Series"][$SerieName]["Max"] = max($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
661
+        $this->Data["Series"][$SerieName]["Min"] = min($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
662
+        }
663 663
     }
664 664
 
665
-   /* Load data from a CSV (or similar) data source */
666
-   function importFromCSV($FileName,$Options="")
665
+    /* Load data from a CSV (or similar) data source */
666
+    function importFromCSV($FileName,$Options="")
667 667
     {
668
-     $Delimiter		= isset($Options["Delimiter"]) ? $Options["Delimiter"] : ",";
669
-     $GotHeader		= isset($Options["GotHeader"]) ? $Options["GotHeader"] : FALSE;
670
-     $SkipColumns	= isset($Options["SkipColumns"]) ? $Options["SkipColumns"] : array(-1);
671
-     $DefaultSerieName	= isset($Options["DefaultSerieName"]) ? $Options["DefaultSerieName"] : "Serie";
668
+        $Delimiter		= isset($Options["Delimiter"]) ? $Options["Delimiter"] : ",";
669
+        $GotHeader		= isset($Options["GotHeader"]) ? $Options["GotHeader"] : FALSE;
670
+        $SkipColumns	= isset($Options["SkipColumns"]) ? $Options["SkipColumns"] : array(-1);
671
+        $DefaultSerieName	= isset($Options["DefaultSerieName"]) ? $Options["DefaultSerieName"] : "Serie";
672 672
 
673
-     $Handle = @fopen($FileName,"r");
674
-     if ($Handle)
675
-      {
676
-       $HeaderParsed = FALSE; $SerieNames = "";
677
-       while (!feof($Handle))
673
+        $Handle = @fopen($FileName,"r");
674
+        if ($Handle)
678 675
         {
679
-         $Buffer = fgets($Handle, 4096);
680
-         $Buffer = str_replace(chr(10),"",$Buffer);
681
-         $Buffer = str_replace(chr(13),"",$Buffer);
682
-         $Values = preg_split("/".$Delimiter."/",$Buffer);
676
+        $HeaderParsed = FALSE; $SerieNames = "";
677
+        while (!feof($Handle))
678
+        {
679
+            $Buffer = fgets($Handle, 4096);
680
+            $Buffer = str_replace(chr(10),"",$Buffer);
681
+            $Buffer = str_replace(chr(13),"",$Buffer);
682
+            $Values = preg_split("/".$Delimiter."/",$Buffer);
683 683
 
684
-         if ( $Buffer != "" )
685
-          {
686
-           if ( $GotHeader && !$HeaderParsed )
684
+            if ( $Buffer != "" )
685
+            {
686
+            if ( $GotHeader && !$HeaderParsed )
687 687
             {
688
-             foreach($Values as $Key => $Name) { if ( !in_array($Key,$SkipColumns) ) { $SerieNames[$Key] = $Name; } }
689
-             $HeaderParsed = TRUE;
688
+                foreach($Values as $Key => $Name) { if ( !in_array($Key,$SkipColumns) ) { $SerieNames[$Key] = $Name; } }
689
+                $HeaderParsed = TRUE;
690 690
             }
691
-           else
691
+            else
692 692
             {
693
-             if ($SerieNames == "" ) { foreach($Values as $Key => $Name) {  if ( !in_array($Key,$SkipColumns) ) { $SerieNames[$Key] = $DefaultSerieName.$Key; } } }
694
-             foreach($Values as $Key => $Value) {  if ( !in_array($Key,$SkipColumns) ) { $this->addPoints($Value,$SerieNames[$Key]); } }
693
+                if ($SerieNames == "" ) { foreach($Values as $Key => $Name) {  if ( !in_array($Key,$SkipColumns) ) { $SerieNames[$Key] = $DefaultSerieName.$Key; } } }
694
+                foreach($Values as $Key => $Value) {  if ( !in_array($Key,$SkipColumns) ) { $this->addPoints($Value,$SerieNames[$Key]); } }
695 695
             }
696
-          }
696
+            }
697
+        }
698
+        fclose($Handle);
697 699
         }
698
-       fclose($Handle);
699
-      }
700 700
     }
701 701
 
702
-   /* Create a dataset based on a formula */
703
-   function createFunctionSerie($SerieName,$Formula="",$Options="")
702
+    /* Create a dataset based on a formula */
703
+    function createFunctionSerie($SerieName,$Formula="",$Options="")
704 704
     {
705
-     $MinX		= isset($Options["MinX"]) ? $Options["MinX"] : -10;
706
-     $MaxX		= isset($Options["MaxX"]) ? $Options["MaxX"] : 10;
707
-     $XStep		= isset($Options["XStep"]) ? $Options["XStep"] : 1;
708
-     $AutoDescription	= isset($Options["AutoDescription"]) ? $Options["AutoDescription"] : FALSE;
709
-     $RecordAbscissa	= isset($Options["RecordAbscissa"]) ? $Options["RecordAbscissa"] : FALSE;
710
-     $AbscissaSerie	= isset($Options["AbscissaSerie"]) ? $Options["AbscissaSerie"] : "Abscissa";
705
+        $MinX		= isset($Options["MinX"]) ? $Options["MinX"] : -10;
706
+        $MaxX		= isset($Options["MaxX"]) ? $Options["MaxX"] : 10;
707
+        $XStep		= isset($Options["XStep"]) ? $Options["XStep"] : 1;
708
+        $AutoDescription	= isset($Options["AutoDescription"]) ? $Options["AutoDescription"] : FALSE;
709
+        $RecordAbscissa	= isset($Options["RecordAbscissa"]) ? $Options["RecordAbscissa"] : FALSE;
710
+        $AbscissaSerie	= isset($Options["AbscissaSerie"]) ? $Options["AbscissaSerie"] : "Abscissa";
711 711
 
712
-     if ( $Formula == "" ) { return(0); }
712
+        if ( $Formula == "" ) { return(0); }
713 713
 
714
-     $Result = ""; $Abscissa = "";
715
-     for($i=$MinX; $i<=$MaxX; $i=$i+$XStep)
716
-      {
717
-       $Expression = "\$return = '!'.(".str_replace("z",$i,$Formula).");";
718
-       if ( @eval($Expression) === FALSE ) { $return = VOID; }
719
-       if ( $return == "!" ) { $return = VOID; } else { $return = $this->right($return,strlen($return)-1); }
720
-       if ( $return == "NAN" ) { $return = VOID; }
721
-       if ( $return == "INF" ) { $return = VOID; }
722
-       if ( $return == "-INF" ) { $return = VOID; }
723
-
724
-       $Abscissa[] = $i;
725
-       $Result[]   = $return;
726
-      }
714
+        $Result = ""; $Abscissa = "";
715
+        for($i=$MinX; $i<=$MaxX; $i=$i+$XStep)
716
+        {
717
+        $Expression = "\$return = '!'.(".str_replace("z",$i,$Formula).");";
718
+        if ( @eval($Expression) === FALSE ) { $return = VOID; }
719
+        if ( $return == "!" ) { $return = VOID; } else { $return = $this->right($return,strlen($return)-1); }
720
+        if ( $return == "NAN" ) { $return = VOID; }
721
+        if ( $return == "INF" ) { $return = VOID; }
722
+        if ( $return == "-INF" ) { $return = VOID; }
723
+
724
+        $Abscissa[] = $i;
725
+        $Result[]   = $return;
726
+        }
727 727
 
728
-     $this->addPoints($Result,$SerieName);
729
-     if ( $AutoDescription ) { $this->setSerieDescription($SerieName,$Formula); }
730
-     if ( $RecordAbscissa ) { $this->addPoints($Abscissa,$AbscissaSerie); }
728
+        $this->addPoints($Result,$SerieName);
729
+        if ( $AutoDescription ) { $this->setSerieDescription($SerieName,$Formula); }
730
+        if ( $RecordAbscissa ) { $this->addPoints($Abscissa,$AbscissaSerie); }
731 731
     }
732 732
 
733
-   function negateValues($Series)
733
+    function negateValues($Series)
734 734
     {
735
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
736
-     foreach($Series as $Key => $SerieName)
737
-      {
738
-       if (isset($this->Data["Series"][$SerieName]))
735
+        if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
736
+        foreach($Series as $Key => $SerieName)
737
+        {
738
+        if (isset($this->Data["Series"][$SerieName]))
739 739
         {
740
-         $Data = "";
741
-         foreach($this->Data["Series"][$SerieName]["Data"] as $Key => $Value)
742
-          { if ( $Value == VOID ) { $Data[] = VOID; } else { $Data[] = -$Value; } }
743
-         $this->Data["Series"][$SerieName]["Data"] = $Data;
740
+            $Data = "";
741
+            foreach($this->Data["Series"][$SerieName]["Data"] as $Key => $Value)
742
+            { if ( $Value == VOID ) { $Data[] = VOID; } else { $Data[] = -$Value; } }
743
+            $this->Data["Series"][$SerieName]["Data"] = $Data;
744 744
 
745
-         $this->Data["Series"][$SerieName]["Max"] = max($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
746
-         $this->Data["Series"][$SerieName]["Min"] = min($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
745
+            $this->Data["Series"][$SerieName]["Max"] = max($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
746
+            $this->Data["Series"][$SerieName]["Min"] = min($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
747
+        }
747 748
         }
748
-      }
749 749
     }
750 750
 
751
-   /* Return the data & configuration of the series */
752
-   function getData()
751
+    /* Return the data & configuration of the series */
752
+    function getData()
753 753
     { return($this->Data); }
754 754
 
755
-   /* Save a palette element */
756
-   function savePalette($ID,$Color)
755
+    /* Save a palette element */
756
+    function savePalette($ID,$Color)
757 757
     { $this->Palette[$ID] = $Color; }
758 758
 
759
-   /* Return the palette of the series */
760
-   function getPalette()
759
+    /* Return the palette of the series */
760
+    function getPalette()
761 761
     { return($this->Palette); }
762 762
 
763
-   /* Called by the scaling algorithm to save the config */
764
-   function saveAxisConfig($Axis) { $this->Data["Axis"]=$Axis; }
763
+    /* Called by the scaling algorithm to save the config */
764
+    function saveAxisConfig($Axis) { $this->Data["Axis"]=$Axis; }
765 765
 
766
-   /* Save the Y Margin if set */
767
-   function saveYMargin($Value) { $this->Data["YMargin"]=$Value; }
766
+    /* Save the Y Margin if set */
767
+    function saveYMargin($Value) { $this->Data["YMargin"]=$Value; }
768 768
 
769
-   /* Save extended configuration to the pData object */
770
-   function saveExtendedData($Tag,$Values) { $this->Data["Extended"][$Tag]=$Values; }
769
+    /* Save extended configuration to the pData object */
770
+    function saveExtendedData($Tag,$Values) { $this->Data["Extended"][$Tag]=$Values; }
771 771
 
772
-   /* Called by the scaling algorithm to save the orientation of the scale */
773
-   function saveOrientation($Orientation) { $this->Data["Orientation"]=$Orientation; }
772
+    /* Called by the scaling algorithm to save the orientation of the scale */
773
+    function saveOrientation($Orientation) { $this->Data["Orientation"]=$Orientation; }
774 774
 
775
-   /* Convert a string to a single elements array */
776
-   function convertToArray($Value)
775
+    /* Convert a string to a single elements array */
776
+    function convertToArray($Value)
777 777
     { $Values = ""; $Values[] = $Value; return($Values); }
778 778
 
779
-   /* Class string wrapper */
780
-   function __toString()
779
+    /* Class string wrapper */
780
+    function __toString()
781 781
     { return("pData object."); }
782 782
 
783
-   function left($value,$NbChar)	{ return substr($value,0,$NbChar); }  
784
-   function right($value,$NbChar)	{ return substr($value,strlen($value)-$NbChar,$NbChar); }  
785
-   function mid($value,$Depart,$NbChar)	{ return substr($value,$Depart-1,$NbChar); }  
786
-  }
783
+    function left($value,$NbChar)	{ return substr($value,0,$NbChar); }  
784
+    function right($value,$NbChar)	{ return substr($value,strlen($value)-$NbChar,$NbChar); }  
785
+    function mid($value,$Depart,$NbChar)	{ return substr($value,$Depart-1,$NbChar); }  
786
+    }
787 787
 ?>
788 788
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -14,56 +14,56 @@  discard block
 block discarded – undo
14 14
  */
15 15
 
16 16
  /* Axis configuration */
17
- define("AXIS_FORMAT_DEFAULT"		, 680001);
18
- define("AXIS_FORMAT_TIME"		, 680002);
19
- define("AXIS_FORMAT_DATE"		, 680003);
20
- define("AXIS_FORMAT_METRIC"		, 680004);
21
- define("AXIS_FORMAT_CURRENCY"		, 680005);
22
- define("AXIS_FORMAT_CUSTOM"		, 680006);
17
+ define("AXIS_FORMAT_DEFAULT", 680001);
18
+ define("AXIS_FORMAT_TIME", 680002);
19
+ define("AXIS_FORMAT_DATE", 680003);
20
+ define("AXIS_FORMAT_METRIC", 680004);
21
+ define("AXIS_FORMAT_CURRENCY", 680005);
22
+ define("AXIS_FORMAT_CUSTOM", 680006);
23 23
 
24 24
  /* Axis position */
25
- define("AXIS_POSITION_LEFT"		, 681001);
26
- define("AXIS_POSITION_RIGHT"		, 681002);
27
- define("AXIS_POSITION_TOP"		, 681001);
28
- define("AXIS_POSITION_BOTTOM"		, 681002);
25
+ define("AXIS_POSITION_LEFT", 681001);
26
+ define("AXIS_POSITION_RIGHT", 681002);
27
+ define("AXIS_POSITION_TOP", 681001);
28
+ define("AXIS_POSITION_BOTTOM", 681002);
29 29
 
30 30
  /* Families of data points */
31
- define("SERIE_SHAPE_FILLEDCIRCLE"	, 681011);
32
- define("SERIE_SHAPE_FILLEDTRIANGLE"	, 681012);
33
- define("SERIE_SHAPE_FILLEDSQUARE"	, 681013);
34
- define("SERIE_SHAPE_FILLEDDIAMOND"	, 681017);
35
- define("SERIE_SHAPE_CIRCLE"		, 681014);
36
- define("SERIE_SHAPE_TRIANGLE"		, 681015);
37
- define("SERIE_SHAPE_SQUARE"		, 681016);
38
- define("SERIE_SHAPE_DIAMOND"		, 681018);
31
+ define("SERIE_SHAPE_FILLEDCIRCLE", 681011);
32
+ define("SERIE_SHAPE_FILLEDTRIANGLE", 681012);
33
+ define("SERIE_SHAPE_FILLEDSQUARE", 681013);
34
+ define("SERIE_SHAPE_FILLEDDIAMOND", 681017);
35
+ define("SERIE_SHAPE_CIRCLE", 681014);
36
+ define("SERIE_SHAPE_TRIANGLE", 681015);
37
+ define("SERIE_SHAPE_SQUARE", 681016);
38
+ define("SERIE_SHAPE_DIAMOND", 681018);
39 39
 
40 40
  /* Axis position */
41
- define("AXIS_X"			, 682001);
42
- define("AXIS_Y"			, 682002);
41
+ define("AXIS_X", 682001);
42
+ define("AXIS_Y", 682002);
43 43
 
44 44
  /* Define value limits */
45
- define("ABSOLUTE_MIN"          	, -10000000000000);
46
- define("ABSOLUTE_MAX"          	, 10000000000000);
45
+ define("ABSOLUTE_MIN", -10000000000000);
46
+ define("ABSOLUTE_MAX", 10000000000000);
47 47
 
48 48
  /* Replacement to the PHP NULL keyword */
49
- define("VOID"                  	, 0.123456789);
49
+ define("VOID", 0.123456789);
50 50
 
51 51
  /* Euro symbol for GD fonts */
52
- define("EURO_SYMBOL"			, utf8_encode("&#8364;"));
52
+ define("EURO_SYMBOL", utf8_encode("&#8364;"));
53 53
 
54 54
  /* pData class definition */
55 55
  class pData
56 56
   {
57 57
    var $Data;
58 58
 
59
-   var $Palette = array("0"=>array("R"=>188,"G"=>224,"B"=>46,"Alpha"=>100),
60
-                        "1"=>array("R"=>224,"G"=>100,"B"=>46,"Alpha"=>100),
61
-                        "2"=>array("R"=>224,"G"=>214,"B"=>46,"Alpha"=>100),
62
-                        "3"=>array("R"=>46,"G"=>151,"B"=>224,"Alpha"=>100),
63
-                        "4"=>array("R"=>176,"G"=>46,"B"=>224,"Alpha"=>100),
64
-                        "5"=>array("R"=>224,"G"=>46,"B"=>117,"Alpha"=>100),
65
-                        "6"=>array("R"=>92,"G"=>224,"B"=>46,"Alpha"=>100),
66
-                        "7"=>array("R"=>224,"G"=>176,"B"=>46,"Alpha"=>100));
59
+   var $Palette = array("0"=>array("R"=>188, "G"=>224, "B"=>46, "Alpha"=>100),
60
+                        "1"=>array("R"=>224, "G"=>100, "B"=>46, "Alpha"=>100),
61
+                        "2"=>array("R"=>224, "G"=>214, "B"=>46, "Alpha"=>100),
62
+                        "3"=>array("R"=>46, "G"=>151, "B"=>224, "Alpha"=>100),
63
+                        "4"=>array("R"=>176, "G"=>46, "B"=>224, "Alpha"=>100),
64
+                        "5"=>array("R"=>224, "G"=>46, "B"=>117, "Alpha"=>100),
65
+                        "6"=>array("R"=>92, "G"=>224, "B"=>46, "Alpha"=>100),
66
+                        "7"=>array("R"=>224, "G"=>176, "B"=>46, "Alpha"=>100));
67 67
 
68 68
    /* Class creator */
69 69
    function pData()
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
      $this->Data["XAxisFormat"]		= NULL;
74 74
      $this->Data["XAxisName"]		= NULL;
75 75
      $this->Data["XAxisUnit"]		= NULL;
76
-     $this->Data["Abscissa"]		= NULL;
77
-     $this->Data["AbsicssaPosition"]	= AXIS_POSITION_BOTTOM;
76
+     $this->Data["Abscissa"] = NULL;
77
+     $this->Data["AbsicssaPosition"] = AXIS_POSITION_BOTTOM;
78 78
 
79 79
      $this->Data["Axis"][0]["Display"]  = AXIS_FORMAT_DEFAULT;
80 80
      $this->Data["Axis"][0]["Position"] = AXIS_POSITION_LEFT;
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
82 82
     }
83 83
 
84 84
    /* Add a single point or an array to the given serie */
85
-   function addPoints($Values,$SerieName="Serie1")
85
+   function addPoints($Values, $SerieName = "Serie1")
86 86
     {
87 87
      if (!isset($this->Data["Series"][$SerieName]))
88 88
       $this->initialise($SerieName);
89 89
 
90
-     if ( is_array($Values) )
90
+     if (is_array($Values))
91 91
       {
92
-       foreach($Values as $Key => $Value)
92
+       foreach ($Values as $Key => $Value)
93 93
         { $this->Data["Series"][$SerieName]["Data"][] = $Value; }
94 94
       }
95 95
      else
96 96
       $this->Data["Series"][$SerieName]["Data"][] = $Values;
97 97
 
98
-     if ( $Values != VOID )
98
+     if ($Values != VOID)
99 99
       {
100 100
        $StrippedData = $this->stripVOID($this->Data["Series"][$SerieName]["Data"]);
101
-       if ( empty($StrippedData) ) { $this->Data["Series"][$SerieName]["Max"] = 0; $this->Data["Series"][$SerieName]["Min"] =0; return(0); }
101
+       if (empty($StrippedData)) { $this->Data["Series"][$SerieName]["Max"] = 0; $this->Data["Series"][$SerieName]["Min"] = 0; return(0); }
102 102
        $this->Data["Series"][$SerieName]["Max"] = max($StrippedData);
103 103
        $this->Data["Series"][$SerieName]["Min"] = min($StrippedData);
104 104
       }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
    /* Strip VOID values */
108 108
    function stripVOID($Values)
109
-    { if (!is_array($Values)) { return(array()); } $Result = array(); foreach($Values as $Key => $Value) { if ( $Value != VOID ) { $Result[] = $Value; } } return($Result); }
109
+    { if (!is_array($Values)) { return(array()); } $Result = array(); foreach ($Values as $Key => $Value) { if ($Value != VOID) { $Result[] = $Value; } } return($Result); }
110 110
 
111 111
    /* Return the number of values contained in a given serie */
112 112
    function getSerieCount($Serie)
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
    /* Remove a serie from the pData object */
116 116
    function removeSerie($Series)
117 117
     {
118
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
119
-     foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie])) { unset($this->Data["Series"][$Serie]); } }
118
+     if (!is_array($Series)) { $Series = $this->convertToArray($Series); }
119
+     foreach ($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie])) { unset($this->Data["Series"][$Serie]); } }
120 120
     }
121 121
 
122 122
    /* Return a value from given serie & index */
123
-   function getValueAt($Serie,$Index=0)
123
+   function getValueAt($Serie, $Index = 0)
124 124
     { if (isset($this->Data["Series"][$Serie]["Data"][$Index])) { return($this->Data["Series"][$Serie]["Data"][$Index]); } else { return(NULL); } }
125 125
 
126 126
    /* Return the values array */
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
    /* Reverse the values in the given serie */
131 131
    function reverseSerie($Series)
132 132
     {
133
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
134
-     foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]["Data"])) { $this->Data["Series"][$Serie]["Data"] = array_reverse($this->Data["Series"][$Serie]["Data"]); } }
133
+     if (!is_array($Series)) { $Series = $this->convertToArray($Series); }
134
+     foreach ($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]["Data"])) { $this->Data["Series"][$Serie]["Data"] = array_reverse($this->Data["Series"][$Serie]["Data"]); } }
135 135
     }
136 136
 
137 137
    /* Return the sum of the serie values */
@@ -147,31 +147,31 @@  discard block
 block discarded – undo
147 147
     { if (isset($this->Data["Series"][$Serie]["Min"])) { return($this->Data["Series"][$Serie]["Min"]); } else { return(NULL); } }
148 148
 
149 149
    /* Set the description of a given serie */
150
-   function setSerieShape($Series,$Shape=SERIE_SHAPE_FILLEDCIRCLE)
150
+   function setSerieShape($Series, $Shape = SERIE_SHAPE_FILLEDCIRCLE)
151 151
     {
152
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
153
-     foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Shape"] = $Shape; } }
152
+     if (!is_array($Series)) { $Series = $this->convertToArray($Series); }
153
+     foreach ($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie])) { $this->Data["Series"][$Serie]["Shape"] = $Shape; } }
154 154
     }
155 155
 
156 156
    /* Set the description of a given serie */
157
-   function setSerieDescription($Series,$Description="My serie")
157
+   function setSerieDescription($Series, $Description = "My serie")
158 158
     {
159
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
160
-     foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Description"] = $Description; } }
159
+     if (!is_array($Series)) { $Series = $this->convertToArray($Series); }
160
+     foreach ($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie])) { $this->Data["Series"][$Serie]["Description"] = $Description; } }
161 161
     }
162 162
 
163 163
    /* Set a serie as "drawable" while calling a rendering function */
164
-   function setSerieDrawable($Series,$Drawable=TRUE)
164
+   function setSerieDrawable($Series, $Drawable = TRUE)
165 165
     {
166
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
167
-     foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["isDrawable"] = $Drawable; } }
166
+     if (!is_array($Series)) { $Series = $this->convertToArray($Series); }
167
+     foreach ($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie])) { $this->Data["Series"][$Serie]["isDrawable"] = $Drawable; } }
168 168
     }
169 169
 
170 170
    /* Set the icon associated to a given serie */
171
-   function setSeriePicture($Series,$Picture=NULL)
171
+   function setSeriePicture($Series, $Picture = NULL)
172 172
     {
173
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
174
-     foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Picture"] = $Picture; } }
173
+     if (!is_array($Series)) { $Series = $this->convertToArray($Series); }
174
+     foreach ($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie])) { $this->Data["Series"][$Serie]["Picture"] = $Picture; } }
175 175
     }
176 176
 
177 177
    /* Set the name of the X Axis */
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
     { $this->Data["XAxisName"] = $Name; }
180 180
 
181 181
    /* Set the display mode of the  X Axis */
182
-   function setXAxisDisplay($Mode,$Format=NULL)
183
-    { $this->Data["XAxisDisplay"] = $Mode; $this->Data["XAxisFormat"]  = $Format; }
182
+   function setXAxisDisplay($Mode, $Format = NULL)
183
+    { $this->Data["XAxisDisplay"] = $Mode; $this->Data["XAxisFormat"] = $Format; }
184 184
 
185 185
    /* Set the unit that will be displayed on the X axis */
186 186
    function setXAxisUnit($Unit)
@@ -198,42 +198,42 @@  discard block
 block discarded – undo
198 198
     { $this->Data["AbscissaName"] = $Name; }
199 199
 
200 200
    /* Create a scatter group specifyin X and Y data series */
201
-   function setScatterSerie($SerieX,$SerieY,$ID=0)
202
-    { if (isset($this->Data["Series"][$SerieX]) && isset($this->Data["Series"][$SerieY]) ) { $this->initScatterSerie($ID); $this->Data["ScatterSeries"][$ID]["X"] = $SerieX; $this->Data["ScatterSeries"][$ID]["Y"] = $SerieY; } }
201
+   function setScatterSerie($SerieX, $SerieY, $ID = 0)
202
+    { if (isset($this->Data["Series"][$SerieX]) && isset($this->Data["Series"][$SerieY])) { $this->initScatterSerie($ID); $this->Data["ScatterSeries"][$ID]["X"] = $SerieX; $this->Data["ScatterSeries"][$ID]["Y"] = $SerieY; } }
203 203
 
204 204
    /* Set the shape of a given sctatter serie */
205
-   function setScatterSerieShape($ID,$Shape=SERIE_SHAPE_FILLEDCIRCLE)
206
-    { if (isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Shape"] = $Shape; } }
205
+   function setScatterSerieShape($ID, $Shape = SERIE_SHAPE_FILLEDCIRCLE)
206
+    { if (isset($this->Data["ScatterSeries"][$ID])) { $this->Data["ScatterSeries"][$ID]["Shape"] = $Shape; } }
207 207
 
208 208
    /* Set the description of a given scatter serie */
209
-   function setScatterSerieDescription($ID,$Description="My serie")
210
-    { if (isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Description"] = $Description; } }
209
+   function setScatterSerieDescription($ID, $Description = "My serie")
210
+    { if (isset($this->Data["ScatterSeries"][$ID])) { $this->Data["ScatterSeries"][$ID]["Description"] = $Description; } }
211 211
 
212 212
    /* Set the icon associated to a given scatter serie */
213
-   function setScatterSeriePicture($ID,$Picture=NULL)
214
-    { if (isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Picture"] = $Picture; } }
213
+   function setScatterSeriePicture($ID, $Picture = NULL)
214
+    { if (isset($this->Data["ScatterSeries"][$ID])) { $this->Data["ScatterSeries"][$ID]["Picture"] = $Picture; } }
215 215
 
216 216
    /* Set a scatter serie as "drawable" while calling a rendering function */
217
-   function setScatterSerieDrawable($ID ,$Drawable=TRUE)
218
-    { if (isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["isDrawable"] = $Drawable; } }
217
+   function setScatterSerieDrawable($ID, $Drawable = TRUE)
218
+    { if (isset($this->Data["ScatterSeries"][$ID])) { $this->Data["ScatterSeries"][$ID]["isDrawable"] = $Drawable; } }
219 219
 
220 220
    /* Define if a scatter serie should be draw with ticks */
221
-   function setScatterSerieTicks($ID,$Width=0)
222
-    { if ( isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Ticks"] = $Width; } }
221
+   function setScatterSerieTicks($ID, $Width = 0)
222
+    { if (isset($this->Data["ScatterSeries"][$ID])) { $this->Data["ScatterSeries"][$ID]["Ticks"] = $Width; } }
223 223
 
224 224
    /* Define if a scatter serie should be draw with a special weight */
225
-   function setScatterSerieWeight($ID,$Weight=0)
226
-    { if ( isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Weight"] = $Weight; } }
225
+   function setScatterSerieWeight($ID, $Weight = 0)
226
+    { if (isset($this->Data["ScatterSeries"][$ID])) { $this->Data["ScatterSeries"][$ID]["Weight"] = $Weight; } }
227 227
 
228 228
    /* Associate a color to a scatter serie */
229
-   function setScatterSerieColor($ID,$Format)
229
+   function setScatterSerieColor($ID, $Format)
230 230
     {
231 231
      $R	    = isset($Format["R"]) ? $Format["R"] : 0;
232 232
      $G	    = isset($Format["G"]) ? $Format["G"] : 0;
233 233
      $B	    = isset($Format["B"]) ? $Format["B"] : 0;
234 234
      $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
235 235
 
236
-     if ( isset($this->Data["ScatterSeries"][$ID]) )
236
+     if (isset($this->Data["ScatterSeries"][$ID]))
237 237
       {
238 238
        $this->Data["ScatterSeries"][$ID]["Color"]["R"] = $R;
239 239
        $this->Data["ScatterSeries"][$ID]["Color"]["G"] = $G;
@@ -248,28 +248,28 @@  discard block
 block discarded – undo
248 248
      $GlobalMin = ABSOLUTE_MAX;
249 249
      $GlobalMax = ABSOLUTE_MIN;
250 250
 
251
-     foreach($this->Data["Series"] as $Key => $Value)
251
+     foreach ($this->Data["Series"] as $Key => $Value)
252 252
       {
253
-       if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"] == TRUE)
253
+       if ($this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"] == TRUE)
254 254
         {
255
-         if ( $GlobalMin > $this->Data["Series"][$Key]["Min"] ) { $GlobalMin = $this->Data["Series"][$Key]["Min"]; }
256
-         if ( $GlobalMax < $this->Data["Series"][$Key]["Max"] ) { $GlobalMax = $this->Data["Series"][$Key]["Max"]; }
255
+         if ($GlobalMin > $this->Data["Series"][$Key]["Min"]) { $GlobalMin = $this->Data["Series"][$Key]["Min"]; }
256
+         if ($GlobalMax < $this->Data["Series"][$Key]["Max"]) { $GlobalMax = $this->Data["Series"][$Key]["Max"]; }
257 257
         }
258 258
       }
259 259
      $this->Data["Min"] = $GlobalMin;
260 260
      $this->Data["Max"] = $GlobalMax;
261 261
 
262
-     return(array($GlobalMin,$GlobalMax));
262
+     return(array($GlobalMin, $GlobalMax));
263 263
     }
264 264
 
265 265
    /* Mark all series as drawable */
266 266
    function drawAll()
267
-    { foreach($this->Data["Series"] as $Key => $Value) { if ( $this->Data["Abscissa"] != $Key ) { $this->Data["Series"][$Key]["isDrawable"]=TRUE; } } }    
267
+    { foreach ($this->Data["Series"] as $Key => $Value) { if ($this->Data["Abscissa"] != $Key) { $this->Data["Series"][$Key]["isDrawable"] = TRUE; } } }    
268 268
 
269 269
    /* Return the average value of the given serie */
270 270
    function getSerieAverage($Serie)
271 271
     {
272
-     if ( isset($this->Data["Series"][$Serie]) )
272
+     if (isset($this->Data["Series"][$Serie]))
273 273
       {
274 274
        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
275 275
        return(array_sum($SerieData)/sizeof($SerieData));
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
    /* Return the geometric mean of the given serie */
282 282
    function getGeometricMean($Serie)
283 283
     {
284
-     if ( isset($this->Data["Series"][$Serie]) )
284
+     if (isset($this->Data["Series"][$Serie]))
285 285
       {
286 286
        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
287
-       $Seriesum  = 1; foreach($SerieData as $Key => $Value) { $Seriesum = $Seriesum * $Value; }
288
-       return(pow($Seriesum,1/sizeof($SerieData)));
287
+       $Seriesum  = 1; foreach ($SerieData as $Key => $Value) { $Seriesum = $Seriesum*$Value; }
288
+       return(pow($Seriesum, 1/sizeof($SerieData)));
289 289
       }
290 290
      else
291 291
       return(NULL);
@@ -294,10 +294,10 @@  discard block
 block discarded – undo
294 294
    /* Return the harmonic mean of the given serie */
295 295
    function getHarmonicMean($Serie)
296 296
     {
297
-     if ( isset($this->Data["Series"][$Serie]) )
297
+     if (isset($this->Data["Series"][$Serie]))
298 298
       {
299 299
        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
300
-       $Seriesum  = 0; foreach($SerieData as $Key => $Value) { $Seriesum = $Seriesum + 1/$Value; }
300
+       $Seriesum  = 0; foreach ($SerieData as $Key => $Value) { $Seriesum = $Seriesum + 1/$Value; }
301 301
        return(sizeof($SerieData)/$Seriesum);
302 302
       }
303 303
      else
@@ -307,14 +307,14 @@  discard block
 block discarded – undo
307 307
    /* Return the standard deviation of the given serie */
308 308
    function getStandardDeviation($Serie)
309 309
     {
310
-     if ( isset($this->Data["Series"][$Serie]) )
310
+     if (isset($this->Data["Series"][$Serie]))
311 311
       {
312 312
        $Average   = $this->getSerieAverage($Serie);
313 313
        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
314 314
 
315 315
        $DeviationSum = 0;
316
-       foreach($SerieData as $Key => $Value)
317
-        $DeviationSum = $DeviationSum + ($Value-$Average)*($Value-$Average);
316
+       foreach ($SerieData as $Key => $Value)
317
+        $DeviationSum = $DeviationSum + ($Value - $Average)*($Value - $Average);
318 318
 
319 319
        $Deviation = sqrt($DeviationSum/count($SerieData));
320 320
 
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
    /* Return the Coefficient of variation of the given serie */
328 328
    function getCoefficientOfVariation($Serie)
329 329
     {
330
-     if ( isset($this->Data["Series"][$Serie]) )
330
+     if (isset($this->Data["Series"][$Serie]))
331 331
       {
332 332
        $Average           = $this->getSerieAverage($Serie);
333 333
        $StandardDeviation = $this->getStandardDeviation($Serie);
334 334
 
335
-       if ( $StandardDeviation != 0 )
335
+       if ($StandardDeviation != 0)
336 336
         return($StandardDeviation/$Average);
337 337
        else
338 338
         return(NULL);
@@ -344,13 +344,13 @@  discard block
 block discarded – undo
344 344
    /* Return the median value of the given serie */
345 345
    function getSerieMedian($Serie)
346 346
     {
347
-     if ( isset($this->Data["Series"][$Serie]) )
347
+     if (isset($this->Data["Series"][$Serie]))
348 348
       {
349 349
        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
350 350
        sort($SerieData);
351 351
        $SerieCenter = floor(sizeof($SerieData)/2);
352 352
 
353
-       if ( isset($SerieData[$SerieCenter]) )
353
+       if (isset($SerieData[$SerieCenter]))
354 354
         return($SerieData[$SerieCenter]);
355 355
        else
356 356
         return(NULL);
@@ -360,35 +360,35 @@  discard block
 block discarded – undo
360 360
     }
361 361
 
362 362
    /* Return the x th percentil of the given serie */
363
-   function getSeriePercentile($Serie="Serie1",$Percentil=95)
363
+   function getSeriePercentile($Serie = "Serie1", $Percentil = 95)
364 364
     {
365 365
      if (!isset($this->Data["Series"][$Serie]["Data"])) { return(NULL); }
366 366
 
367
-     $Values = count($this->Data["Series"][$Serie]["Data"])-1;
368
-     if ( $Values < 0 ) { $Values = 0; }
367
+     $Values = count($this->Data["Series"][$Serie]["Data"]) - 1;
368
+     if ($Values < 0) { $Values = 0; }
369 369
 
370
-     $PercentilID  = floor(($Values/100)*$Percentil+.5);
370
+     $PercentilID  = floor(($Values/100)*$Percentil + .5);
371 371
      $SortedValues = $this->Data["Series"][$Serie]["Data"];
372 372
      sort($SortedValues);
373 373
 
374
-     if ( is_numeric($SortedValues[$PercentilID]) )
374
+     if (is_numeric($SortedValues[$PercentilID]))
375 375
       return($SortedValues[$PercentilID]);
376 376
      else
377 377
       return(NULL);
378 378
     }
379 379
 
380 380
    /* Add random values to a given serie */
381
-   function addRandomValues($SerieName="Serie1",$Options="")
381
+   function addRandomValues($SerieName = "Serie1", $Options = "")
382 382
     {
383 383
      $Values    = isset($Options["Values"]) ? $Options["Values"] : 20;
384 384
      $Min       = isset($Options["Min"]) ? $Options["Min"] : 0;
385 385
      $Max       = isset($Options["Max"]) ? $Options["Max"] : 100;
386 386
      $withFloat = isset($Options["withFloat"]) ? $Options["withFloat"] : FALSE;
387 387
 
388
-     for ($i=0;$i<=$Values;$i++)
388
+     for ($i = 0; $i <= $Values; $i++)
389 389
       {
390
-       if ( $withFloat ) { $Value = rand($Min*100,$Max*100)/100; } else { $Value = rand($Min,$Max); }
391
-       $this->addPoints($Value,$SerieName);
390
+       if ($withFloat) { $Value = rand($Min*100, $Max*100)/100; } else { $Value = rand($Min, $Max); }
391
+       $this->addPoints($Value, $SerieName);
392 392
       }
393 393
     }
394 394
 
@@ -398,42 +398,42 @@  discard block
 block discarded – undo
398 398
      if (!isset($this->Data["Series"])) { return(FALSE); }
399 399
 
400 400
      $Result = FALSE;
401
-     foreach($this->Data["Series"] as $Key => $Value)
402
-      { if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"]==TRUE) { $Result=TRUE; } }
401
+     foreach ($this->Data["Series"] as $Key => $Value)
402
+      { if ($this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"] == TRUE) { $Result = TRUE; } }
403 403
      return($Result);
404 404
     }
405 405
 
406 406
    /* Set the display mode of an Axis */
407
-   function setAxisDisplay($AxisID,$Mode=AXIS_FORMAT_DEFAULT,$Format=NULL)
407
+   function setAxisDisplay($AxisID, $Mode = AXIS_FORMAT_DEFAULT, $Format = NULL)
408 408
     {
409
-     if ( isset($this->Data["Axis"][$AxisID] ) )
409
+     if (isset($this->Data["Axis"][$AxisID]))
410 410
       {
411 411
        $this->Data["Axis"][$AxisID]["Display"] = $Mode;
412
-       if ( $Format != NULL ) { $this->Data["Axis"][$AxisID]["Format"] = $Format; }
412
+       if ($Format != NULL) { $this->Data["Axis"][$AxisID]["Format"] = $Format; }
413 413
       }
414 414
     }
415 415
 
416 416
    /* Set the position of an Axis */
417
-   function setAxisPosition($AxisID,$Position=AXIS_POSITION_LEFT)
418
-    { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Position"] = $Position; } }
417
+   function setAxisPosition($AxisID, $Position = AXIS_POSITION_LEFT)
418
+    { if (isset($this->Data["Axis"][$AxisID])) { $this->Data["Axis"][$AxisID]["Position"] = $Position; } }
419 419
 
420 420
    /* Associate an unit to an axis */
421
-   function setAxisUnit($AxisID,$Unit)
422
-    { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Unit"] = $Unit; } }
421
+   function setAxisUnit($AxisID, $Unit)
422
+    { if (isset($this->Data["Axis"][$AxisID])) { $this->Data["Axis"][$AxisID]["Unit"] = $Unit; } }
423 423
 
424 424
    /* Associate a name to an axis */
425
-   function setAxisName($AxisID,$Name)
426
-    { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Name"] = $Name; } }
425
+   function setAxisName($AxisID, $Name)
426
+    { if (isset($this->Data["Axis"][$AxisID])) { $this->Data["Axis"][$AxisID]["Name"] = $Name; } }
427 427
 
428 428
    /* Associate a color to an axis */
429
-   function setAxisColor($AxisID,$Format)
429
+   function setAxisColor($AxisID, $Format)
430 430
     {
431 431
      $R	    = isset($Format["R"]) ? $Format["R"] : 0;
432 432
      $G	    = isset($Format["G"]) ? $Format["G"] : 0;
433 433
      $B	    = isset($Format["B"]) ? $Format["B"] : 0;
434 434
      $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
435 435
 
436
-     if ( isset($this->Data["Axis"][$AxisID] ) )
436
+     if (isset($this->Data["Axis"][$AxisID]))
437 437
       {
438 438
        $this->Data["Axis"][$AxisID]["Color"]["R"] = $R;
439 439
        $this->Data["Axis"][$AxisID]["Color"]["G"] = $G;
@@ -444,48 +444,48 @@  discard block
 block discarded – undo
444 444
 
445 445
 
446 446
    /* Design an axis as X or Y member */
447
-   function setAxisXY($AxisID,$Identity=AXIS_Y)
448
-    { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Identity"] = $Identity; } }
447
+   function setAxisXY($AxisID, $Identity = AXIS_Y)
448
+    { if (isset($this->Data["Axis"][$AxisID])) { $this->Data["Axis"][$AxisID]["Identity"] = $Identity; } }
449 449
 
450 450
    /* Associate one data serie with one axis */
451
-   function setSerieOnAxis($Series,$AxisID)
451
+   function setSerieOnAxis($Series, $AxisID)
452 452
     {
453
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
454
-     foreach($Series as $Key => $Serie)
453
+     if (!is_array($Series)) { $Series = $this->convertToArray($Series); }
454
+     foreach ($Series as $Key => $Serie)
455 455
       {
456 456
        $PreviousAxis = $this->Data["Series"][$Serie]["Axis"];
457 457
 
458 458
        /* Create missing axis */
459
-       if ( !isset($this->Data["Axis"][$AxisID] ) )
460
-        { $this->Data["Axis"][$AxisID]["Position"] = AXIS_POSITION_LEFT; $this->Data["Axis"][$AxisID]["Identity"] = AXIS_Y;}
459
+       if (!isset($this->Data["Axis"][$AxisID]))
460
+        { $this->Data["Axis"][$AxisID]["Position"] = AXIS_POSITION_LEFT; $this->Data["Axis"][$AxisID]["Identity"] = AXIS_Y; }
461 461
 
462 462
        $this->Data["Series"][$Serie]["Axis"] = $AxisID;
463 463
 
464 464
        /* Cleanup unused axis */
465 465
        $Found = FALSE;
466
-       foreach($this->Data["Series"] as $SerieName => $Values) { if ( $Values["Axis"] == $PreviousAxis ) { $Found = TRUE; } }
466
+       foreach ($this->Data["Series"] as $SerieName => $Values) { if ($Values["Axis"] == $PreviousAxis) { $Found = TRUE; } }
467 467
        if (!$Found) { unset($this->Data["Axis"][$PreviousAxis]); }
468 468
       }
469 469
     }
470 470
 
471 471
    /* Define if a serie should be draw with ticks */
472
-   function setSerieTicks($Series,$Width=0)
472
+   function setSerieTicks($Series, $Width = 0)
473 473
     {
474
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
475
-     foreach($Series as $Key => $Serie) { if ( isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Ticks"] = $Width; } }
474
+     if (!is_array($Series)) { $Series = $this->convertToArray($Series); }
475
+     foreach ($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie])) { $this->Data["Series"][$Serie]["Ticks"] = $Width; } }
476 476
     }
477 477
 
478 478
    /* Define if a serie should be draw with a special weight */
479
-   function setSerieWeight($Series,$Weight=0)
479
+   function setSerieWeight($Series, $Weight = 0)
480 480
     {
481
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
482
-     foreach($Series as $Key => $Serie) { if ( isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Weight"] = $Weight; } }
481
+     if (!is_array($Series)) { $Series = $this->convertToArray($Series); }
482
+     foreach ($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie])) { $this->Data["Series"][$Serie]["Weight"] = $Weight; } }
483 483
     }
484 484
 
485 485
    /* Returns the palette of the given serie */
486 486
    function getSeriePalette($Serie)
487 487
     {
488
-     if ( !isset($this->Data["Series"][$Serie]) ) { return(NULL); }
488
+     if (!isset($this->Data["Series"][$Serie])) { return(NULL); }
489 489
 
490 490
      $Result = "";
491 491
      $Result["R"] = $this->Data["Series"][$Serie]["Color"]["R"];
@@ -497,18 +497,18 @@  discard block
 block discarded – undo
497 497
     }
498 498
 
499 499
    /* Set the color of one serie */
500
-   function setPalette($Series,$Format=NULL)
500
+   function setPalette($Series, $Format = NULL)
501 501
     {
502
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
502
+     if (!is_array($Series)) { $Series = $this->convertToArray($Series); }
503 503
 
504
-     foreach($Series as $Key => $Serie)
504
+     foreach ($Series as $Key => $Serie)
505 505
       {
506 506
        $R	    = isset($Format["R"]) ? $Format["R"] : 0;
507 507
        $G	    = isset($Format["G"]) ? $Format["G"] : 0;
508 508
        $B	    = isset($Format["B"]) ? $Format["B"] : 0;
509 509
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
510 510
 
511
-       if ( isset($this->Data["Series"][$Serie]) )
511
+       if (isset($this->Data["Series"][$Serie]))
512 512
         {
513 513
          $OldR = $this->Data["Series"][$Serie]["Color"]["R"]; $OldG = $this->Data["Series"][$Serie]["Color"]["G"]; $OldB = $this->Data["Series"][$Serie]["Color"]["B"];
514 514
          $this->Data["Series"][$Serie]["Color"]["R"] = $R;
@@ -518,39 +518,39 @@  discard block
 block discarded – undo
518 518
 
519 519
          /* Do reverse processing on the internal palette array */
520 520
          foreach ($this->Palette as $Key => $Value)
521
-          { if ($Value["R"] == $OldR && $Value["G"] == $OldG && $Value["B"] == $OldB) { $this->Palette[$Key]["R"] = $R; $this->Palette[$Key]["G"] = $G; $this->Palette[$Key]["B"] = $B; $this->Palette[$Key]["Alpha"] = $Alpha;} }
521
+          { if ($Value["R"] == $OldR && $Value["G"] == $OldG && $Value["B"] == $OldB) { $this->Palette[$Key]["R"] = $R; $this->Palette[$Key]["G"] = $G; $this->Palette[$Key]["B"] = $B; $this->Palette[$Key]["Alpha"] = $Alpha; } }
522 522
         }
523 523
       }
524 524
     }
525 525
 
526 526
    /* Load a palette file */
527
-   function loadPalette($FileName,$Overwrite=FALSE)
527
+   function loadPalette($FileName, $Overwrite = FALSE)
528 528
     {
529
-     if ( !file_exists($FileName) ) { return(-1); }
530
-     if ( $Overwrite ) { $this->Palette = ""; }
529
+     if (!file_exists($FileName)) { return(-1); }
530
+     if ($Overwrite) { $this->Palette = ""; }
531 531
 
532 532
      $fileHandle = @fopen($FileName, "r");
533 533
      if (!$fileHandle) { return(-1); }
534 534
      while (!feof($fileHandle))
535 535
       {
536 536
        $buffer = fgets($fileHandle, 4096);
537
-       if ( preg_match("/,/",$buffer) )
537
+       if (preg_match("/,/", $buffer))
538 538
         {
539
-         list($R,$G,$B,$Alpha) = preg_split("/,/",$buffer);
540
-         if ( $this->Palette == "" ) { $ID = 0; } else { $ID = count($this->Palette); }
541
-         $this->Palette[$ID] = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
539
+         list($R, $G, $B, $Alpha) = preg_split("/,/", $buffer);
540
+         if ($this->Palette == "") { $ID = 0; } else { $ID = count($this->Palette); }
541
+         $this->Palette[$ID] = array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha);
542 542
         }
543 543
       }
544 544
      fclose($fileHandle);
545 545
 
546 546
      /* Apply changes to current series */
547 547
      $ID = 0;
548
-     if ( isset($this->Data["Series"]))
548
+     if (isset($this->Data["Series"]))
549 549
       {
550
-       foreach($this->Data["Series"] as $Key => $Value)
550
+       foreach ($this->Data["Series"] as $Key => $Value)
551 551
         {
552
-         if ( !isset($this->Palette[$ID]) )
553
-          $this->Data["Series"][$Key]["Color"] = array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>0);
552
+         if (!isset($this->Palette[$ID]))
553
+          $this->Data["Series"][$Key]["Color"] = array("R"=>0, "G"=>0, "B"=>0, "Alpha"=>0);
554 554
          else
555 555
           $this->Data["Series"][$Key]["Color"] = $this->Palette[$ID];
556 556
          $ID++;
@@ -561,21 +561,21 @@  discard block
 block discarded – undo
561 561
    /* Initialise a given scatter serie */
562 562
    function initScatterSerie($ID)
563 563
     {
564
-     if ( isset($this->Data["ScatterSeries"][$ID]) ) { return(0); }
564
+     if (isset($this->Data["ScatterSeries"][$ID])) { return(0); }
565 565
 
566
-     $this->Data["ScatterSeries"][$ID]["Description"]	= "Scatter ".$ID;
567
-     $this->Data["ScatterSeries"][$ID]["isDrawable"]	= TRUE;
568
-     $this->Data["ScatterSeries"][$ID]["Picture"]	= NULL;
566
+     $this->Data["ScatterSeries"][$ID]["Description"] = "Scatter ".$ID;
567
+     $this->Data["ScatterSeries"][$ID]["isDrawable"] = TRUE;
568
+     $this->Data["ScatterSeries"][$ID]["Picture"] = NULL;
569 569
      $this->Data["ScatterSeries"][$ID]["Ticks"]		= 0;
570 570
      $this->Data["ScatterSeries"][$ID]["Weight"]	= 0;
571 571
 
572
-     if ( isset($this->Palette[$ID]) )
572
+     if (isset($this->Palette[$ID]))
573 573
       $this->Data["ScatterSeries"][$ID]["Color"] = $this->Palette[$ID];
574 574
      else
575 575
       {
576
-       $this->Data["ScatterSeries"][$ID]["Color"]["R"] = rand(0,255);
577
-       $this->Data["ScatterSeries"][$ID]["Color"]["G"] = rand(0,255);
578
-       $this->Data["ScatterSeries"][$ID]["Color"]["B"] = rand(0,255);
576
+       $this->Data["ScatterSeries"][$ID]["Color"]["R"] = rand(0, 255);
577
+       $this->Data["ScatterSeries"][$ID]["Color"]["G"] = rand(0, 255);
578
+       $this->Data["ScatterSeries"][$ID]["Color"]["B"] = rand(0, 255);
579 579
        $this->Data["ScatterSeries"][$ID]["Color"]["Alpha"] = 100;
580 580
       }
581 581
     }
@@ -583,79 +583,79 @@  discard block
 block discarded – undo
583 583
    /* Initialise a given serie */
584 584
    function initialise($Serie)
585 585
     {
586
-     if ( isset($this->Data["Series"]) ) { $ID = count($this->Data["Series"]); } else { $ID = 0; }
586
+     if (isset($this->Data["Series"])) { $ID = count($this->Data["Series"]); } else { $ID = 0; }
587 587
 
588
-     $this->Data["Series"][$Serie]["Description"]	= $Serie;
589
-     $this->Data["Series"][$Serie]["isDrawable"]	= TRUE;
590
-     $this->Data["Series"][$Serie]["Picture"]		= NULL;
588
+     $this->Data["Series"][$Serie]["Description"] = $Serie;
589
+     $this->Data["Series"][$Serie]["isDrawable"] = TRUE;
590
+     $this->Data["Series"][$Serie]["Picture"] = NULL;
591 591
      $this->Data["Series"][$Serie]["Max"]		= NULL;
592 592
      $this->Data["Series"][$Serie]["Min"]		= NULL;
593
-     $this->Data["Series"][$Serie]["Axis"]		= 0;
593
+     $this->Data["Series"][$Serie]["Axis"] = 0;
594 594
      $this->Data["Series"][$Serie]["Ticks"]		= 0;
595
-     $this->Data["Series"][$Serie]["Weight"]		= 0;
595
+     $this->Data["Series"][$Serie]["Weight"] = 0;
596 596
      $this->Data["Series"][$Serie]["Shape"]		= SERIE_SHAPE_FILLEDCIRCLE;
597 597
 
598
-     if ( isset($this->Palette[$ID]) )
598
+     if (isset($this->Palette[$ID]))
599 599
       $this->Data["Series"][$Serie]["Color"] = $this->Palette[$ID];
600 600
      else
601 601
       {
602
-       $this->Data["Series"][$Serie]["Color"]["R"] = rand(0,255);
603
-       $this->Data["Series"][$Serie]["Color"]["G"] = rand(0,255);
604
-       $this->Data["Series"][$Serie]["Color"]["B"] = rand(0,255);
602
+       $this->Data["Series"][$Serie]["Color"]["R"] = rand(0, 255);
603
+       $this->Data["Series"][$Serie]["Color"]["G"] = rand(0, 255);
604
+       $this->Data["Series"][$Serie]["Color"]["B"] = rand(0, 255);
605 605
        $this->Data["Series"][$Serie]["Color"]["Alpha"] = 100;
606 606
       }
607 607
     }
608 608
      
609
-   function normalize($NormalizationFactor=100,$UnitChange=NULL,$Round=1)
609
+   function normalize($NormalizationFactor = 100, $UnitChange = NULL, $Round = 1)
610 610
     {
611 611
      $Abscissa = $this->Data["Abscissa"];
612 612
 
613 613
      $SelectedSeries = "";
614 614
      $MaxVal         = 0;
615
-     foreach($this->Data["Axis"] as $AxisID => $Axis)
615
+     foreach ($this->Data["Axis"] as $AxisID => $Axis)
616 616
       {
617
-       if ( $UnitChange != NULL ) { $this->Data["Axis"][$AxisID]["Unit"] = $UnitChange; }
617
+       if ($UnitChange != NULL) { $this->Data["Axis"][$AxisID]["Unit"] = $UnitChange; }
618 618
 
619
-       foreach($this->Data["Series"] as $SerieName => $Serie)
619
+       foreach ($this->Data["Series"] as $SerieName => $Serie)
620 620
         {
621 621
          if ($Serie["Axis"] == $AxisID && $Serie["isDrawable"] == TRUE && $SerieName != $Abscissa)
622 622
           {
623 623
            $SelectedSeries[$SerieName] = $SerieName;
624 624
 
625
-           if ( count($Serie["Data"] ) > $MaxVal ) { $MaxVal = count($Serie["Data"]); }
625
+           if (count($Serie["Data"]) > $MaxVal) { $MaxVal = count($Serie["Data"]); }
626 626
           }
627 627
         }
628 628
       }
629 629
 
630
-     for($i=0;$i<=$MaxVal-1;$i++)
630
+     for ($i = 0; $i <= $MaxVal - 1; $i++)
631 631
       {
632 632
        $Factor = 0;
633
-       foreach ($SelectedSeries as $Key => $SerieName )
633
+       foreach ($SelectedSeries as $Key => $SerieName)
634 634
         {
635 635
          $Value = $this->Data["Series"][$SerieName]["Data"][$i];
636
-         if ( $Value != VOID )
636
+         if ($Value != VOID)
637 637
           $Factor = $Factor + abs($Value);
638 638
         }
639 639
 
640
-       if ( $Factor != 0 )
640
+       if ($Factor != 0)
641 641
         {
642
-         $Factor = $NormalizationFactor / $Factor;
642
+         $Factor = $NormalizationFactor/$Factor;
643 643
 
644
-         foreach ($SelectedSeries as $Key => $SerieName )
644
+         foreach ($SelectedSeries as $Key => $SerieName)
645 645
           {
646 646
            $Value = $this->Data["Series"][$SerieName]["Data"][$i];
647 647
 
648
-           if ( $Value != VOID && $Factor != $NormalizationFactor )
649
-            $this->Data["Series"][$SerieName]["Data"][$i] = round(abs($Value)*$Factor,$Round);
650
-           elseif ( $Value == VOID || $Value == 0 )
648
+           if ($Value != VOID && $Factor != $NormalizationFactor)
649
+            $this->Data["Series"][$SerieName]["Data"][$i] = round(abs($Value)*$Factor, $Round);
650
+           elseif ($Value == VOID || $Value == 0)
651 651
             $this->Data["Series"][$SerieName]["Data"][$i] = VOID;
652
-           elseif ( $Factor == $NormalizationFactor )
652
+           elseif ($Factor == $NormalizationFactor)
653 653
             $this->Data["Series"][$SerieName]["Data"][$i] = $NormalizationFactor;
654 654
           }
655 655
         }
656 656
       }
657 657
 
658
-     foreach ($SelectedSeries as $Key => $SerieName )
658
+     foreach ($SelectedSeries as $Key => $SerieName)
659 659
       {
660 660
        $this->Data["Series"][$SerieName]["Max"] = max($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
661 661
        $this->Data["Series"][$SerieName]["Min"] = min($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
@@ -663,35 +663,35 @@  discard block
 block discarded – undo
663 663
     }
664 664
 
665 665
    /* Load data from a CSV (or similar) data source */
666
-   function importFromCSV($FileName,$Options="")
666
+   function importFromCSV($FileName, $Options = "")
667 667
     {
668 668
      $Delimiter		= isset($Options["Delimiter"]) ? $Options["Delimiter"] : ",";
669 669
      $GotHeader		= isset($Options["GotHeader"]) ? $Options["GotHeader"] : FALSE;
670
-     $SkipColumns	= isset($Options["SkipColumns"]) ? $Options["SkipColumns"] : array(-1);
671
-     $DefaultSerieName	= isset($Options["DefaultSerieName"]) ? $Options["DefaultSerieName"] : "Serie";
670
+     $SkipColumns = isset($Options["SkipColumns"]) ? $Options["SkipColumns"] : array(-1);
671
+     $DefaultSerieName = isset($Options["DefaultSerieName"]) ? $Options["DefaultSerieName"] : "Serie";
672 672
 
673
-     $Handle = @fopen($FileName,"r");
673
+     $Handle = @fopen($FileName, "r");
674 674
      if ($Handle)
675 675
       {
676 676
        $HeaderParsed = FALSE; $SerieNames = "";
677 677
        while (!feof($Handle))
678 678
         {
679 679
          $Buffer = fgets($Handle, 4096);
680
-         $Buffer = str_replace(chr(10),"",$Buffer);
681
-         $Buffer = str_replace(chr(13),"",$Buffer);
682
-         $Values = preg_split("/".$Delimiter."/",$Buffer);
680
+         $Buffer = str_replace(chr(10), "", $Buffer);
681
+         $Buffer = str_replace(chr(13), "", $Buffer);
682
+         $Values = preg_split("/".$Delimiter."/", $Buffer);
683 683
 
684
-         if ( $Buffer != "" )
684
+         if ($Buffer != "")
685 685
           {
686
-           if ( $GotHeader && !$HeaderParsed )
686
+           if ($GotHeader && !$HeaderParsed)
687 687
             {
688
-             foreach($Values as $Key => $Name) { if ( !in_array($Key,$SkipColumns) ) { $SerieNames[$Key] = $Name; } }
688
+             foreach ($Values as $Key => $Name) { if (!in_array($Key, $SkipColumns)) { $SerieNames[$Key] = $Name; } }
689 689
              $HeaderParsed = TRUE;
690 690
             }
691 691
            else
692 692
             {
693
-             if ($SerieNames == "" ) { foreach($Values as $Key => $Name) {  if ( !in_array($Key,$SkipColumns) ) { $SerieNames[$Key] = $DefaultSerieName.$Key; } } }
694
-             foreach($Values as $Key => $Value) {  if ( !in_array($Key,$SkipColumns) ) { $this->addPoints($Value,$SerieNames[$Key]); } }
693
+             if ($SerieNames == "") { foreach ($Values as $Key => $Name) {  if (!in_array($Key, $SkipColumns)) { $SerieNames[$Key] = $DefaultSerieName.$Key; } } }
694
+             foreach ($Values as $Key => $Value) {  if (!in_array($Key, $SkipColumns)) { $this->addPoints($Value, $SerieNames[$Key]); } }
695 695
             }
696 696
           }
697 697
         }
@@ -700,46 +700,46 @@  discard block
 block discarded – undo
700 700
     }
701 701
 
702 702
    /* Create a dataset based on a formula */
703
-   function createFunctionSerie($SerieName,$Formula="",$Options="")
703
+   function createFunctionSerie($SerieName, $Formula = "", $Options = "")
704 704
     {
705 705
      $MinX		= isset($Options["MinX"]) ? $Options["MinX"] : -10;
706 706
      $MaxX		= isset($Options["MaxX"]) ? $Options["MaxX"] : 10;
707
-     $XStep		= isset($Options["XStep"]) ? $Options["XStep"] : 1;
708
-     $AutoDescription	= isset($Options["AutoDescription"]) ? $Options["AutoDescription"] : FALSE;
709
-     $RecordAbscissa	= isset($Options["RecordAbscissa"]) ? $Options["RecordAbscissa"] : FALSE;
710
-     $AbscissaSerie	= isset($Options["AbscissaSerie"]) ? $Options["AbscissaSerie"] : "Abscissa";
707
+     $XStep = isset($Options["XStep"]) ? $Options["XStep"] : 1;
708
+     $AutoDescription = isset($Options["AutoDescription"]) ? $Options["AutoDescription"] : FALSE;
709
+     $RecordAbscissa = isset($Options["RecordAbscissa"]) ? $Options["RecordAbscissa"] : FALSE;
710
+     $AbscissaSerie = isset($Options["AbscissaSerie"]) ? $Options["AbscissaSerie"] : "Abscissa";
711 711
 
712
-     if ( $Formula == "" ) { return(0); }
712
+     if ($Formula == "") { return(0); }
713 713
 
714 714
      $Result = ""; $Abscissa = "";
715
-     for($i=$MinX; $i<=$MaxX; $i=$i+$XStep)
715
+     for ($i = $MinX; $i <= $MaxX; $i = $i + $XStep)
716 716
       {
717
-       $Expression = "\$return = '!'.(".str_replace("z",$i,$Formula).");";
718
-       if ( @eval($Expression) === FALSE ) { $return = VOID; }
719
-       if ( $return == "!" ) { $return = VOID; } else { $return = $this->right($return,strlen($return)-1); }
720
-       if ( $return == "NAN" ) { $return = VOID; }
721
-       if ( $return == "INF" ) { $return = VOID; }
722
-       if ( $return == "-INF" ) { $return = VOID; }
717
+       $Expression = "\$return = '!'.(".str_replace("z", $i, $Formula).");";
718
+       if (@eval($Expression) === FALSE) { $return = VOID; }
719
+       if ($return == "!") { $return = VOID; } else { $return = $this->right($return, strlen($return) - 1); }
720
+       if ($return == "NAN") { $return = VOID; }
721
+       if ($return == "INF") { $return = VOID; }
722
+       if ($return == "-INF") { $return = VOID; }
723 723
 
724 724
        $Abscissa[] = $i;
725 725
        $Result[]   = $return;
726 726
       }
727 727
 
728
-     $this->addPoints($Result,$SerieName);
729
-     if ( $AutoDescription ) { $this->setSerieDescription($SerieName,$Formula); }
730
-     if ( $RecordAbscissa ) { $this->addPoints($Abscissa,$AbscissaSerie); }
728
+     $this->addPoints($Result, $SerieName);
729
+     if ($AutoDescription) { $this->setSerieDescription($SerieName, $Formula); }
730
+     if ($RecordAbscissa) { $this->addPoints($Abscissa, $AbscissaSerie); }
731 731
     }
732 732
 
733 733
    function negateValues($Series)
734 734
     {
735
-     if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
736
-     foreach($Series as $Key => $SerieName)
735
+     if (!is_array($Series)) { $Series = $this->convertToArray($Series); }
736
+     foreach ($Series as $Key => $SerieName)
737 737
       {
738 738
        if (isset($this->Data["Series"][$SerieName]))
739 739
         {
740 740
          $Data = "";
741
-         foreach($this->Data["Series"][$SerieName]["Data"] as $Key => $Value)
742
-          { if ( $Value == VOID ) { $Data[] = VOID; } else { $Data[] = -$Value; } }
741
+         foreach ($this->Data["Series"][$SerieName]["Data"] as $Key => $Value)
742
+          { if ($Value == VOID) { $Data[] = VOID; } else { $Data[] = -$Value; } }
743 743
          $this->Data["Series"][$SerieName]["Data"] = $Data;
744 744
 
745 745
          $this->Data["Series"][$SerieName]["Max"] = max($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
     { return($this->Data); }
754 754
 
755 755
    /* Save a palette element */
756
-   function savePalette($ID,$Color)
756
+   function savePalette($ID, $Color)
757 757
     { $this->Palette[$ID] = $Color; }
758 758
 
759 759
    /* Return the palette of the series */
@@ -761,16 +761,16 @@  discard block
 block discarded – undo
761 761
     { return($this->Palette); }
762 762
 
763 763
    /* Called by the scaling algorithm to save the config */
764
-   function saveAxisConfig($Axis) { $this->Data["Axis"]=$Axis; }
764
+   function saveAxisConfig($Axis) { $this->Data["Axis"] = $Axis; }
765 765
 
766 766
    /* Save the Y Margin if set */
767
-   function saveYMargin($Value) { $this->Data["YMargin"]=$Value; }
767
+   function saveYMargin($Value) { $this->Data["YMargin"] = $Value; }
768 768
 
769 769
    /* Save extended configuration to the pData object */
770
-   function saveExtendedData($Tag,$Values) { $this->Data["Extended"][$Tag]=$Values; }
770
+   function saveExtendedData($Tag, $Values) { $this->Data["Extended"][$Tag] = $Values; }
771 771
 
772 772
    /* Called by the scaling algorithm to save the orientation of the scale */
773
-   function saveOrientation($Orientation) { $this->Data["Orientation"]=$Orientation; }
773
+   function saveOrientation($Orientation) { $this->Data["Orientation"] = $Orientation; }
774 774
 
775 775
    /* Convert a string to a single elements array */
776 776
    function convertToArray($Value)
@@ -780,8 +780,8 @@  discard block
 block discarded – undo
780 780
    function __toString()
781 781
     { return("pData object."); }
782 782
 
783
-   function left($value,$NbChar)	{ return substr($value,0,$NbChar); }  
784
-   function right($value,$NbChar)	{ return substr($value,strlen($value)-$NbChar,$NbChar); }  
785
-   function mid($value,$Depart,$NbChar)	{ return substr($value,$Depart-1,$NbChar); }  
783
+   function left($value, $NbChar) { return substr($value, 0, $NbChar); }  
784
+   function right($value, $NbChar) { return substr($value, strlen($value) - $NbChar, $NbChar); }  
785
+   function mid($value, $Depart, $NbChar) { return substr($value, $Depart - 1, $NbChar); }  
786 786
   }
787 787
 ?>
788 788
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +83 added lines, -163 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@  discard block
 block discarded – undo
52 52
  define("EURO_SYMBOL"			, utf8_encode("&#8364;"));
53 53
 
54 54
  /* pData class definition */
55
- class pData
56
-  {
55
+ class pData {
57 56
    var $Data;
58 57
 
59 58
    var $Palette = array("0"=>array("R"=>188,"G"=>224,"B"=>46,"Alpha"=>100),
@@ -66,8 +65,7 @@  discard block
 block discarded – undo
66 65
                         "7"=>array("R"=>224,"G"=>176,"B"=>46,"Alpha"=>100));
67 66
 
68 67
    /* Class creator */
69
-   function pData()
70
-    {
68
+   function pData() {
71 69
      $this->Data = "";
72 70
      $this->Data["XAxisDisplay"]	= AXIS_FORMAT_DEFAULT;
73 71
      $this->Data["XAxisFormat"]		= NULL;
@@ -82,21 +80,17 @@  discard block
 block discarded – undo
82 80
     }
83 81
 
84 82
    /* Add a single point or an array to the given serie */
85
-   function addPoints($Values,$SerieName="Serie1")
86
-    {
83
+   function addPoints($Values,$SerieName="Serie1") {
87 84
      if (!isset($this->Data["Series"][$SerieName]))
88 85
       $this->initialise($SerieName);
89 86
 
90
-     if ( is_array($Values) )
91
-      {
87
+     if ( is_array($Values) ) {
92 88
        foreach($Values as $Key => $Value)
93 89
         { $this->Data["Series"][$SerieName]["Data"][] = $Value; }
94
-      }
95
-     else
90
+      } else
96 91
       $this->Data["Series"][$SerieName]["Data"][] = $Values;
97 92
 
98
-     if ( $Values != VOID )
99
-      {
93
+     if ( $Values != VOID ) {
100 94
        $StrippedData = $this->stripVOID($this->Data["Series"][$SerieName]["Data"]);
101 95
        if ( empty($StrippedData) ) { $this->Data["Series"][$SerieName]["Max"] = 0; $this->Data["Series"][$SerieName]["Min"] =0; return(0); }
102 96
        $this->Data["Series"][$SerieName]["Max"] = max($StrippedData);
@@ -113,8 +107,7 @@  discard block
 block discarded – undo
113 107
     { if (isset($this->Data["Series"][$Serie]["Data"])) { return(sizeof($this->Data["Series"][$Serie]["Data"])); } else { return(0); } }
114 108
 
115 109
    /* Remove a serie from the pData object */
116
-   function removeSerie($Series)
117
-    {
110
+   function removeSerie($Series) {
118 111
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
119 112
      foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie])) { unset($this->Data["Series"][$Serie]); } }
120 113
     }
@@ -128,8 +121,7 @@  discard block
 block discarded – undo
128 121
     { if (isset($this->Data["Series"][$Serie]["Data"])) { return($this->Data["Series"][$Serie]["Data"]); } else { return(NULL); } }
129 122
 
130 123
    /* Reverse the values in the given serie */
131
-   function reverseSerie($Series)
132
-    {
124
+   function reverseSerie($Series) {
133 125
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
134 126
      foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]["Data"])) { $this->Data["Series"][$Serie]["Data"] = array_reverse($this->Data["Series"][$Serie]["Data"]); } }
135 127
     }
@@ -147,29 +139,25 @@  discard block
 block discarded – undo
147 139
     { if (isset($this->Data["Series"][$Serie]["Min"])) { return($this->Data["Series"][$Serie]["Min"]); } else { return(NULL); } }
148 140
 
149 141
    /* Set the description of a given serie */
150
-   function setSerieShape($Series,$Shape=SERIE_SHAPE_FILLEDCIRCLE)
151
-    {
142
+   function setSerieShape($Series,$Shape=SERIE_SHAPE_FILLEDCIRCLE) {
152 143
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
153 144
      foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Shape"] = $Shape; } }
154 145
     }
155 146
 
156 147
    /* Set the description of a given serie */
157
-   function setSerieDescription($Series,$Description="My serie")
158
-    {
148
+   function setSerieDescription($Series,$Description="My serie") {
159 149
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
160 150
      foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Description"] = $Description; } }
161 151
     }
162 152
 
163 153
    /* Set a serie as "drawable" while calling a rendering function */
164
-   function setSerieDrawable($Series,$Drawable=TRUE)
165
-    {
154
+   function setSerieDrawable($Series,$Drawable=TRUE) {
166 155
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
167 156
      foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["isDrawable"] = $Drawable; } }
168 157
     }
169 158
 
170 159
    /* Set the icon associated to a given serie */
171
-   function setSeriePicture($Series,$Picture=NULL)
172
-    {
160
+   function setSeriePicture($Series,$Picture=NULL) {
173 161
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
174 162
      foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Picture"] = $Picture; } }
175 163
     }
@@ -226,15 +214,13 @@  discard block
 block discarded – undo
226 214
     { if ( isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Weight"] = $Weight; } }
227 215
 
228 216
    /* Associate a color to a scatter serie */
229
-   function setScatterSerieColor($ID,$Format)
230
-    {
217
+   function setScatterSerieColor($ID,$Format) {
231 218
      $R	    = isset($Format["R"]) ? $Format["R"] : 0;
232 219
      $G	    = isset($Format["G"]) ? $Format["G"] : 0;
233 220
      $B	    = isset($Format["B"]) ? $Format["B"] : 0;
234 221
      $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
235 222
 
236
-     if ( isset($this->Data["ScatterSeries"][$ID]) )
237
-      {
223
+     if ( isset($this->Data["ScatterSeries"][$ID]) ) {
238 224
        $this->Data["ScatterSeries"][$ID]["Color"]["R"] = $R;
239 225
        $this->Data["ScatterSeries"][$ID]["Color"]["G"] = $G;
240 226
        $this->Data["ScatterSeries"][$ID]["Color"]["B"] = $B;
@@ -243,15 +229,12 @@  discard block
 block discarded – undo
243 229
     }
244 230
 
245 231
    /* Compute the series limits for an individual and global point of view */
246
-   function limits()
247
-    {
232
+   function limits() {
248 233
      $GlobalMin = ABSOLUTE_MAX;
249 234
      $GlobalMax = ABSOLUTE_MIN;
250 235
 
251
-     foreach($this->Data["Series"] as $Key => $Value)
252
-      {
253
-       if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"] == TRUE)
254
-        {
236
+     foreach($this->Data["Series"] as $Key => $Value) {
237
+       if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"] == TRUE) {
255 238
          if ( $GlobalMin > $this->Data["Series"][$Key]["Min"] ) { $GlobalMin = $this->Data["Series"][$Key]["Min"]; }
256 239
          if ( $GlobalMax < $this->Data["Series"][$Key]["Max"] ) { $GlobalMax = $this->Data["Series"][$Key]["Max"]; }
257 240
         }
@@ -267,68 +250,55 @@  discard block
 block discarded – undo
267 250
     { foreach($this->Data["Series"] as $Key => $Value) { if ( $this->Data["Abscissa"] != $Key ) { $this->Data["Series"][$Key]["isDrawable"]=TRUE; } } }    
268 251
 
269 252
    /* Return the average value of the given serie */
270
-   function getSerieAverage($Serie)
271
-    {
272
-     if ( isset($this->Data["Series"][$Serie]) )
273
-      {
253
+   function getSerieAverage($Serie) {
254
+     if ( isset($this->Data["Series"][$Serie]) ) {
274 255
        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
275 256
        return(array_sum($SerieData)/sizeof($SerieData));
276
-      }
277
-     else
257
+      } else
278 258
       return(NULL);
279 259
     }
280 260
 
281 261
    /* Return the geometric mean of the given serie */
282
-   function getGeometricMean($Serie)
283
-    {
284
-     if ( isset($this->Data["Series"][$Serie]) )
285
-      {
262
+   function getGeometricMean($Serie) {
263
+     if ( isset($this->Data["Series"][$Serie]) ) {
286 264
        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
287 265
        $Seriesum  = 1; foreach($SerieData as $Key => $Value) { $Seriesum = $Seriesum * $Value; }
288 266
        return(pow($Seriesum,1/sizeof($SerieData)));
289
-      }
290
-     else
267
+      } else
291 268
       return(NULL);
292 269
     }
293 270
 
294 271
    /* Return the harmonic mean of the given serie */
295
-   function getHarmonicMean($Serie)
296
-    {
297
-     if ( isset($this->Data["Series"][$Serie]) )
298
-      {
272
+   function getHarmonicMean($Serie) {
273
+     if ( isset($this->Data["Series"][$Serie]) ) {
299 274
        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
300 275
        $Seriesum  = 0; foreach($SerieData as $Key => $Value) { $Seriesum = $Seriesum + 1/$Value; }
301 276
        return(sizeof($SerieData)/$Seriesum);
302
-      }
303
-     else
277
+      } else
304 278
       return(NULL);
305 279
     }
306 280
 
307 281
    /* Return the standard deviation of the given serie */
308
-   function getStandardDeviation($Serie)
309
-    {
310
-     if ( isset($this->Data["Series"][$Serie]) )
311
-      {
282
+   function getStandardDeviation($Serie) {
283
+     if ( isset($this->Data["Series"][$Serie]) ) {
312 284
        $Average   = $this->getSerieAverage($Serie);
313 285
        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
314 286
 
315 287
        $DeviationSum = 0;
316
-       foreach($SerieData as $Key => $Value)
317
-        $DeviationSum = $DeviationSum + ($Value-$Average)*($Value-$Average);
288
+       foreach($SerieData as $Key => $Value) {
289
+               $DeviationSum = $DeviationSum + ($Value-$Average)*($Value-$Average);
290
+       }
318 291
 
319 292
        $Deviation = sqrt($DeviationSum/count($SerieData));
320 293
 
321 294
        return($Deviation);
322
-      }
323
-     else
295
+      } else
324 296
       return(NULL);
325 297
     }
326 298
 
327 299
    /* Return the Coefficient of variation of the given serie */
328
-   function getCoefficientOfVariation($Serie)
329
-    {
330
-     if ( isset($this->Data["Series"][$Serie]) )
331
-      {
300
+   function getCoefficientOfVariation($Serie) {
301
+     if ( isset($this->Data["Series"][$Serie]) ) {
332 302
        $Average           = $this->getSerieAverage($Serie);
333 303
        $StandardDeviation = $this->getStandardDeviation($Serie);
334 304
 
@@ -336,16 +306,13 @@  discard block
 block discarded – undo
336 306
         return($StandardDeviation/$Average);
337 307
        else
338 308
         return(NULL);
339
-      }
340
-     else
309
+      } else
341 310
       return(NULL);
342 311
     }
343 312
 
344 313
    /* Return the median value of the given serie */
345
-   function getSerieMedian($Serie)
346
-    {
347
-     if ( isset($this->Data["Series"][$Serie]) )
348
-      {
314
+   function getSerieMedian($Serie) {
315
+     if ( isset($this->Data["Series"][$Serie]) ) {
349 316
        $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]);
350 317
        sort($SerieData);
351 318
        $SerieCenter = floor(sizeof($SerieData)/2);
@@ -354,14 +321,12 @@  discard block
 block discarded – undo
354 321
         return($SerieData[$SerieCenter]);
355 322
        else
356 323
         return(NULL);
357
-      }
358
-     else
324
+      } else
359 325
       return(NULL);
360 326
     }
361 327
 
362 328
    /* Return the x th percentil of the given serie */
363
-   function getSeriePercentile($Serie="Serie1",$Percentil=95)
364
-    {
329
+   function getSeriePercentile($Serie="Serie1",$Percentil=95) {
365 330
      if (!isset($this->Data["Series"][$Serie]["Data"])) { return(NULL); }
366 331
 
367 332
      $Values = count($this->Data["Series"][$Serie]["Data"])-1;
@@ -378,23 +343,20 @@  discard block
 block discarded – undo
378 343
     }
379 344
 
380 345
    /* Add random values to a given serie */
381
-   function addRandomValues($SerieName="Serie1",$Options="")
382
-    {
346
+   function addRandomValues($SerieName="Serie1",$Options="") {
383 347
      $Values    = isset($Options["Values"]) ? $Options["Values"] : 20;
384 348
      $Min       = isset($Options["Min"]) ? $Options["Min"] : 0;
385 349
      $Max       = isset($Options["Max"]) ? $Options["Max"] : 100;
386 350
      $withFloat = isset($Options["withFloat"]) ? $Options["withFloat"] : FALSE;
387 351
 
388
-     for ($i=0;$i<=$Values;$i++)
389
-      {
352
+     for ($i=0;$i<=$Values;$i++) {
390 353
        if ( $withFloat ) { $Value = rand($Min*100,$Max*100)/100; } else { $Value = rand($Min,$Max); }
391 354
        $this->addPoints($Value,$SerieName);
392 355
       }
393 356
     }
394 357
 
395 358
    /* Test if we have valid data */
396
-   function containsData()
397
-    {
359
+   function containsData() {
398 360
      if (!isset($this->Data["Series"])) { return(FALSE); }
399 361
 
400 362
      $Result = FALSE;
@@ -404,10 +366,8 @@  discard block
 block discarded – undo
404 366
     }
405 367
 
406 368
    /* Set the display mode of an Axis */
407
-   function setAxisDisplay($AxisID,$Mode=AXIS_FORMAT_DEFAULT,$Format=NULL)
408
-    {
409
-     if ( isset($this->Data["Axis"][$AxisID] ) )
410
-      {
369
+   function setAxisDisplay($AxisID,$Mode=AXIS_FORMAT_DEFAULT,$Format=NULL) {
370
+     if ( isset($this->Data["Axis"][$AxisID] ) ) {
411 371
        $this->Data["Axis"][$AxisID]["Display"] = $Mode;
412 372
        if ( $Format != NULL ) { $this->Data["Axis"][$AxisID]["Format"] = $Format; }
413 373
       }
@@ -426,15 +386,13 @@  discard block
 block discarded – undo
426 386
     { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Name"] = $Name; } }
427 387
 
428 388
    /* Associate a color to an axis */
429
-   function setAxisColor($AxisID,$Format)
430
-    {
389
+   function setAxisColor($AxisID,$Format) {
431 390
      $R	    = isset($Format["R"]) ? $Format["R"] : 0;
432 391
      $G	    = isset($Format["G"]) ? $Format["G"] : 0;
433 392
      $B	    = isset($Format["B"]) ? $Format["B"] : 0;
434 393
      $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
435 394
 
436
-     if ( isset($this->Data["Axis"][$AxisID] ) )
437
-      {
395
+     if ( isset($this->Data["Axis"][$AxisID] ) ) {
438 396
        $this->Data["Axis"][$AxisID]["Color"]["R"] = $R;
439 397
        $this->Data["Axis"][$AxisID]["Color"]["G"] = $G;
440 398
        $this->Data["Axis"][$AxisID]["Color"]["B"] = $B;
@@ -448,11 +406,9 @@  discard block
 block discarded – undo
448 406
     { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Identity"] = $Identity; } }
449 407
 
450 408
    /* Associate one data serie with one axis */
451
-   function setSerieOnAxis($Series,$AxisID)
452
-    {
409
+   function setSerieOnAxis($Series,$AxisID) {
453 410
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
454
-     foreach($Series as $Key => $Serie)
455
-      {
411
+     foreach($Series as $Key => $Serie) {
456 412
        $PreviousAxis = $this->Data["Series"][$Serie]["Axis"];
457 413
 
458 414
        /* Create missing axis */
@@ -469,22 +425,19 @@  discard block
 block discarded – undo
469 425
     }
470 426
 
471 427
    /* Define if a serie should be draw with ticks */
472
-   function setSerieTicks($Series,$Width=0)
473
-    {
428
+   function setSerieTicks($Series,$Width=0) {
474 429
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
475 430
      foreach($Series as $Key => $Serie) { if ( isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Ticks"] = $Width; } }
476 431
     }
477 432
 
478 433
    /* Define if a serie should be draw with a special weight */
479
-   function setSerieWeight($Series,$Weight=0)
480
-    {
434
+   function setSerieWeight($Series,$Weight=0) {
481 435
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
482 436
      foreach($Series as $Key => $Serie) { if ( isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Weight"] = $Weight; } }
483 437
     }
484 438
 
485 439
    /* Returns the palette of the given serie */
486
-   function getSeriePalette($Serie)
487
-    {
440
+   function getSeriePalette($Serie) {
488 441
      if ( !isset($this->Data["Series"][$Serie]) ) { return(NULL); }
489 442
 
490 443
      $Result = "";
@@ -497,19 +450,16 @@  discard block
 block discarded – undo
497 450
     }
498 451
 
499 452
    /* Set the color of one serie */
500
-   function setPalette($Series,$Format=NULL)
501
-    {
453
+   function setPalette($Series,$Format=NULL) {
502 454
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
503 455
 
504
-     foreach($Series as $Key => $Serie)
505
-      {
456
+     foreach($Series as $Key => $Serie) {
506 457
        $R	    = isset($Format["R"]) ? $Format["R"] : 0;
507 458
        $G	    = isset($Format["G"]) ? $Format["G"] : 0;
508 459
        $B	    = isset($Format["B"]) ? $Format["B"] : 0;
509 460
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
510 461
 
511
-       if ( isset($this->Data["Series"][$Serie]) )
512
-        {
462
+       if ( isset($this->Data["Series"][$Serie]) ) {
513 463
          $OldR = $this->Data["Series"][$Serie]["Color"]["R"]; $OldG = $this->Data["Series"][$Serie]["Color"]["G"]; $OldB = $this->Data["Series"][$Serie]["Color"]["B"];
514 464
          $this->Data["Series"][$Serie]["Color"]["R"] = $R;
515 465
          $this->Data["Series"][$Serie]["Color"]["G"] = $G;
@@ -524,18 +474,15 @@  discard block
 block discarded – undo
524 474
     }
525 475
 
526 476
    /* Load a palette file */
527
-   function loadPalette($FileName,$Overwrite=FALSE)
528
-    {
477
+   function loadPalette($FileName,$Overwrite=FALSE) {
529 478
      if ( !file_exists($FileName) ) { return(-1); }
530 479
      if ( $Overwrite ) { $this->Palette = ""; }
531 480
 
532 481
      $fileHandle = @fopen($FileName, "r");
533 482
      if (!$fileHandle) { return(-1); }
534
-     while (!feof($fileHandle))
535
-      {
483
+     while (!feof($fileHandle)) {
536 484
        $buffer = fgets($fileHandle, 4096);
537
-       if ( preg_match("/,/",$buffer) )
538
-        {
485
+       if ( preg_match("/,/",$buffer) ) {
539 486
          list($R,$G,$B,$Alpha) = preg_split("/,/",$buffer);
540 487
          if ( $this->Palette == "" ) { $ID = 0; } else { $ID = count($this->Palette); }
541 488
          $this->Palette[$ID] = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
@@ -545,10 +492,8 @@  discard block
 block discarded – undo
545 492
 
546 493
      /* Apply changes to current series */
547 494
      $ID = 0;
548
-     if ( isset($this->Data["Series"]))
549
-      {
550
-       foreach($this->Data["Series"] as $Key => $Value)
551
-        {
495
+     if ( isset($this->Data["Series"])) {
496
+       foreach($this->Data["Series"] as $Key => $Value) {
552 497
          if ( !isset($this->Palette[$ID]) )
553 498
           $this->Data["Series"][$Key]["Color"] = array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>0);
554 499
          else
@@ -559,8 +504,7 @@  discard block
 block discarded – undo
559 504
     }
560 505
 
561 506
    /* Initialise a given scatter serie */
562
-   function initScatterSerie($ID)
563
-    {
507
+   function initScatterSerie($ID) {
564 508
      if ( isset($this->Data["ScatterSeries"][$ID]) ) { return(0); }
565 509
 
566 510
      $this->Data["ScatterSeries"][$ID]["Description"]	= "Scatter ".$ID;
@@ -571,8 +515,7 @@  discard block
 block discarded – undo
571 515
 
572 516
      if ( isset($this->Palette[$ID]) )
573 517
       $this->Data["ScatterSeries"][$ID]["Color"] = $this->Palette[$ID];
574
-     else
575
-      {
518
+     else {
576 519
        $this->Data["ScatterSeries"][$ID]["Color"]["R"] = rand(0,255);
577 520
        $this->Data["ScatterSeries"][$ID]["Color"]["G"] = rand(0,255);
578 521
        $this->Data["ScatterSeries"][$ID]["Color"]["B"] = rand(0,255);
@@ -581,8 +524,7 @@  discard block
 block discarded – undo
581 524
     }
582 525
 
583 526
    /* Initialise a given serie */
584
-   function initialise($Serie)
585
-    {
527
+   function initialise($Serie) {
586 528
      if ( isset($this->Data["Series"]) ) { $ID = count($this->Data["Series"]); } else { $ID = 0; }
587 529
 
588 530
      $this->Data["Series"][$Serie]["Description"]	= $Serie;
@@ -597,8 +539,7 @@  discard block
 block discarded – undo
597 539
 
598 540
      if ( isset($this->Palette[$ID]) )
599 541
       $this->Data["Series"][$Serie]["Color"] = $this->Palette[$ID];
600
-     else
601
-      {
542
+     else {
602 543
        $this->Data["Series"][$Serie]["Color"]["R"] = rand(0,255);
603 544
        $this->Data["Series"][$Serie]["Color"]["G"] = rand(0,255);
604 545
        $this->Data["Series"][$Serie]["Color"]["B"] = rand(0,255);
@@ -606,20 +547,16 @@  discard block
 block discarded – undo
606 547
       }
607 548
     }
608 549
      
609
-   function normalize($NormalizationFactor=100,$UnitChange=NULL,$Round=1)
610
-    {
550
+   function normalize($NormalizationFactor=100,$UnitChange=NULL,$Round=1) {
611 551
      $Abscissa = $this->Data["Abscissa"];
612 552
 
613 553
      $SelectedSeries = "";
614 554
      $MaxVal         = 0;
615
-     foreach($this->Data["Axis"] as $AxisID => $Axis)
616
-      {
555
+     foreach($this->Data["Axis"] as $AxisID => $Axis) {
617 556
        if ( $UnitChange != NULL ) { $this->Data["Axis"][$AxisID]["Unit"] = $UnitChange; }
618 557
 
619
-       foreach($this->Data["Series"] as $SerieName => $Serie)
620
-        {
621
-         if ($Serie["Axis"] == $AxisID && $Serie["isDrawable"] == TRUE && $SerieName != $Abscissa)
622
-          {
558
+       foreach($this->Data["Series"] as $SerieName => $Serie) {
559
+         if ($Serie["Axis"] == $AxisID && $Serie["isDrawable"] == TRUE && $SerieName != $Abscissa) {
623 560
            $SelectedSeries[$SerieName] = $SerieName;
624 561
 
625 562
            if ( count($Serie["Data"] ) > $MaxVal ) { $MaxVal = count($Serie["Data"]); }
@@ -627,22 +564,18 @@  discard block
 block discarded – undo
627 564
         }
628 565
       }
629 566
 
630
-     for($i=0;$i<=$MaxVal-1;$i++)
631
-      {
567
+     for($i=0;$i<=$MaxVal-1;$i++) {
632 568
        $Factor = 0;
633
-       foreach ($SelectedSeries as $Key => $SerieName )
634
-        {
569
+       foreach ($SelectedSeries as $Key => $SerieName ) {
635 570
          $Value = $this->Data["Series"][$SerieName]["Data"][$i];
636 571
          if ( $Value != VOID )
637 572
           $Factor = $Factor + abs($Value);
638 573
         }
639 574
 
640
-       if ( $Factor != 0 )
641
-        {
575
+       if ( $Factor != 0 ) {
642 576
          $Factor = $NormalizationFactor / $Factor;
643 577
 
644
-         foreach ($SelectedSeries as $Key => $SerieName )
645
-          {
578
+         foreach ($SelectedSeries as $Key => $SerieName ) {
646 579
            $Value = $this->Data["Series"][$SerieName]["Data"][$i];
647 580
 
648 581
            if ( $Value != VOID && $Factor != $NormalizationFactor )
@@ -655,41 +588,33 @@  discard block
 block discarded – undo
655 588
         }
656 589
       }
657 590
 
658
-     foreach ($SelectedSeries as $Key => $SerieName )
659
-      {
591
+     foreach ($SelectedSeries as $Key => $SerieName ) {
660 592
        $this->Data["Series"][$SerieName]["Max"] = max($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
661 593
        $this->Data["Series"][$SerieName]["Min"] = min($this->stripVOID($this->Data["Series"][$SerieName]["Data"]));
662 594
       }
663 595
     }
664 596
 
665 597
    /* Load data from a CSV (or similar) data source */
666
-   function importFromCSV($FileName,$Options="")
667
-    {
598
+   function importFromCSV($FileName,$Options="") {
668 599
      $Delimiter		= isset($Options["Delimiter"]) ? $Options["Delimiter"] : ",";
669 600
      $GotHeader		= isset($Options["GotHeader"]) ? $Options["GotHeader"] : FALSE;
670 601
      $SkipColumns	= isset($Options["SkipColumns"]) ? $Options["SkipColumns"] : array(-1);
671 602
      $DefaultSerieName	= isset($Options["DefaultSerieName"]) ? $Options["DefaultSerieName"] : "Serie";
672 603
 
673 604
      $Handle = @fopen($FileName,"r");
674
-     if ($Handle)
675
-      {
605
+     if ($Handle) {
676 606
        $HeaderParsed = FALSE; $SerieNames = "";
677
-       while (!feof($Handle))
678
-        {
607
+       while (!feof($Handle)) {
679 608
          $Buffer = fgets($Handle, 4096);
680 609
          $Buffer = str_replace(chr(10),"",$Buffer);
681 610
          $Buffer = str_replace(chr(13),"",$Buffer);
682 611
          $Values = preg_split("/".$Delimiter."/",$Buffer);
683 612
 
684
-         if ( $Buffer != "" )
685
-          {
686
-           if ( $GotHeader && !$HeaderParsed )
687
-            {
613
+         if ( $Buffer != "" ) {
614
+           if ( $GotHeader && !$HeaderParsed ) {
688 615
              foreach($Values as $Key => $Name) { if ( !in_array($Key,$SkipColumns) ) { $SerieNames[$Key] = $Name; } }
689 616
              $HeaderParsed = TRUE;
690
-            }
691
-           else
692
-            {
617
+            } else {
693 618
              if ($SerieNames == "" ) { foreach($Values as $Key => $Name) {  if ( !in_array($Key,$SkipColumns) ) { $SerieNames[$Key] = $DefaultSerieName.$Key; } } }
694 619
              foreach($Values as $Key => $Value) {  if ( !in_array($Key,$SkipColumns) ) { $this->addPoints($Value,$SerieNames[$Key]); } }
695 620
             }
@@ -700,8 +625,7 @@  discard block
 block discarded – undo
700 625
     }
701 626
 
702 627
    /* Create a dataset based on a formula */
703
-   function createFunctionSerie($SerieName,$Formula="",$Options="")
704
-    {
628
+   function createFunctionSerie($SerieName,$Formula="",$Options="") {
705 629
      $MinX		= isset($Options["MinX"]) ? $Options["MinX"] : -10;
706 630
      $MaxX		= isset($Options["MaxX"]) ? $Options["MaxX"] : 10;
707 631
      $XStep		= isset($Options["XStep"]) ? $Options["XStep"] : 1;
@@ -712,8 +636,7 @@  discard block
 block discarded – undo
712 636
      if ( $Formula == "" ) { return(0); }
713 637
 
714 638
      $Result = ""; $Abscissa = "";
715
-     for($i=$MinX; $i<=$MaxX; $i=$i+$XStep)
716
-      {
639
+     for($i=$MinX; $i<=$MaxX; $i=$i+$XStep) {
717 640
        $Expression = "\$return = '!'.(".str_replace("z",$i,$Formula).");";
718 641
        if ( @eval($Expression) === FALSE ) { $return = VOID; }
719 642
        if ( $return == "!" ) { $return = VOID; } else { $return = $this->right($return,strlen($return)-1); }
@@ -730,13 +653,10 @@  discard block
 block discarded – undo
730 653
      if ( $RecordAbscissa ) { $this->addPoints($Abscissa,$AbscissaSerie); }
731 654
     }
732 655
 
733
-   function negateValues($Series)
734
-    {
656
+   function negateValues($Series) {
735 657
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
736
-     foreach($Series as $Key => $SerieName)
737
-      {
738
-       if (isset($this->Data["Series"][$SerieName]))
739
-        {
658
+     foreach($Series as $Key => $SerieName) {
659
+       if (isset($this->Data["Series"][$SerieName])) {
740 660
          $Data = "";
741 661
          foreach($this->Data["Series"][$SerieName]["Data"] as $Key => $Value)
742 662
           { if ( $Value == VOID ) { $Data[] = VOID; } else { $Data[] = -$Value; } }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
     {
71 71
      $this->Data = "";
72 72
      $this->Data["XAxisDisplay"]	= AXIS_FORMAT_DEFAULT;
73
-     $this->Data["XAxisFormat"]		= NULL;
74
-     $this->Data["XAxisName"]		= NULL;
75
-     $this->Data["XAxisUnit"]		= NULL;
76
-     $this->Data["Abscissa"]		= NULL;
73
+     $this->Data["XAxisFormat"]		= null;
74
+     $this->Data["XAxisName"]		= null;
75
+     $this->Data["XAxisUnit"]		= null;
76
+     $this->Data["Abscissa"]		= null;
77 77
      $this->Data["AbsicssaPosition"]	= AXIS_POSITION_BOTTOM;
78 78
 
79 79
      $this->Data["Axis"][0]["Display"]  = AXIS_FORMAT_DEFAULT;
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 
122 122
    /* Return a value from given serie & index */
123 123
    function getValueAt($Serie,$Index=0)
124
-    { if (isset($this->Data["Series"][$Serie]["Data"][$Index])) { return($this->Data["Series"][$Serie]["Data"][$Index]); } else { return(NULL); } }
124
+    { if (isset($this->Data["Series"][$Serie]["Data"][$Index])) { return($this->Data["Series"][$Serie]["Data"][$Index]); } else { return(null); } }
125 125
 
126 126
    /* Return the values array */
127 127
    function getValues($Serie)
128
-    { if (isset($this->Data["Series"][$Serie]["Data"])) { return($this->Data["Series"][$Serie]["Data"]); } else { return(NULL); } }
128
+    { if (isset($this->Data["Series"][$Serie]["Data"])) { return($this->Data["Series"][$Serie]["Data"]); } else { return(null); } }
129 129
 
130 130
    /* Reverse the values in the given serie */
131 131
    function reverseSerie($Series)
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
 
137 137
    /* Return the sum of the serie values */
138 138
    function getSum($Serie)
139
-    { if (isset($this->Data["Series"][$Serie])) { return(array_sum($this->Data["Series"][$Serie]["Data"])); } else { return(NULL); } }
139
+    { if (isset($this->Data["Series"][$Serie])) { return(array_sum($this->Data["Series"][$Serie]["Data"])); } else { return(null); } }
140 140
 
141 141
    /* Return the max value of a given serie */
142 142
    function getMax($Serie)
143
-    { if (isset($this->Data["Series"][$Serie]["Max"])) { return($this->Data["Series"][$Serie]["Max"]); } else { return(NULL); } }
143
+    { if (isset($this->Data["Series"][$Serie]["Max"])) { return($this->Data["Series"][$Serie]["Max"]); } else { return(null); } }
144 144
 
145 145
    /* Return the min value of a given serie */
146 146
    function getMin($Serie)
147
-    { if (isset($this->Data["Series"][$Serie]["Min"])) { return($this->Data["Series"][$Serie]["Min"]); } else { return(NULL); } }
147
+    { if (isset($this->Data["Series"][$Serie]["Min"])) { return($this->Data["Series"][$Serie]["Min"]); } else { return(null); } }
148 148
 
149 149
    /* Set the description of a given serie */
150 150
    function setSerieShape($Series,$Shape=SERIE_SHAPE_FILLEDCIRCLE)
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
     }
162 162
 
163 163
    /* Set a serie as "drawable" while calling a rendering function */
164
-   function setSerieDrawable($Series,$Drawable=TRUE)
164
+   function setSerieDrawable($Series,$Drawable=true)
165 165
     {
166 166
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
167 167
      foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["isDrawable"] = $Drawable; } }
168 168
     }
169 169
 
170 170
    /* Set the icon associated to a given serie */
171
-   function setSeriePicture($Series,$Picture=NULL)
171
+   function setSeriePicture($Series,$Picture=null)
172 172
     {
173 173
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
174 174
      foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Picture"] = $Picture; } }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     { $this->Data["XAxisName"] = $Name; }
180 180
 
181 181
    /* Set the display mode of the  X Axis */
182
-   function setXAxisDisplay($Mode,$Format=NULL)
182
+   function setXAxisDisplay($Mode,$Format=null)
183 183
     { $this->Data["XAxisDisplay"] = $Mode; $this->Data["XAxisFormat"]  = $Format; }
184 184
 
185 185
    /* Set the unit that will be displayed on the X axis */
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
     { if (isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Description"] = $Description; } }
211 211
 
212 212
    /* Set the icon associated to a given scatter serie */
213
-   function setScatterSeriePicture($ID,$Picture=NULL)
213
+   function setScatterSeriePicture($ID,$Picture=null)
214 214
     { if (isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Picture"] = $Picture; } }
215 215
 
216 216
    /* Set a scatter serie as "drawable" while calling a rendering function */
217
-   function setScatterSerieDrawable($ID ,$Drawable=TRUE)
217
+   function setScatterSerieDrawable($ID ,$Drawable=true)
218 218
     { if (isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["isDrawable"] = $Drawable; } }
219 219
 
220 220
    /* Define if a scatter serie should be draw with ticks */
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 
251 251
      foreach($this->Data["Series"] as $Key => $Value)
252 252
       {
253
-       if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"] == TRUE)
253
+       if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"] == true)
254 254
         {
255 255
          if ( $GlobalMin > $this->Data["Series"][$Key]["Min"] ) { $GlobalMin = $this->Data["Series"][$Key]["Min"]; }
256 256
          if ( $GlobalMax < $this->Data["Series"][$Key]["Max"] ) { $GlobalMax = $this->Data["Series"][$Key]["Max"]; }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
    /* Mark all series as drawable */
266 266
    function drawAll()
267
-    { foreach($this->Data["Series"] as $Key => $Value) { if ( $this->Data["Abscissa"] != $Key ) { $this->Data["Series"][$Key]["isDrawable"]=TRUE; } } }    
267
+    { foreach($this->Data["Series"] as $Key => $Value) { if ( $this->Data["Abscissa"] != $Key ) { $this->Data["Series"][$Key]["isDrawable"]=true; } } }    
268 268
 
269 269
    /* Return the average value of the given serie */
270 270
    function getSerieAverage($Serie)
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
        return(array_sum($SerieData)/sizeof($SerieData));
276 276
       }
277 277
      else
278
-      return(NULL);
278
+      return(null);
279 279
     }
280 280
 
281 281
    /* Return the geometric mean of the given serie */
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
        return(pow($Seriesum,1/sizeof($SerieData)));
289 289
       }
290 290
      else
291
-      return(NULL);
291
+      return(null);
292 292
     }
293 293
 
294 294
    /* Return the harmonic mean of the given serie */
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
        return(sizeof($SerieData)/$Seriesum);
302 302
       }
303 303
      else
304
-      return(NULL);
304
+      return(null);
305 305
     }
306 306
 
307 307
    /* Return the standard deviation of the given serie */
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
        return($Deviation);
322 322
       }
323 323
      else
324
-      return(NULL);
324
+      return(null);
325 325
     }
326 326
 
327 327
    /* Return the Coefficient of variation of the given serie */
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
        if ( $StandardDeviation != 0 )
336 336
         return($StandardDeviation/$Average);
337 337
        else
338
-        return(NULL);
338
+        return(null);
339 339
       }
340 340
      else
341
-      return(NULL);
341
+      return(null);
342 342
     }
343 343
 
344 344
    /* Return the median value of the given serie */
@@ -353,16 +353,16 @@  discard block
 block discarded – undo
353 353
        if ( isset($SerieData[$SerieCenter]) )
354 354
         return($SerieData[$SerieCenter]);
355 355
        else
356
-        return(NULL);
356
+        return(null);
357 357
       }
358 358
      else
359
-      return(NULL);
359
+      return(null);
360 360
     }
361 361
 
362 362
    /* Return the x th percentil of the given serie */
363 363
    function getSeriePercentile($Serie="Serie1",$Percentil=95)
364 364
     {
365
-     if (!isset($this->Data["Series"][$Serie]["Data"])) { return(NULL); }
365
+     if (!isset($this->Data["Series"][$Serie]["Data"])) { return(null); }
366 366
 
367 367
      $Values = count($this->Data["Series"][$Serie]["Data"])-1;
368 368
      if ( $Values < 0 ) { $Values = 0; }
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
      if ( is_numeric($SortedValues[$PercentilID]) )
375 375
       return($SortedValues[$PercentilID]);
376 376
      else
377
-      return(NULL);
377
+      return(null);
378 378
     }
379 379
 
380 380
    /* Add random values to a given serie */
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      $Values    = isset($Options["Values"]) ? $Options["Values"] : 20;
384 384
      $Min       = isset($Options["Min"]) ? $Options["Min"] : 0;
385 385
      $Max       = isset($Options["Max"]) ? $Options["Max"] : 100;
386
-     $withFloat = isset($Options["withFloat"]) ? $Options["withFloat"] : FALSE;
386
+     $withFloat = isset($Options["withFloat"]) ? $Options["withFloat"] : false;
387 387
 
388 388
      for ($i=0;$i<=$Values;$i++)
389 389
       {
@@ -395,21 +395,21 @@  discard block
 block discarded – undo
395 395
    /* Test if we have valid data */
396 396
    function containsData()
397 397
     {
398
-     if (!isset($this->Data["Series"])) { return(FALSE); }
398
+     if (!isset($this->Data["Series"])) { return(false); }
399 399
 
400
-     $Result = FALSE;
400
+     $Result = false;
401 401
      foreach($this->Data["Series"] as $Key => $Value)
402
-      { if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"]==TRUE) { $Result=TRUE; } }
402
+      { if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"]==true) { $Result=true; } }
403 403
      return($Result);
404 404
     }
405 405
 
406 406
    /* Set the display mode of an Axis */
407
-   function setAxisDisplay($AxisID,$Mode=AXIS_FORMAT_DEFAULT,$Format=NULL)
407
+   function setAxisDisplay($AxisID,$Mode=AXIS_FORMAT_DEFAULT,$Format=null)
408 408
     {
409 409
      if ( isset($this->Data["Axis"][$AxisID] ) )
410 410
       {
411 411
        $this->Data["Axis"][$AxisID]["Display"] = $Mode;
412
-       if ( $Format != NULL ) { $this->Data["Axis"][$AxisID]["Format"] = $Format; }
412
+       if ( $Format != null ) { $this->Data["Axis"][$AxisID]["Format"] = $Format; }
413 413
       }
414 414
     }
415 415
 
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
        $this->Data["Series"][$Serie]["Axis"] = $AxisID;
463 463
 
464 464
        /* Cleanup unused axis */
465
-       $Found = FALSE;
466
-       foreach($this->Data["Series"] as $SerieName => $Values) { if ( $Values["Axis"] == $PreviousAxis ) { $Found = TRUE; } }
465
+       $Found = false;
466
+       foreach($this->Data["Series"] as $SerieName => $Values) { if ( $Values["Axis"] == $PreviousAxis ) { $Found = true; } }
467 467
        if (!$Found) { unset($this->Data["Axis"][$PreviousAxis]); }
468 468
       }
469 469
     }
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
    /* Returns the palette of the given serie */
486 486
    function getSeriePalette($Serie)
487 487
     {
488
-     if ( !isset($this->Data["Series"][$Serie]) ) { return(NULL); }
488
+     if ( !isset($this->Data["Series"][$Serie]) ) { return(null); }
489 489
 
490 490
      $Result = "";
491 491
      $Result["R"] = $this->Data["Series"][$Serie]["Color"]["R"];
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
     }
498 498
 
499 499
    /* Set the color of one serie */
500
-   function setPalette($Series,$Format=NULL)
500
+   function setPalette($Series,$Format=null)
501 501
     {
502 502
      if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); }
503 503
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
     }
525 525
 
526 526
    /* Load a palette file */
527
-   function loadPalette($FileName,$Overwrite=FALSE)
527
+   function loadPalette($FileName,$Overwrite=false)
528 528
     {
529 529
      if ( !file_exists($FileName) ) { return(-1); }
530 530
      if ( $Overwrite ) { $this->Palette = ""; }
@@ -564,8 +564,8 @@  discard block
 block discarded – undo
564 564
      if ( isset($this->Data["ScatterSeries"][$ID]) ) { return(0); }
565 565
 
566 566
      $this->Data["ScatterSeries"][$ID]["Description"]	= "Scatter ".$ID;
567
-     $this->Data["ScatterSeries"][$ID]["isDrawable"]	= TRUE;
568
-     $this->Data["ScatterSeries"][$ID]["Picture"]	= NULL;
567
+     $this->Data["ScatterSeries"][$ID]["isDrawable"]	= true;
568
+     $this->Data["ScatterSeries"][$ID]["Picture"]	= null;
569 569
      $this->Data["ScatterSeries"][$ID]["Ticks"]		= 0;
570 570
      $this->Data["ScatterSeries"][$ID]["Weight"]	= 0;
571 571
 
@@ -586,10 +586,10 @@  discard block
 block discarded – undo
586 586
      if ( isset($this->Data["Series"]) ) { $ID = count($this->Data["Series"]); } else { $ID = 0; }
587 587
 
588 588
      $this->Data["Series"][$Serie]["Description"]	= $Serie;
589
-     $this->Data["Series"][$Serie]["isDrawable"]	= TRUE;
590
-     $this->Data["Series"][$Serie]["Picture"]		= NULL;
591
-     $this->Data["Series"][$Serie]["Max"]		= NULL;
592
-     $this->Data["Series"][$Serie]["Min"]		= NULL;
589
+     $this->Data["Series"][$Serie]["isDrawable"]	= true;
590
+     $this->Data["Series"][$Serie]["Picture"]		= null;
591
+     $this->Data["Series"][$Serie]["Max"]		= null;
592
+     $this->Data["Series"][$Serie]["Min"]		= null;
593 593
      $this->Data["Series"][$Serie]["Axis"]		= 0;
594 594
      $this->Data["Series"][$Serie]["Ticks"]		= 0;
595 595
      $this->Data["Series"][$Serie]["Weight"]		= 0;
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
       }
607 607
     }
608 608
      
609
-   function normalize($NormalizationFactor=100,$UnitChange=NULL,$Round=1)
609
+   function normalize($NormalizationFactor=100,$UnitChange=null,$Round=1)
610 610
     {
611 611
      $Abscissa = $this->Data["Abscissa"];
612 612
 
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
      $MaxVal         = 0;
615 615
      foreach($this->Data["Axis"] as $AxisID => $Axis)
616 616
       {
617
-       if ( $UnitChange != NULL ) { $this->Data["Axis"][$AxisID]["Unit"] = $UnitChange; }
617
+       if ( $UnitChange != null ) { $this->Data["Axis"][$AxisID]["Unit"] = $UnitChange; }
618 618
 
619 619
        foreach($this->Data["Series"] as $SerieName => $Serie)
620 620
         {
621
-         if ($Serie["Axis"] == $AxisID && $Serie["isDrawable"] == TRUE && $SerieName != $Abscissa)
621
+         if ($Serie["Axis"] == $AxisID && $Serie["isDrawable"] == true && $SerieName != $Abscissa)
622 622
           {
623 623
            $SelectedSeries[$SerieName] = $SerieName;
624 624
 
@@ -666,14 +666,14 @@  discard block
 block discarded – undo
666 666
    function importFromCSV($FileName,$Options="")
667 667
     {
668 668
      $Delimiter		= isset($Options["Delimiter"]) ? $Options["Delimiter"] : ",";
669
-     $GotHeader		= isset($Options["GotHeader"]) ? $Options["GotHeader"] : FALSE;
669
+     $GotHeader		= isset($Options["GotHeader"]) ? $Options["GotHeader"] : false;
670 670
      $SkipColumns	= isset($Options["SkipColumns"]) ? $Options["SkipColumns"] : array(-1);
671 671
      $DefaultSerieName	= isset($Options["DefaultSerieName"]) ? $Options["DefaultSerieName"] : "Serie";
672 672
 
673 673
      $Handle = @fopen($FileName,"r");
674 674
      if ($Handle)
675 675
       {
676
-       $HeaderParsed = FALSE; $SerieNames = "";
676
+       $HeaderParsed = false; $SerieNames = "";
677 677
        while (!feof($Handle))
678 678
         {
679 679
          $Buffer = fgets($Handle, 4096);
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
            if ( $GotHeader && !$HeaderParsed )
687 687
             {
688 688
              foreach($Values as $Key => $Name) { if ( !in_array($Key,$SkipColumns) ) { $SerieNames[$Key] = $Name; } }
689
-             $HeaderParsed = TRUE;
689
+             $HeaderParsed = true;
690 690
             }
691 691
            else
692 692
             {
@@ -705,8 +705,8 @@  discard block
 block discarded – undo
705 705
      $MinX		= isset($Options["MinX"]) ? $Options["MinX"] : -10;
706 706
      $MaxX		= isset($Options["MaxX"]) ? $Options["MaxX"] : 10;
707 707
      $XStep		= isset($Options["XStep"]) ? $Options["XStep"] : 1;
708
-     $AutoDescription	= isset($Options["AutoDescription"]) ? $Options["AutoDescription"] : FALSE;
709
-     $RecordAbscissa	= isset($Options["RecordAbscissa"]) ? $Options["RecordAbscissa"] : FALSE;
708
+     $AutoDescription	= isset($Options["AutoDescription"]) ? $Options["AutoDescription"] : false;
709
+     $RecordAbscissa	= isset($Options["RecordAbscissa"]) ? $Options["RecordAbscissa"] : false;
710 710
      $AbscissaSerie	= isset($Options["AbscissaSerie"]) ? $Options["AbscissaSerie"] : "Abscissa";
711 711
 
712 712
      if ( $Formula == "" ) { return(0); }
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
      for($i=$MinX; $i<=$MaxX; $i=$i+$XStep)
716 716
       {
717 717
        $Expression = "\$return = '!'.(".str_replace("z",$i,$Formula).");";
718
-       if ( @eval($Expression) === FALSE ) { $return = VOID; }
718
+       if ( @eval($Expression) === false ) { $return = VOID; }
719 719
        if ( $return == "!" ) { $return = VOID; } else { $return = $this->right($return,strlen($return)-1); }
720 720
        if ( $return == "NAN" ) { $return = VOID; }
721 721
        if ( $return == "INF" ) { $return = VOID; }
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pBubble.class.php 4 patches
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pBubble - class to draw bubble charts
4 4
 
5 5
      Version     : 2.1.3
@@ -13,314 +13,314 @@  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("BUBBLE_SHAPE_ROUND"		, 700001);
17
- define("BUBBLE_SHAPE_SQUARE"		, 700002);
16
+    define("BUBBLE_SHAPE_ROUND"		, 700001);
17
+    define("BUBBLE_SHAPE_SQUARE"		, 700002);
18 18
 
19
- /* pBubble class definition */
20
- class pBubble
21
-  {
22
-   var $pChartObject;
23
-   var $pDataObject;
19
+    /* pBubble class definition */
20
+    class pBubble
21
+    {
22
+    var $pChartObject;
23
+    var $pDataObject;
24 24
 
25
-   /* Class creator */
26
-   function pBubble($pChartObject,$pDataObject)
25
+    /* Class creator */
26
+    function pBubble($pChartObject,$pDataObject)
27 27
     {
28
-     $this->pChartObject = $pChartObject;
29
-     $this->pDataObject  = $pDataObject;
28
+        $this->pChartObject = $pChartObject;
29
+        $this->pDataObject  = $pDataObject;
30 30
     }
31 31
 
32
-   /* Prepare the scale */
33
-   function bubbleScale($DataSeries,$WeightSeries)
32
+    /* Prepare the scale */
33
+    function bubbleScale($DataSeries,$WeightSeries)
34 34
     {
35
-     if ( !is_array($DataSeries) )	{ $DataSeries = array($DataSeries); }
36
-     if ( !is_array($WeightSeries) )	{ $WeightSeries = array($WeightSeries); }
35
+        if ( !is_array($DataSeries) )	{ $DataSeries = array($DataSeries); }
36
+        if ( !is_array($WeightSeries) )	{ $WeightSeries = array($WeightSeries); }
37 37
 
38
-     /* Parse each data series to find the new min & max boundaries to scale */
39
-     $NewPositiveSerie = ""; $NewNegativeSerie = ""; $MaxValues = 0; $LastPositive = 0; $LastNegative = 0;
40
-     foreach($DataSeries as $Key => $SerieName)
41
-      {
42
-       $SerieWeightName = $WeightSeries[$Key];
38
+        /* Parse each data series to find the new min & max boundaries to scale */
39
+        $NewPositiveSerie = ""; $NewNegativeSerie = ""; $MaxValues = 0; $LastPositive = 0; $LastNegative = 0;
40
+        foreach($DataSeries as $Key => $SerieName)
41
+        {
42
+        $SerieWeightName = $WeightSeries[$Key];
43 43
 
44
-       $this->pDataObject->setSerieDrawable($SerieWeightName,FALSE);
44
+        $this->pDataObject->setSerieDrawable($SerieWeightName,FALSE);
45 45
 
46
-       if ( count($this->pDataObject->Data["Series"][$SerieName]["Data"]) > $MaxValues ) { $MaxValues = count($this->pDataObject->Data["Series"][$SerieName]["Data"]); }
46
+        if ( count($this->pDataObject->Data["Series"][$SerieName]["Data"]) > $MaxValues ) { $MaxValues = count($this->pDataObject->Data["Series"][$SerieName]["Data"]); }
47 47
 
48
-       foreach($this->pDataObject->Data["Series"][$SerieName]["Data"] as $Key => $Value)
48
+        foreach($this->pDataObject->Data["Series"][$SerieName]["Data"] as $Key => $Value)
49 49
         {
50
-         if ( $Value >= 0 )
51
-          {
52
-           $BubbleBounds = $Value + $this->pDataObject->Data["Series"][$SerieWeightName]["Data"][$Key];
50
+            if ( $Value >= 0 )
51
+            {
52
+            $BubbleBounds = $Value + $this->pDataObject->Data["Series"][$SerieWeightName]["Data"][$Key];
53 53
 
54
-           if ( !isset($NewPositiveSerie[$Key]) )
54
+            if ( !isset($NewPositiveSerie[$Key]) )
55 55
             { $NewPositiveSerie[$Key] = $BubbleBounds; }
56
-           elseif ( $NewPositiveSerie[$Key] < $BubbleBounds )
56
+            elseif ( $NewPositiveSerie[$Key] < $BubbleBounds )
57 57
             { $NewPositiveSerie[$Key] = $BubbleBounds; }
58 58
 
59
-           $LastPositive = $BubbleBounds;
60
-          }
61
-         else
62
-          {
63
-           $BubbleBounds = $Value - $this->pDataObject->Data["Series"][$SerieWeightName]["Data"][$Key];
59
+            $LastPositive = $BubbleBounds;
60
+            }
61
+            else
62
+            {
63
+            $BubbleBounds = $Value - $this->pDataObject->Data["Series"][$SerieWeightName]["Data"][$Key];
64 64
 
65
-           if ( !isset($NewNegativeSerie[$Key]) )
65
+            if ( !isset($NewNegativeSerie[$Key]) )
66 66
             { $NewNegativeSerie[$Key] = $BubbleBounds; }
67
-           elseif ( $NewNegativeSerie[$Key] > $BubbleBounds )
67
+            elseif ( $NewNegativeSerie[$Key] > $BubbleBounds )
68 68
             { $NewNegativeSerie[$Key] = $BubbleBounds; }
69 69
 
70
-           $LastNegative = $BubbleBounds;
71
-          }
70
+            $LastNegative = $BubbleBounds;
71
+            }
72
+        }
72 73
         }
73
-      }
74 74
 
75
-     /* Check for missing values and all the fake positive serie */
76
-     if ( $NewPositiveSerie != "" )
77
-      {
78
-       for ($i=0; $i<$MaxValues; $i++) { if (!isset($NewPositiveSerie[$i])) { $NewPositiveSerie[$i] = $LastPositive; } }
75
+        /* Check for missing values and all the fake positive serie */
76
+        if ( $NewPositiveSerie != "" )
77
+        {
78
+        for ($i=0; $i<$MaxValues; $i++) { if (!isset($NewPositiveSerie[$i])) { $NewPositiveSerie[$i] = $LastPositive; } }
79 79
 
80
-       $this->pDataObject->addPoints($NewPositiveSerie,"BubbleFakePositiveSerie");
81
-      }
80
+        $this->pDataObject->addPoints($NewPositiveSerie,"BubbleFakePositiveSerie");
81
+        }
82 82
 
83
-     /* Check for missing values and all the fake negative serie */
84
-     if ( $NewNegativeSerie != "" )
85
-      {
86
-       for ($i=0; $i<$MaxValues; $i++) { if (!isset($NewNegativeSerie[$i])) { $NewNegativeSerie[$i] = $LastNegative; } }
83
+        /* Check for missing values and all the fake negative serie */
84
+        if ( $NewNegativeSerie != "" )
85
+        {
86
+        for ($i=0; $i<$MaxValues; $i++) { if (!isset($NewNegativeSerie[$i])) { $NewNegativeSerie[$i] = $LastNegative; } }
87 87
 
88
-       $this->pDataObject->addPoints($NewNegativeSerie,"BubbleFakeNegativeSerie");
89
-      }
88
+        $this->pDataObject->addPoints($NewNegativeSerie,"BubbleFakeNegativeSerie");
89
+        }
90 90
     }
91 91
 
92
-   function resetSeriesColors()
92
+    function resetSeriesColors()
93 93
     {
94
-     $Data    = $this->pDataObject->getData();
95
-     $Palette = $this->pDataObject->getPalette();
94
+        $Data    = $this->pDataObject->getData();
95
+        $Palette = $this->pDataObject->getPalette();
96 96
 
97
-     $ID = 0;
98
-     foreach($Data["Series"] as $SerieName => $SeriesParameters)
99
-      {
100
-       if ( $SeriesParameters["isDrawable"] )
97
+        $ID = 0;
98
+        foreach($Data["Series"] as $SerieName => $SeriesParameters)
101 99
         {
102
-         $this->pDataObject->Data["Series"][$SerieName]["Color"]["R"]     = $Palette[$ID]["R"];
103
-         $this->pDataObject->Data["Series"][$SerieName]["Color"]["G"]     = $Palette[$ID]["G"];
104
-         $this->pDataObject->Data["Series"][$SerieName]["Color"]["B"]     = $Palette[$ID]["B"];
105
-         $this->pDataObject->Data["Series"][$SerieName]["Color"]["Alpha"] = $Palette[$ID]["Alpha"];
106
-         $ID++;
100
+        if ( $SeriesParameters["isDrawable"] )
101
+        {
102
+            $this->pDataObject->Data["Series"][$SerieName]["Color"]["R"]     = $Palette[$ID]["R"];
103
+            $this->pDataObject->Data["Series"][$SerieName]["Color"]["G"]     = $Palette[$ID]["G"];
104
+            $this->pDataObject->Data["Series"][$SerieName]["Color"]["B"]     = $Palette[$ID]["B"];
105
+            $this->pDataObject->Data["Series"][$SerieName]["Color"]["Alpha"] = $Palette[$ID]["Alpha"];
106
+            $ID++;
107
+        }
107 108
         }
108
-      }
109 109
     }
110 110
 
111
-   /* Prepare the scale */
112
-   function drawBubbleChart($DataSeries,$WeightSeries,$Format="")
111
+    /* Prepare the scale */
112
+    function drawBubbleChart($DataSeries,$WeightSeries,$Format="")
113 113
     {
114
-     $ForceAlpha	= isset($Format["ForceAlpha"]) ? $Format["ForceAlpha"] : VOID;
115
-     $DrawBorder	= isset($Format["DrawBorder"]) ? $Format["DrawBorder"] : TRUE;
116
-     $BorderWidth	= isset($Format["BorderWidth"]) ? $Format["BorderWidth"] : 1;
117
-     $Shape		= isset($Format["Shape"]) ? $Format["Shape"] : BUBBLE_SHAPE_ROUND;
118
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
119
-     $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
120
-     $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
121
-     $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
122
-     $BorderAlpha	= isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30;
123
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
114
+        $ForceAlpha	= isset($Format["ForceAlpha"]) ? $Format["ForceAlpha"] : VOID;
115
+        $DrawBorder	= isset($Format["DrawBorder"]) ? $Format["DrawBorder"] : TRUE;
116
+        $BorderWidth	= isset($Format["BorderWidth"]) ? $Format["BorderWidth"] : 1;
117
+        $Shape		= isset($Format["Shape"]) ? $Format["Shape"] : BUBBLE_SHAPE_ROUND;
118
+        $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
119
+        $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
120
+        $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
121
+        $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
122
+        $BorderAlpha	= isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30;
123
+        $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
124 124
 
125
-     if ( !is_array($DataSeries) )	{ $DataSeries = array($DataSeries); }
126
-     if ( !is_array($WeightSeries) )	{ $WeightSeries = array($WeightSeries); }
125
+        if ( !is_array($DataSeries) )	{ $DataSeries = array($DataSeries); }
126
+        if ( !is_array($WeightSeries) )	{ $WeightSeries = array($WeightSeries); }
127 127
 
128
-     $Data    = $this->pDataObject->getData();
129
-     $Palette = $this->pDataObject->getPalette();
128
+        $Data    = $this->pDataObject->getData();
129
+        $Palette = $this->pDataObject->getPalette();
130 130
 
131
-     if ( isset($Data["Series"]["BubbleFakePositiveSerie"] ) ) { $this->pDataObject->setSerieDrawable("BubbleFakePositiveSerie",FALSE); }
132
-     if ( isset($Data["Series"]["BubbleFakeNegativeSerie"] ) ) { $this->pDataObject->setSerieDrawable("BubbleFakeNegativeSerie",FALSE); }
131
+        if ( isset($Data["Series"]["BubbleFakePositiveSerie"] ) ) { $this->pDataObject->setSerieDrawable("BubbleFakePositiveSerie",FALSE); }
132
+        if ( isset($Data["Series"]["BubbleFakeNegativeSerie"] ) ) { $this->pDataObject->setSerieDrawable("BubbleFakeNegativeSerie",FALSE); }
133 133
 
134
-     $this->resetSeriesColors();
134
+        $this->resetSeriesColors();
135 135
 
136
-     list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
136
+        list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
137 137
 
138
-     foreach($DataSeries as $Key => $SerieName)
139
-      {
140
-       $AxisID	= $Data["Series"][$SerieName]["Axis"];
141
-       $Mode	= $Data["Axis"][$AxisID]["Display"];
142
-       $Format	= $Data["Axis"][$AxisID]["Format"];
143
-       $Unit	= $Data["Axis"][$AxisID]["Unit"];
138
+        foreach($DataSeries as $Key => $SerieName)
139
+        {
140
+        $AxisID	= $Data["Series"][$SerieName]["Axis"];
141
+        $Mode	= $Data["Axis"][$AxisID]["Display"];
142
+        $Format	= $Data["Axis"][$AxisID]["Format"];
143
+        $Unit	= $Data["Axis"][$AxisID]["Unit"];
144 144
 
145
-       if (isset($Data["Series"][$SerieName]["Description"])) { $SerieDescription = $Data["Series"][$SerieName]["Description"]; } else { $SerieDescription = $SerieName; }
145
+        if (isset($Data["Series"][$SerieName]["Description"])) { $SerieDescription = $Data["Series"][$SerieName]["Description"]; } else { $SerieDescription = $SerieName; }
146 146
 
147
-       $XStep	= ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
147
+        $XStep	= ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
148 148
 
149
-       $X = $this->pChartObject->GraphAreaX1 + $XMargin;
150
-       $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
149
+        $X = $this->pChartObject->GraphAreaX1 + $XMargin;
150
+        $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
151 151
 
152
-       $Color = array("R"=>$Palette[$Key]["R"],"G"=>$Palette[$Key]["G"],"B"=>$Palette[$Key]["B"],"Alpha"=>$Palette[$Key]["Alpha"]);
152
+        $Color = array("R"=>$Palette[$Key]["R"],"G"=>$Palette[$Key]["G"],"B"=>$Palette[$Key]["B"],"Alpha"=>$Palette[$Key]["Alpha"]);
153 153
 
154
-       if ( $ForceAlpha != VOID ) { $Color["Alpha"]=$ForceAlpha; }
154
+        if ( $ForceAlpha != VOID ) { $Color["Alpha"]=$ForceAlpha; }
155 155
 
156
-       if ( $DrawBorder )
156
+        if ( $DrawBorder )
157 157
         {
158
-         if ( $BorderWidth != 1 )
159
-          {
160
-           if ( $Surrounding != NULL )
158
+            if ( $BorderWidth != 1 )
159
+            {
160
+            if ( $Surrounding != NULL )
161 161
             { $BorderR = $Palette[$Key]["R"]+$Surrounding; $BorderG = $Palette[$Key]["G"]+$Surrounding; $BorderB = $Palette[$Key]["B"]+$Surrounding; }
162
-           else
162
+            else
163 163
             { $BorderR = $BorderR; $BorderG = $BorderG; $BorderB = $BorderB; }
164
-           if ( $ForceAlpha != VOID ) { $BorderAlpha = $ForceAlpha/2; }
165
-           $BorderColor = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
166
-          }
167
-         else
168
-          {
169
-           $Color["BorderAlpha"] = $BorderAlpha;
170
-
171
-           if ( $Surrounding != NULL )
164
+            if ( $ForceAlpha != VOID ) { $BorderAlpha = $ForceAlpha/2; }
165
+            $BorderColor = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
166
+            }
167
+            else
168
+            {
169
+            $Color["BorderAlpha"] = $BorderAlpha;
170
+
171
+            if ( $Surrounding != NULL )
172 172
             { $Color["BorderR"] = $Palette[$Key]["R"]+$Surrounding; $Color["BorderG"] = $Palette[$Key]["G"]+$Surrounding; $Color["BorderB"] = $Palette[$Key]["B"]+$Surrounding; }
173
-           else
173
+            else
174 174
             { $Color["BorderR"] = $BorderR; $Color["BorderG"] = $BorderG; $Color["BorderB"] = $BorderB; }
175
-           if ( $ForceAlpha != VOID ) { $Color["BorderAlpha"] = $ForceAlpha/2; }
176
-          }
175
+            if ( $ForceAlpha != VOID ) { $Color["BorderAlpha"] = $ForceAlpha/2; }
176
+            }
177 177
         }
178 178
 
179
-       foreach($Data["Series"][$SerieName]["Data"] as $iKey => $Point)
179
+        foreach($Data["Series"][$SerieName]["Data"] as $iKey => $Point)
180 180
         {
181
-         $Weight = $Point + $Data["Series"][$WeightSeries[$Key]]["Data"][$iKey];
181
+            $Weight = $Point + $Data["Series"][$WeightSeries[$Key]]["Data"][$iKey];
182 182
 
183
-         $PosArray    = $this->pChartObject->scaleComputeY($Point,array("AxisID"=>$AxisID));
184
-         $WeightArray = $this->pChartObject->scaleComputeY($Weight,array("AxisID"=>$AxisID));
183
+            $PosArray    = $this->pChartObject->scaleComputeY($Point,array("AxisID"=>$AxisID));
184
+            $WeightArray = $this->pChartObject->scaleComputeY($Weight,array("AxisID"=>$AxisID));
185 185
 
186
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
187
-          {
188
-           if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
189
-           $Y = floor($PosArray); $CircleRadius = floor(abs($PosArray - $WeightArray)/2);
186
+            if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
187
+            {
188
+            if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
189
+            $Y = floor($PosArray); $CircleRadius = floor(abs($PosArray - $WeightArray)/2);
190 190
 
191
-           if ( $Shape == BUBBLE_SHAPE_SQUARE )
191
+            if ( $Shape == BUBBLE_SHAPE_SQUARE )
192 192
             {
193
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$CircleRadius).",".floor($Y-$CircleRadius).",".floor($X+$CircleRadius).",".floor($Y+$CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
194
-
195
-             if ( $BorderWidth != 1 )
196
-              {
197
-               $this->pChartObject->drawFilledRectangle($X-$CircleRadius-$BorderWidth,$Y-$CircleRadius-$BorderWidth,$X+$CircleRadius+$BorderWidth,$Y+$CircleRadius+$BorderWidth,$BorderColor);
198
-               $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
199
-              }
200
-             else
201
-              $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
193
+                if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$CircleRadius).",".floor($Y-$CircleRadius).",".floor($X+$CircleRadius).",".floor($Y+$CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
194
+
195
+                if ( $BorderWidth != 1 )
196
+                {
197
+                $this->pChartObject->drawFilledRectangle($X-$CircleRadius-$BorderWidth,$Y-$CircleRadius-$BorderWidth,$X+$CircleRadius+$BorderWidth,$Y+$CircleRadius+$BorderWidth,$BorderColor);
198
+                $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
199
+                }
200
+                else
201
+                $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
202 202
             }
203
-           elseif ( $Shape == BUBBLE_SHAPE_ROUND )
203
+            elseif ( $Shape == BUBBLE_SHAPE_ROUND )
204 204
             {
205
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".floor($CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
206
-
207
-             if ( $BorderWidth != 1 )
208
-              {
209
-               $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius+$BorderWidth,$BorderColor);
210
-               $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
211
-              }
212
-             else
213
-              $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
205
+                if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".floor($CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
206
+
207
+                if ( $BorderWidth != 1 )
208
+                {
209
+                $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius+$BorderWidth,$BorderColor);
210
+                $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
211
+                }
212
+                else
213
+                $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
214 214
             }
215 215
 
216
-           $X = $X + $XStep;
217
-          }
218
-         elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
219
-          {
220
-           if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
221
-           $X = floor($PosArray); $CircleRadius = floor(abs($PosArray - $WeightArray)/2);
216
+            $X = $X + $XStep;
217
+            }
218
+            elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
219
+            {
220
+            if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
221
+            $X = floor($PosArray); $CircleRadius = floor(abs($PosArray - $WeightArray)/2);
222 222
 
223
-           if ( $Shape == BUBBLE_SHAPE_SQUARE )
223
+            if ( $Shape == BUBBLE_SHAPE_SQUARE )
224 224
             {
225
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$CircleRadius).",".floor($Y-$CircleRadius).",".floor($X+$CircleRadius).",".floor($Y+$CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
226
-
227
-             if ( $BorderWidth != 1 )
228
-              {
229
-               $this->pChartObject->drawFilledRectangle($X-$CircleRadius-$BorderWidth,$Y-$CircleRadius-$BorderWidth,$X+$CircleRadius+$BorderWidth,$Y+$CircleRadius+$BorderWidth,$BorderColor);
230
-               $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
231
-              }
232
-             else
233
-              $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
225
+                if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$CircleRadius).",".floor($Y-$CircleRadius).",".floor($X+$CircleRadius).",".floor($Y+$CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
226
+
227
+                if ( $BorderWidth != 1 )
228
+                {
229
+                $this->pChartObject->drawFilledRectangle($X-$CircleRadius-$BorderWidth,$Y-$CircleRadius-$BorderWidth,$X+$CircleRadius+$BorderWidth,$Y+$CircleRadius+$BorderWidth,$BorderColor);
230
+                $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
231
+                }
232
+                else
233
+                $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
234 234
             }
235
-           elseif ( $Shape == BUBBLE_SHAPE_ROUND )
235
+            elseif ( $Shape == BUBBLE_SHAPE_ROUND )
236 236
             {
237
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".floor($CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
238
-
239
-             if ( $BorderWidth != 1 )
240
-              {
241
-               $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius+$BorderWidth,$BorderColor);
242
-               $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
243
-              }
244
-             else
245
-              $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
237
+                if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".floor($CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
238
+
239
+                if ( $BorderWidth != 1 )
240
+                {
241
+                $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius+$BorderWidth,$BorderColor);
242
+                $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
243
+                }
244
+                else
245
+                $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
246 246
             }
247 247
 
248
-           $Y = $Y + $XStep;
249
-          }
248
+            $Y = $Y + $XStep;
249
+            }
250
+        }
250 251
         }
251
-      }
252 252
     }
253 253
 
254
-   function writeBubbleLabel($SerieName,$SerieWeightName,$Points,$Format="")
254
+    function writeBubbleLabel($SerieName,$SerieWeightName,$Points,$Format="")
255 255
     {
256
-     $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
257
-     $DrawPoint		= isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
256
+        $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
257
+        $DrawPoint		= isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
258 258
 
259
-     if ( !is_array($Points) ) { $Point = $Points; $Points = ""; $Points[] = $Point; }
259
+        if ( !is_array($Points) ) { $Point = $Points; $Points = ""; $Points[] = $Point; }
260 260
 
261
-     $Data    = $this->pDataObject->getData();
262
-     $Palette = $this->pDataObject->getPalette();
261
+        $Data    = $this->pDataObject->getData();
262
+        $Palette = $this->pDataObject->getPalette();
263 263
 
264
-     if ( !isset($Data["Series"][$SerieName]) || !isset($Data["Series"][$SerieWeightName]) )
265
-      return(0);
264
+        if ( !isset($Data["Series"][$SerieName]) || !isset($Data["Series"][$SerieWeightName]) )
265
+        return(0);
266 266
 
267
-     list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
267
+        list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
268 268
 
269
-     $AxisID	 = $Data["Series"][$SerieName]["Axis"];
270
-     $AxisMode	 = $Data["Axis"][$AxisID]["Display"];
271
-     $AxisFormat = $Data["Axis"][$AxisID]["Format"];
272
-     $AxisUnit	 = $Data["Axis"][$AxisID]["Unit"];
273
-     $XStep	 = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
269
+        $AxisID	 = $Data["Series"][$SerieName]["Axis"];
270
+        $AxisMode	 = $Data["Axis"][$AxisID]["Display"];
271
+        $AxisFormat = $Data["Axis"][$AxisID]["Format"];
272
+        $AxisUnit	 = $Data["Axis"][$AxisID]["Unit"];
273
+        $XStep	 = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
274 274
 
275
-     $X = $this->pChartObject->GraphAreaX1 + $XMargin;
276
-     $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
275
+        $X = $this->pChartObject->GraphAreaX1 + $XMargin;
276
+        $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
277 277
 
278
-     $Color = array("R"=>$Data["Series"][$SerieName]["Color"]["R"],"G"=>$Data["Series"][$SerieName]["Color"]["G"],"B"=>$Data["Series"][$SerieName]["Color"]["B"],"Alpha"=>$Data["Series"][$SerieName]["Color"]["Alpha"]);
278
+        $Color = array("R"=>$Data["Series"][$SerieName]["Color"]["R"],"G"=>$Data["Series"][$SerieName]["Color"]["G"],"B"=>$Data["Series"][$SerieName]["Color"]["B"],"Alpha"=>$Data["Series"][$SerieName]["Color"]["Alpha"]);
279 279
 
280
-     foreach($Points as $Key => $Point)
281
-      {
282
-       $Value    = $Data["Series"][$SerieName]["Data"][$Point];
283
-       $PosArray = $this->pChartObject->scaleComputeY($Value,array("AxisID"=>$AxisID));
280
+        foreach($Points as $Key => $Point)
281
+        {
282
+        $Value    = $Data["Series"][$SerieName]["Data"][$Point];
283
+        $PosArray = $this->pChartObject->scaleComputeY($Value,array("AxisID"=>$AxisID));
284 284
 
285
-       if ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Point]) )
285
+        if ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Point]) )
286 286
         $Abscissa = $Data["Series"][$Data["Abscissa"]]["Data"][$Point]." : ";
287
-       else
287
+        else
288 288
         $Abscissa = "";
289 289
 
290
-       $Value   = $this->pChartObject->scaleFormat($Value,$AxisMode,$AxisFormat,$AxisUnit);
291
-       $Weight  = $Data["Series"][$SerieWeightName]["Data"][$Point];
292
-       $Caption = $Abscissa.$Value." / ".$Weight;
290
+        $Value   = $this->pChartObject->scaleFormat($Value,$AxisMode,$AxisFormat,$AxisUnit);
291
+        $Weight  = $Data["Series"][$SerieWeightName]["Data"][$Point];
292
+        $Caption = $Abscissa.$Value." / ".$Weight;
293 293
 
294
-       if ( isset($Data["Series"][$SerieName]["Description"]) )
294
+        if ( isset($Data["Series"][$SerieName]["Description"]) )
295 295
         $Description = $Data["Series"][$SerieName]["Description"];
296
-       else
296
+        else
297 297
         $Description = "No description";
298 298
 
299
-       $Series = "";
300
-       $Series[] = array("Format"=>$Color,"Caption"=>$Caption);
299
+        $Series = "";
300
+        $Series[] = array("Format"=>$Color,"Caption"=>$Caption);
301 301
 
302
-       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
302
+        if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
303 303
         {
304
-         if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
304
+            if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
305 305
 
306
-         $X = floor($X + $Point * $XStep);
307
-         $Y = floor($PosArray);
306
+            $X = floor($X + $Point * $XStep);
307
+            $Y = floor($PosArray);
308 308
         }
309
-       else
309
+        else
310 310
         {
311
-         if ( $XDivs == 0 ) { $YStep = 0; } else { $YStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
311
+            if ( $XDivs == 0 ) { $YStep = 0; } else { $YStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
312 312
 
313
-         $X = floor($PosArray);
314
-         $Y = floor($Y + $Point * $YStep);
313
+            $X = floor($PosArray);
314
+            $Y = floor($Y + $Point * $YStep);
315 315
         }
316 316
 
317
-       if ( $DrawPoint == LABEL_POINT_CIRCLE )
317
+        if ( $DrawPoint == LABEL_POINT_CIRCLE )
318 318
         $this->pChartObject->drawFilledCircle($X,$Y,3,array("R"=>255,"G"=>255,"B"=>255,"BorderR"=>0,"BorderG"=>0,"BorderB"=>0));
319
-       elseif ( $DrawPoint == LABEL_POINT_BOX )
319
+        elseif ( $DrawPoint == LABEL_POINT_BOX )
320 320
         $this->pChartObject->drawFilledRectangle($X-2,$Y-2,$X+2,$Y+2,array("R"=>255,"G"=>255,"B"=>255,"BorderR"=>0,"BorderG"=>0,"BorderB"=>0));
321 321
 
322
-       $this->pChartObject->drawLabelBox($X,$Y-3,$Description,$Series,$Format);
323
-      }
322
+        $this->pChartObject->drawLabelBox($X,$Y-3,$Description,$Series,$Format);
323
+        }
324
+    }
324 325
     }
325
-  }
326 326
 ?>
327 327
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  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("BUBBLE_SHAPE_ROUND"		, 700001);
17
- define("BUBBLE_SHAPE_SQUARE"		, 700002);
16
+ define("BUBBLE_SHAPE_ROUND", 700001);
17
+ define("BUBBLE_SHAPE_SQUARE", 700002);
18 18
 
19 19
  /* pBubble class definition */
20 20
  class pBubble
@@ -23,37 +23,37 @@  discard block
 block discarded – undo
23 23
    var $pDataObject;
24 24
 
25 25
    /* Class creator */
26
-   function pBubble($pChartObject,$pDataObject)
26
+   function pBubble($pChartObject, $pDataObject)
27 27
     {
28 28
      $this->pChartObject = $pChartObject;
29 29
      $this->pDataObject  = $pDataObject;
30 30
     }
31 31
 
32 32
    /* Prepare the scale */
33
-   function bubbleScale($DataSeries,$WeightSeries)
33
+   function bubbleScale($DataSeries, $WeightSeries)
34 34
     {
35
-     if ( !is_array($DataSeries) )	{ $DataSeries = array($DataSeries); }
36
-     if ( !is_array($WeightSeries) )	{ $WeightSeries = array($WeightSeries); }
35
+     if (!is_array($DataSeries)) { $DataSeries = array($DataSeries); }
36
+     if (!is_array($WeightSeries)) { $WeightSeries = array($WeightSeries); }
37 37
 
38 38
      /* Parse each data series to find the new min & max boundaries to scale */
39 39
      $NewPositiveSerie = ""; $NewNegativeSerie = ""; $MaxValues = 0; $LastPositive = 0; $LastNegative = 0;
40
-     foreach($DataSeries as $Key => $SerieName)
40
+     foreach ($DataSeries as $Key => $SerieName)
41 41
       {
42 42
        $SerieWeightName = $WeightSeries[$Key];
43 43
 
44
-       $this->pDataObject->setSerieDrawable($SerieWeightName,FALSE);
44
+       $this->pDataObject->setSerieDrawable($SerieWeightName, FALSE);
45 45
 
46
-       if ( count($this->pDataObject->Data["Series"][$SerieName]["Data"]) > $MaxValues ) { $MaxValues = count($this->pDataObject->Data["Series"][$SerieName]["Data"]); }
46
+       if (count($this->pDataObject->Data["Series"][$SerieName]["Data"]) > $MaxValues) { $MaxValues = count($this->pDataObject->Data["Series"][$SerieName]["Data"]); }
47 47
 
48
-       foreach($this->pDataObject->Data["Series"][$SerieName]["Data"] as $Key => $Value)
48
+       foreach ($this->pDataObject->Data["Series"][$SerieName]["Data"] as $Key => $Value)
49 49
         {
50
-         if ( $Value >= 0 )
50
+         if ($Value >= 0)
51 51
           {
52 52
            $BubbleBounds = $Value + $this->pDataObject->Data["Series"][$SerieWeightName]["Data"][$Key];
53 53
 
54
-           if ( !isset($NewPositiveSerie[$Key]) )
54
+           if (!isset($NewPositiveSerie[$Key]))
55 55
             { $NewPositiveSerie[$Key] = $BubbleBounds; }
56
-           elseif ( $NewPositiveSerie[$Key] < $BubbleBounds )
56
+           elseif ($NewPositiveSerie[$Key] < $BubbleBounds)
57 57
             { $NewPositiveSerie[$Key] = $BubbleBounds; }
58 58
 
59 59
            $LastPositive = $BubbleBounds;
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
           {
63 63
            $BubbleBounds = $Value - $this->pDataObject->Data["Series"][$SerieWeightName]["Data"][$Key];
64 64
 
65
-           if ( !isset($NewNegativeSerie[$Key]) )
65
+           if (!isset($NewNegativeSerie[$Key]))
66 66
             { $NewNegativeSerie[$Key] = $BubbleBounds; }
67
-           elseif ( $NewNegativeSerie[$Key] > $BubbleBounds )
67
+           elseif ($NewNegativeSerie[$Key] > $BubbleBounds)
68 68
             { $NewNegativeSerie[$Key] = $BubbleBounds; }
69 69
 
70 70
            $LastNegative = $BubbleBounds;
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
       }
74 74
 
75 75
      /* Check for missing values and all the fake positive serie */
76
-     if ( $NewPositiveSerie != "" )
76
+     if ($NewPositiveSerie != "")
77 77
       {
78
-       for ($i=0; $i<$MaxValues; $i++) { if (!isset($NewPositiveSerie[$i])) { $NewPositiveSerie[$i] = $LastPositive; } }
78
+       for ($i = 0; $i < $MaxValues; $i++) { if (!isset($NewPositiveSerie[$i])) { $NewPositiveSerie[$i] = $LastPositive; } }
79 79
 
80
-       $this->pDataObject->addPoints($NewPositiveSerie,"BubbleFakePositiveSerie");
80
+       $this->pDataObject->addPoints($NewPositiveSerie, "BubbleFakePositiveSerie");
81 81
       }
82 82
 
83 83
      /* Check for missing values and all the fake negative serie */
84
-     if ( $NewNegativeSerie != "" )
84
+     if ($NewNegativeSerie != "")
85 85
       {
86
-       for ($i=0; $i<$MaxValues; $i++) { if (!isset($NewNegativeSerie[$i])) { $NewNegativeSerie[$i] = $LastNegative; } }
86
+       for ($i = 0; $i < $MaxValues; $i++) { if (!isset($NewNegativeSerie[$i])) { $NewNegativeSerie[$i] = $LastNegative; } }
87 87
 
88
-       $this->pDataObject->addPoints($NewNegativeSerie,"BubbleFakeNegativeSerie");
88
+       $this->pDataObject->addPoints($NewNegativeSerie, "BubbleFakeNegativeSerie");
89 89
       }
90 90
     }
91 91
 
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
      $Palette = $this->pDataObject->getPalette();
96 96
 
97 97
      $ID = 0;
98
-     foreach($Data["Series"] as $SerieName => $SeriesParameters)
98
+     foreach ($Data["Series"] as $SerieName => $SeriesParameters)
99 99
       {
100
-       if ( $SeriesParameters["isDrawable"] )
100
+       if ($SeriesParameters["isDrawable"])
101 101
         {
102 102
          $this->pDataObject->Data["Series"][$SerieName]["Color"]["R"]     = $Palette[$ID]["R"];
103 103
          $this->pDataObject->Data["Series"][$SerieName]["Color"]["G"]     = $Palette[$ID]["G"];
@@ -109,33 +109,33 @@  discard block
 block discarded – undo
109 109
     }
110 110
 
111 111
    /* Prepare the scale */
112
-   function drawBubbleChart($DataSeries,$WeightSeries,$Format="")
112
+   function drawBubbleChart($DataSeries, $WeightSeries, $Format = "")
113 113
     {
114 114
      $ForceAlpha	= isset($Format["ForceAlpha"]) ? $Format["ForceAlpha"] : VOID;
115 115
      $DrawBorder	= isset($Format["DrawBorder"]) ? $Format["DrawBorder"] : TRUE;
116 116
      $BorderWidth	= isset($Format["BorderWidth"]) ? $Format["BorderWidth"] : 1;
117
-     $Shape		= isset($Format["Shape"]) ? $Format["Shape"] : BUBBLE_SHAPE_ROUND;
117
+     $Shape = isset($Format["Shape"]) ? $Format["Shape"] : BUBBLE_SHAPE_ROUND;
118 118
      $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
119 119
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
120 120
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
121 121
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
122
-     $BorderAlpha	= isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30;
123
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
122
+     $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30;
123
+     $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
124 124
 
125
-     if ( !is_array($DataSeries) )	{ $DataSeries = array($DataSeries); }
126
-     if ( !is_array($WeightSeries) )	{ $WeightSeries = array($WeightSeries); }
125
+     if (!is_array($DataSeries)) { $DataSeries = array($DataSeries); }
126
+     if (!is_array($WeightSeries)) { $WeightSeries = array($WeightSeries); }
127 127
 
128 128
      $Data    = $this->pDataObject->getData();
129 129
      $Palette = $this->pDataObject->getPalette();
130 130
 
131
-     if ( isset($Data["Series"]["BubbleFakePositiveSerie"] ) ) { $this->pDataObject->setSerieDrawable("BubbleFakePositiveSerie",FALSE); }
132
-     if ( isset($Data["Series"]["BubbleFakeNegativeSerie"] ) ) { $this->pDataObject->setSerieDrawable("BubbleFakeNegativeSerie",FALSE); }
131
+     if (isset($Data["Series"]["BubbleFakePositiveSerie"])) { $this->pDataObject->setSerieDrawable("BubbleFakePositiveSerie", FALSE); }
132
+     if (isset($Data["Series"]["BubbleFakeNegativeSerie"])) { $this->pDataObject->setSerieDrawable("BubbleFakeNegativeSerie", FALSE); }
133 133
 
134 134
      $this->resetSeriesColors();
135 135
 
136
-     list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
136
+     list($XMargin, $XDivs) = $this->pChartObject->scaleGetXSettings();
137 137
 
138
-     foreach($DataSeries as $Key => $SerieName)
138
+     foreach ($DataSeries as $Key => $SerieName)
139 139
       {
140 140
        $AxisID	= $Data["Series"][$SerieName]["Axis"];
141 141
        $Mode	= $Data["Axis"][$AxisID]["Display"];
@@ -144,105 +144,105 @@  discard block
 block discarded – undo
144 144
 
145 145
        if (isset($Data["Series"][$SerieName]["Description"])) { $SerieDescription = $Data["Series"][$SerieName]["Description"]; } else { $SerieDescription = $SerieName; }
146 146
 
147
-       $XStep	= ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
147
+       $XStep = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin*2)/$XDivs;
148 148
 
149 149
        $X = $this->pChartObject->GraphAreaX1 + $XMargin;
150 150
        $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
151 151
 
152
-       $Color = array("R"=>$Palette[$Key]["R"],"G"=>$Palette[$Key]["G"],"B"=>$Palette[$Key]["B"],"Alpha"=>$Palette[$Key]["Alpha"]);
152
+       $Color = array("R"=>$Palette[$Key]["R"], "G"=>$Palette[$Key]["G"], "B"=>$Palette[$Key]["B"], "Alpha"=>$Palette[$Key]["Alpha"]);
153 153
 
154
-       if ( $ForceAlpha != VOID ) { $Color["Alpha"]=$ForceAlpha; }
154
+       if ($ForceAlpha != VOID) { $Color["Alpha"] = $ForceAlpha; }
155 155
 
156
-       if ( $DrawBorder )
156
+       if ($DrawBorder)
157 157
         {
158
-         if ( $BorderWidth != 1 )
158
+         if ($BorderWidth != 1)
159 159
           {
160
-           if ( $Surrounding != NULL )
161
-            { $BorderR = $Palette[$Key]["R"]+$Surrounding; $BorderG = $Palette[$Key]["G"]+$Surrounding; $BorderB = $Palette[$Key]["B"]+$Surrounding; }
160
+           if ($Surrounding != NULL)
161
+            { $BorderR = $Palette[$Key]["R"] + $Surrounding; $BorderG = $Palette[$Key]["G"] + $Surrounding; $BorderB = $Palette[$Key]["B"] + $Surrounding; }
162 162
            else
163 163
             { $BorderR = $BorderR; $BorderG = $BorderG; $BorderB = $BorderB; }
164
-           if ( $ForceAlpha != VOID ) { $BorderAlpha = $ForceAlpha/2; }
165
-           $BorderColor = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
164
+           if ($ForceAlpha != VOID) { $BorderAlpha = $ForceAlpha/2; }
165
+           $BorderColor = array("R"=>$BorderR, "G"=>$BorderG, "B"=>$BorderB, "Alpha"=>$BorderAlpha);
166 166
           }
167 167
          else
168 168
           {
169 169
            $Color["BorderAlpha"] = $BorderAlpha;
170 170
 
171
-           if ( $Surrounding != NULL )
172
-            { $Color["BorderR"] = $Palette[$Key]["R"]+$Surrounding; $Color["BorderG"] = $Palette[$Key]["G"]+$Surrounding; $Color["BorderB"] = $Palette[$Key]["B"]+$Surrounding; }
171
+           if ($Surrounding != NULL)
172
+            { $Color["BorderR"] = $Palette[$Key]["R"] + $Surrounding; $Color["BorderG"] = $Palette[$Key]["G"] + $Surrounding; $Color["BorderB"] = $Palette[$Key]["B"] + $Surrounding; }
173 173
            else
174 174
             { $Color["BorderR"] = $BorderR; $Color["BorderG"] = $BorderG; $Color["BorderB"] = $BorderB; }
175
-           if ( $ForceAlpha != VOID ) { $Color["BorderAlpha"] = $ForceAlpha/2; }
175
+           if ($ForceAlpha != VOID) { $Color["BorderAlpha"] = $ForceAlpha/2; }
176 176
           }
177 177
         }
178 178
 
179
-       foreach($Data["Series"][$SerieName]["Data"] as $iKey => $Point)
179
+       foreach ($Data["Series"][$SerieName]["Data"] as $iKey => $Point)
180 180
         {
181 181
          $Weight = $Point + $Data["Series"][$WeightSeries[$Key]]["Data"][$iKey];
182 182
 
183
-         $PosArray    = $this->pChartObject->scaleComputeY($Point,array("AxisID"=>$AxisID));
184
-         $WeightArray = $this->pChartObject->scaleComputeY($Weight,array("AxisID"=>$AxisID));
183
+         $PosArray    = $this->pChartObject->scaleComputeY($Point, array("AxisID"=>$AxisID));
184
+         $WeightArray = $this->pChartObject->scaleComputeY($Weight, array("AxisID"=>$AxisID));
185 185
 
186
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
186
+         if ($Data["Orientation"] == SCALE_POS_LEFTRIGHT)
187 187
           {
188
-           if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
188
+           if ($XDivs == 0) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin*2)/$XDivs; }
189 189
            $Y = floor($PosArray); $CircleRadius = floor(abs($PosArray - $WeightArray)/2);
190 190
 
191
-           if ( $Shape == BUBBLE_SHAPE_SQUARE )
191
+           if ($Shape == BUBBLE_SHAPE_SQUARE)
192 192
             {
193
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$CircleRadius).",".floor($Y-$CircleRadius).",".floor($X+$CircleRadius).",".floor($Y+$CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
193
+             if ($RecordImageMap) { $this->pChartObject->addToImageMap("RECT", floor($X - $CircleRadius).",".floor($Y - $CircleRadius).",".floor($X + $CircleRadius).",".floor($Y + $CircleRadius), $this->pChartObject->toHTMLColor($Palette[$Key]["R"], $Palette[$Key]["G"], $Palette[$Key]["B"]), $SerieDescription, $Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
194 194
 
195
-             if ( $BorderWidth != 1 )
195
+             if ($BorderWidth != 1)
196 196
               {
197
-               $this->pChartObject->drawFilledRectangle($X-$CircleRadius-$BorderWidth,$Y-$CircleRadius-$BorderWidth,$X+$CircleRadius+$BorderWidth,$Y+$CircleRadius+$BorderWidth,$BorderColor);
198
-               $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
197
+               $this->pChartObject->drawFilledRectangle($X - $CircleRadius - $BorderWidth, $Y - $CircleRadius - $BorderWidth, $X + $CircleRadius + $BorderWidth, $Y + $CircleRadius + $BorderWidth, $BorderColor);
198
+               $this->pChartObject->drawFilledRectangle($X - $CircleRadius, $Y - $CircleRadius, $X + $CircleRadius, $Y + $CircleRadius, $Color);
199 199
               }
200 200
              else
201
-              $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
201
+              $this->pChartObject->drawFilledRectangle($X - $CircleRadius, $Y - $CircleRadius, $X + $CircleRadius, $Y + $CircleRadius, $Color);
202 202
             }
203
-           elseif ( $Shape == BUBBLE_SHAPE_ROUND )
203
+           elseif ($Shape == BUBBLE_SHAPE_ROUND)
204 204
             {
205
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".floor($CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
205
+             if ($RecordImageMap) { $this->pChartObject->addToImageMap("CIRCLE", floor($X).",".floor($Y).",".floor($CircleRadius), $this->pChartObject->toHTMLColor($Palette[$Key]["R"], $Palette[$Key]["G"], $Palette[$Key]["B"]), $SerieDescription, $Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
206 206
 
207
-             if ( $BorderWidth != 1 )
207
+             if ($BorderWidth != 1)
208 208
               {
209
-               $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius+$BorderWidth,$BorderColor);
210
-               $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
209
+               $this->pChartObject->drawFilledCircle($X, $Y, $CircleRadius + $BorderWidth, $BorderColor);
210
+               $this->pChartObject->drawFilledCircle($X, $Y, $CircleRadius, $Color);
211 211
               }
212 212
              else
213
-              $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
213
+              $this->pChartObject->drawFilledCircle($X, $Y, $CircleRadius, $Color);
214 214
             }
215 215
 
216 216
            $X = $X + $XStep;
217 217
           }
218
-         elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
218
+         elseif ($Data["Orientation"] == SCALE_POS_TOPBOTTOM)
219 219
           {
220
-           if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
220
+           if ($XDivs == 0) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1 - $XMargin*2)/$XDivs; }
221 221
            $X = floor($PosArray); $CircleRadius = floor(abs($PosArray - $WeightArray)/2);
222 222
 
223
-           if ( $Shape == BUBBLE_SHAPE_SQUARE )
223
+           if ($Shape == BUBBLE_SHAPE_SQUARE)
224 224
             {
225
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$CircleRadius).",".floor($Y-$CircleRadius).",".floor($X+$CircleRadius).",".floor($Y+$CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
225
+             if ($RecordImageMap) { $this->pChartObject->addToImageMap("RECT", floor($X - $CircleRadius).",".floor($Y - $CircleRadius).",".floor($X + $CircleRadius).",".floor($Y + $CircleRadius), $this->pChartObject->toHTMLColor($Palette[$Key]["R"], $Palette[$Key]["G"], $Palette[$Key]["B"]), $SerieDescription, $Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
226 226
 
227
-             if ( $BorderWidth != 1 )
227
+             if ($BorderWidth != 1)
228 228
               {
229
-               $this->pChartObject->drawFilledRectangle($X-$CircleRadius-$BorderWidth,$Y-$CircleRadius-$BorderWidth,$X+$CircleRadius+$BorderWidth,$Y+$CircleRadius+$BorderWidth,$BorderColor);
230
-               $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
229
+               $this->pChartObject->drawFilledRectangle($X - $CircleRadius - $BorderWidth, $Y - $CircleRadius - $BorderWidth, $X + $CircleRadius + $BorderWidth, $Y + $CircleRadius + $BorderWidth, $BorderColor);
230
+               $this->pChartObject->drawFilledRectangle($X - $CircleRadius, $Y - $CircleRadius, $X + $CircleRadius, $Y + $CircleRadius, $Color);
231 231
               }
232 232
              else
233
-              $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
233
+              $this->pChartObject->drawFilledRectangle($X - $CircleRadius, $Y - $CircleRadius, $X + $CircleRadius, $Y + $CircleRadius, $Color);
234 234
             }
235
-           elseif ( $Shape == BUBBLE_SHAPE_ROUND )
235
+           elseif ($Shape == BUBBLE_SHAPE_ROUND)
236 236
             {
237
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".floor($CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
237
+             if ($RecordImageMap) { $this->pChartObject->addToImageMap("CIRCLE", floor($X).",".floor($Y).",".floor($CircleRadius), $this->pChartObject->toHTMLColor($Palette[$Key]["R"], $Palette[$Key]["G"], $Palette[$Key]["B"]), $SerieDescription, $Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
238 238
 
239
-             if ( $BorderWidth != 1 )
239
+             if ($BorderWidth != 1)
240 240
               {
241
-               $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius+$BorderWidth,$BorderColor);
242
-               $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
241
+               $this->pChartObject->drawFilledCircle($X, $Y, $CircleRadius + $BorderWidth, $BorderColor);
242
+               $this->pChartObject->drawFilledCircle($X, $Y, $CircleRadius, $Color);
243 243
               }
244 244
              else
245
-              $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
245
+              $this->pChartObject->drawFilledCircle($X, $Y, $CircleRadius, $Color);
246 246
             }
247 247
 
248 248
            $Y = $Y + $XStep;
@@ -251,75 +251,75 @@  discard block
 block discarded – undo
251 251
       }
252 252
     }
253 253
 
254
-   function writeBubbleLabel($SerieName,$SerieWeightName,$Points,$Format="")
254
+   function writeBubbleLabel($SerieName, $SerieWeightName, $Points, $Format = "")
255 255
     {
256
-     $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
257
-     $DrawPoint		= isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
256
+     $OverrideTitle = isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
257
+     $DrawPoint = isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
258 258
 
259
-     if ( !is_array($Points) ) { $Point = $Points; $Points = ""; $Points[] = $Point; }
259
+     if (!is_array($Points)) { $Point = $Points; $Points = ""; $Points[] = $Point; }
260 260
 
261 261
      $Data    = $this->pDataObject->getData();
262 262
      $Palette = $this->pDataObject->getPalette();
263 263
 
264
-     if ( !isset($Data["Series"][$SerieName]) || !isset($Data["Series"][$SerieWeightName]) )
264
+     if (!isset($Data["Series"][$SerieName]) || !isset($Data["Series"][$SerieWeightName]))
265 265
       return(0);
266 266
 
267
-     list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
267
+     list($XMargin, $XDivs) = $this->pChartObject->scaleGetXSettings();
268 268
 
269
-     $AxisID	 = $Data["Series"][$SerieName]["Axis"];
269
+     $AxisID = $Data["Series"][$SerieName]["Axis"];
270 270
      $AxisMode	 = $Data["Axis"][$AxisID]["Display"];
271 271
      $AxisFormat = $Data["Axis"][$AxisID]["Format"];
272 272
      $AxisUnit	 = $Data["Axis"][$AxisID]["Unit"];
273
-     $XStep	 = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
273
+     $XStep = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin*2)/$XDivs;
274 274
 
275 275
      $X = $this->pChartObject->GraphAreaX1 + $XMargin;
276 276
      $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
277 277
 
278
-     $Color = array("R"=>$Data["Series"][$SerieName]["Color"]["R"],"G"=>$Data["Series"][$SerieName]["Color"]["G"],"B"=>$Data["Series"][$SerieName]["Color"]["B"],"Alpha"=>$Data["Series"][$SerieName]["Color"]["Alpha"]);
278
+     $Color = array("R"=>$Data["Series"][$SerieName]["Color"]["R"], "G"=>$Data["Series"][$SerieName]["Color"]["G"], "B"=>$Data["Series"][$SerieName]["Color"]["B"], "Alpha"=>$Data["Series"][$SerieName]["Color"]["Alpha"]);
279 279
 
280
-     foreach($Points as $Key => $Point)
280
+     foreach ($Points as $Key => $Point)
281 281
       {
282 282
        $Value    = $Data["Series"][$SerieName]["Data"][$Point];
283
-       $PosArray = $this->pChartObject->scaleComputeY($Value,array("AxisID"=>$AxisID));
283
+       $PosArray = $this->pChartObject->scaleComputeY($Value, array("AxisID"=>$AxisID));
284 284
 
285
-       if ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Point]) )
285
+       if (isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Point]))
286 286
         $Abscissa = $Data["Series"][$Data["Abscissa"]]["Data"][$Point]." : ";
287 287
        else
288 288
         $Abscissa = "";
289 289
 
290
-       $Value   = $this->pChartObject->scaleFormat($Value,$AxisMode,$AxisFormat,$AxisUnit);
290
+       $Value   = $this->pChartObject->scaleFormat($Value, $AxisMode, $AxisFormat, $AxisUnit);
291 291
        $Weight  = $Data["Series"][$SerieWeightName]["Data"][$Point];
292 292
        $Caption = $Abscissa.$Value." / ".$Weight;
293 293
 
294
-       if ( isset($Data["Series"][$SerieName]["Description"]) )
294
+       if (isset($Data["Series"][$SerieName]["Description"]))
295 295
         $Description = $Data["Series"][$SerieName]["Description"];
296 296
        else
297 297
         $Description = "No description";
298 298
 
299 299
        $Series = "";
300
-       $Series[] = array("Format"=>$Color,"Caption"=>$Caption);
300
+       $Series[] = array("Format"=>$Color, "Caption"=>$Caption);
301 301
 
302
-       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
302
+       if ($Data["Orientation"] == SCALE_POS_LEFTRIGHT)
303 303
         {
304
-         if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
304
+         if ($XDivs == 0) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin*2)/$XDivs; }
305 305
 
306
-         $X = floor($X + $Point * $XStep);
306
+         $X = floor($X + $Point*$XStep);
307 307
          $Y = floor($PosArray);
308 308
         }
309 309
        else
310 310
         {
311
-         if ( $XDivs == 0 ) { $YStep = 0; } else { $YStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
311
+         if ($XDivs == 0) { $YStep = 0; } else { $YStep = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1 - $XMargin*2)/$XDivs; }
312 312
 
313 313
          $X = floor($PosArray);
314
-         $Y = floor($Y + $Point * $YStep);
314
+         $Y = floor($Y + $Point*$YStep);
315 315
         }
316 316
 
317
-       if ( $DrawPoint == LABEL_POINT_CIRCLE )
318
-        $this->pChartObject->drawFilledCircle($X,$Y,3,array("R"=>255,"G"=>255,"B"=>255,"BorderR"=>0,"BorderG"=>0,"BorderB"=>0));
319
-       elseif ( $DrawPoint == LABEL_POINT_BOX )
320
-        $this->pChartObject->drawFilledRectangle($X-2,$Y-2,$X+2,$Y+2,array("R"=>255,"G"=>255,"B"=>255,"BorderR"=>0,"BorderG"=>0,"BorderB"=>0));
317
+       if ($DrawPoint == LABEL_POINT_CIRCLE)
318
+        $this->pChartObject->drawFilledCircle($X, $Y, 3, array("R"=>255, "G"=>255, "B"=>255, "BorderR"=>0, "BorderG"=>0, "BorderB"=>0));
319
+       elseif ($DrawPoint == LABEL_POINT_BOX)
320
+        $this->pChartObject->drawFilledRectangle($X - 2, $Y - 2, $X + 2, $Y + 2, array("R"=>255, "G"=>255, "B"=>255, "BorderR"=>0, "BorderG"=>0, "BorderB"=>0));
321 321
 
322
-       $this->pChartObject->drawLabelBox($X,$Y-3,$Description,$Series,$Format);
322
+       $this->pChartObject->drawLabelBox($X, $Y - 3, $Description, $Series, $Format);
323 323
       }
324 324
     }
325 325
   }
Please login to merge, or discard this patch.
Braces   +40 added lines, -86 removed lines patch added patch discarded remove patch
@@ -17,54 +17,44 @@  discard block
 block discarded – undo
17 17
  define("BUBBLE_SHAPE_SQUARE"		, 700002);
18 18
 
19 19
  /* pBubble class definition */
20
- class pBubble
21
-  {
20
+ class pBubble {
22 21
    var $pChartObject;
23 22
    var $pDataObject;
24 23
 
25 24
    /* Class creator */
26
-   function pBubble($pChartObject,$pDataObject)
27
-    {
25
+   function pBubble($pChartObject,$pDataObject) {
28 26
      $this->pChartObject = $pChartObject;
29 27
      $this->pDataObject  = $pDataObject;
30 28
     }
31 29
 
32 30
    /* Prepare the scale */
33
-   function bubbleScale($DataSeries,$WeightSeries)
34
-    {
31
+   function bubbleScale($DataSeries,$WeightSeries) {
35 32
      if ( !is_array($DataSeries) )	{ $DataSeries = array($DataSeries); }
36 33
      if ( !is_array($WeightSeries) )	{ $WeightSeries = array($WeightSeries); }
37 34
 
38 35
      /* Parse each data series to find the new min & max boundaries to scale */
39 36
      $NewPositiveSerie = ""; $NewNegativeSerie = ""; $MaxValues = 0; $LastPositive = 0; $LastNegative = 0;
40
-     foreach($DataSeries as $Key => $SerieName)
41
-      {
37
+     foreach($DataSeries as $Key => $SerieName) {
42 38
        $SerieWeightName = $WeightSeries[$Key];
43 39
 
44 40
        $this->pDataObject->setSerieDrawable($SerieWeightName,FALSE);
45 41
 
46 42
        if ( count($this->pDataObject->Data["Series"][$SerieName]["Data"]) > $MaxValues ) { $MaxValues = count($this->pDataObject->Data["Series"][$SerieName]["Data"]); }
47 43
 
48
-       foreach($this->pDataObject->Data["Series"][$SerieName]["Data"] as $Key => $Value)
49
-        {
50
-         if ( $Value >= 0 )
51
-          {
44
+       foreach($this->pDataObject->Data["Series"][$SerieName]["Data"] as $Key => $Value) {
45
+         if ( $Value >= 0 ) {
52 46
            $BubbleBounds = $Value + $this->pDataObject->Data["Series"][$SerieWeightName]["Data"][$Key];
53 47
 
54 48
            if ( !isset($NewPositiveSerie[$Key]) )
55
-            { $NewPositiveSerie[$Key] = $BubbleBounds; }
56
-           elseif ( $NewPositiveSerie[$Key] < $BubbleBounds )
49
+            { $NewPositiveSerie[$Key] = $BubbleBounds; } elseif ( $NewPositiveSerie[$Key] < $BubbleBounds )
57 50
             { $NewPositiveSerie[$Key] = $BubbleBounds; }
58 51
 
59 52
            $LastPositive = $BubbleBounds;
60
-          }
61
-         else
62
-          {
53
+          } else {
63 54
            $BubbleBounds = $Value - $this->pDataObject->Data["Series"][$SerieWeightName]["Data"][$Key];
64 55
 
65 56
            if ( !isset($NewNegativeSerie[$Key]) )
66
-            { $NewNegativeSerie[$Key] = $BubbleBounds; }
67
-           elseif ( $NewNegativeSerie[$Key] > $BubbleBounds )
57
+            { $NewNegativeSerie[$Key] = $BubbleBounds; } elseif ( $NewNegativeSerie[$Key] > $BubbleBounds )
68 58
             { $NewNegativeSerie[$Key] = $BubbleBounds; }
69 59
 
70 60
            $LastNegative = $BubbleBounds;
@@ -73,32 +63,27 @@  discard block
 block discarded – undo
73 63
       }
74 64
 
75 65
      /* Check for missing values and all the fake positive serie */
76
-     if ( $NewPositiveSerie != "" )
77
-      {
66
+     if ( $NewPositiveSerie != "" ) {
78 67
        for ($i=0; $i<$MaxValues; $i++) { if (!isset($NewPositiveSerie[$i])) { $NewPositiveSerie[$i] = $LastPositive; } }
79 68
 
80 69
        $this->pDataObject->addPoints($NewPositiveSerie,"BubbleFakePositiveSerie");
81 70
       }
82 71
 
83 72
      /* Check for missing values and all the fake negative serie */
84
-     if ( $NewNegativeSerie != "" )
85
-      {
73
+     if ( $NewNegativeSerie != "" ) {
86 74
        for ($i=0; $i<$MaxValues; $i++) { if (!isset($NewNegativeSerie[$i])) { $NewNegativeSerie[$i] = $LastNegative; } }
87 75
 
88 76
        $this->pDataObject->addPoints($NewNegativeSerie,"BubbleFakeNegativeSerie");
89 77
       }
90 78
     }
91 79
 
92
-   function resetSeriesColors()
93
-    {
80
+   function resetSeriesColors() {
94 81
      $Data    = $this->pDataObject->getData();
95 82
      $Palette = $this->pDataObject->getPalette();
96 83
 
97 84
      $ID = 0;
98
-     foreach($Data["Series"] as $SerieName => $SeriesParameters)
99
-      {
100
-       if ( $SeriesParameters["isDrawable"] )
101
-        {
85
+     foreach($Data["Series"] as $SerieName => $SeriesParameters) {
86
+       if ( $SeriesParameters["isDrawable"] ) {
102 87
          $this->pDataObject->Data["Series"][$SerieName]["Color"]["R"]     = $Palette[$ID]["R"];
103 88
          $this->pDataObject->Data["Series"][$SerieName]["Color"]["G"]     = $Palette[$ID]["G"];
104 89
          $this->pDataObject->Data["Series"][$SerieName]["Color"]["B"]     = $Palette[$ID]["B"];
@@ -109,8 +94,7 @@  discard block
 block discarded – undo
109 94
     }
110 95
 
111 96
    /* Prepare the scale */
112
-   function drawBubbleChart($DataSeries,$WeightSeries,$Format="")
113
-    {
97
+   function drawBubbleChart($DataSeries,$WeightSeries,$Format="") {
114 98
      $ForceAlpha	= isset($Format["ForceAlpha"]) ? $Format["ForceAlpha"] : VOID;
115 99
      $DrawBorder	= isset($Format["DrawBorder"]) ? $Format["DrawBorder"] : TRUE;
116 100
      $BorderWidth	= isset($Format["BorderWidth"]) ? $Format["BorderWidth"] : 1;
@@ -135,8 +119,7 @@  discard block
 block discarded – undo
135 119
 
136 120
      list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
137 121
 
138
-     foreach($DataSeries as $Key => $SerieName)
139
-      {
122
+     foreach($DataSeries as $Key => $SerieName) {
140 123
        $AxisID	= $Data["Series"][$SerieName]["Axis"];
141 124
        $Mode	= $Data["Axis"][$AxisID]["Display"];
142 125
        $Format	= $Data["Axis"][$AxisID]["Format"];
@@ -153,95 +136,71 @@  discard block
 block discarded – undo
153 136
 
154 137
        if ( $ForceAlpha != VOID ) { $Color["Alpha"]=$ForceAlpha; }
155 138
 
156
-       if ( $DrawBorder )
157
-        {
158
-         if ( $BorderWidth != 1 )
159
-          {
139
+       if ( $DrawBorder ) {
140
+         if ( $BorderWidth != 1 ) {
160 141
            if ( $Surrounding != NULL )
161
-            { $BorderR = $Palette[$Key]["R"]+$Surrounding; $BorderG = $Palette[$Key]["G"]+$Surrounding; $BorderB = $Palette[$Key]["B"]+$Surrounding; }
162
-           else
142
+            { $BorderR = $Palette[$Key]["R"]+$Surrounding; $BorderG = $Palette[$Key]["G"]+$Surrounding; $BorderB = $Palette[$Key]["B"]+$Surrounding; } else
163 143
             { $BorderR = $BorderR; $BorderG = $BorderG; $BorderB = $BorderB; }
164 144
            if ( $ForceAlpha != VOID ) { $BorderAlpha = $ForceAlpha/2; }
165 145
            $BorderColor = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
166
-          }
167
-         else
168
-          {
146
+          } else {
169 147
            $Color["BorderAlpha"] = $BorderAlpha;
170 148
 
171 149
            if ( $Surrounding != NULL )
172
-            { $Color["BorderR"] = $Palette[$Key]["R"]+$Surrounding; $Color["BorderG"] = $Palette[$Key]["G"]+$Surrounding; $Color["BorderB"] = $Palette[$Key]["B"]+$Surrounding; }
173
-           else
150
+            { $Color["BorderR"] = $Palette[$Key]["R"]+$Surrounding; $Color["BorderG"] = $Palette[$Key]["G"]+$Surrounding; $Color["BorderB"] = $Palette[$Key]["B"]+$Surrounding; } else
174 151
             { $Color["BorderR"] = $BorderR; $Color["BorderG"] = $BorderG; $Color["BorderB"] = $BorderB; }
175 152
            if ( $ForceAlpha != VOID ) { $Color["BorderAlpha"] = $ForceAlpha/2; }
176 153
           }
177 154
         }
178 155
 
179
-       foreach($Data["Series"][$SerieName]["Data"] as $iKey => $Point)
180
-        {
156
+       foreach($Data["Series"][$SerieName]["Data"] as $iKey => $Point) {
181 157
          $Weight = $Point + $Data["Series"][$WeightSeries[$Key]]["Data"][$iKey];
182 158
 
183 159
          $PosArray    = $this->pChartObject->scaleComputeY($Point,array("AxisID"=>$AxisID));
184 160
          $WeightArray = $this->pChartObject->scaleComputeY($Weight,array("AxisID"=>$AxisID));
185 161
 
186
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
187
-          {
162
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
188 163
            if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
189 164
            $Y = floor($PosArray); $CircleRadius = floor(abs($PosArray - $WeightArray)/2);
190 165
 
191
-           if ( $Shape == BUBBLE_SHAPE_SQUARE )
192
-            {
166
+           if ( $Shape == BUBBLE_SHAPE_SQUARE ) {
193 167
              if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$CircleRadius).",".floor($Y-$CircleRadius).",".floor($X+$CircleRadius).",".floor($Y+$CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
194 168
 
195
-             if ( $BorderWidth != 1 )
196
-              {
169
+             if ( $BorderWidth != 1 ) {
197 170
                $this->pChartObject->drawFilledRectangle($X-$CircleRadius-$BorderWidth,$Y-$CircleRadius-$BorderWidth,$X+$CircleRadius+$BorderWidth,$Y+$CircleRadius+$BorderWidth,$BorderColor);
198 171
                $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
199
-              }
200
-             else
172
+              } else
201 173
               $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
202
-            }
203
-           elseif ( $Shape == BUBBLE_SHAPE_ROUND )
204
-            {
174
+            } elseif ( $Shape == BUBBLE_SHAPE_ROUND ) {
205 175
              if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".floor($CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
206 176
 
207
-             if ( $BorderWidth != 1 )
208
-              {
177
+             if ( $BorderWidth != 1 ) {
209 178
                $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius+$BorderWidth,$BorderColor);
210 179
                $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
211
-              }
212
-             else
180
+              } else
213 181
               $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
214 182
             }
215 183
 
216 184
            $X = $X + $XStep;
217
-          }
218
-         elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
219
-          {
185
+          } elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) {
220 186
            if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
221 187
            $X = floor($PosArray); $CircleRadius = floor(abs($PosArray - $WeightArray)/2);
222 188
 
223
-           if ( $Shape == BUBBLE_SHAPE_SQUARE )
224
-            {
189
+           if ( $Shape == BUBBLE_SHAPE_SQUARE ) {
225 190
              if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$CircleRadius).",".floor($Y-$CircleRadius).",".floor($X+$CircleRadius).",".floor($Y+$CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
226 191
 
227
-             if ( $BorderWidth != 1 )
228
-              {
192
+             if ( $BorderWidth != 1 ) {
229 193
                $this->pChartObject->drawFilledRectangle($X-$CircleRadius-$BorderWidth,$Y-$CircleRadius-$BorderWidth,$X+$CircleRadius+$BorderWidth,$Y+$CircleRadius+$BorderWidth,$BorderColor);
230 194
                $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
231
-              }
232
-             else
195
+              } else
233 196
               $this->pChartObject->drawFilledRectangle($X-$CircleRadius,$Y-$CircleRadius,$X+$CircleRadius,$Y+$CircleRadius,$Color);
234
-            }
235
-           elseif ( $Shape == BUBBLE_SHAPE_ROUND )
236
-            {
197
+            } elseif ( $Shape == BUBBLE_SHAPE_ROUND ) {
237 198
              if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".floor($CircleRadius),$this->pChartObject->toHTMLColor($Palette[$Key]["R"],$Palette[$Key]["G"],$Palette[$Key]["B"]),$SerieDescription,$Data["Series"][$WeightSeries[$Key]]["Data"][$iKey]); }
238 199
 
239
-             if ( $BorderWidth != 1 )
240
-              {
200
+             if ( $BorderWidth != 1 ) {
241 201
                $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius+$BorderWidth,$BorderColor);
242 202
                $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
243
-              }
244
-             else
203
+              } else
245 204
               $this->pChartObject->drawFilledCircle($X,$Y,$CircleRadius,$Color);
246 205
             }
247 206
 
@@ -251,8 +210,7 @@  discard block
 block discarded – undo
251 210
       }
252 211
     }
253 212
 
254
-   function writeBubbleLabel($SerieName,$SerieWeightName,$Points,$Format="")
255
-    {
213
+   function writeBubbleLabel($SerieName,$SerieWeightName,$Points,$Format="") {
256 214
      $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
257 215
      $DrawPoint		= isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
258 216
 
@@ -277,8 +235,7 @@  discard block
 block discarded – undo
277 235
 
278 236
      $Color = array("R"=>$Data["Series"][$SerieName]["Color"]["R"],"G"=>$Data["Series"][$SerieName]["Color"]["G"],"B"=>$Data["Series"][$SerieName]["Color"]["B"],"Alpha"=>$Data["Series"][$SerieName]["Color"]["Alpha"]);
279 237
 
280
-     foreach($Points as $Key => $Point)
281
-      {
238
+     foreach($Points as $Key => $Point) {
282 239
        $Value    = $Data["Series"][$SerieName]["Data"][$Point];
283 240
        $PosArray = $this->pChartObject->scaleComputeY($Value,array("AxisID"=>$AxisID));
284 241
 
@@ -299,15 +256,12 @@  discard block
 block discarded – undo
299 256
        $Series = "";
300 257
        $Series[] = array("Format"=>$Color,"Caption"=>$Caption);
301 258
 
302
-       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
303
-        {
259
+       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
304 260
          if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
305 261
 
306 262
          $X = floor($X + $Point * $XStep);
307 263
          $Y = floor($PosArray);
308
-        }
309
-       else
310
-        {
264
+        } else {
311 265
          if ( $XDivs == 0 ) { $YStep = 0; } else { $YStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
312 266
 
313 267
          $X = floor($PosArray);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
       {
42 42
        $SerieWeightName = $WeightSeries[$Key];
43 43
 
44
-       $this->pDataObject->setSerieDrawable($SerieWeightName,FALSE);
44
+       $this->pDataObject->setSerieDrawable($SerieWeightName,false);
45 45
 
46 46
        if ( count($this->pDataObject->Data["Series"][$SerieName]["Data"]) > $MaxValues ) { $MaxValues = count($this->pDataObject->Data["Series"][$SerieName]["Data"]); }
47 47
 
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
    function drawBubbleChart($DataSeries,$WeightSeries,$Format="")
113 113
     {
114 114
      $ForceAlpha	= isset($Format["ForceAlpha"]) ? $Format["ForceAlpha"] : VOID;
115
-     $DrawBorder	= isset($Format["DrawBorder"]) ? $Format["DrawBorder"] : TRUE;
115
+     $DrawBorder	= isset($Format["DrawBorder"]) ? $Format["DrawBorder"] : true;
116 116
      $BorderWidth	= isset($Format["BorderWidth"]) ? $Format["BorderWidth"] : 1;
117 117
      $Shape		= isset($Format["Shape"]) ? $Format["Shape"] : BUBBLE_SHAPE_ROUND;
118
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
118
+     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : null;
119 119
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
120 120
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
121 121
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
122 122
      $BorderAlpha	= isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30;
123
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
123
+     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
124 124
 
125 125
      if ( !is_array($DataSeries) )	{ $DataSeries = array($DataSeries); }
126 126
      if ( !is_array($WeightSeries) )	{ $WeightSeries = array($WeightSeries); }
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
      $Data    = $this->pDataObject->getData();
129 129
      $Palette = $this->pDataObject->getPalette();
130 130
 
131
-     if ( isset($Data["Series"]["BubbleFakePositiveSerie"] ) ) { $this->pDataObject->setSerieDrawable("BubbleFakePositiveSerie",FALSE); }
132
-     if ( isset($Data["Series"]["BubbleFakeNegativeSerie"] ) ) { $this->pDataObject->setSerieDrawable("BubbleFakeNegativeSerie",FALSE); }
131
+     if ( isset($Data["Series"]["BubbleFakePositiveSerie"] ) ) { $this->pDataObject->setSerieDrawable("BubbleFakePositiveSerie",false); }
132
+     if ( isset($Data["Series"]["BubbleFakeNegativeSerie"] ) ) { $this->pDataObject->setSerieDrawable("BubbleFakeNegativeSerie",false); }
133 133
 
134 134
      $this->resetSeriesColors();
135 135
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         {
158 158
          if ( $BorderWidth != 1 )
159 159
           {
160
-           if ( $Surrounding != NULL )
160
+           if ( $Surrounding != null )
161 161
             { $BorderR = $Palette[$Key]["R"]+$Surrounding; $BorderG = $Palette[$Key]["G"]+$Surrounding; $BorderB = $Palette[$Key]["B"]+$Surrounding; }
162 162
            else
163 163
             { $BorderR = $BorderR; $BorderG = $BorderG; $BorderB = $BorderB; }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
           {
169 169
            $Color["BorderAlpha"] = $BorderAlpha;
170 170
 
171
-           if ( $Surrounding != NULL )
171
+           if ( $Surrounding != null )
172 172
             { $Color["BorderR"] = $Palette[$Key]["R"]+$Surrounding; $Color["BorderG"] = $Palette[$Key]["G"]+$Surrounding; $Color["BorderB"] = $Palette[$Key]["B"]+$Surrounding; }
173 173
            else
174 174
             { $Color["BorderR"] = $BorderR; $Color["BorderG"] = $BorderG; $Color["BorderB"] = $BorderB; }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
    function writeBubbleLabel($SerieName,$SerieWeightName,$Points,$Format="")
255 255
     {
256
-     $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
256
+     $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : null;
257 257
      $DrawPoint		= isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
258 258
 
259 259
      if ( !is_array($Points) ) { $Point = $Points; $Points = ""; $Points[] = $Point; }
Please login to merge, or discard this patch.
boinc/modules/boincstats/includes/pchart/class/pBarcode128.class.php 4 patches
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pBarcode128 - class to create barcodes (128B)
4 4
 
5 5
      Version     : 2.1.3
@@ -13,172 +13,172 @@  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 pBarcode128
18
-  {
19
-   var $Codes;
20
-   var $Reverse;
21
-   var $Result;
22
-   var $pChartObject;
23
-   var $CRC;
24
-
25
-   /* Class creator */
26
-   function pBarcode128($BasePath="")
16
+    /* pData class definition */
17
+    class pBarcode128
27 18
     {
28
-     $this->Codes   = "";
29
-     $this->Reverse = "";
30
-
31
-     $FileHandle = @fopen($BasePath."data/128B.db", "r");
32
-
33
-     if (!$FileHandle) { die("Cannot find barcode database (".$BasePath."128B.db)."); }
34
-
35
-     while (!feof($FileHandle))
36
-      {
37
-       $Buffer = fgets($FileHandle,4096);
38
-       $Buffer = str_replace(chr(10),"",$Buffer);
39
-       $Buffer = str_replace(chr(13),"",$Buffer);
40
-       $Values = preg_split("/;/",$Buffer);
41
-
42
-       $this->Codes[$Values[1]]["ID"]     = $Values[0];
43
-       $this->Codes[$Values[1]]["Code"]   = $Values[2];
44
-       $this->Reverse[$Values[0]]["Code"] = $Values[2];
45
-       $this->Reverse[$Values[0]]["Asc"]  = $Values[1];
46
-      }
47
-     fclose($FileHandle);
19
+    var $Codes;
20
+    var $Reverse;
21
+    var $Result;
22
+    var $pChartObject;
23
+    var $CRC;
24
+
25
+    /* Class creator */
26
+    function pBarcode128($BasePath="")
27
+    {
28
+        $this->Codes   = "";
29
+        $this->Reverse = "";
30
+
31
+        $FileHandle = @fopen($BasePath."data/128B.db", "r");
32
+
33
+        if (!$FileHandle) { die("Cannot find barcode database (".$BasePath."128B.db)."); }
34
+
35
+        while (!feof($FileHandle))
36
+        {
37
+        $Buffer = fgets($FileHandle,4096);
38
+        $Buffer = str_replace(chr(10),"",$Buffer);
39
+        $Buffer = str_replace(chr(13),"",$Buffer);
40
+        $Values = preg_split("/;/",$Buffer);
41
+
42
+        $this->Codes[$Values[1]]["ID"]     = $Values[0];
43
+        $this->Codes[$Values[1]]["Code"]   = $Values[2];
44
+        $this->Reverse[$Values[0]]["Code"] = $Values[2];
45
+        $this->Reverse[$Values[0]]["Asc"]  = $Values[1];
46
+        }
47
+        fclose($FileHandle);
48 48
     }
49 49
 
50
-   /* Return the projected size of a barcode */
51
-   function getSize($TextString,$Format="")
50
+    /* Return the projected size of a barcode */
51
+    function getSize($TextString,$Format="")
52 52
     {
53
-     $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
54
-     $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
55
-     $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
56
-     $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
57
-     $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : 12;
58
-     $Height		= isset($Format["Height"]) ? $Format["Height"] : 30;
53
+        $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
54
+        $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
55
+        $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
56
+        $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
57
+        $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : 12;
58
+        $Height		= isset($Format["Height"]) ? $Format["Height"] : 30;
59 59
 
60
-     $TextString    = $this->encode128($TextString);
61
-     $BarcodeLength = strlen($this->Result);
60
+        $TextString    = $this->encode128($TextString);
61
+        $BarcodeLength = strlen($this->Result);
62 62
 
63
-     if ( $DrawArea )   { $WOffset = 20; } else { $WOffset = 0; }
64
-     if ( $ShowLegend ) { $HOffset = $FontSize+$LegendOffset+$WOffset; } else { $HOffset = 0; }
63
+        if ( $DrawArea )   { $WOffset = 20; } else { $WOffset = 0; }
64
+        if ( $ShowLegend ) { $HOffset = $FontSize+$LegendOffset+$WOffset; } else { $HOffset = 0; }
65 65
 
66
-     $X1 = cos($Angle * PI / 180) * ($WOffset+$BarcodeLength);
67
-     $Y1 = sin($Angle * PI / 180) * ($WOffset+$BarcodeLength);
66
+        $X1 = cos($Angle * PI / 180) * ($WOffset+$BarcodeLength);
67
+        $Y1 = sin($Angle * PI / 180) * ($WOffset+$BarcodeLength);
68 68
 
69
-     $X2 = $X1 + cos(($Angle+90) * PI / 180) * ($HOffset+$Height);
70
-     $Y2 = $Y1 + sin(($Angle+90) * PI / 180) * ($HOffset+$Height);
69
+        $X2 = $X1 + cos(($Angle+90) * PI / 180) * ($HOffset+$Height);
70
+        $Y2 = $Y1 + sin(($Angle+90) * PI / 180) * ($HOffset+$Height);
71 71
 
72 72
 
73
-     $AreaWidth  = max(abs($X1),abs($X2));
74
-     $AreaHeight = max(abs($Y1),abs($Y2));
73
+        $AreaWidth  = max(abs($X1),abs($X2));
74
+        $AreaHeight = max(abs($Y1),abs($Y2));
75 75
 
76
-     return(array("Width"=>$AreaWidth,"Height"=>$AreaHeight));
76
+        return(array("Width"=>$AreaWidth,"Height"=>$AreaHeight));
77 77
     }
78 78
 
79
-   function encode128($Value,$Format="")
79
+    function encode128($Value,$Format="")
80 80
     {
81
-     $this->Result  = "11010010000";
82
-     $this->CRC     = 104;
83
-     $TextString    = "";
84
-
85
-     for($i=1;$i<=strlen($Value);$i++)
86
-      {
87
-       $CharCode = ord($this->mid($Value,$i,1));
88
-       if ( isset($this->Codes[$CharCode]) )
81
+        $this->Result  = "11010010000";
82
+        $this->CRC     = 104;
83
+        $TextString    = "";
84
+
85
+        for($i=1;$i<=strlen($Value);$i++)
89 86
         {
90
-         $this->Result = $this->Result.$this->Codes[$CharCode]["Code"];
91
-         $this->CRC = $this->CRC + $i*$this->Codes[$CharCode]["ID"];
92
-         $TextString = $TextString.chr($CharCode);
87
+        $CharCode = ord($this->mid($Value,$i,1));
88
+        if ( isset($this->Codes[$CharCode]) )
89
+        {
90
+            $this->Result = $this->Result.$this->Codes[$CharCode]["Code"];
91
+            $this->CRC = $this->CRC + $i*$this->Codes[$CharCode]["ID"];
92
+            $TextString = $TextString.chr($CharCode);
93
+        }
93 94
         }
94
-      }
95
-     $this->CRC = $this->CRC - floor($this->CRC/103)*103;
95
+        $this->CRC = $this->CRC - floor($this->CRC/103)*103;
96 96
 
97
-     $this->Result = $this->Result.$this->Reverse[$this->CRC]["Code"];
98
-     $this->Result = $this->Result."1100011101011";
97
+        $this->Result = $this->Result.$this->Reverse[$this->CRC]["Code"];
98
+        $this->Result = $this->Result."1100011101011";
99 99
 
100
-     return($TextString);
100
+        return($TextString);
101 101
     }
102 102
 
103
-   /* Create the encoded string */
104
-   function draw($Object,$Value,$X,$Y,$Format="")
103
+    /* Create the encoded string */
104
+    function draw($Object,$Value,$X,$Y,$Format="")
105 105
     {
106
-     $this->pChartObject = $Object;
107
-
108
-     $R			= isset($Format["R"]) ? $Format["R"] : 0;
109
-     $G			= isset($Format["G"]) ? $Format["G"] : 0;
110
-     $B			= isset($Format["B"]) ? $Format["B"] : 0;
111
-     $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
112
-     $Height		= isset($Format["Height"]) ? $Format["Height"] : 30;
113
-     $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
114
-     $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
115
-     $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
116
-     $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
117
-     $AreaR		= isset($Format["AreaR"]) ? $Format["AreaR"] : 255;
118
-     $AreaG		= isset($Format["AreaG"]) ? $Format["AreaG"] : 255;
119
-     $AreaB		= isset($Format["AreaB"]) ? $Format["AreaB"] : 255;
120
-     $AreaBorderR	= isset($Format["AreaBorderR"]) ? $Format["AreaBorderR"] : $AreaR;
121
-     $AreaBorderG	= isset($Format["AreaBorderG"]) ? $Format["AreaBorderG"] : $AreaG;
122
-     $AreaBorderB	= isset($Format["AreaBorderB"]) ? $Format["AreaBorderB"] : $AreaB;
123
-
124
-     $TextString = $this->encode128($Value);
125
-
126
-     if ( $DrawArea )
127
-      {
128
-       $X1 = $X + cos(($Angle-135) * PI / 180) * 10;
129
-       $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10;
130
-
131
-       $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20);
132
-       $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20);
133
-
134
-       if ( $ShowLegend )
106
+        $this->pChartObject = $Object;
107
+
108
+        $R			= isset($Format["R"]) ? $Format["R"] : 0;
109
+        $G			= isset($Format["G"]) ? $Format["G"] : 0;
110
+        $B			= isset($Format["B"]) ? $Format["B"] : 0;
111
+        $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
112
+        $Height		= isset($Format["Height"]) ? $Format["Height"] : 30;
113
+        $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
114
+        $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
115
+        $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
116
+        $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
117
+        $AreaR		= isset($Format["AreaR"]) ? $Format["AreaR"] : 255;
118
+        $AreaG		= isset($Format["AreaG"]) ? $Format["AreaG"] : 255;
119
+        $AreaB		= isset($Format["AreaB"]) ? $Format["AreaB"] : 255;
120
+        $AreaBorderR	= isset($Format["AreaBorderR"]) ? $Format["AreaBorderR"] : $AreaR;
121
+        $AreaBorderG	= isset($Format["AreaBorderG"]) ? $Format["AreaBorderG"] : $AreaG;
122
+        $AreaBorderB	= isset($Format["AreaBorderB"]) ? $Format["AreaBorderB"] : $AreaB;
123
+
124
+        $TextString = $this->encode128($Value);
125
+
126
+        if ( $DrawArea )
135 127
         {
136
-         $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
137
-         $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
128
+        $X1 = $X + cos(($Angle-135) * PI / 180) * 10;
129
+        $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10;
130
+
131
+        $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20);
132
+        $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20);
133
+
134
+        if ( $ShowLegend )
135
+        {
136
+            $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
137
+            $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
138 138
         }
139
-       else
139
+        else
140 140
         {
141
-         $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20);
142
-         $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20);
141
+            $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20);
142
+            $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20);
143 143
         }
144 144
 
145
-       $X4 = $X3 + cos(($Angle+180) * PI / 180) * (strlen($this->Result)+20);
146
-       $Y4 = $Y3 + sin(($Angle+180) * PI / 180) * (strlen($this->Result)+20);
145
+        $X4 = $X3 + cos(($Angle+180) * PI / 180) * (strlen($this->Result)+20);
146
+        $Y4 = $Y3 + sin(($Angle+180) * PI / 180) * (strlen($this->Result)+20);
147 147
 
148
-       $Polygon  = array($X1,$Y1,$X2,$Y2,$X3,$Y3,$X4,$Y4);
149
-       $Settings = array("R"=>$AreaR,"G"=>$AreaG,"B"=>$AreaB,"BorderR"=>$AreaBorderR,"BorderG"=>$AreaBorderG,"BorderB"=>$AreaBorderB);
150
-       $this->pChartObject->drawPolygon($Polygon,$Settings);
151
-      }
148
+        $Polygon  = array($X1,$Y1,$X2,$Y2,$X3,$Y3,$X4,$Y4);
149
+        $Settings = array("R"=>$AreaR,"G"=>$AreaG,"B"=>$AreaB,"BorderR"=>$AreaBorderR,"BorderG"=>$AreaBorderG,"BorderB"=>$AreaBorderB);
150
+        $this->pChartObject->drawPolygon($Polygon,$Settings);
151
+        }
152 152
 
153
-     for($i=1;$i<=strlen($this->Result);$i++)
154
-      {
155
-       if ( $this->mid($this->Result,$i,1) == 1 )
153
+        for($i=1;$i<=strlen($this->Result);$i++)
154
+        {
155
+        if ( $this->mid($this->Result,$i,1) == 1 )
156 156
         {
157
-         $X1 = $X + cos($Angle * PI / 180) * $i;
158
-         $Y1 = $Y + sin($Angle * PI / 180) * $i;
159
-         $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height;
160
-         $Y2 = $Y1 + sin(($Angle+90) * PI / 180) * $Height;
157
+            $X1 = $X + cos($Angle * PI / 180) * $i;
158
+            $Y1 = $Y + sin($Angle * PI / 180) * $i;
159
+            $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height;
160
+            $Y2 = $Y1 + sin(($Angle+90) * PI / 180) * $Height;
161 161
 
162
-         $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
163
-         $this->pChartObject->drawLine($X1,$Y1,$X2,$Y2,$Settings);
162
+            $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
163
+            $this->pChartObject->drawLine($X1,$Y1,$X2,$Y2,$Settings);
164
+        }
164 165
         }
165
-      }
166 166
 
167
-     if ( $ShowLegend )
168
-      {
169
-       $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2);
170
-       $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2);
167
+        if ( $ShowLegend )
168
+        {
169
+        $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2);
170
+        $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2);
171 171
 
172
-       $LegendX = $X1 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset);
173
-       $LegendY = $Y1 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset);
172
+        $LegendX = $X1 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset);
173
+        $LegendY = $Y1 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset);
174 174
 
175
-       $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Angle"=>-$Angle,"Align"=>TEXT_ALIGN_TOPMIDDLE);
176
-       $this->pChartObject->drawText($LegendX,$LegendY,$TextString,$Settings);
177
-      }
175
+        $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Angle"=>-$Angle,"Align"=>TEXT_ALIGN_TOPMIDDLE);
176
+        $this->pChartObject->drawText($LegendX,$LegendY,$TextString,$Settings);
177
+        }
178 178
     }
179 179
 
180
-   function left($value,$NbChar) { return substr($value,0,$NbChar); }  
181
-   function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); }  
182
-   function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); }  
183
-  }
180
+    function left($value,$NbChar) { return substr($value,0,$NbChar); }  
181
+    function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); }  
182
+    function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); }  
183
+    }
184 184
 ?>
185 185
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
    var $CRC;
24 24
 
25 25
    /* Class creator */
26
-   function pBarcode128($BasePath="")
26
+   function pBarcode128($BasePath = "")
27 27
     {
28 28
      $this->Codes   = "";
29 29
      $this->Reverse = "";
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 
35 35
      while (!feof($FileHandle))
36 36
       {
37
-       $Buffer = fgets($FileHandle,4096);
38
-       $Buffer = str_replace(chr(10),"",$Buffer);
39
-       $Buffer = str_replace(chr(13),"",$Buffer);
40
-       $Values = preg_split("/;/",$Buffer);
37
+       $Buffer = fgets($FileHandle, 4096);
38
+       $Buffer = str_replace(chr(10), "", $Buffer);
39
+       $Buffer = str_replace(chr(13), "", $Buffer);
40
+       $Values = preg_split("/;/", $Buffer);
41 41
 
42 42
        $this->Codes[$Values[1]]["ID"]     = $Values[0];
43 43
        $this->Codes[$Values[1]]["Code"]   = $Values[2];
@@ -48,44 +48,44 @@  discard block
 block discarded – undo
48 48
     }
49 49
 
50 50
    /* Return the projected size of a barcode */
51
-   function getSize($TextString,$Format="")
51
+   function getSize($TextString, $Format = "")
52 52
     {
53
-     $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
54
-     $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
55
-     $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
53
+     $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0;
54
+     $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
55
+     $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
56 56
      $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
57 57
      $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : 12;
58
-     $Height		= isset($Format["Height"]) ? $Format["Height"] : 30;
58
+     $Height = isset($Format["Height"]) ? $Format["Height"] : 30;
59 59
 
60 60
      $TextString    = $this->encode128($TextString);
61 61
      $BarcodeLength = strlen($this->Result);
62 62
 
63
-     if ( $DrawArea )   { $WOffset = 20; } else { $WOffset = 0; }
64
-     if ( $ShowLegend ) { $HOffset = $FontSize+$LegendOffset+$WOffset; } else { $HOffset = 0; }
63
+     if ($DrawArea) { $WOffset = 20; } else { $WOffset = 0; }
64
+     if ($ShowLegend) { $HOffset = $FontSize + $LegendOffset + $WOffset; } else { $HOffset = 0; }
65 65
 
66
-     $X1 = cos($Angle * PI / 180) * ($WOffset+$BarcodeLength);
67
-     $Y1 = sin($Angle * PI / 180) * ($WOffset+$BarcodeLength);
66
+     $X1 = cos($Angle*PI/180)*($WOffset + $BarcodeLength);
67
+     $Y1 = sin($Angle*PI/180)*($WOffset + $BarcodeLength);
68 68
 
69
-     $X2 = $X1 + cos(($Angle+90) * PI / 180) * ($HOffset+$Height);
70
-     $Y2 = $Y1 + sin(($Angle+90) * PI / 180) * ($HOffset+$Height);
69
+     $X2 = $X1 + cos(($Angle + 90)*PI/180)*($HOffset + $Height);
70
+     $Y2 = $Y1 + sin(($Angle + 90)*PI/180)*($HOffset + $Height);
71 71
 
72 72
 
73
-     $AreaWidth  = max(abs($X1),abs($X2));
74
-     $AreaHeight = max(abs($Y1),abs($Y2));
73
+     $AreaWidth  = max(abs($X1), abs($X2));
74
+     $AreaHeight = max(abs($Y1), abs($Y2));
75 75
 
76
-     return(array("Width"=>$AreaWidth,"Height"=>$AreaHeight));
76
+     return(array("Width"=>$AreaWidth, "Height"=>$AreaHeight));
77 77
     }
78 78
 
79
-   function encode128($Value,$Format="")
79
+   function encode128($Value, $Format = "")
80 80
     {
81 81
      $this->Result  = "11010010000";
82 82
      $this->CRC     = 104;
83 83
      $TextString    = "";
84 84
 
85
-     for($i=1;$i<=strlen($Value);$i++)
85
+     for ($i = 1; $i <= strlen($Value); $i++)
86 86
       {
87
-       $CharCode = ord($this->mid($Value,$i,1));
88
-       if ( isset($this->Codes[$CharCode]) )
87
+       $CharCode = ord($this->mid($Value, $i, 1));
88
+       if (isset($this->Codes[$CharCode]))
89 89
         {
90 90
          $this->Result = $this->Result.$this->Codes[$CharCode]["Code"];
91 91
          $this->CRC = $this->CRC + $i*$this->Codes[$CharCode]["ID"];
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     }
102 102
 
103 103
    /* Create the encoded string */
104
-   function draw($Object,$Value,$X,$Y,$Format="")
104
+   function draw($Object, $Value, $X, $Y, $Format = "")
105 105
     {
106 106
      $this->pChartObject = $Object;
107 107
 
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
110 110
      $B			= isset($Format["B"]) ? $Format["B"] : 0;
111 111
      $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
112
-     $Height		= isset($Format["Height"]) ? $Format["Height"] : 30;
112
+     $Height = isset($Format["Height"]) ? $Format["Height"] : 30;
113 113
      $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
114
-     $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
115
-     $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
116
-     $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
114
+     $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
115
+     $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
116
+     $DrawArea = isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
117 117
      $AreaR		= isset($Format["AreaR"]) ? $Format["AreaR"] : 255;
118 118
      $AreaG		= isset($Format["AreaG"]) ? $Format["AreaG"] : 255;
119 119
      $AreaB		= isset($Format["AreaB"]) ? $Format["AreaB"] : 255;
@@ -123,62 +123,62 @@  discard block
 block discarded – undo
123 123
 
124 124
      $TextString = $this->encode128($Value);
125 125
 
126
-     if ( $DrawArea )
126
+     if ($DrawArea)
127 127
       {
128
-       $X1 = $X + cos(($Angle-135) * PI / 180) * 10;
129
-       $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10;
128
+       $X1 = $X + cos(($Angle - 135)*PI/180)*10;
129
+       $Y1 = $Y + sin(($Angle - 135)*PI/180)*10;
130 130
 
131
-       $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20);
132
-       $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20);
131
+       $X2 = $X1 + cos($Angle*PI/180)*(strlen($this->Result) + 20);
132
+       $Y2 = $Y1 + sin($Angle*PI/180)*(strlen($this->Result) + 20);
133 133
 
134
-       if ( $ShowLegend )
134
+       if ($ShowLegend)
135 135
         {
136
-         $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
137
-         $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
136
+         $X3 = $X2 + cos(($Angle + 90)*PI/180)*($Height + $LegendOffset + $this->pChartObject->FontSize + 10);
137
+         $Y3 = $Y2 + sin(($Angle + 90)*PI/180)*($Height + $LegendOffset + $this->pChartObject->FontSize + 10);
138 138
         }
139 139
        else
140 140
         {
141
-         $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20);
142
-         $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20);
141
+         $X3 = $X2 + cos(($Angle + 90)*PI/180)*($Height + 20);
142
+         $Y3 = $Y2 + sin(($Angle + 90)*PI/180)*($Height + 20);
143 143
         }
144 144
 
145
-       $X4 = $X3 + cos(($Angle+180) * PI / 180) * (strlen($this->Result)+20);
146
-       $Y4 = $Y3 + sin(($Angle+180) * PI / 180) * (strlen($this->Result)+20);
145
+       $X4 = $X3 + cos(($Angle + 180)*PI/180)*(strlen($this->Result) + 20);
146
+       $Y4 = $Y3 + sin(($Angle + 180)*PI/180)*(strlen($this->Result) + 20);
147 147
 
148
-       $Polygon  = array($X1,$Y1,$X2,$Y2,$X3,$Y3,$X4,$Y4);
149
-       $Settings = array("R"=>$AreaR,"G"=>$AreaG,"B"=>$AreaB,"BorderR"=>$AreaBorderR,"BorderG"=>$AreaBorderG,"BorderB"=>$AreaBorderB);
150
-       $this->pChartObject->drawPolygon($Polygon,$Settings);
148
+       $Polygon  = array($X1, $Y1, $X2, $Y2, $X3, $Y3, $X4, $Y4);
149
+       $Settings = array("R"=>$AreaR, "G"=>$AreaG, "B"=>$AreaB, "BorderR"=>$AreaBorderR, "BorderG"=>$AreaBorderG, "BorderB"=>$AreaBorderB);
150
+       $this->pChartObject->drawPolygon($Polygon, $Settings);
151 151
       }
152 152
 
153
-     for($i=1;$i<=strlen($this->Result);$i++)
153
+     for ($i = 1; $i <= strlen($this->Result); $i++)
154 154
       {
155
-       if ( $this->mid($this->Result,$i,1) == 1 )
155
+       if ($this->mid($this->Result, $i, 1) == 1)
156 156
         {
157
-         $X1 = $X + cos($Angle * PI / 180) * $i;
158
-         $Y1 = $Y + sin($Angle * PI / 180) * $i;
159
-         $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height;
160
-         $Y2 = $Y1 + sin(($Angle+90) * PI / 180) * $Height;
157
+         $X1 = $X + cos($Angle*PI/180)*$i;
158
+         $Y1 = $Y + sin($Angle*PI/180)*$i;
159
+         $X2 = $X1 + cos(($Angle + 90)*PI/180)*$Height;
160
+         $Y2 = $Y1 + sin(($Angle + 90)*PI/180)*$Height;
161 161
 
162
-         $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
163
-         $this->pChartObject->drawLine($X1,$Y1,$X2,$Y2,$Settings);
162
+         $Settings = array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha);
163
+         $this->pChartObject->drawLine($X1, $Y1, $X2, $Y2, $Settings);
164 164
         }
165 165
       }
166 166
 
167
-     if ( $ShowLegend )
167
+     if ($ShowLegend)
168 168
       {
169
-       $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2);
170
-       $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2);
169
+       $X1 = $X + cos($Angle*PI/180)*(strlen($this->Result)/2);
170
+       $Y1 = $Y + sin($Angle*PI/180)*(strlen($this->Result)/2);
171 171
 
172
-       $LegendX = $X1 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset);
173
-       $LegendY = $Y1 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset);
172
+       $LegendX = $X1 + cos(($Angle + 90)*PI/180)*($Height + $LegendOffset);
173
+       $LegendY = $Y1 + sin(($Angle + 90)*PI/180)*($Height + $LegendOffset);
174 174
 
175
-       $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Angle"=>-$Angle,"Align"=>TEXT_ALIGN_TOPMIDDLE);
176
-       $this->pChartObject->drawText($LegendX,$LegendY,$TextString,$Settings);
175
+       $Settings = array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha, "Angle"=>-$Angle, "Align"=>TEXT_ALIGN_TOPMIDDLE);
176
+       $this->pChartObject->drawText($LegendX, $LegendY, $TextString, $Settings);
177 177
       }
178 178
     }
179 179
 
180
-   function left($value,$NbChar) { return substr($value,0,$NbChar); }  
181
-   function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); }  
182
-   function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); }  
180
+   function left($value, $NbChar) { return substr($value, 0, $NbChar); }  
181
+   function right($value, $NbChar) { return substr($value, strlen($value) - $NbChar, $NbChar); }  
182
+   function mid($value, $Depart, $NbChar) { return substr($value, $Depart - 1, $NbChar); }  
183 183
   }
184 184
 ?>
185 185
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +14 added lines, -29 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
  */
15 15
 
16 16
  /* pData class definition */
17
- class pBarcode128
18
-  {
17
+ class pBarcode128 {
19 18
    var $Codes;
20 19
    var $Reverse;
21 20
    var $Result;
@@ -23,8 +22,7 @@  discard block
 block discarded – undo
23 22
    var $CRC;
24 23
 
25 24
    /* Class creator */
26
-   function pBarcode128($BasePath="")
27
-    {
25
+   function pBarcode128($BasePath="") {
28 26
      $this->Codes   = "";
29 27
      $this->Reverse = "";
30 28
 
@@ -32,8 +30,7 @@  discard block
 block discarded – undo
32 30
 
33 31
      if (!$FileHandle) { die("Cannot find barcode database (".$BasePath."128B.db)."); }
34 32
 
35
-     while (!feof($FileHandle))
36
-      {
33
+     while (!feof($FileHandle)) {
37 34
        $Buffer = fgets($FileHandle,4096);
38 35
        $Buffer = str_replace(chr(10),"",$Buffer);
39 36
        $Buffer = str_replace(chr(13),"",$Buffer);
@@ -48,8 +45,7 @@  discard block
 block discarded – undo
48 45
     }
49 46
 
50 47
    /* Return the projected size of a barcode */
51
-   function getSize($TextString,$Format="")
52
-    {
48
+   function getSize($TextString,$Format="") {
53 49
      $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
54 50
      $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
55 51
      $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
@@ -76,17 +72,14 @@  discard block
 block discarded – undo
76 72
      return(array("Width"=>$AreaWidth,"Height"=>$AreaHeight));
77 73
     }
78 74
 
79
-   function encode128($Value,$Format="")
80
-    {
75
+   function encode128($Value,$Format="") {
81 76
      $this->Result  = "11010010000";
82 77
      $this->CRC     = 104;
83 78
      $TextString    = "";
84 79
 
85
-     for($i=1;$i<=strlen($Value);$i++)
86
-      {
80
+     for($i=1;$i<=strlen($Value);$i++) {
87 81
        $CharCode = ord($this->mid($Value,$i,1));
88
-       if ( isset($this->Codes[$CharCode]) )
89
-        {
82
+       if ( isset($this->Codes[$CharCode]) ) {
90 83
          $this->Result = $this->Result.$this->Codes[$CharCode]["Code"];
91 84
          $this->CRC = $this->CRC + $i*$this->Codes[$CharCode]["ID"];
92 85
          $TextString = $TextString.chr($CharCode);
@@ -101,8 +94,7 @@  discard block
 block discarded – undo
101 94
     }
102 95
 
103 96
    /* Create the encoded string */
104
-   function draw($Object,$Value,$X,$Y,$Format="")
105
-    {
97
+   function draw($Object,$Value,$X,$Y,$Format="") {
106 98
      $this->pChartObject = $Object;
107 99
 
108 100
      $R			= isset($Format["R"]) ? $Format["R"] : 0;
@@ -123,21 +115,17 @@  discard block
 block discarded – undo
123 115
 
124 116
      $TextString = $this->encode128($Value);
125 117
 
126
-     if ( $DrawArea )
127
-      {
118
+     if ( $DrawArea ) {
128 119
        $X1 = $X + cos(($Angle-135) * PI / 180) * 10;
129 120
        $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10;
130 121
 
131 122
        $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20);
132 123
        $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20);
133 124
 
134
-       if ( $ShowLegend )
135
-        {
125
+       if ( $ShowLegend ) {
136 126
          $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
137 127
          $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
138
-        }
139
-       else
140
-        {
128
+        } else {
141 129
          $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20);
142 130
          $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20);
143 131
         }
@@ -150,10 +138,8 @@  discard block
 block discarded – undo
150 138
        $this->pChartObject->drawPolygon($Polygon,$Settings);
151 139
       }
152 140
 
153
-     for($i=1;$i<=strlen($this->Result);$i++)
154
-      {
155
-       if ( $this->mid($this->Result,$i,1) == 1 )
156
-        {
141
+     for($i=1;$i<=strlen($this->Result);$i++) {
142
+       if ( $this->mid($this->Result,$i,1) == 1 ) {
157 143
          $X1 = $X + cos($Angle * PI / 180) * $i;
158 144
          $Y1 = $Y + sin($Angle * PI / 180) * $i;
159 145
          $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height;
@@ -164,8 +150,7 @@  discard block
 block discarded – undo
164 150
         }
165 151
       }
166 152
 
167
-     if ( $ShowLegend )
168
-      {
153
+     if ( $ShowLegend ) {
169 154
        $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2);
170 155
        $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2);
171 156
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
    function getSize($TextString,$Format="")
52 52
     {
53 53
      $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
54
-     $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
54
+     $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : false;
55 55
      $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
56
-     $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
56
+     $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : false;
57 57
      $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : 12;
58 58
      $Height		= isset($Format["Height"]) ? $Format["Height"] : 30;
59 59
 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
      $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
112 112
      $Height		= isset($Format["Height"]) ? $Format["Height"] : 30;
113 113
      $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
114
-     $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
114
+     $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : false;
115 115
      $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
116
-     $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
116
+     $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : false;
117 117
      $AreaR		= isset($Format["AreaR"]) ? $Format["AreaR"] : 255;
118 118
      $AreaG		= isset($Format["AreaG"]) ? $Format["AreaG"] : 255;
119 119
      $AreaB		= isset($Format["AreaB"]) ? $Format["AreaB"] : 255;
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pScatter.class.php 4 patches
Indentation   +866 added lines, -866 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pScatter - class to draw scatter charts
4 4
 
5 5
      Version     : 2.1.3
@@ -13,1146 +13,1146 @@  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("SCATTER_MISSING_X_SERIE"	, 190001);
17
- define("SCATTER_MISSING_Y_SERIE"	, 190002);
16
+    define("SCATTER_MISSING_X_SERIE"	, 190001);
17
+    define("SCATTER_MISSING_Y_SERIE"	, 190002);
18 18
 
19
- /* pScatter class definition */
20
- class pScatter
21
-  {
22
-   var $pChartObject;
23
-   var $pDataObject;
19
+    /* pScatter class definition */
20
+    class pScatter
21
+    {
22
+    var $pChartObject;
23
+    var $pDataObject;
24 24
 
25
-   /* Class creator */
26
-   function pScatter($pChartObject,$pDataObject)
25
+    /* Class creator */
26
+    function pScatter($pChartObject,$pDataObject)
27 27
     {
28
-     $this->pChartObject = $pChartObject;
29
-     $this->pDataObject  = $pDataObject;
28
+        $this->pChartObject = $pChartObject;
29
+        $this->pDataObject  = $pDataObject;
30 30
     }
31 31
 
32
-   /* Prepare the scale */
33
-   function drawScatterScale($Format="")
32
+    /* Prepare the scale */
33
+    function drawScatterScale($Format="")
34 34
     {
35
-     $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : SCALE_MODE_FLOATING;
36
-     $Floating		= isset($Format["Floating"]) ? $Format["Floating"] : FALSE;
37
-     $XLabelsRotation	= isset($Format["XLabelsRotation"]) ? $Format["XLabelsRotation"] : 90;
38
-     $MinDivHeight	= isset($Format["MinDivHeight"]) ? $Format["MinDivHeight"] : 20;
39
-     $Factors		= isset($Format["Factors"]) ? $Format["Factors"] : array(1,2,5);
40
-     $ManualScale	= isset($Format["ManualScale"]) ? $Format["ManualScale"] : array("0"=>array("Min"=>-100,"Max"=>100));
41
-     $XMargin		= isset($Format["XMargin"]) ? $Format["XMargin"] : 0;
42
-     $YMargin		= isset($Format["YMargin"]) ? $Format["YMargin"] : 0;
43
-     $ScaleSpacing	= isset($Format["ScaleSpacing"]) ? $Format["ScaleSpacing"] : 15;
44
-     $InnerTickWidth	= isset($Format["InnerTickWidth"]) ? $Format["InnerTickWidth"] : 2;
45
-     $OuterTickWidth	= isset($Format["OuterTickWidth"]) ? $Format["OuterTickWidth"] : 2;
46
-     $DrawXLines	= isset($Format["DrawXLines"]) ? $Format["DrawXLines"] : ALL;
47
-     $DrawYLines	= isset($Format["DrawYLines"]) ? $Format["DrawYLines"] : ALL;
48
-     $GridTicks		= isset($Format["GridTicks"]) ? $Format["GridTicks"] : 4;
49
-     $GridR		= isset($Format["GridR"]) ? $Format["GridR"] : 255;
50
-     $GridG		= isset($Format["GridG"]) ? $Format["GridG"] : 255;
51
-     $GridB		= isset($Format["GridB"]) ? $Format["GridB"] : 255;
52
-     $GridAlpha		= isset($Format["GridAlpha"]) ? $Format["GridAlpha"] : 40;
53
-     $AxisRo		= isset($Format["AxisR"]) ? $Format["AxisR"] : 0;
54
-     $AxisGo		= isset($Format["AxisG"]) ? $Format["AxisG"] : 0;
55
-     $AxisBo		= isset($Format["AxisB"]) ? $Format["AxisB"] : 0;
56
-     $AxisAlpha		= isset($Format["AxisAlpha"]) ? $Format["AxisAlpha"] : 100;
57
-     $TickRo		= isset($Format["TickR"]) ? $Format["TickR"] : 0;
58
-     $TickGo		= isset($Format["TickG"]) ? $Format["TickG"] : 0;
59
-     $TickBo		= isset($Format["TickB"]) ? $Format["TickB"] : 0;
60
-     $TickAlpha		= isset($Format["TickAlpha"]) ? $Format["TickAlpha"] : 100;
61
-     $DrawSubTicks	= isset($Format["DrawSubTicks"]) ? $Format["DrawSubTicks"] : FALSE;
62
-     $InnerSubTickWidth	= isset($Format["InnerSubTickWidth"]) ? $Format["InnerSubTickWidth"] : 0;
63
-     $OuterSubTickWidth	= isset($Format["OuterSubTickWidth"]) ? $Format["OuterSubTickWidth"] : 2;
64
-     $SubTickR		= isset($Format["SubTickR"]) ? $Format["SubTickR"] : 255;
65
-     $SubTickG		= isset($Format["SubTickG"]) ? $Format["SubTickG"] : 0;
66
-     $SubTickB		= isset($Format["SubTickB"]) ? $Format["SubTickB"] : 0;
67
-     $SubTickAlpha	= isset($Format["SubTickAlpha"]) ? $Format["SubTickAlpha"] : 100;
68
-     $XReleasePercent	= isset($Format["XReleasePercent"]) ? $Format["XReleasePercent"] : 1;
69
-     $DrawArrows	= isset($Format["DrawArrows"]) ? $Format["DrawArrows"] : FALSE;
70
-     $ArrowSize         = isset($Format["ArrowSize"]) ? $Format["ArrowSize"] : 8;
71
-     $CycleBackground	= isset($Format["CycleBackground"]) ? $Format["CycleBackground"] : FALSE;
72
-     $BackgroundR1	= isset($Format["BackgroundR1"]) ? $Format["BackgroundR1"] : 255;
73
-     $BackgroundG1	= isset($Format["BackgroundG1"]) ? $Format["BackgroundG1"] : 255;
74
-     $BackgroundB1	= isset($Format["BackgroundB1"]) ? $Format["BackgroundB1"] : 255;
75
-     $BackgroundAlpha1	= isset($Format["BackgroundAlpha1"]) ? $Format["BackgroundAlpha1"] : 10;
76
-     $BackgroundR2	= isset($Format["BackgroundR2"]) ? $Format["BackgroundR2"] : 230;
77
-     $BackgroundG2	= isset($Format["BackgroundG2"]) ? $Format["BackgroundG2"] : 230;
78
-     $BackgroundB2	= isset($Format["BackgroundB2"]) ? $Format["BackgroundB2"] : 230;
79
-     $BackgroundAlpha2	= isset($Format["BackgroundAlpha2"]) ? $Format["BackgroundAlpha2"] : 10;
80
-
81
-     /* Check if we have at least both one X and Y axis */
82
-     $GotXAxis = FALSE; $GotYAxis = FALSE;
83
-     foreach($this->pDataObject->Data["Axis"] as $AxisID => $AxisSettings)
84
-      {
85
-       if ( $AxisSettings["Identity"] == AXIS_X ) { $GotXAxis = TRUE; }
86
-       if ( $AxisSettings["Identity"] == AXIS_Y ) { $GotYAxis = TRUE; }
87
-      }
88
-     if ( !$GotXAxis ) { return(SCATTER_MISSING_X_SERIE); }
89
-     if ( !$GotYAxis ) { return(SCATTER_MISSING_Y_SERIE); }
90
-
91
-     /* Skip a NOTICE event in case of an empty array */
92
-     if ( $DrawYLines == NONE ) { $DrawYLines = array("zarma"=>"31"); }
93
-
94
-     $Data = $this->pDataObject->getData();
95
-
96
-     foreach($Data["Axis"] as $AxisID => $AxisSettings)
97
-      {
98
-       if ( $AxisSettings["Identity"] == AXIS_X)
35
+        $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : SCALE_MODE_FLOATING;
36
+        $Floating		= isset($Format["Floating"]) ? $Format["Floating"] : FALSE;
37
+        $XLabelsRotation	= isset($Format["XLabelsRotation"]) ? $Format["XLabelsRotation"] : 90;
38
+        $MinDivHeight	= isset($Format["MinDivHeight"]) ? $Format["MinDivHeight"] : 20;
39
+        $Factors		= isset($Format["Factors"]) ? $Format["Factors"] : array(1,2,5);
40
+        $ManualScale	= isset($Format["ManualScale"]) ? $Format["ManualScale"] : array("0"=>array("Min"=>-100,"Max"=>100));
41
+        $XMargin		= isset($Format["XMargin"]) ? $Format["XMargin"] : 0;
42
+        $YMargin		= isset($Format["YMargin"]) ? $Format["YMargin"] : 0;
43
+        $ScaleSpacing	= isset($Format["ScaleSpacing"]) ? $Format["ScaleSpacing"] : 15;
44
+        $InnerTickWidth	= isset($Format["InnerTickWidth"]) ? $Format["InnerTickWidth"] : 2;
45
+        $OuterTickWidth	= isset($Format["OuterTickWidth"]) ? $Format["OuterTickWidth"] : 2;
46
+        $DrawXLines	= isset($Format["DrawXLines"]) ? $Format["DrawXLines"] : ALL;
47
+        $DrawYLines	= isset($Format["DrawYLines"]) ? $Format["DrawYLines"] : ALL;
48
+        $GridTicks		= isset($Format["GridTicks"]) ? $Format["GridTicks"] : 4;
49
+        $GridR		= isset($Format["GridR"]) ? $Format["GridR"] : 255;
50
+        $GridG		= isset($Format["GridG"]) ? $Format["GridG"] : 255;
51
+        $GridB		= isset($Format["GridB"]) ? $Format["GridB"] : 255;
52
+        $GridAlpha		= isset($Format["GridAlpha"]) ? $Format["GridAlpha"] : 40;
53
+        $AxisRo		= isset($Format["AxisR"]) ? $Format["AxisR"] : 0;
54
+        $AxisGo		= isset($Format["AxisG"]) ? $Format["AxisG"] : 0;
55
+        $AxisBo		= isset($Format["AxisB"]) ? $Format["AxisB"] : 0;
56
+        $AxisAlpha		= isset($Format["AxisAlpha"]) ? $Format["AxisAlpha"] : 100;
57
+        $TickRo		= isset($Format["TickR"]) ? $Format["TickR"] : 0;
58
+        $TickGo		= isset($Format["TickG"]) ? $Format["TickG"] : 0;
59
+        $TickBo		= isset($Format["TickB"]) ? $Format["TickB"] : 0;
60
+        $TickAlpha		= isset($Format["TickAlpha"]) ? $Format["TickAlpha"] : 100;
61
+        $DrawSubTicks	= isset($Format["DrawSubTicks"]) ? $Format["DrawSubTicks"] : FALSE;
62
+        $InnerSubTickWidth	= isset($Format["InnerSubTickWidth"]) ? $Format["InnerSubTickWidth"] : 0;
63
+        $OuterSubTickWidth	= isset($Format["OuterSubTickWidth"]) ? $Format["OuterSubTickWidth"] : 2;
64
+        $SubTickR		= isset($Format["SubTickR"]) ? $Format["SubTickR"] : 255;
65
+        $SubTickG		= isset($Format["SubTickG"]) ? $Format["SubTickG"] : 0;
66
+        $SubTickB		= isset($Format["SubTickB"]) ? $Format["SubTickB"] : 0;
67
+        $SubTickAlpha	= isset($Format["SubTickAlpha"]) ? $Format["SubTickAlpha"] : 100;
68
+        $XReleasePercent	= isset($Format["XReleasePercent"]) ? $Format["XReleasePercent"] : 1;
69
+        $DrawArrows	= isset($Format["DrawArrows"]) ? $Format["DrawArrows"] : FALSE;
70
+        $ArrowSize         = isset($Format["ArrowSize"]) ? $Format["ArrowSize"] : 8;
71
+        $CycleBackground	= isset($Format["CycleBackground"]) ? $Format["CycleBackground"] : FALSE;
72
+        $BackgroundR1	= isset($Format["BackgroundR1"]) ? $Format["BackgroundR1"] : 255;
73
+        $BackgroundG1	= isset($Format["BackgroundG1"]) ? $Format["BackgroundG1"] : 255;
74
+        $BackgroundB1	= isset($Format["BackgroundB1"]) ? $Format["BackgroundB1"] : 255;
75
+        $BackgroundAlpha1	= isset($Format["BackgroundAlpha1"]) ? $Format["BackgroundAlpha1"] : 10;
76
+        $BackgroundR2	= isset($Format["BackgroundR2"]) ? $Format["BackgroundR2"] : 230;
77
+        $BackgroundG2	= isset($Format["BackgroundG2"]) ? $Format["BackgroundG2"] : 230;
78
+        $BackgroundB2	= isset($Format["BackgroundB2"]) ? $Format["BackgroundB2"] : 230;
79
+        $BackgroundAlpha2	= isset($Format["BackgroundAlpha2"]) ? $Format["BackgroundAlpha2"] : 10;
80
+
81
+        /* Check if we have at least both one X and Y axis */
82
+        $GotXAxis = FALSE; $GotYAxis = FALSE;
83
+        foreach($this->pDataObject->Data["Axis"] as $AxisID => $AxisSettings)
84
+        {
85
+        if ( $AxisSettings["Identity"] == AXIS_X ) { $GotXAxis = TRUE; }
86
+        if ( $AxisSettings["Identity"] == AXIS_Y ) { $GotYAxis = TRUE; }
87
+        }
88
+        if ( !$GotXAxis ) { return(SCATTER_MISSING_X_SERIE); }
89
+        if ( !$GotYAxis ) { return(SCATTER_MISSING_Y_SERIE); }
90
+
91
+        /* Skip a NOTICE event in case of an empty array */
92
+        if ( $DrawYLines == NONE ) { $DrawYLines = array("zarma"=>"31"); }
93
+
94
+        $Data = $this->pDataObject->getData();
95
+
96
+        foreach($Data["Axis"] as $AxisID => $AxisSettings)
97
+        {
98
+        if ( $AxisSettings["Identity"] == AXIS_X)
99 99
         { $Width = $this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin*2; }
100
-       else
100
+        else
101 101
         { $Width = $this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1 - $YMargin*2; }
102 102
 
103
-       $AxisMin = ABSOLUTE_MAX; $AxisMax = OUT_OF_SIGHT;
104
-       if ( $Mode == SCALE_MODE_FLOATING )
103
+        $AxisMin = ABSOLUTE_MAX; $AxisMax = OUT_OF_SIGHT;
104
+        if ( $Mode == SCALE_MODE_FLOATING )
105 105
         {
106
-         foreach($Data["Series"] as $SerieID => $SerieParameter)
107
-          {
108
-           if ( $SerieParameter["Axis"] == $AxisID && $Data["Series"][$SerieID]["isDrawable"] )
106
+            foreach($Data["Series"] as $SerieID => $SerieParameter)
109 107
             {
110
-             $AxisMax = max($AxisMax,$Data["Series"][$SerieID]["Max"]);
111
-             $AxisMin = min($AxisMin,$Data["Series"][$SerieID]["Min"]);
108
+            if ( $SerieParameter["Axis"] == $AxisID && $Data["Series"][$SerieID]["isDrawable"] )
109
+            {
110
+                $AxisMax = max($AxisMax,$Data["Series"][$SerieID]["Max"]);
111
+                $AxisMin = min($AxisMin,$Data["Series"][$SerieID]["Min"]);
112
+            }
112 113
             }
113
-          }
114
-         $AutoMargin = (($AxisMax-$AxisMin)/100)*$XReleasePercent;
114
+            $AutoMargin = (($AxisMax-$AxisMin)/100)*$XReleasePercent;
115 115
 
116
-         $Data["Axis"][$AxisID]["Min"] = $AxisMin-$AutoMargin; $Data["Axis"][$AxisID]["Max"] = $AxisMax+$AutoMargin;
116
+            $Data["Axis"][$AxisID]["Min"] = $AxisMin-$AutoMargin; $Data["Axis"][$AxisID]["Max"] = $AxisMax+$AutoMargin;
117 117
         }
118
-       elseif ( $Mode == SCALE_MODE_MANUAL )
118
+        elseif ( $Mode == SCALE_MODE_MANUAL )
119 119
         {
120
-         if ( isset($ManualScale[$AxisID]["Min"]) && isset($ManualScale[$AxisID]["Max"]) )
121
-          {
122
-           $Data["Axis"][$AxisID]["Min"] = $ManualScale[$AxisID]["Min"];
123
-           $Data["Axis"][$AxisID]["Max"] = $ManualScale[$AxisID]["Max"];
124
-          }
125
-         else
126
-          { echo "Manual scale boundaries not set."; exit(); }
120
+            if ( isset($ManualScale[$AxisID]["Min"]) && isset($ManualScale[$AxisID]["Max"]) )
121
+            {
122
+            $Data["Axis"][$AxisID]["Min"] = $ManualScale[$AxisID]["Min"];
123
+            $Data["Axis"][$AxisID]["Max"] = $ManualScale[$AxisID]["Max"];
124
+            }
125
+            else
126
+            { echo "Manual scale boundaries not set."; exit(); }
127 127
         }
128 128
 
129
-       /* Full manual scale */
130
-       if ( isset($ManualScale[$AxisID]["Rows"]) && isset($ManualScale[$AxisID]["RowHeight"]) )
129
+        /* Full manual scale */
130
+        if ( isset($ManualScale[$AxisID]["Rows"]) && isset($ManualScale[$AxisID]["RowHeight"]) )
131 131
         $Scale = array("Rows"=>$ManualScale[$AxisID]["Rows"],"RowHeight"=>$ManualScale[$AxisID]["RowHeight"],"XMin"=>$ManualScale[$AxisID]["Min"],"XMax"=>$ManualScale[$AxisID]["Max"]);
132
-       else
132
+        else
133 133
         {
134
-         $MaxDivs = floor($Width/$MinDivHeight);
135
-         $Scale   = $this->pChartObject->computeScale($Data["Axis"][$AxisID]["Min"],$Data["Axis"][$AxisID]["Max"],$MaxDivs,$Factors,$AxisID);
134
+            $MaxDivs = floor($Width/$MinDivHeight);
135
+            $Scale   = $this->pChartObject->computeScale($Data["Axis"][$AxisID]["Min"],$Data["Axis"][$AxisID]["Max"],$MaxDivs,$Factors,$AxisID);
136 136
         }
137 137
 
138
-       $Data["Axis"][$AxisID]["Margin"]    = $AxisSettings["Identity"] == AXIS_X ? $XMargin : $YMargin;
139
-       $Data["Axis"][$AxisID]["ScaleMin"]  = $Scale["XMin"];
140
-       $Data["Axis"][$AxisID]["ScaleMax"]  = $Scale["XMax"];
141
-       $Data["Axis"][$AxisID]["Rows"]      = $Scale["Rows"];
142
-       $Data["Axis"][$AxisID]["RowHeight"] = $Scale["RowHeight"];
138
+        $Data["Axis"][$AxisID]["Margin"]    = $AxisSettings["Identity"] == AXIS_X ? $XMargin : $YMargin;
139
+        $Data["Axis"][$AxisID]["ScaleMin"]  = $Scale["XMin"];
140
+        $Data["Axis"][$AxisID]["ScaleMax"]  = $Scale["XMax"];
141
+        $Data["Axis"][$AxisID]["Rows"]      = $Scale["Rows"];
142
+        $Data["Axis"][$AxisID]["RowHeight"] = $Scale["RowHeight"];
143 143
 
144
-       if ( isset($Scale["Format"]) ) { $Data["Axis"][$AxisID]["Format"] = $Scale["Format"]; }
144
+        if ( isset($Scale["Format"]) ) { $Data["Axis"][$AxisID]["Format"] = $Scale["Format"]; }
145 145
 
146
-       if ( !isset($Data["Axis"][$AxisID]["Display"]) ) { $Data["Axis"][$AxisID]["Display"] = NULL; }
147
-       if ( !isset($Data["Axis"][$AxisID]["Format"]) )  { $Data["Axis"][$AxisID]["Format"] = NULL; }
148
-       if ( !isset($Data["Axis"][$AxisID]["Unit"]) )    { $Data["Axis"][$AxisID]["Unit"] = NULL; }
149
-      }
146
+        if ( !isset($Data["Axis"][$AxisID]["Display"]) ) { $Data["Axis"][$AxisID]["Display"] = NULL; }
147
+        if ( !isset($Data["Axis"][$AxisID]["Format"]) )  { $Data["Axis"][$AxisID]["Format"] = NULL; }
148
+        if ( !isset($Data["Axis"][$AxisID]["Unit"]) )    { $Data["Axis"][$AxisID]["Unit"] = NULL; }
149
+        }
150 150
 
151
-     /* Get the default font color */
152
-     $FontColorRo = $this->pChartObject->FontColorR; $FontColorGo = $this->pChartObject->FontColorG; $FontColorBo = $this->pChartObject->FontColorB;
151
+        /* Get the default font color */
152
+        $FontColorRo = $this->pChartObject->FontColorR; $FontColorGo = $this->pChartObject->FontColorG; $FontColorBo = $this->pChartObject->FontColorB;
153 153
 
154
-     /* Set the original boundaries */
155
-     $AxisPos["L"] = $this->pChartObject->GraphAreaX1; $AxisPos["R"] = $this->pChartObject->GraphAreaX2; $AxisPos["T"] = $this->pChartObject->GraphAreaY1; $AxisPos["B"] = $this->pChartObject->GraphAreaY2;
154
+        /* Set the original boundaries */
155
+        $AxisPos["L"] = $this->pChartObject->GraphAreaX1; $AxisPos["R"] = $this->pChartObject->GraphAreaX2; $AxisPos["T"] = $this->pChartObject->GraphAreaY1; $AxisPos["B"] = $this->pChartObject->GraphAreaY2;
156 156
 
157
-     foreach($Data["Axis"] as $AxisID => $AxisSettings)
158
-      {
159
-       if ( isset($AxisSettings["Color"]) )
157
+        foreach($Data["Axis"] as $AxisID => $AxisSettings)
158
+        {
159
+        if ( isset($AxisSettings["Color"]) )
160 160
         {
161
-         $AxisR = $AxisSettings["Color"]["R"]; $AxisG = $AxisSettings["Color"]["G"]; $AxisB = $AxisSettings["Color"]["B"];
162
-         $TickR = $AxisSettings["Color"]["R"]; $TickG = $AxisSettings["Color"]["G"]; $TickB = $AxisSettings["Color"]["B"];
163
-         $this->pChartObject->setFontProperties(array("R"=>$AxisSettings["Color"]["R"],"G"=>$AxisSettings["Color"]["G"],"B"=>$AxisSettings["Color"]["B"]));
161
+            $AxisR = $AxisSettings["Color"]["R"]; $AxisG = $AxisSettings["Color"]["G"]; $AxisB = $AxisSettings["Color"]["B"];
162
+            $TickR = $AxisSettings["Color"]["R"]; $TickG = $AxisSettings["Color"]["G"]; $TickB = $AxisSettings["Color"]["B"];
163
+            $this->pChartObject->setFontProperties(array("R"=>$AxisSettings["Color"]["R"],"G"=>$AxisSettings["Color"]["G"],"B"=>$AxisSettings["Color"]["B"]));
164 164
         }
165
-       else
165
+        else
166 166
         {
167
-         $AxisR = $AxisRo; $AxisG = $AxisGo; $AxisB = $AxisBo;
168
-         $TickR = $TickRo; $TickG = $TickGo; $TickB = $TickBo;
169
-         $this->pChartObject->setFontProperties(array("R"=>$FontColorRo,"G"=>$FontColorGo,"B"=>$FontColorBo));
167
+            $AxisR = $AxisRo; $AxisG = $AxisGo; $AxisB = $AxisBo;
168
+            $TickR = $TickRo; $TickG = $TickGo; $TickB = $TickBo;
169
+            $this->pChartObject->setFontProperties(array("R"=>$FontColorRo,"G"=>$FontColorGo,"B"=>$FontColorBo));
170 170
         }
171 171
 
172
-       $LastValue = "w00t"; $ID = 1;
173
-       if ( $AxisSettings["Identity"] == AXIS_X )
172
+        $LastValue = "w00t"; $ID = 1;
173
+        if ( $AxisSettings["Identity"] == AXIS_X )
174 174
         {
175
-         if ( $AxisSettings["Position"] == AXIS_POSITION_BOTTOM )
176
-          {
177
-           if ( $XLabelsRotation == 0 )				   { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $LabelOffset = 2; }
178
-           if ( $XLabelsRotation > 0 && $XLabelsRotation < 190 )   { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $LabelOffset = 5; }
179
-           if ( $XLabelsRotation == 180 )			   { $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $LabelOffset = 5; }
180
-           if ( $XLabelsRotation > 180 && $XLabelsRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $LabelOffset = 2; }
181
-
182
-           if ( $Floating )
175
+            if ( $AxisSettings["Position"] == AXIS_POSITION_BOTTOM )
176
+            {
177
+            if ( $XLabelsRotation == 0 )				   { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $LabelOffset = 2; }
178
+            if ( $XLabelsRotation > 0 && $XLabelsRotation < 190 )   { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $LabelOffset = 5; }
179
+            if ( $XLabelsRotation == 180 )			   { $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $LabelOffset = 5; }
180
+            if ( $XLabelsRotation > 180 && $XLabelsRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $LabelOffset = 2; }
181
+
182
+            if ( $Floating )
183 183
             { $FloatingOffset = $YMargin; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$AxisSettings["Margin"],$AxisPos["B"],$this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
184
-           else
184
+            else
185 185
             { $FloatingOffset = 0; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1,$AxisPos["B"],$this->pChartObject->GraphAreaX2,$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
186 186
 
187
-           if ( $DrawArrows ) { $this->pChartObject->drawArrow($this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["B"],$this->pChartObject->GraphAreaX2+($ArrowSize*2),$AxisPos["B"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
187
+            if ( $DrawArrows ) { $this->pChartObject->drawArrow($this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["B"],$this->pChartObject->GraphAreaX2+($ArrowSize*2),$AxisPos["B"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
188 188
 
189
-           $Width = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $AxisSettings["Margin"]*2;
190
-           $Step   = $Width / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MaxBottom = $AxisPos["B"];
191
-           $LastX  = NULL;
192
-           for($i=0;$i<=$AxisSettings["Rows"];$i++)
189
+            $Width = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $AxisSettings["Margin"]*2;
190
+            $Step   = $Width / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MaxBottom = $AxisPos["B"];
191
+            $LastX  = NULL;
192
+            for($i=0;$i<=$AxisSettings["Rows"];$i++)
193 193
             {
194
-             $XPos  = $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"] + $Step*$i;
195
-             $YPos  = $AxisPos["B"];
196
-             $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
194
+                $XPos  = $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"] + $Step*$i;
195
+                $YPos  = $AxisPos["B"];
196
+                $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
197 197
 
198
-             if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
199
-             if ( $LastX != NULL && $CycleBackground  && ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) )) { $this->pChartObject->drawFilledRectangle($LastX,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,$BGColor); }
198
+                if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
199
+                if ( $LastX != NULL && $CycleBackground  && ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) )) { $this->pChartObject->drawFilledRectangle($LastX,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,$BGColor); }
200 200
 
201
-             if ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) ) { $this->pChartObject->drawLine($XPos,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
202
-             if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
203
-              $this->pChartObject->drawLine($XPos+$SubTicksSize,$YPos-$InnerSubTickWidth,$XPos+$SubTicksSize,$YPos+$OuterSubTickWidth,array("R"=>$SubTickR,"G"=>$SubTickG,"B"=>$SubTickB,"Alpha"=>$SubTickAlpha));
201
+                if ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) ) { $this->pChartObject->drawLine($XPos,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
202
+                if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
203
+                $this->pChartObject->drawLine($XPos+$SubTicksSize,$YPos-$InnerSubTickWidth,$XPos+$SubTicksSize,$YPos+$OuterSubTickWidth,array("R"=>$SubTickR,"G"=>$SubTickG,"B"=>$SubTickB,"Alpha"=>$SubTickAlpha));
204 204
 
205
-             $this->pChartObject->drawLine($XPos,$YPos-$InnerTickWidth,$XPos,$YPos+$OuterTickWidth,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha));
206
-             $Bounds    = $this->pChartObject->drawText($XPos,$YPos+$OuterTickWidth+$LabelOffset,$Value,array("Angle"=>$XLabelsRotation,"Align"=>$LabelAlign));
207
-             $TxtBottom = $YPos+2+$OuterTickWidth+2+($Bounds[0]["Y"]-$Bounds[2]["Y"]);
208
-             $MaxBottom = max($MaxBottom,$TxtBottom);
205
+                $this->pChartObject->drawLine($XPos,$YPos-$InnerTickWidth,$XPos,$YPos+$OuterTickWidth,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha));
206
+                $Bounds    = $this->pChartObject->drawText($XPos,$YPos+$OuterTickWidth+$LabelOffset,$Value,array("Angle"=>$XLabelsRotation,"Align"=>$LabelAlign));
207
+                $TxtBottom = $YPos+2+$OuterTickWidth+2+($Bounds[0]["Y"]-$Bounds[2]["Y"]);
208
+                $MaxBottom = max($MaxBottom,$TxtBottom);
209 209
 
210
-             $LastX = $XPos;
210
+                $LastX = $XPos;
211 211
             }
212 212
 
213
-           if ( isset($AxisSettings["Name"]) )
213
+            if ( isset($AxisSettings["Name"]) )
214 214
             {
215
-             $YPos   = $MaxBottom+2;
216
-             $XPos   = $this->pChartObject->GraphAreaX1+($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1)/2;
217
-             $Bounds = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_TOPMIDDLE));
218
-             $MaxBottom = $Bounds[0]["Y"];
215
+                $YPos   = $MaxBottom+2;
216
+                $XPos   = $this->pChartObject->GraphAreaX1+($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1)/2;
217
+                $Bounds = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_TOPMIDDLE));
218
+                $MaxBottom = $Bounds[0]["Y"];
219 219
 
220
-             $this->pDataObject->Data["GraphArea"]["Y2"] = $MaxBottom + $this->pChartObject->FontSize;
220
+                $this->pDataObject->Data["GraphArea"]["Y2"] = $MaxBottom + $this->pChartObject->FontSize;
221 221
             }
222 222
 
223
-           $AxisPos["B"] = $MaxBottom + $ScaleSpacing;
224
-          }
225
-         elseif ( $AxisSettings["Position"] == AXIS_POSITION_TOP )
226
-          {
227
-           if ( $XLabelsRotation == 0 )					{ $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $LabelOffset = 2; }
228
-           if ( $XLabelsRotation > 0 && $XLabelsRotation < 190 )	{ $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $LabelOffset = 2; }
229
-           if ( $XLabelsRotation == 180 )				{ $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $LabelOffset = 5; }
230
-           if ( $XLabelsRotation > 180 && $SLabelxRotation < 360 )	{ $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $LabelOffset = 5; }
223
+            $AxisPos["B"] = $MaxBottom + $ScaleSpacing;
224
+            }
225
+            elseif ( $AxisSettings["Position"] == AXIS_POSITION_TOP )
226
+            {
227
+            if ( $XLabelsRotation == 0 )					{ $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $LabelOffset = 2; }
228
+            if ( $XLabelsRotation > 0 && $XLabelsRotation < 190 )	{ $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $LabelOffset = 2; }
229
+            if ( $XLabelsRotation == 180 )				{ $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $LabelOffset = 5; }
230
+            if ( $XLabelsRotation > 180 && $SLabelxRotation < 360 )	{ $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $LabelOffset = 5; }
231 231
 
232
-           if ( $Floating )
232
+            if ( $Floating )
233 233
             { $FloatingOffset = $YMargin; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$AxisSettings["Margin"],$AxisPos["T"],$this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
234
-           else
234
+            else
235 235
             { $FloatingOffset = 0; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1,$AxisPos["T"],$this->pChartObject->GraphAreaX2,$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
236 236
 
237
-           if ( $DrawArrows ) { $this->pChartObject->drawArrow($this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["T"],$this->pChartObject->GraphAreaX2+($ArrowSize*2),$AxisPos["T"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
237
+            if ( $DrawArrows ) { $this->pChartObject->drawArrow($this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["T"],$this->pChartObject->GraphAreaX2+($ArrowSize*2),$AxisPos["T"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
238 238
 
239
-           $Width = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $AxisSettings["Margin"]*2;
240
-           $Step   = $Width / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MinTop = $AxisPos["T"];
241
-           $LastX  = NULL;
242
-           for($i=0;$i<=$AxisSettings["Rows"];$i++)
239
+            $Width = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $AxisSettings["Margin"]*2;
240
+            $Step   = $Width / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MinTop = $AxisPos["T"];
241
+            $LastX  = NULL;
242
+            for($i=0;$i<=$AxisSettings["Rows"];$i++)
243 243
             {
244
-             $XPos  = $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"] + $Step*$i;
245
-             $YPos  = $AxisPos["T"];
246
-             $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
244
+                $XPos  = $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"] + $Step*$i;
245
+                $YPos  = $AxisPos["T"];
246
+                $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
247 247
 
248
-             if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
249
-             if ( $LastX != NULL && $CycleBackground  && ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) )) { $this->pChartObject->drawFilledRectangle($LastX,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,$BGColor); }
248
+                if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
249
+                if ( $LastX != NULL && $CycleBackground  && ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) )) { $this->pChartObject->drawFilledRectangle($LastX,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,$BGColor); }
250 250
 
251
-             if ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) ) { $this->pChartObject->drawLine($XPos,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
251
+                if ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) ) { $this->pChartObject->drawLine($XPos,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
252 252
 
253
-             if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
254
-              $this->pChartObject->drawLine($XPos+$SubTicksSize,$YPos-$OuterSubTickWidth,$XPos+$SubTicksSize,$YPos+$InnerSubTickWidth,array("R"=>$SubTickR,"G"=>$SubTickG,"B"=>$SubTickB,"Alpha"=>$SubTickAlpha));
253
+                if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
254
+                $this->pChartObject->drawLine($XPos+$SubTicksSize,$YPos-$OuterSubTickWidth,$XPos+$SubTicksSize,$YPos+$InnerSubTickWidth,array("R"=>$SubTickR,"G"=>$SubTickG,"B"=>$SubTickB,"Alpha"=>$SubTickAlpha));
255 255
 
256
-             $this->pChartObject->drawLine($XPos,$YPos-$OuterTickWidth,$XPos,$YPos+$InnerTickWidth,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha));
257
-             $Bounds = $this->pChartObject->drawText($XPos,$YPos-$OuterTickWidth-$LabelOffset,$Value,array("Angle"=>$XLabelsRotation,"Align"=>$LabelAlign));
258
-             $TxtBox = $YPos-$OuterTickWidth-4-($Bounds[0]["Y"]-$Bounds[2]["Y"]);
259
-             $MinTop = min($MinTop,$TxtBox);
256
+                $this->pChartObject->drawLine($XPos,$YPos-$OuterTickWidth,$XPos,$YPos+$InnerTickWidth,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha));
257
+                $Bounds = $this->pChartObject->drawText($XPos,$YPos-$OuterTickWidth-$LabelOffset,$Value,array("Angle"=>$XLabelsRotation,"Align"=>$LabelAlign));
258
+                $TxtBox = $YPos-$OuterTickWidth-4-($Bounds[0]["Y"]-$Bounds[2]["Y"]);
259
+                $MinTop = min($MinTop,$TxtBox);
260 260
 
261
-             $LastX = $XPos;
261
+                $LastX = $XPos;
262 262
             }
263 263
 
264
-           if ( isset($AxisSettings["Name"]) )
264
+            if ( isset($AxisSettings["Name"]) )
265 265
             {
266
-             $YPos   = $MinTop-2;
267
-             $XPos   = $this->pChartObject->GraphAreaX1+($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1)/2;
268
-             $Bounds = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
269
-             $MinTop = $Bounds[2]["Y"];
266
+                $YPos   = $MinTop-2;
267
+                $XPos   = $this->pChartObject->GraphAreaX1+($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1)/2;
268
+                $Bounds = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
269
+                $MinTop = $Bounds[2]["Y"];
270 270
 
271
-             $this->pDataObject->Data["GraphArea"]["Y1"] = $MinTop;
271
+                $this->pDataObject->Data["GraphArea"]["Y1"] = $MinTop;
272 272
             }
273 273
 
274
-           $AxisPos["T"] = $MinTop - $ScaleSpacing;
275
-          }
274
+            $AxisPos["T"] = $MinTop - $ScaleSpacing;
275
+            }
276 276
         }
277
-       elseif ( $AxisSettings["Identity"] == AXIS_Y )
277
+        elseif ( $AxisSettings["Identity"] == AXIS_Y )
278 278
         {
279
-         if ( $AxisSettings["Position"] == AXIS_POSITION_LEFT )
280
-          {
279
+            if ( $AxisSettings["Position"] == AXIS_POSITION_LEFT )
280
+            {
281 281
 
282
-           if ( $Floating )
282
+            if ( $Floating )
283 283
             { $FloatingOffset = $XMargin; $this->pChartObject->drawLine($AxisPos["L"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["L"],$this->pChartObject->GraphAreaY2-$AxisSettings["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
284
-           else
284
+            else
285 285
             { $FloatingOffset = 0; $this->pChartObject->drawLine($AxisPos["L"],$this->pChartObject->GraphAreaY1,$AxisPos["L"],$this->pChartObject->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
286 286
 
287
-           if ( $DrawArrows ) { $this->pChartObject->drawArrow($AxisPos["L"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["L"],$this->pChartObject->GraphAreaY1-($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
287
+            if ( $DrawArrows ) { $this->pChartObject->drawArrow($AxisPos["L"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["L"],$this->pChartObject->GraphAreaY1-($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
288 288
 
289
-           $Height = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $AxisSettings["Margin"]*2;
290
-           $Step   = $Height / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MinLeft = $AxisPos["L"];
291
-           $LastY  = NULL;
292
-           for($i=0;$i<=$AxisSettings["Rows"];$i++)
289
+            $Height = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $AxisSettings["Margin"]*2;
290
+            $Step   = $Height / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MinLeft = $AxisPos["L"];
291
+            $LastY  = NULL;
292
+            for($i=0;$i<=$AxisSettings["Rows"];$i++)
293 293
             {
294
-             $YPos  = $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"] - $Step*$i;
295
-             $XPos  = $AxisPos["L"];
296
-             $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
294
+                $YPos  = $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"] - $Step*$i;
295
+                $XPos  = $AxisPos["L"];
296
+                $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
297 297
 
298
-             if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
299
-             if ( $LastY != NULL && $CycleBackground && ( $DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawFilledRectangle($this->pChartObject->GraphAreaX1+$FloatingOffset,$LastY,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,$BGColor); }
298
+                if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
299
+                if ( $LastY != NULL && $CycleBackground && ( $DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawFilledRectangle($this->pChartObject->GraphAreaX1+$FloatingOffset,$LastY,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,$BGColor); }
300 300
 
301
-             if ( ($YPos != $this->pChartObject->GraphAreaY1 && $YPos != $this->pChartObject->GraphAreaY2) && ($DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$FloatingOffset,$YPos,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
301
+                if ( ($YPos != $this->pChartObject->GraphAreaY1 && $YPos != $this->pChartObject->GraphAreaY2) && ($DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$FloatingOffset,$YPos,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
302 302
 
303
-             if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
304
-              $this->pChartObject->drawLine($XPos-$OuterSubTickWidth,$YPos-$SubTicksSize,$XPos+$InnerSubTickWidth,$YPos-$SubTicksSize,array("R"=>$SubTickR,"G"=>$SubTickG,"B"=>$SubTickB,"Alpha"=>$SubTickAlpha));
303
+                if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
304
+                $this->pChartObject->drawLine($XPos-$OuterSubTickWidth,$YPos-$SubTicksSize,$XPos+$InnerSubTickWidth,$YPos-$SubTicksSize,array("R"=>$SubTickR,"G"=>$SubTickG,"B"=>$SubTickB,"Alpha"=>$SubTickAlpha));
305 305
 
306
-             $this->pChartObject->drawLine($XPos-$OuterTickWidth,$YPos,$XPos+$InnerTickWidth,$YPos,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha));
307
-             $Bounds  = $this->pChartObject->drawText($XPos-$OuterTickWidth-2,$YPos,$Value,array("Align"=>TEXT_ALIGN_MIDDLERIGHT));
308
-             $TxtLeft = $XPos-$OuterTickWidth-2-($Bounds[1]["X"]-$Bounds[0]["X"]);
309
-             $MinLeft = min($MinLeft,$TxtLeft);
306
+                $this->pChartObject->drawLine($XPos-$OuterTickWidth,$YPos,$XPos+$InnerTickWidth,$YPos,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha));
307
+                $Bounds  = $this->pChartObject->drawText($XPos-$OuterTickWidth-2,$YPos,$Value,array("Align"=>TEXT_ALIGN_MIDDLERIGHT));
308
+                $TxtLeft = $XPos-$OuterTickWidth-2-($Bounds[1]["X"]-$Bounds[0]["X"]);
309
+                $MinLeft = min($MinLeft,$TxtLeft);
310 310
 
311
-             $LastY = $YPos;
311
+                $LastY = $YPos;
312 312
             }
313 313
 
314
-           if ( isset($AxisSettings["Name"]) )
314
+            if ( isset($AxisSettings["Name"]) )
315 315
             {
316
-             $XPos    = $MinLeft-2;
317
-             $YPos    = $this->pChartObject->GraphAreaY1+($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1)/2;
318
-             $Bounds  = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>90));
319
-             $MinLeft = $Bounds[2]["X"];
316
+                $XPos    = $MinLeft-2;
317
+                $YPos    = $this->pChartObject->GraphAreaY1+($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1)/2;
318
+                $Bounds  = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>90));
319
+                $MinLeft = $Bounds[2]["X"];
320 320
 
321
-             $this->pDataObject->Data["GraphArea"]["X1"] = $MinLeft;
321
+                $this->pDataObject->Data["GraphArea"]["X1"] = $MinLeft;
322 322
             }
323 323
 
324
-           $AxisPos["L"] = $MinLeft - $ScaleSpacing;
325
-          }
326
-         elseif ( $AxisSettings["Position"] == AXIS_POSITION_RIGHT )
327
-          {
324
+            $AxisPos["L"] = $MinLeft - $ScaleSpacing;
325
+            }
326
+            elseif ( $AxisSettings["Position"] == AXIS_POSITION_RIGHT )
327
+            {
328 328
 
329
-           if ( $Floating )
329
+            if ( $Floating )
330 330
             { $FloatingOffset = $XMargin; $this->pChartObject->drawLine($AxisPos["R"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["R"],$this->pChartObject->GraphAreaY2-$AxisSettings["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
331
-           else
331
+            else
332 332
             { $FloatingOffset = 0; $this->pChartObject->drawLine($AxisPos["R"],$this->pChartObject->GraphAreaY1,$AxisPos["R"],$this->pChartObject->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
333 333
 
334
-           if ( $DrawArrows ) { $this->pChartObject->drawArrow($AxisPos["R"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["R"],$this->pChartObject->GraphAreaY1-($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
334
+            if ( $DrawArrows ) { $this->pChartObject->drawArrow($AxisPos["R"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["R"],$this->pChartObject->GraphAreaY1-($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
335 335
 
336
-           $Height = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $AxisSettings["Margin"]*2;
337
-           $Step   = $Height / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MaxLeft = $AxisPos["R"];
338
-           $LastY  = NULL;
339
-           for($i=0;$i<=$AxisSettings["Rows"];$i++)
336
+            $Height = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $AxisSettings["Margin"]*2;
337
+            $Step   = $Height / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MaxLeft = $AxisPos["R"];
338
+            $LastY  = NULL;
339
+            for($i=0;$i<=$AxisSettings["Rows"];$i++)
340 340
             {
341
-             $YPos  = $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"] - $Step*$i;
342
-             $XPos  = $AxisPos["R"];
343
-             $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
341
+                $YPos  = $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"] - $Step*$i;
342
+                $XPos  = $AxisPos["R"];
343
+                $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
344 344
 
345
-             if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
346
-             if ( $LastY != NULL && $CycleBackground  && ( $DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawFilledRectangle($this->pChartObject->GraphAreaX1+$FloatingOffset,$LastY,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,$BGColor); }
345
+                if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
346
+                if ( $LastY != NULL && $CycleBackground  && ( $DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawFilledRectangle($this->pChartObject->GraphAreaX1+$FloatingOffset,$LastY,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,$BGColor); }
347 347
 
348
-             if ( ($YPos != $this->pChartObject->GraphAreaY1 && $YPos != $this->pChartObject->GraphAreaY2) && ($DrawYLines == ALL || in_array($AxisID,$DrawYLines)) ) { $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$FloatingOffset,$YPos,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
348
+                if ( ($YPos != $this->pChartObject->GraphAreaY1 && $YPos != $this->pChartObject->GraphAreaY2) && ($DrawYLines == ALL || in_array($AxisID,$DrawYLines)) ) { $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$FloatingOffset,$YPos,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
349 349
 
350
-             if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
351
-              $this->pChartObject->drawLine($XPos-$InnerSubTickWidth,$YPos-$SubTicksSize,$XPos+$OuterSubTickWidth,$YPos-$SubTicksSize,array("R"=>$SubTickR,"G"=>$SubTickG,"B"=>$SubTickB,"Alpha"=>$SubTickAlpha));
350
+                if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
351
+                $this->pChartObject->drawLine($XPos-$InnerSubTickWidth,$YPos-$SubTicksSize,$XPos+$OuterSubTickWidth,$YPos-$SubTicksSize,array("R"=>$SubTickR,"G"=>$SubTickG,"B"=>$SubTickB,"Alpha"=>$SubTickAlpha));
352 352
 
353
-             $this->pChartObject->drawLine($XPos-$InnerTickWidth,$YPos,$XPos+$OuterTickWidth,$YPos,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha));
354
-             $Bounds  = $this->pChartObject->drawText($XPos+$OuterTickWidth+2,$YPos,$Value,array("Align"=>TEXT_ALIGN_MIDDLELEFT));
355
-             $TxtLeft = $XPos+$OuterTickWidth+2+($Bounds[1]["X"]-$Bounds[0]["X"]);
356
-             $MaxLeft = max($MaxLeft,$TxtLeft);
353
+                $this->pChartObject->drawLine($XPos-$InnerTickWidth,$YPos,$XPos+$OuterTickWidth,$YPos,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha));
354
+                $Bounds  = $this->pChartObject->drawText($XPos+$OuterTickWidth+2,$YPos,$Value,array("Align"=>TEXT_ALIGN_MIDDLELEFT));
355
+                $TxtLeft = $XPos+$OuterTickWidth+2+($Bounds[1]["X"]-$Bounds[0]["X"]);
356
+                $MaxLeft = max($MaxLeft,$TxtLeft);
357 357
 
358
-             $LastY = $YPos;
358
+                $LastY = $YPos;
359 359
             }
360 360
 
361
-           if ( isset($AxisSettings["Name"]) )
361
+            if ( isset($AxisSettings["Name"]) )
362 362
             {
363
-             $XPos    = $MaxLeft+6;
364
-             $YPos    = $this->pChartObject->GraphAreaY1+($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1)/2;
365
-             $Bounds  = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>270));
366
-             $MaxLeft = $Bounds[2]["X"];
363
+                $XPos    = $MaxLeft+6;
364
+                $YPos    = $this->pChartObject->GraphAreaY1+($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1)/2;
365
+                $Bounds  = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>270));
366
+                $MaxLeft = $Bounds[2]["X"];
367 367
 
368
-             $this->pDataObject->Data["GraphArea"]["X2"] = $MaxLeft + $this->pChartObject->FontSize;
368
+                $this->pDataObject->Data["GraphArea"]["X2"] = $MaxLeft + $this->pChartObject->FontSize;
369 369
             }
370 370
 
371
-           $AxisPos["R"] = $MaxLeft + $ScaleSpacing;
372
-          }
371
+            $AxisPos["R"] = $MaxLeft + $ScaleSpacing;
372
+            }
373
+        }
373 374
         }
374
-      }
375 375
 
376
-     $this->pDataObject->saveAxisConfig($Data["Axis"]);
376
+        $this->pDataObject->saveAxisConfig($Data["Axis"]);
377 377
     }
378 378
 
379
-   /* Draw a scatter plot chart */
380
-   function drawScatterPlotChart($Format=NULL)
379
+    /* Draw a scatter plot chart */
380
+    function drawScatterPlotChart($Format=NULL)
381 381
     {
382
-     $PlotSize		= isset($Format["PlotSize"]) ? $Format["PlotSize"] : 3;
383
-     $PlotBorder	= isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : FALSE;
384
-     $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 250;
385
-     $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 250;
386
-     $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 250;
387
-     $BorderAlpha	= isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30;
388
-     $BorderSize	= isset($Format["BorderSize"]) ? $Format["BorderSize"] : 1;
389
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
390
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
391
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
392
-     $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
393
-
394
-     $Data    = $this->pDataObject->getData();
395
-     $Palette = $this->pDataObject->getPalette();
396
-
397
-     $BorderColor = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
398
-
399
-     foreach($Data["ScatterSeries"] as $Key => $Series)
400
-      {
401
-       if ( $Series["isDrawable"] == TRUE )
382
+        $PlotSize		= isset($Format["PlotSize"]) ? $Format["PlotSize"] : 3;
383
+        $PlotBorder	= isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : FALSE;
384
+        $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 250;
385
+        $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 250;
386
+        $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 250;
387
+        $BorderAlpha	= isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30;
388
+        $BorderSize	= isset($Format["BorderSize"]) ? $Format["BorderSize"] : 1;
389
+        $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
390
+        $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
391
+        $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
392
+        $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
393
+
394
+        $Data    = $this->pDataObject->getData();
395
+        $Palette = $this->pDataObject->getPalette();
396
+
397
+        $BorderColor = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
398
+
399
+        foreach($Data["ScatterSeries"] as $Key => $Series)
402 400
         {
403
-         $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
404
-         $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
401
+        if ( $Series["isDrawable"] == TRUE )
402
+        {
403
+            $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
404
+            $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
405 405
 
406
-         if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
406
+            if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
407 407
          
408
-         if ( isset($Series["Picture"]) && $Series["Picture"] != "" )
409
-          { $Picture = $Series["Picture"]; list($PicWidth,$PicHeight,$PicType) = $this->pChartObject->getPicInfo($Picture); }
410
-         else
411
-          { $Picture = NULL; }
408
+            if ( isset($Series["Picture"]) && $Series["Picture"] != "" )
409
+            { $Picture = $Series["Picture"]; list($PicWidth,$PicHeight,$PicType) = $this->pChartObject->getPicInfo($Picture); }
410
+            else
411
+            { $Picture = NULL; }
412 412
 
413
-         $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
414
-         if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
415
-         $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
416
-         if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
413
+            $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
414
+            if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
415
+            $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
416
+            if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
417 417
 
418
-         $Color = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
418
+            $Color = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
419 419
 
420
-         foreach($PosArrayX as $Key => $Value)
421
-          {
422
-           $X = $Value; $Y = $PosArrayY[$Key];
420
+            foreach($PosArrayX as $Key => $Value)
421
+            {
422
+            $X = $Value; $Y = $PosArrayY[$Key];
423 423
 
424
-           if ( $X != VOID && $Y != VOID )
424
+            if ( $X != VOID && $Y != VOID )
425 425
             {
426
-             $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key],2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key],2);
427
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".floor($PlotSize+$BorderSize),$this->pChartObject->toHTMLColor($Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"]),$Description,$RealValue); }
428
-
429
-             if( isset($Series["Shape"]) )
430
-              { $this->pChartObject->drawShape($X,$Y,$Series["Shape"],$PlotSize,$PlotBorder,$BorderSize,$Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"],$Series["Color"]["Alpha"],$BorderR,$BorderG,$BorderB,$BorderAlpha); }
431
-             elseif ( $Picture == NULL )
432
-              {
433
-               if ( $PlotBorder ) { $this->pChartObject->drawFilledCircle($X,$Y,$PlotSize+$BorderSize,$BorderColor); }
434
-               $this->pChartObject->drawFilledCircle($X,$Y,$PlotSize,$Color);
435
-              }
436
-             else
437
-              { $this->pChartObject->drawFromPicture($PicType,$Picture,$X-$PicWidth/2,$Y-$PicHeight/2); }
426
+                $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key],2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key],2);
427
+                if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".floor($PlotSize+$BorderSize),$this->pChartObject->toHTMLColor($Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"]),$Description,$RealValue); }
428
+
429
+                if( isset($Series["Shape"]) )
430
+                { $this->pChartObject->drawShape($X,$Y,$Series["Shape"],$PlotSize,$PlotBorder,$BorderSize,$Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"],$Series["Color"]["Alpha"],$BorderR,$BorderG,$BorderB,$BorderAlpha); }
431
+                elseif ( $Picture == NULL )
432
+                {
433
+                if ( $PlotBorder ) { $this->pChartObject->drawFilledCircle($X,$Y,$PlotSize+$BorderSize,$BorderColor); }
434
+                $this->pChartObject->drawFilledCircle($X,$Y,$PlotSize,$Color);
435
+                }
436
+                else
437
+                { $this->pChartObject->drawFromPicture($PicType,$Picture,$X-$PicWidth/2,$Y-$PicHeight/2); }
438
+            }
438 439
             }
439
-          }
440 440
         }
441
-      }
441
+        }
442 442
     }
443 443
 
444
-   /* Draw a scatter line chart */
445
-   function drawScatterLineChart($Format=NULL)
444
+    /* Draw a scatter line chart */
445
+    function drawScatterLineChart($Format=NULL)
446 446
     {
447
-     $Data		= $this->pDataObject->getData();
448
-     $Palette		= $this->pDataObject->getPalette();
449
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
450
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
451
-     $ImageMapPlotSize	= isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 10;
452
-     $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
453
-
454
-     /* Parse all the series to draw */
455
-     foreach($Data["ScatterSeries"] as $Key => $Series)
456
-      {
457
-       if ( $Series["isDrawable"] == TRUE )
447
+        $Data		= $this->pDataObject->getData();
448
+        $Palette		= $this->pDataObject->getPalette();
449
+        $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
450
+        $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
451
+        $ImageMapPlotSize	= isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 10;
452
+        $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
453
+
454
+        /* Parse all the series to draw */
455
+        foreach($Data["ScatterSeries"] as $Key => $Series)
456
+        {
457
+        if ( $Series["isDrawable"] == TRUE )
458 458
         {
459
-         $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
460
-         $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
461
-         $Ticks  = $Series["Ticks"];
462
-         $Weight = $Series["Weight"];
459
+            $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
460
+            $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
461
+            $Ticks  = $Series["Ticks"];
462
+            $Weight = $Series["Weight"];
463 463
 
464
-         if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
464
+            if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
465 465
 
466
-         $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
467
-         if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
468
-         $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
469
-         if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
466
+            $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
467
+            if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
468
+            $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
469
+            if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
470 470
 
471
-         $Color = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
472
-         if ( $Ticks != 0 )  { $Color["Ticks"]  = $Ticks; }
473
-         if ( $Weight != 0 ) { $Color["Weight"] = $Weight; }
471
+            $Color = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
472
+            if ( $Ticks != 0 )  { $Color["Ticks"]  = $Ticks; }
473
+            if ( $Weight != 0 ) { $Color["Weight"] = $Weight; }
474 474
 
475
-         $LastX = VOID; $LastY = VOID;
476
-         foreach($PosArrayX as $Key => $Value)
477
-          {
478
-           $X = $Value; $Y = $PosArrayY[$Key];
475
+            $LastX = VOID; $LastY = VOID;
476
+            foreach($PosArrayX as $Key => $Value)
477
+            {
478
+            $X = $Value; $Y = $PosArrayY[$Key];
479 479
 
480
-           if ( $X != VOID && $Y != VOID )
480
+            if ( $X != VOID && $Y != VOID )
481 481
             {
482
-             $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key],2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key],2);
483
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$ImageMapPlotSize,$this->pChartObject->toHTMLColor($Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"]),$Description,$RealValue); }
482
+                $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key],2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key],2);
483
+                if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$ImageMapPlotSize,$this->pChartObject->toHTMLColor($Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"]),$Description,$RealValue); }
484 484
             }
485 485
 
486
-           if ( $X != VOID && $Y != VOID && $LastX != VOID && $LastY != VOID)
486
+            if ( $X != VOID && $Y != VOID && $LastX != VOID && $LastY != VOID)
487 487
             $this->pChartObject->drawLine($LastX,$LastY,$X,$Y,$Color);
488 488
 
489
-           $LastX = $X; $LastY = $Y;
490
-          }
489
+            $LastX = $X; $LastY = $Y;
490
+            }
491
+        }
491 492
         }
492
-      }
493 493
     }
494 494
 
495
-   /* Draw a scatter spline chart */
496
-   function drawScatterSplineChart($Format=NULL)
495
+    /* Draw a scatter spline chart */
496
+    function drawScatterSplineChart($Format=NULL)
497 497
     {
498
-     $Data		= $this->pDataObject->getData();
499
-     $Palette		= $this->pDataObject->getPalette();
500
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
501
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
502
-     $ImageMapPlotSize	= isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 10;
503
-     $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
504
-
505
-     foreach($Data["ScatterSeries"] as $Key => $Series)
506
-      {
507
-       if ( $Series["isDrawable"] == TRUE )
498
+        $Data		= $this->pDataObject->getData();
499
+        $Palette		= $this->pDataObject->getPalette();
500
+        $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
501
+        $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
502
+        $ImageMapPlotSize	= isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 10;
503
+        $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
504
+
505
+        foreach($Data["ScatterSeries"] as $Key => $Series)
506
+        {
507
+        if ( $Series["isDrawable"] == TRUE )
508 508
         {
509
-         $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
510
-         $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
511
-         $Ticks  = $Series["Ticks"];
512
-         $Weight = $Series["Weight"];
509
+            $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
510
+            $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
511
+            $Ticks  = $Series["Ticks"];
512
+            $Weight = $Series["Weight"];
513 513
 
514
-         if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
514
+            if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
515 515
 
516
-         $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
517
-         if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
518
-         $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
519
-         if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
516
+            $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
517
+            if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
518
+            $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
519
+            if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
520 520
 
521
-         $SplineSettings = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
522
-         if ( $Ticks != 0 )  { $SplineSettings["Ticks"]  = $Ticks; }
523
-         if ( $Weight != 0 ) { $SplineSettings["Weight"] = $Weight; }
521
+            $SplineSettings = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
522
+            if ( $Ticks != 0 )  { $SplineSettings["Ticks"]  = $Ticks; }
523
+            if ( $Weight != 0 ) { $SplineSettings["Weight"] = $Weight; }
524 524
 
525
-         $LastX = VOID; $LastY = VOID; $WayPoints = ""; $Forces = "";
526
-         foreach($PosArrayX as $Key => $Value)
527
-          {
528
-           $X = $Value; $Y = $PosArrayY[$Key];
529
-           $Force = $this->pChartObject->getLength($LastX,$LastY,$X,$Y)/5;
525
+            $LastX = VOID; $LastY = VOID; $WayPoints = ""; $Forces = "";
526
+            foreach($PosArrayX as $Key => $Value)
527
+            {
528
+            $X = $Value; $Y = $PosArrayY[$Key];
529
+            $Force = $this->pChartObject->getLength($LastX,$LastY,$X,$Y)/5;
530 530
 
531
-           if ( $X != VOID && $Y != VOID )
531
+            if ( $X != VOID && $Y != VOID )
532 532
             {
533
-             $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key],2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key],2);
534
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$ImageMapPlotSize,$this->pChartObject->toHTMLColor($Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"]),$Description,$RealValue); }
533
+                $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key],2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key],2);
534
+                if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$ImageMapPlotSize,$this->pChartObject->toHTMLColor($Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"]),$Description,$RealValue); }
535 535
             }
536 536
 
537
-           if ( $X != VOID && $Y != VOID )
537
+            if ( $X != VOID && $Y != VOID )
538 538
             { $WayPoints[] = array($X,$Y); $Forces[] = $Force; }
539 539
 
540
-           if ( $Y == VOID || $X == VOID )
540
+            if ( $Y == VOID || $X == VOID )
541 541
             { $SplineSettings["Forces"] = $Forces; $this->pChartObject->drawSpline($WayPoints,$SplineSettings); $WayPoints = ""; $Forces = "";}
542 542
 
543
-           $LastX = $X; $LastY = $Y;
544
-          }
545
-         $SplineSettings["Forces"] = $Forces; 
546
-         $this->pChartObject->drawSpline($WayPoints,$SplineSettings);
543
+            $LastX = $X; $LastY = $Y;
544
+            }
545
+            $SplineSettings["Forces"] = $Forces; 
546
+            $this->pChartObject->drawSpline($WayPoints,$SplineSettings);
547
+        }
547 548
         }
548
-      }
549 549
     }
550 550
 
551
-   /* Return the scaled plot position */
552
-   function getPosArray($Values,$AxisID)
551
+    /* Return the scaled plot position */
552
+    function getPosArray($Values,$AxisID)
553 553
     {
554
-     $Data = $this->pDataObject->getData();
554
+        $Data = $this->pDataObject->getData();
555 555
 
556
-     if ( !is_array($Values) ) { $Values = array($Values); }
556
+        if ( !is_array($Values) ) { $Values = array($Values); }
557 557
 
558
-     if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X )
559
-      {
560
-       $Height      = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $Data["Axis"][$AxisID]["Margin"]*2;
561
-       $ScaleHeight = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"];
562
-       $Step        = $Height / $ScaleHeight;
558
+        if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X )
559
+        {
560
+        $Height      = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $Data["Axis"][$AxisID]["Margin"]*2;
561
+        $ScaleHeight = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"];
562
+        $Step        = $Height / $ScaleHeight;
563 563
 
564
-       $Result = "";
565
-       foreach($Values as $Key => $Value)
564
+        $Result = "";
565
+        foreach($Values as $Key => $Value)
566 566
         {
567
-         if ( $Value == VOID ) 
568
-          $Result[] = VOID;
569
-         else
570
-          $Result[] = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"] + ($Step * ($Value-$Data["Axis"][$AxisID]["ScaleMin"]));
567
+            if ( $Value == VOID ) 
568
+            $Result[] = VOID;
569
+            else
570
+            $Result[] = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"] + ($Step * ($Value-$Data["Axis"][$AxisID]["ScaleMin"]));
571 571
         }
572 572
 
573
-       if ( count($Result) == 1 ) { return($Result[0]); } else { return($Result); }
574
-      }
575
-     else
576
-      {
577
-       $Height      = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $Data["Axis"][$AxisID]["Margin"]*2;
578
-       $ScaleHeight = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"];
579
-       $Step        = $Height / $ScaleHeight;
573
+        if ( count($Result) == 1 ) { return($Result[0]); } else { return($Result); }
574
+        }
575
+        else
576
+        {
577
+        $Height      = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $Data["Axis"][$AxisID]["Margin"]*2;
578
+        $ScaleHeight = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"];
579
+        $Step        = $Height / $ScaleHeight;
580 580
 
581
-       $Result = "";
582
-       foreach($Values as $Key => $Value)
581
+        $Result = "";
582
+        foreach($Values as $Key => $Value)
583 583
         {
584
-         if ( $Value == VOID ) 
585
-          $Result[] = VOID;
586
-         else
587
-          $Result[] = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"] - ($Step * ($Value-$Data["Axis"][$AxisID]["ScaleMin"]));
584
+            if ( $Value == VOID ) 
585
+            $Result[] = VOID;
586
+            else
587
+            $Result[] = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"] - ($Step * ($Value-$Data["Axis"][$AxisID]["ScaleMin"]));
588 588
         }
589 589
 
590
-       if ( count($Result) == 1 ) { return($Result[0]); } else { return($Result); }
591
-      }
590
+        if ( count($Result) == 1 ) { return($Result[0]); } else { return($Result); }
591
+        }
592 592
     }
593 593
 
594
-   /* Draw the legend of the active series */
595
-   function drawScatterLegend($X,$Y,$Format="")
594
+    /* Draw the legend of the active series */
595
+    function drawScatterLegend($X,$Y,$Format="")
596 596
     {
597
-     $Family		= isset($Format["Family"]) ? $Format["Family"] : LEGEND_FAMILY_BOX;
598
-     $FontName		= isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
599
-     $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
600
-     $FontR		= isset($Format["FontR"]) ? $Format["FontR"] : $this->pChartObject->FontColorR;
601
-     $FontG		= isset($Format["FontG"]) ? $Format["FontG"] : $this->pChartObject->FontColorG;
602
-     $FontB		= isset($Format["FontB"]) ? $Format["FontB"] : $this->pChartObject->FontColorB;
603
-     $BoxWidth		= isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 5;
604
-     $BoxHeight		= isset($Format["BoxHeight"]) ? $Format["BoxHeight"] : 5;
605
-     $IconAreaWidth	= isset($Format["IconAreaWidth"]) ? $Format["IconAreaWidth"] : $BoxWidth;
606
-     $IconAreaHeight	= isset($Format["IconAreaHeight"]) ? $Format["IconAreaHeight"] : $BoxHeight;
607
-     $XSpacing		= isset($Format["XSpacing"]) ? $Format["XSpacing"] : 5;
608
-     $Margin		= isset($Format["Margin"]) ? $Format["Margin"] : 5;
609
-     $R			= isset($Format["R"]) ? $Format["R"] : 200;
610
-     $G			= isset($Format["G"]) ? $Format["G"] : 200;
611
-     $B			= isset($Format["B"]) ? $Format["B"] : 200;
612
-     $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
613
-     $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
614
-     $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
615
-     $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
616
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
617
-     $Style		= isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND;
618
-     $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
619
-
620
-     if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
621
-
622
-     $Data = $this->pDataObject->getData();
623
-
624
-     foreach($Data["ScatterSeries"] as $Key => $Series)
625
-      {
626
-       if ( $Series["isDrawable"] == TRUE && isset($Series["Picture"]))
597
+        $Family		= isset($Format["Family"]) ? $Format["Family"] : LEGEND_FAMILY_BOX;
598
+        $FontName		= isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
599
+        $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
600
+        $FontR		= isset($Format["FontR"]) ? $Format["FontR"] : $this->pChartObject->FontColorR;
601
+        $FontG		= isset($Format["FontG"]) ? $Format["FontG"] : $this->pChartObject->FontColorG;
602
+        $FontB		= isset($Format["FontB"]) ? $Format["FontB"] : $this->pChartObject->FontColorB;
603
+        $BoxWidth		= isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 5;
604
+        $BoxHeight		= isset($Format["BoxHeight"]) ? $Format["BoxHeight"] : 5;
605
+        $IconAreaWidth	= isset($Format["IconAreaWidth"]) ? $Format["IconAreaWidth"] : $BoxWidth;
606
+        $IconAreaHeight	= isset($Format["IconAreaHeight"]) ? $Format["IconAreaHeight"] : $BoxHeight;
607
+        $XSpacing		= isset($Format["XSpacing"]) ? $Format["XSpacing"] : 5;
608
+        $Margin		= isset($Format["Margin"]) ? $Format["Margin"] : 5;
609
+        $R			= isset($Format["R"]) ? $Format["R"] : 200;
610
+        $G			= isset($Format["G"]) ? $Format["G"] : 200;
611
+        $B			= isset($Format["B"]) ? $Format["B"] : 200;
612
+        $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
613
+        $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
614
+        $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
615
+        $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
616
+        $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
617
+        $Style		= isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND;
618
+        $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
619
+
620
+        if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
621
+
622
+        $Data = $this->pDataObject->getData();
623
+
624
+        foreach($Data["ScatterSeries"] as $Key => $Series)
627 625
         {
628
-         list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Series["Picture"]);
629
-         if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; }
630
-         if ( $IconAreaHeight < $PicHeight ) { $IconAreaHeight = $PicHeight; }
626
+        if ( $Series["isDrawable"] == TRUE && isset($Series["Picture"]))
627
+        {
628
+            list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Series["Picture"]);
629
+            if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; }
630
+            if ( $IconAreaHeight < $PicHeight ) { $IconAreaHeight = $PicHeight; }
631
+        }
631 632
         }
632
-      }
633 633
 
634
-     $YStep = max($this->pChartObject->FontSize,$IconAreaHeight) + 5;
635
-     $XStep = $IconAreaWidth + 5;
636
-     $XStep = $XSpacing;
634
+        $YStep = max($this->pChartObject->FontSize,$IconAreaHeight) + 5;
635
+        $XStep = $IconAreaWidth + 5;
636
+        $XStep = $XSpacing;
637 637
 
638
-     $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
639
-     foreach($Data["ScatterSeries"] as $Key => $Series)
640
-      {
641
-       if ( $Series["isDrawable"] == TRUE )
638
+        $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
639
+        foreach($Data["ScatterSeries"] as $Key => $Series)
642 640
         {
643
-         if ( $Mode == LEGEND_VERTICAL )
644
-          {
645
-           $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+4,$vY+$IconAreaHeight/2,$FontName,$FontSize,0,$Series["Description"]);
646
-
647
-           if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
648
-           if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
649
-           if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$IconAreaHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$IconAreaHeight/2; }
650
-
651
-           $Lines = preg_split("/\n/",$Series["Description"]);
652
-           $vY = $vY + max($this->pChartObject->FontSize*count($Lines),$IconAreaHeight) + 5;
653
-          }
654
-         elseif ( $Mode == LEGEND_HORIZONTAL )
655
-          {
656
-           $Lines = preg_split("/\n/",$Series["Description"]);
657
-           $Width = "";
658
-           foreach($Lines as $Key => $Value)
641
+        if ( $Series["isDrawable"] == TRUE )
642
+        {
643
+            if ( $Mode == LEGEND_VERTICAL )
659 644
             {
660
-             $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+6,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$FontName,$FontSize,0,$Value);
645
+            $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+4,$vY+$IconAreaHeight/2,$FontName,$FontSize,0,$Series["Description"]);
661 646
 
662
-             if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
663
-             if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
664
-             if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$IconAreaHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$IconAreaHeight/2; }
647
+            if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
648
+            if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
649
+            if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$IconAreaHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$IconAreaHeight/2; }
665 650
 
666
-             $Width[] = $BoxArray[1]["X"];
651
+            $Lines = preg_split("/\n/",$Series["Description"]);
652
+            $vY = $vY + max($this->pChartObject->FontSize*count($Lines),$IconAreaHeight) + 5;
667 653
             }
654
+            elseif ( $Mode == LEGEND_HORIZONTAL )
655
+            {
656
+            $Lines = preg_split("/\n/",$Series["Description"]);
657
+            $Width = "";
658
+            foreach($Lines as $Key => $Value)
659
+            {
660
+                $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+6,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$FontName,$FontSize,0,$Value);
661
+
662
+                if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
663
+                if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
664
+                if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$IconAreaHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$IconAreaHeight/2; }
668 665
 
669
-           $vX=max($Width)+$XStep;
670
-          }
666
+                $Width[] = $BoxArray[1]["X"];
667
+            }
668
+
669
+            $vX=max($Width)+$XStep;
670
+            }
671
+        }
671 672
         }
672
-      }
673
-     $vY=$vY-$YStep; $vX=$vX-$XStep;
673
+        $vY=$vY-$YStep; $vX=$vX-$XStep;
674 674
 
675
-     $TopOffset  = $Y - $Boundaries["T"];
676
-     if ( $Boundaries["B"]-($vY+$IconAreaHeight) < $TopOffset ) { $Boundaries["B"] = $vY+$IconAreaHeight+$TopOffset; }
675
+        $TopOffset  = $Y - $Boundaries["T"];
676
+        if ( $Boundaries["B"]-($vY+$IconAreaHeight) < $TopOffset ) { $Boundaries["B"] = $vY+$IconAreaHeight+$TopOffset; }
677 677
 
678
-     if ( $Style == LEGEND_ROUND )
679
-      $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));
680
-     elseif ( $Style == LEGEND_BOX )
681
-      $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));
678
+        if ( $Style == LEGEND_ROUND )
679
+        $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));
680
+        elseif ( $Style == LEGEND_BOX )
681
+        $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));
682 682
 
683
-     $RestoreShadow = $this->pChartObject->Shadow; $this->Shadow = FALSE;
684
-     foreach($Data["ScatterSeries"] as $Key => $Series)
685
-      {
686
-       if ( $Series["isDrawable"] == TRUE )
683
+        $RestoreShadow = $this->pChartObject->Shadow; $this->Shadow = FALSE;
684
+        foreach($Data["ScatterSeries"] as $Key => $Series)
687 685
         {
688
-         $R = $Series["Color"]["R"]; $G = $Series["Color"]["G"]; $B = $Series["Color"]["B"];
689
-         $Ticks = $Series["Ticks"]; $Weight = $Series["Weight"];
690
-
691
-         if ( isset($Series["Picture"]) )
692
-          {
693
-           $Picture = $Series["Picture"];
694
-           list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Picture);
695
-           $PicX = $X+$IconAreaWidth/2; $PicY = $Y+$IconAreaHeight/2; 
696
-
697
-           $this->pChartObject->drawFromPNG($PicX-$PicWidth/2,$PicY-$PicHeight/2,$Picture);
698
-          }
699
-         else
700
-          {
701
-           if ( $Family == LEGEND_FAMILY_BOX )
686
+        if ( $Series["isDrawable"] == TRUE )
687
+        {
688
+            $R = $Series["Color"]["R"]; $G = $Series["Color"]["G"]; $B = $Series["Color"]["B"];
689
+            $Ticks = $Series["Ticks"]; $Weight = $Series["Weight"];
690
+
691
+            if ( isset($Series["Picture"]) )
702 692
             {
703
-             if ( $BoxWidth != $IconAreaWidth ) { $XOffset = floor(($IconAreaWidth-$BoxWidth)/2); } else { $XOffset = 0; }
704
-             if ( $BoxHeight != $IconAreaHeight ) { $YOffset = floor(($IconAreaHeight-$BoxHeight)/2); } else { $YOffset = 0; }
693
+            $Picture = $Series["Picture"];
694
+            list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Picture);
695
+            $PicX = $X+$IconAreaWidth/2; $PicY = $Y+$IconAreaHeight/2; 
705 696
 
706
-             $this->pChartObject->drawFilledRectangle($X+1+$XOffset,$Y+1+$YOffset,$X+$BoxWidth+$XOffset+1,$Y+$BoxHeight+1+$YOffset,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
707
-             $this->pChartObject->drawFilledRectangle($X+$XOffset,$Y+$YOffset,$X+$BoxWidth+$XOffset,$Y+$BoxHeight+$YOffset,array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
697
+            $this->pChartObject->drawFromPNG($PicX-$PicWidth/2,$PicY-$PicHeight/2,$Picture);
708 698
             }
709
-           elseif ( $Family == LEGEND_FAMILY_CIRCLE )
699
+            else
700
+            {
701
+            if ( $Family == LEGEND_FAMILY_BOX )
710 702
             {
711
-             $this->pChartObject->drawFilledCircle($X+1+$IconAreaWidth/2,$Y+1+$IconAreaHeight/2,min($IconAreaHeight/2,$IconAreaWidth/2),array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
712
-             $this->pChartObject->drawFilledCircle($X+$IconAreaWidth/2,$Y+$IconAreaHeight/2,min($IconAreaHeight/2,$IconAreaWidth/2),array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
703
+                if ( $BoxWidth != $IconAreaWidth ) { $XOffset = floor(($IconAreaWidth-$BoxWidth)/2); } else { $XOffset = 0; }
704
+                if ( $BoxHeight != $IconAreaHeight ) { $YOffset = floor(($IconAreaHeight-$BoxHeight)/2); } else { $YOffset = 0; }
705
+
706
+                $this->pChartObject->drawFilledRectangle($X+1+$XOffset,$Y+1+$YOffset,$X+$BoxWidth+$XOffset+1,$Y+$BoxHeight+1+$YOffset,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
707
+                $this->pChartObject->drawFilledRectangle($X+$XOffset,$Y+$YOffset,$X+$BoxWidth+$XOffset,$Y+$BoxHeight+$YOffset,array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
708
+            }
709
+            elseif ( $Family == LEGEND_FAMILY_CIRCLE )
710
+            {
711
+                $this->pChartObject->drawFilledCircle($X+1+$IconAreaWidth/2,$Y+1+$IconAreaHeight/2,min($IconAreaHeight/2,$IconAreaWidth/2),array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
712
+                $this->pChartObject->drawFilledCircle($X+$IconAreaWidth/2,$Y+$IconAreaHeight/2,min($IconAreaHeight/2,$IconAreaWidth/2),array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
713 713
             }
714
-           elseif ( $Family == LEGEND_FAMILY_LINE )
714
+            elseif ( $Family == LEGEND_FAMILY_LINE )
715 715
             {
716
-             $this->pChartObject->drawLine($X+1,$Y+1+$IconAreaHeight/2,$X+1+$IconAreaWidth,$Y+1+$IconAreaHeight/2,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20,"Ticks"=>$Ticks,"Weight"=>$Weight));
717
-             $this->pChartObject->drawLine($X,$Y+$IconAreaHeight/2,$X+$IconAreaWidth,$Y+$IconAreaHeight/2,array("R"=>$R,"G"=>$G,"B"=>$B,"Ticks"=>$Ticks,"Weight"=>$Weight));
716
+                $this->pChartObject->drawLine($X+1,$Y+1+$IconAreaHeight/2,$X+1+$IconAreaWidth,$Y+1+$IconAreaHeight/2,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20,"Ticks"=>$Ticks,"Weight"=>$Weight));
717
+                $this->pChartObject->drawLine($X,$Y+$IconAreaHeight/2,$X+$IconAreaWidth,$Y+$IconAreaHeight/2,array("R"=>$R,"G"=>$G,"B"=>$B,"Ticks"=>$Ticks,"Weight"=>$Weight));
718
+            }
718 719
             }
719
-          }
720 720
 
721
-         if ( $Mode == LEGEND_VERTICAL )
722
-          {
723
-           $Lines = preg_split("/\n/",$Series["Description"]);
724
-           foreach($Lines as $Key => $Value)
721
+            if ( $Mode == LEGEND_VERTICAL )
722
+            {
723
+            $Lines = preg_split("/\n/",$Series["Description"]);
724
+            foreach($Lines as $Key => $Value)
725 725
             $this->pChartObject->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT));
726 726
 
727
-           $Y=$Y+max($this->pChartObject->FontSize*count($Lines),$IconAreaHeight) + 5;
728
-          }
729
-         elseif ( $Mode == LEGEND_HORIZONTAL )
730
-          {
731
-           $Lines = preg_split("/\n/",$Series["Description"]);
732
-           $Width = "";
733
-           foreach($Lines as $Key => $Value)
727
+            $Y=$Y+max($this->pChartObject->FontSize*count($Lines),$IconAreaHeight) + 5;
728
+            }
729
+            elseif ( $Mode == LEGEND_HORIZONTAL )
730
+            {
731
+            $Lines = preg_split("/\n/",$Series["Description"]);
732
+            $Width = "";
733
+            foreach($Lines as $Key => $Value)
734 734
             {
735
-             $BoxArray = $this->pChartObject->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT));
736
-             $Width[] = $BoxArray[1]["X"];
735
+                $BoxArray = $this->pChartObject->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT));
736
+                $Width[] = $BoxArray[1]["X"];
737 737
             }
738
-           $X=max($Width)+2+$XStep;
739
-          }
738
+            $X=max($Width)+2+$XStep;
739
+            }
740
+        }
740 741
         }
741
-      }
742 742
 
743
-     $this->Shadow = $RestoreShadow;
743
+        $this->Shadow = $RestoreShadow;
744 744
     }
745 745
 
746
-   /* Get the legend box size */
747
-   function getScatterLegendSize($Format="")
746
+    /* Get the legend box size */
747
+    function getScatterLegendSize($Format="")
748 748
     {
749
-     $FontName	= isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
750
-     $FontSize	= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
751
-     $BoxSize	= isset($Format["BoxSize"]) ? $Format["BoxSize"] : 5;
752
-     $Margin	= isset($Format["Margin"]) ? $Format["Margin"] : 5;
753
-     $Style	= isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND;
754
-     $Mode	= isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
749
+        $FontName	= isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
750
+        $FontSize	= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
751
+        $BoxSize	= isset($Format["BoxSize"]) ? $Format["BoxSize"] : 5;
752
+        $Margin	= isset($Format["Margin"]) ? $Format["Margin"] : 5;
753
+        $Style	= isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND;
754
+        $Mode	= isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
755 755
 
756
-     $YStep = max($this->pChartObject->FontSize,$BoxSize) + 5;
757
-     $XStep = $BoxSize + 5;
756
+        $YStep = max($this->pChartObject->FontSize,$BoxSize) + 5;
757
+        $XStep = $BoxSize + 5;
758 758
 
759
-     $X=100; $Y=100;
759
+        $X=100; $Y=100;
760 760
 
761
-     $Data = $this->pDataObject->getData();
761
+        $Data = $this->pDataObject->getData();
762 762
 
763
-     foreach($Data["ScatterSeries"] as $Key => $Series)
764
-      {
765
-       if ( $Series["isDrawable"] == TRUE && isset($Series["Picture"]))
763
+        foreach($Data["ScatterSeries"] as $Key => $Series)
764
+        {
765
+        if ( $Series["isDrawable"] == TRUE && isset($Series["Picture"]))
766 766
         {
767
-         list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Series["Picture"]);
768
-         if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; }
769
-         if ( $IconAreaHeight < $PicHeight ) { $IconAreaHeight = $PicHeight; }
767
+            list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Series["Picture"]);
768
+            if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; }
769
+            if ( $IconAreaHeight < $PicHeight ) { $IconAreaHeight = $PicHeight; }
770
+        }
770 771
         }
771
-      }
772 772
 
773
-     $YStep = max($this->pChartObject->FontSize,$IconAreaHeight) + 5;
774
-     $XStep = $IconAreaWidth + 5;
775
-     $XStep = $XSpacing;
773
+        $YStep = max($this->pChartObject->FontSize,$IconAreaHeight) + 5;
774
+        $XStep = $IconAreaWidth + 5;
775
+        $XStep = $XSpacing;
776 776
 
777
-     $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
778
-     foreach($Data["ScatterSeries"] as $Key => $Series)
779
-      {
780
-       if ( $Series["isDrawable"] == TRUE )
777
+        $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
778
+        foreach($Data["ScatterSeries"] as $Key => $Series)
779
+        {
780
+        if ( $Series["isDrawable"] == TRUE )
781 781
         {
782
-         if ( $Mode == LEGEND_VERTICAL )
783
-          {
784
-           $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+4,$vY+$IconAreaHeight/2,$FontName,$FontSize,0,$Series["Description"]);
785
-
786
-           if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
787
-           if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
788
-           if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$IconAreaHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$IconAreaHeight/2; }
789
-
790
-           $Lines = preg_split("/\n/",$Series["Description"]);
791
-           $vY = $vY + max($this->pChartObject->FontSize*count($Lines),$IconAreaHeight) + 5;
792
-          }
793
-         elseif ( $Mode == LEGEND_HORIZONTAL )
794
-          {
795
-           $Lines = preg_split("/\n/",$Series["Description"]);
796
-           $Width = "";
797
-           foreach($Lines as $Key => $Value)
782
+            if ( $Mode == LEGEND_VERTICAL )
783
+            {
784
+            $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+4,$vY+$IconAreaHeight/2,$FontName,$FontSize,0,$Series["Description"]);
785
+
786
+            if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
787
+            if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
788
+            if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$IconAreaHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$IconAreaHeight/2; }
789
+
790
+            $Lines = preg_split("/\n/",$Series["Description"]);
791
+            $vY = $vY + max($this->pChartObject->FontSize*count($Lines),$IconAreaHeight) + 5;
792
+            }
793
+            elseif ( $Mode == LEGEND_HORIZONTAL )
794
+            {
795
+            $Lines = preg_split("/\n/",$Series["Description"]);
796
+            $Width = "";
797
+            foreach($Lines as $Key => $Value)
798 798
             {
799
-             $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+6,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$FontName,$FontSize,0,$Value);
799
+                $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+6,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$FontName,$FontSize,0,$Value);
800 800
 
801
-             if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
802
-             if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
803
-             if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$IconAreaHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$IconAreaHeight/2; }
801
+                if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
802
+                if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
803
+                if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$IconAreaHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$IconAreaHeight/2; }
804 804
 
805
-             $Width[] = $BoxArray[1]["X"];
805
+                $Width[] = $BoxArray[1]["X"];
806 806
             }
807 807
 
808
-           $vX=max($Width)+$XStep;
809
-          }
808
+            $vX=max($Width)+$XStep;
809
+            }
810
+        }
810 811
         }
811
-      }
812
-     $vY=$vY-$YStep; $vX=$vX-$XStep;
812
+        $vY=$vY-$YStep; $vX=$vX-$XStep;
813 813
 
814
-     $TopOffset  = $Y - $Boundaries["T"];
815
-     if ( $Boundaries["B"]-($vY+$BoxSize) < $TopOffset ) { $Boundaries["B"] = $vY+$BoxSize+$TopOffset; }
814
+        $TopOffset  = $Y - $Boundaries["T"];
815
+        if ( $Boundaries["B"]-($vY+$BoxSize) < $TopOffset ) { $Boundaries["B"] = $vY+$BoxSize+$TopOffset; }
816 816
 
817
-     $Width  = ($Boundaries["R"]+$Margin) - ($Boundaries["L"]-$Margin);
818
-     $Height = ($Boundaries["B"]+$Margin) - ($Boundaries["T"]-$Margin);
817
+        $Width  = ($Boundaries["R"]+$Margin) - ($Boundaries["L"]-$Margin);
818
+        $Height = ($Boundaries["B"]+$Margin) - ($Boundaries["T"]-$Margin);
819 819
 
820
-     return(array("Width"=>$Width,"Height"=>$Height));
820
+        return(array("Width"=>$Width,"Height"=>$Height));
821 821
     }
822 822
 
823
-   /* Draw the line of best fit */
824
-   function drawScatterBestFit($Format="")
823
+    /* Draw the line of best fit */
824
+    function drawScatterBestFit($Format="")
825 825
     {
826
-     $Ticks	= isset($Format["Ticks"]) ? $Format["Ticks"] : 0;
826
+        $Ticks	= isset($Format["Ticks"]) ? $Format["Ticks"] : 0;
827 827
 
828
-     $Data    = $this->pDataObject->getData();
828
+        $Data    = $this->pDataObject->getData();
829 829
 
830
-     foreach($Data["ScatterSeries"] as $Key => $Series)
831
-      {
832
-       if ( $Series["isDrawable"] == TRUE )
830
+        foreach($Data["ScatterSeries"] as $Key => $Series)
831
+        {
832
+        if ( $Series["isDrawable"] == TRUE )
833 833
         {
834
-         $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
835
-         $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
836
-
837
-         $Color = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
838
-         $Color["Ticks"] = $Ticks;
839
-
840
-         $PosArrayX = $Data["Series"][$Series["X"]]["Data"];
841
-         $PosArrayY = $Data["Series"][$Series["Y"]]["Data"];
842
-
843
-         $Sxy = 0; $Sx = 0; $Sy = 0; $Sxx = 0;
844
-         foreach($PosArrayX as $Key => $Value)
845
-          {
846
-           $X = $Value; $Y = $PosArrayY[$Key];
847
-
848
-           $Sxy = $Sxy + $X*$Y;
849
-           $Sx  = $Sx + $X;
850
-           $Sy  = $Sy + $Y;
851
-           $Sxx = $Sxx + $X*$X;
852
-          }
853
-
854
-         $n = count($PosArrayX);
855
-
856
-         if ((($n*$Sxx) == ($Sx*$Sx)))
857
-          {
858
-           $X1 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMin"],$SerieXAxis);
859
-           $X2 = $X1;
860
-           $Y1 = $this->pChartObject->GraphAreaY1;
861
-           $Y2 = $this->pChartObject->GraphAreaY2;
862
-          }
863
-         else
864
-          {
865
-           $M = (($n*$Sxy)-($Sx*$Sy)) / (($n*$Sxx)-($Sx*$Sx));
866
-           $B = (($Sy)-($M*$Sx))/($n);
867
-
868
-           $X1 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMin"],$SerieXAxis);
869
-           $Y1 = $this->getPosArray($M * $Data["Axis"][$SerieXAxis]["ScaleMin"] + $B,$SerieYAxis);
870
-           $X2 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMax"],$SerieXAxis);
871
-           $Y2 = $this->getPosArray($M * $Data["Axis"][$SerieXAxis]["ScaleMax"] + $B,$SerieYAxis);
872
-
873
-           $RealM = -($Y2-$Y1)/($X2-$X1);
874
-
875
-           if ( $Y1 < $this->pChartObject->GraphAreaY1 ) { $X1 = $X1 + ($this->pChartObject->GraphAreaY1-$Y1/$RealM); $Y1 = $this->pChartObject->GraphAreaY1; }
876
-           if ( $Y1 > $this->pChartObject->GraphAreaY2 ) { $X1 = $X1 + ($Y1-$this->pChartObject->GraphAreaY2)/$RealM; $Y1 = $this->pChartObject->GraphAreaY2; }
877
-           if ( $Y2 < $this->pChartObject->GraphAreaY1 ) { $X2 = $X2 - ($this->pChartObject->GraphAreaY1-$Y2)/$RealM; $Y2 = $this->pChartObject->GraphAreaY1; }
878
-           if ( $Y2 > $this->pChartObject->GraphAreaY2 ) { $X2 = $X2 - ($Y2-$this->pChartObject->GraphAreaY2)/$RealM; $Y2 = $this->pChartObject->GraphAreaY2; }
879
-          }
880
-
881
-         $this->pChartObject->drawLine($X1,$Y1,$X2,$Y2,$Color);
834
+            $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
835
+            $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
836
+
837
+            $Color = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
838
+            $Color["Ticks"] = $Ticks;
839
+
840
+            $PosArrayX = $Data["Series"][$Series["X"]]["Data"];
841
+            $PosArrayY = $Data["Series"][$Series["Y"]]["Data"];
842
+
843
+            $Sxy = 0; $Sx = 0; $Sy = 0; $Sxx = 0;
844
+            foreach($PosArrayX as $Key => $Value)
845
+            {
846
+            $X = $Value; $Y = $PosArrayY[$Key];
847
+
848
+            $Sxy = $Sxy + $X*$Y;
849
+            $Sx  = $Sx + $X;
850
+            $Sy  = $Sy + $Y;
851
+            $Sxx = $Sxx + $X*$X;
852
+            }
853
+
854
+            $n = count($PosArrayX);
855
+
856
+            if ((($n*$Sxx) == ($Sx*$Sx)))
857
+            {
858
+            $X1 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMin"],$SerieXAxis);
859
+            $X2 = $X1;
860
+            $Y1 = $this->pChartObject->GraphAreaY1;
861
+            $Y2 = $this->pChartObject->GraphAreaY2;
862
+            }
863
+            else
864
+            {
865
+            $M = (($n*$Sxy)-($Sx*$Sy)) / (($n*$Sxx)-($Sx*$Sx));
866
+            $B = (($Sy)-($M*$Sx))/($n);
867
+
868
+            $X1 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMin"],$SerieXAxis);
869
+            $Y1 = $this->getPosArray($M * $Data["Axis"][$SerieXAxis]["ScaleMin"] + $B,$SerieYAxis);
870
+            $X2 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMax"],$SerieXAxis);
871
+            $Y2 = $this->getPosArray($M * $Data["Axis"][$SerieXAxis]["ScaleMax"] + $B,$SerieYAxis);
872
+
873
+            $RealM = -($Y2-$Y1)/($X2-$X1);
874
+
875
+            if ( $Y1 < $this->pChartObject->GraphAreaY1 ) { $X1 = $X1 + ($this->pChartObject->GraphAreaY1-$Y1/$RealM); $Y1 = $this->pChartObject->GraphAreaY1; }
876
+            if ( $Y1 > $this->pChartObject->GraphAreaY2 ) { $X1 = $X1 + ($Y1-$this->pChartObject->GraphAreaY2)/$RealM; $Y1 = $this->pChartObject->GraphAreaY2; }
877
+            if ( $Y2 < $this->pChartObject->GraphAreaY1 ) { $X2 = $X2 - ($this->pChartObject->GraphAreaY1-$Y2)/$RealM; $Y2 = $this->pChartObject->GraphAreaY1; }
878
+            if ( $Y2 > $this->pChartObject->GraphAreaY2 ) { $X2 = $X2 - ($Y2-$this->pChartObject->GraphAreaY2)/$RealM; $Y2 = $this->pChartObject->GraphAreaY2; }
879
+            }
880
+
881
+            $this->pChartObject->drawLine($X1,$Y1,$X2,$Y2,$Color);
882
+        }
882 883
         }
883
-      }
884 884
     }
885 885
 
886
-   function writeScatterLabel($ScatterSerieID,$Points,$Format="")
886
+    function writeScatterLabel($ScatterSerieID,$Points,$Format="")
887 887
     {
888
-     $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
889
-     $DrawPoint		= isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
890
-     $Decimals		= isset($Format["Decimals"]) ? $Format["Decimals"] : NULL;
888
+        $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
889
+        $DrawPoint		= isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
890
+        $Decimals		= isset($Format["Decimals"]) ? $Format["Decimals"] : NULL;
891 891
 
892
-     $Data    = $this->pDataObject->getData();
893
-     $Palette = $this->pDataObject->getPalette();
892
+        $Data    = $this->pDataObject->getData();
893
+        $Palette = $this->pDataObject->getPalette();
894 894
 
895
-     if ( !is_array($Points) ) { $Point = $Points; $Points = ""; $Points[0] = $Point; }
895
+        if ( !is_array($Points) ) { $Point = $Points; $Points = ""; $Points[0] = $Point; }
896 896
 
897
-     if ( !isset($Data["ScatterSeries"][$ScatterSerieID]) ) 
898
-      return(0);
897
+        if ( !isset($Data["ScatterSeries"][$ScatterSerieID]) ) 
898
+        return(0);
899 899
 
900
-     $Series = $Data["ScatterSeries"][$ScatterSerieID];
901
-     $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
902
-     $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
900
+        $Series = $Data["ScatterSeries"][$ScatterSerieID];
901
+        $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
902
+        $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
903 903
 
904
-     $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
905
-     if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
906
-     $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
907
-     if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
904
+        $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
905
+        if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
906
+        $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
907
+        if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
908 908
 
909
-     foreach($Points as $Key => $Point)
910
-      {
911
-       if ( isset($PosArrayX[$Point]) && isset($PosArrayY[$Point]) )
909
+        foreach($Points as $Key => $Point)
910
+        {
911
+        if ( isset($PosArrayX[$Point]) && isset($PosArrayY[$Point]) )
912 912
         {
913
-         $X = floor($PosArrayX[$Point]);
914
-         $Y = floor($PosArrayY[$Point]);
915
-
916
-         if ( $DrawPoint == LABEL_POINT_CIRCLE )
917
-          $this->pChartObject->drawFilledCircle($X,$Y,3,array("R"=>255,"G"=>255,"B"=>255,"BorderR"=>0,"BorderG"=>0,"BorderB"=>0));
918
-         elseif ( $DrawPoint == LABEL_POINT_BOX )
919
-          $this->pChartObject->drawFilledRectangle($X-2,$Y-2,$X+2,$Y+2,array("R"=>255,"G"=>255,"B"=>255,"BorderR"=>0,"BorderG"=>0,"BorderB"=>0));
920
-
921
-         $Serie = "";
922
-         $Serie["R"] = $Series["Color"]["R"];
923
-         $Serie["G"] = $Series["Color"]["G"];
924
-         $Serie["B"] = $Series["Color"]["B"];
925
-         $Serie["Alpha"] = $Series["Color"]["Alpha"];
926
-
927
-         $XAxisMode   = $Data["Axis"][$SerieXAxis]["Display"];
928
-         $XAxisFormat = $Data["Axis"][$SerieXAxis]["Format"];
929
-         $XAxisUnit   = $Data["Axis"][$SerieXAxis]["Unit"];
930
-         if ( $Decimals == NULL ) { $XValue = $SerieValuesX[$Point]; } else { $XValue = round($SerieValuesX[$Point],$Decimals); }
931
-         $XValue      = $this->pChartObject->scaleFormat($XValue,$XAxisMode,$XAxisFormat,$XAxisUnit);
932
-
933
-         $YAxisMode   = $Data["Axis"][$SerieYAxis]["Display"];
934
-         $YAxisFormat = $Data["Axis"][$SerieYAxis]["Format"];
935
-         $YAxisUnit   = $Data["Axis"][$SerieYAxis]["Unit"];
936
-         if ( $Decimals == NULL ) { $YValue = $SerieValuesY[$Point]; } else { $YValue = round($SerieValuesY[$Point],$Decimals); }
937
-         $YValue      = $this->pChartObject->scaleFormat($YValue,$YAxisMode,$YAxisFormat,$YAxisUnit);
938
-
939
-         $Caption = $XValue." / ".$YValue;
940
-
941
-         if ( isset($Series["Description"]) )
942
-          $Description = $Series["Description"];
943
-         else
944
-          $Description = "No description";
945
-
946
-         $Series = "";
947
-         $Series[] = array("Format"=>$Serie,"Caption"=>$Caption);
948
-
949
-         $this->pChartObject->drawLabelBox($X,$Y-3,$Description,$Series,$Format);
913
+            $X = floor($PosArrayX[$Point]);
914
+            $Y = floor($PosArrayY[$Point]);
915
+
916
+            if ( $DrawPoint == LABEL_POINT_CIRCLE )
917
+            $this->pChartObject->drawFilledCircle($X,$Y,3,array("R"=>255,"G"=>255,"B"=>255,"BorderR"=>0,"BorderG"=>0,"BorderB"=>0));
918
+            elseif ( $DrawPoint == LABEL_POINT_BOX )
919
+            $this->pChartObject->drawFilledRectangle($X-2,$Y-2,$X+2,$Y+2,array("R"=>255,"G"=>255,"B"=>255,"BorderR"=>0,"BorderG"=>0,"BorderB"=>0));
920
+
921
+            $Serie = "";
922
+            $Serie["R"] = $Series["Color"]["R"];
923
+            $Serie["G"] = $Series["Color"]["G"];
924
+            $Serie["B"] = $Series["Color"]["B"];
925
+            $Serie["Alpha"] = $Series["Color"]["Alpha"];
926
+
927
+            $XAxisMode   = $Data["Axis"][$SerieXAxis]["Display"];
928
+            $XAxisFormat = $Data["Axis"][$SerieXAxis]["Format"];
929
+            $XAxisUnit   = $Data["Axis"][$SerieXAxis]["Unit"];
930
+            if ( $Decimals == NULL ) { $XValue = $SerieValuesX[$Point]; } else { $XValue = round($SerieValuesX[$Point],$Decimals); }
931
+            $XValue      = $this->pChartObject->scaleFormat($XValue,$XAxisMode,$XAxisFormat,$XAxisUnit);
932
+
933
+            $YAxisMode   = $Data["Axis"][$SerieYAxis]["Display"];
934
+            $YAxisFormat = $Data["Axis"][$SerieYAxis]["Format"];
935
+            $YAxisUnit   = $Data["Axis"][$SerieYAxis]["Unit"];
936
+            if ( $Decimals == NULL ) { $YValue = $SerieValuesY[$Point]; } else { $YValue = round($SerieValuesY[$Point],$Decimals); }
937
+            $YValue      = $this->pChartObject->scaleFormat($YValue,$YAxisMode,$YAxisFormat,$YAxisUnit);
938
+
939
+            $Caption = $XValue." / ".$YValue;
940
+
941
+            if ( isset($Series["Description"]) )
942
+            $Description = $Series["Description"];
943
+            else
944
+            $Description = "No description";
945
+
946
+            $Series = "";
947
+            $Series[] = array("Format"=>$Serie,"Caption"=>$Caption);
948
+
949
+            $this->pChartObject->drawLabelBox($X,$Y-3,$Description,$Series,$Format);
950
+        }
950 951
         }
951
-      }
952 952
     }
953 953
 
954
-   /* Draw a Scatter threshold */
955
-   function drawScatterThreshold($Value,$Format="")
954
+    /* Draw a Scatter threshold */
955
+    function drawScatterThreshold($Value,$Format="")
956 956
     {
957
-     $AxisID		= isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
958
-     $R			= isset($Format["R"]) ? $Format["R"] : 255;
959
-     $G			= isset($Format["G"]) ? $Format["G"] : 0;
960
-     $B			= isset($Format["B"]) ? $Format["B"] : 0;
961
-     $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 50;
962
-     $Weight		= isset($Format["Weight"]) ? $Format["Weight"] : NULL;
963
-     $Ticks		= isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
964
-     $Wide		= isset($Format["Wide"]) ? $Format["Wide"] : FALSE;
965
-     $WideFactor	= isset($Format["WideFactor"]) ? $Format["WideFactor"] : 5;
966
-     $WriteCaption	= isset($Format["WriteCaption"]) ? $Format["WriteCaption"] : FALSE;
967
-     $Caption		= isset($Format["Caption"]) ? $Format["Caption"] : NULL;
968
-     $CaptionAlign	= isset($Format["CaptionAlign"]) ? $Format["CaptionAlign"] : CAPTION_LEFT_TOP;
969
-     $CaptionOffset     = isset($Format["CaptionOffset"]) ? $Format["CaptionOffset"] : 10;
970
-     $CaptionR		= isset($Format["CaptionR"]) ? $Format["CaptionR"] : 255;
971
-     $CaptionG		= isset($Format["CaptionG"]) ? $Format["CaptionG"] : 255;
972
-     $CaptionB		= isset($Format["CaptionB"]) ? $Format["CaptionB"] : 255;
973
-     $CaptionAlpha	= isset($Format["CaptionAlpha"]) ? $Format["CaptionAlpha"] : 100;
974
-     $DrawBox		= isset($Format["DrawBox"]) ? $Format["DrawBox"] : TRUE;
975
-     $DrawBoxBorder	= isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : FALSE;
976
-     $BorderOffset	= isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 5;
977
-     $BoxRounded	= isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : TRUE;
978
-     $RoundedRadius	= isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 3;
979
-     $BoxR		= isset($Format["BoxR"]) ? $Format["BoxR"] : 0;
980
-     $BoxG		= isset($Format["BoxG"]) ? $Format["BoxG"] : 0;
981
-     $BoxB		= isset($Format["BoxB"]) ? $Format["BoxB"] : 0;
982
-     $BoxAlpha		= isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 20;
983
-     $BoxSurrounding	= isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : "";
984
-     $BoxBorderR	= isset($Format["BoxBorderR"]) ? $Format["BoxBorderR"] : 255;
985
-     $BoxBorderG	= isset($Format["BoxBorderG"]) ? $Format["BoxBorderG"] : 255;
986
-     $BoxBorderB	= isset($Format["BoxBorderB"]) ? $Format["BoxBorderB"] : 255;
987
-     $BoxBorderAlpha	= isset($Format["BoxBorderAlpha"]) ? $Format["BoxBorderAlpha"] : 100;
988
-
989
-     $CaptionSettings = array("DrawBox"=>$DrawBox,"DrawBoxBorder"=>$DrawBoxBorder,"BorderOffset"=>$BorderOffset,"BoxRounded"=>$BoxRounded,"RoundedRadius"=>$RoundedRadius,
990
-                              "BoxR"=>$BoxR,"BoxG"=>$BoxG,"BoxB"=>$BoxB,"BoxAlpha"=>$BoxAlpha,"BoxSurrounding"=>$BoxSurrounding,
991
-                              "BoxBorderR"=>$BoxBorderR,"BoxBorderG"=>$BoxBorderG,"BoxBorderB"=>$BoxBorderB,"BoxBorderAlpha"=>$BoxBorderAlpha,
992
-                              "R"=>$CaptionR,"G"=>$CaptionG,"B"=>$CaptionB,"Alpha"=>$CaptionAlpha);
993
-
994
-     if ( $Caption == NULL ) { $Caption = $Value; }
995
-
996
-     $Data = $this->pDataObject->getData();
997
-
998
-     if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); }
957
+        $AxisID		= isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
958
+        $R			= isset($Format["R"]) ? $Format["R"] : 255;
959
+        $G			= isset($Format["G"]) ? $Format["G"] : 0;
960
+        $B			= isset($Format["B"]) ? $Format["B"] : 0;
961
+        $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 50;
962
+        $Weight		= isset($Format["Weight"]) ? $Format["Weight"] : NULL;
963
+        $Ticks		= isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
964
+        $Wide		= isset($Format["Wide"]) ? $Format["Wide"] : FALSE;
965
+        $WideFactor	= isset($Format["WideFactor"]) ? $Format["WideFactor"] : 5;
966
+        $WriteCaption	= isset($Format["WriteCaption"]) ? $Format["WriteCaption"] : FALSE;
967
+        $Caption		= isset($Format["Caption"]) ? $Format["Caption"] : NULL;
968
+        $CaptionAlign	= isset($Format["CaptionAlign"]) ? $Format["CaptionAlign"] : CAPTION_LEFT_TOP;
969
+        $CaptionOffset     = isset($Format["CaptionOffset"]) ? $Format["CaptionOffset"] : 10;
970
+        $CaptionR		= isset($Format["CaptionR"]) ? $Format["CaptionR"] : 255;
971
+        $CaptionG		= isset($Format["CaptionG"]) ? $Format["CaptionG"] : 255;
972
+        $CaptionB		= isset($Format["CaptionB"]) ? $Format["CaptionB"] : 255;
973
+        $CaptionAlpha	= isset($Format["CaptionAlpha"]) ? $Format["CaptionAlpha"] : 100;
974
+        $DrawBox		= isset($Format["DrawBox"]) ? $Format["DrawBox"] : TRUE;
975
+        $DrawBoxBorder	= isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : FALSE;
976
+        $BorderOffset	= isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 5;
977
+        $BoxRounded	= isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : TRUE;
978
+        $RoundedRadius	= isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 3;
979
+        $BoxR		= isset($Format["BoxR"]) ? $Format["BoxR"] : 0;
980
+        $BoxG		= isset($Format["BoxG"]) ? $Format["BoxG"] : 0;
981
+        $BoxB		= isset($Format["BoxB"]) ? $Format["BoxB"] : 0;
982
+        $BoxAlpha		= isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 20;
983
+        $BoxSurrounding	= isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : "";
984
+        $BoxBorderR	= isset($Format["BoxBorderR"]) ? $Format["BoxBorderR"] : 255;
985
+        $BoxBorderG	= isset($Format["BoxBorderG"]) ? $Format["BoxBorderG"] : 255;
986
+        $BoxBorderB	= isset($Format["BoxBorderB"]) ? $Format["BoxBorderB"] : 255;
987
+        $BoxBorderAlpha	= isset($Format["BoxBorderAlpha"]) ? $Format["BoxBorderAlpha"] : 100;
988
+
989
+        $CaptionSettings = array("DrawBox"=>$DrawBox,"DrawBoxBorder"=>$DrawBoxBorder,"BorderOffset"=>$BorderOffset,"BoxRounded"=>$BoxRounded,"RoundedRadius"=>$RoundedRadius,
990
+                                "BoxR"=>$BoxR,"BoxG"=>$BoxG,"BoxB"=>$BoxB,"BoxAlpha"=>$BoxAlpha,"BoxSurrounding"=>$BoxSurrounding,
991
+                                "BoxBorderR"=>$BoxBorderR,"BoxBorderG"=>$BoxBorderG,"BoxBorderB"=>$BoxBorderB,"BoxBorderAlpha"=>$BoxBorderAlpha,
992
+                                "R"=>$CaptionR,"G"=>$CaptionG,"B"=>$CaptionB,"Alpha"=>$CaptionAlpha);
993
+
994
+        if ( $Caption == NULL ) { $Caption = $Value; }
995
+
996
+        $Data = $this->pDataObject->getData();
997
+
998
+        if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); }
999 999
  
1000
-     if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_Y )
1001
-      {
1002
-       $X1 = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"];
1003
-       $X2 = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"];
1004
-       $Y  = $this->getPosArray($Value,$AxisID);
1000
+        if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_Y )
1001
+        {
1002
+        $X1 = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"];
1003
+        $X2 = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"];
1004
+        $Y  = $this->getPosArray($Value,$AxisID);
1005 1005
 
1006
-       $this->pChartObject->drawLine($X1,$Y,$X2,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
1006
+        $this->pChartObject->drawLine($X1,$Y,$X2,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
1007 1007
 
1008
-       if ( $Wide )
1008
+        if ( $Wide )
1009 1009
         {
1010
-         $this->pChartObject->drawLine($X1,$Y-1,$X2,$Y-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1011
-         $this->pChartObject->drawLine($X1,$Y+1,$X2,$Y+1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1010
+            $this->pChartObject->drawLine($X1,$Y-1,$X2,$Y-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1011
+            $this->pChartObject->drawLine($X1,$Y+1,$X2,$Y+1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1012 1012
         }
1013 1013
 
1014
-       if ( $WriteCaption )
1014
+        if ( $WriteCaption )
1015 1015
         {
1016
-         if ( $CaptionAlign == CAPTION_LEFT_TOP )
1017
-          { $X = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"] + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
1018
-         else 
1019
-          { $X = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"] - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
1016
+            if ( $CaptionAlign == CAPTION_LEFT_TOP )
1017
+            { $X = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"] + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
1018
+            else 
1019
+            { $X = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"] - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
1020 1020
 
1021
-         $this->pChartObject->drawText($X,$Y,$Caption,$CaptionSettings);
1021
+            $this->pChartObject->drawText($X,$Y,$Caption,$CaptionSettings);
1022 1022
         }
1023 1023
 
1024
-       return(array("Y"=>$Y));
1025
-      }
1026
-     elseif ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X )
1027
-      {
1028
-       $X  = $this->getPosArray($Value,$AxisID);
1029
-       $Y1 = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"];
1030
-       $Y2 = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"];
1024
+        return(array("Y"=>$Y));
1025
+        }
1026
+        elseif ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X )
1027
+        {
1028
+        $X  = $this->getPosArray($Value,$AxisID);
1029
+        $Y1 = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"];
1030
+        $Y2 = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"];
1031 1031
 
1032
-       $this->pChartObject->drawLine($X,$Y1,$X,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
1032
+        $this->pChartObject->drawLine($X,$Y1,$X,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
1033 1033
 
1034
-       if ( $Wide )
1034
+        if ( $Wide )
1035 1035
         {
1036
-         $this->pChartObject->drawLine($X-1,$Y1,$X-1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1037
-         $this->pChartObject->drawLine($X+1,$Y1,$X+1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1036
+            $this->pChartObject->drawLine($X-1,$Y1,$X-1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1037
+            $this->pChartObject->drawLine($X+1,$Y1,$X+1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1038 1038
         }
1039 1039
 
1040
-       if ( $WriteCaption )
1040
+        if ( $WriteCaption )
1041 1041
         {
1042
-         if ( $CaptionAlign == CAPTION_LEFT_TOP )
1043
-          { $Y = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"] + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
1044
-         else 
1045
-          { $Y = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"] - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
1042
+            if ( $CaptionAlign == CAPTION_LEFT_TOP )
1043
+            { $Y = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"] + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
1044
+            else 
1045
+            { $Y = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"] - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
1046 1046
 
1047
-         $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE;
1048
-         $this->pChartObject->drawText($X,$Y,$Caption,$CaptionSettings);
1047
+            $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE;
1048
+            $this->pChartObject->drawText($X,$Y,$Caption,$CaptionSettings);
1049 1049
         }
1050 1050
 
1051
-       return(array("X"=>$X));
1052
-      }
1051
+        return(array("X"=>$X));
1052
+        }
1053 1053
     }
1054 1054
 
1055
-   /* Draw a Scatter threshold area */
1056
-   function drawScatterThresholdArea($Value1,$Value2,$Format="")
1055
+    /* Draw a Scatter threshold area */
1056
+    function drawScatterThresholdArea($Value1,$Value2,$Format="")
1057 1057
     {
1058
-     $AxisID	= isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
1059
-     $R		= isset($Format["R"]) ? $Format["R"] : 255;
1060
-     $G		= isset($Format["G"]) ? $Format["G"] : 0;
1061
-     $B		= isset($Format["B"]) ? $Format["B"] : 0;
1062
-     $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 20;
1063
-     $Border    = isset($Format["Border"]) ? $Format["Border"] : TRUE;
1064
-     $BorderR   = isset($Format["BorderR"]) ? $Format["BorderR"] : $R;
1065
-     $BorderG   = isset($Format["BorderG"]) ? $Format["BorderG"] : $G;
1066
-     $BorderB   = isset($Format["BorderB"]) ? $Format["BorderB"] : $B;
1067
-     $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha + 20;
1068
-     $BorderTicks = isset($Format["BorderTicks"]) ? $Format["BorderTicks"] : 2;
1069
-     $AreaName 	= isset($Format["AreaName"]) ? $Format["AreaName"] : "La ouate de phoque"; //NULL;
1070
-     $NameAngle	= isset($Format["NameAngle"]) ? $Format["NameAngle"] : ZONE_NAME_ANGLE_AUTO;
1071
-     $NameR	= isset($Format["NameR"]) ? $Format["NameR"] : 255;
1072
-     $NameG	= isset($Format["NameG"]) ? $Format["NameG"] : 255;
1073
-     $NameB	= isset($Format["NameB"]) ? $Format["NameB"] : 255;
1074
-     $NameAlpha	= isset($Format["NameAlpha"]) ? $Format["NameAlpha"] : 100;
1075
-     $DisableShadowOnArea = isset($Format["DisableShadowOnArea"]) ? $Format["DisableShadowOnArea"] : TRUE;
1076
-
1077
-     if ($Value1 > $Value2) { list($Value1, $Value2) = array($Value2, $Value1); }
1078
-
1079
-     $RestoreShadow = $this->pChartObject->Shadow;
1080
-     if ( $DisableShadowOnArea && $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = FALSE; }
1081
-
1082
-     if ($BorderAlpha >100) { $BorderAlpha = 100;}
1083
-
1084
-     $Data = $this->pDataObject->getData();
1085
-
1086
-     if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); }
1058
+        $AxisID	= isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
1059
+        $R		= isset($Format["R"]) ? $Format["R"] : 255;
1060
+        $G		= isset($Format["G"]) ? $Format["G"] : 0;
1061
+        $B		= isset($Format["B"]) ? $Format["B"] : 0;
1062
+        $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 20;
1063
+        $Border    = isset($Format["Border"]) ? $Format["Border"] : TRUE;
1064
+        $BorderR   = isset($Format["BorderR"]) ? $Format["BorderR"] : $R;
1065
+        $BorderG   = isset($Format["BorderG"]) ? $Format["BorderG"] : $G;
1066
+        $BorderB   = isset($Format["BorderB"]) ? $Format["BorderB"] : $B;
1067
+        $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha + 20;
1068
+        $BorderTicks = isset($Format["BorderTicks"]) ? $Format["BorderTicks"] : 2;
1069
+        $AreaName 	= isset($Format["AreaName"]) ? $Format["AreaName"] : "La ouate de phoque"; //NULL;
1070
+        $NameAngle	= isset($Format["NameAngle"]) ? $Format["NameAngle"] : ZONE_NAME_ANGLE_AUTO;
1071
+        $NameR	= isset($Format["NameR"]) ? $Format["NameR"] : 255;
1072
+        $NameG	= isset($Format["NameG"]) ? $Format["NameG"] : 255;
1073
+        $NameB	= isset($Format["NameB"]) ? $Format["NameB"] : 255;
1074
+        $NameAlpha	= isset($Format["NameAlpha"]) ? $Format["NameAlpha"] : 100;
1075
+        $DisableShadowOnArea = isset($Format["DisableShadowOnArea"]) ? $Format["DisableShadowOnArea"] : TRUE;
1076
+
1077
+        if ($Value1 > $Value2) { list($Value1, $Value2) = array($Value2, $Value1); }
1078
+
1079
+        $RestoreShadow = $this->pChartObject->Shadow;
1080
+        if ( $DisableShadowOnArea && $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = FALSE; }
1081
+
1082
+        if ($BorderAlpha >100) { $BorderAlpha = 100;}
1083
+
1084
+        $Data = $this->pDataObject->getData();
1085
+
1086
+        if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); }
1087 1087
  
1088
-     if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X )
1089
-      {
1090
-       $Y1 = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"];
1091
-       $Y2 = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"];
1092
-       $X1  = $this->getPosArray($Value1,$AxisID);
1093
-       $X2  = $this->getPosArray($Value2,$AxisID);
1088
+        if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X )
1089
+        {
1090
+        $Y1 = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"];
1091
+        $Y2 = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"];
1092
+        $X1  = $this->getPosArray($Value1,$AxisID);
1093
+        $X2  = $this->getPosArray($Value2,$AxisID);
1094 1094
 
1095
-       if ( $X1 <= $this->pChartObject->GraphAreaX1 ) { $X1 = $this->pChartObject->GraphAreaX1+$Data["Axis"][$AxisID]["Margin"]; }
1096
-       if ( $X2 >= $this->pChartObject->GraphAreaX2 ) { $X2 = $this->pChartObject->GraphAreaX2-$Data["Axis"][$AxisID]["Margin"]; }
1095
+        if ( $X1 <= $this->pChartObject->GraphAreaX1 ) { $X1 = $this->pChartObject->GraphAreaX1+$Data["Axis"][$AxisID]["Margin"]; }
1096
+        if ( $X2 >= $this->pChartObject->GraphAreaX2 ) { $X2 = $this->pChartObject->GraphAreaX2-$Data["Axis"][$AxisID]["Margin"]; }
1097 1097
 
1098
-       $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
1098
+        $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
1099 1099
 
1100
-       if ( $Border )
1100
+        if ( $Border )
1101 1101
         {
1102
-         $this->pChartObject->drawLine($X1,$Y1,$X1,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1103
-         $this->pChartObject->drawLine($X2,$Y1,$X2,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1102
+            $this->pChartObject->drawLine($X1,$Y1,$X1,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1103
+            $this->pChartObject->drawLine($X2,$Y1,$X2,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1104 1104
         }
1105 1105
 
1106
-       if ( $AreaName != NULL )
1106
+        if ( $AreaName != NULL )
1107 1107
         {
1108
-         $XPos = ($X2-$X1)/2 + $X1;
1109
-         $YPos = ($Y2-$Y1)/2 + $Y1;
1110
-
1111
-         if ( $NameAngle == ZONE_NAME_ANGLE_AUTO )
1112
-          {
1113
-           $TxtPos   = $this->pChartObject->getTextBox($XPos,$YPos,$this->pChartObject->FontName,$this->pChartObject->FontSize,0,$AreaName);
1114
-           $TxtWidth = $TxtPos[1]["X"] - $TxtPos[0]["X"];
1115
-           if ( abs($X2 - $X1) > $TxtWidth ) { $NameAngle = 0; } else { $NameAngle = 90; }
1116
-          }
1117
-         $this->pChartObject->Shadow = $RestoreShadow;
1118
-         $this->pChartObject->drawText($XPos,$YPos,$AreaName,array("R"=>$NameR,"G"=>$NameG,"B"=>$NameB,"Alpha"=>$NameAlpha,"Angle"=>$NameAngle,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
1119
-         if ( $DisableShadowOnArea ) { $this->pChartObject->Shadow = FALSE; }
1108
+            $XPos = ($X2-$X1)/2 + $X1;
1109
+            $YPos = ($Y2-$Y1)/2 + $Y1;
1110
+
1111
+            if ( $NameAngle == ZONE_NAME_ANGLE_AUTO )
1112
+            {
1113
+            $TxtPos   = $this->pChartObject->getTextBox($XPos,$YPos,$this->pChartObject->FontName,$this->pChartObject->FontSize,0,$AreaName);
1114
+            $TxtWidth = $TxtPos[1]["X"] - $TxtPos[0]["X"];
1115
+            if ( abs($X2 - $X1) > $TxtWidth ) { $NameAngle = 0; } else { $NameAngle = 90; }
1116
+            }
1117
+            $this->pChartObject->Shadow = $RestoreShadow;
1118
+            $this->pChartObject->drawText($XPos,$YPos,$AreaName,array("R"=>$NameR,"G"=>$NameG,"B"=>$NameB,"Alpha"=>$NameAlpha,"Angle"=>$NameAngle,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
1119
+            if ( $DisableShadowOnArea ) { $this->pChartObject->Shadow = FALSE; }
1120 1120
         }
1121 1121
 
1122
-       $this->pChartObject->Shadow = $RestoreShadow;
1123
-       return(array("X1"=>$X1,"X2"=>$X2));
1124
-      }
1125
-     elseif ( $Data["Axis"][$AxisID]["Identity"] == AXIS_Y )
1126
-      {
1127
-       $X1 = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"];
1128
-       $X2 = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"];
1129
-       $Y1 = $this->getPosArray($Value1,$AxisID);
1130
-       $Y2 = $this->getPosArray($Value2,$AxisID);
1122
+        $this->pChartObject->Shadow = $RestoreShadow;
1123
+        return(array("X1"=>$X1,"X2"=>$X2));
1124
+        }
1125
+        elseif ( $Data["Axis"][$AxisID]["Identity"] == AXIS_Y )
1126
+        {
1127
+        $X1 = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"];
1128
+        $X2 = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"];
1129
+        $Y1 = $this->getPosArray($Value1,$AxisID);
1130
+        $Y2 = $this->getPosArray($Value2,$AxisID);
1131 1131
 
1132
-       if ( $Y1 >= $this->pChartObject->GraphAreaY2 ) { $Y1 = $this->pChartObject->GraphAreaY2-$Data["Axis"][$AxisID]["Margin"]; }
1133
-       if ( $Y2 <= $this->pChartObject->GraphAreaY1 ) { $Y2 = $this->pChartObject->GraphAreaY1+$Data["Axis"][$AxisID]["Margin"]; }
1132
+        if ( $Y1 >= $this->pChartObject->GraphAreaY2 ) { $Y1 = $this->pChartObject->GraphAreaY2-$Data["Axis"][$AxisID]["Margin"]; }
1133
+        if ( $Y2 <= $this->pChartObject->GraphAreaY1 ) { $Y2 = $this->pChartObject->GraphAreaY1+$Data["Axis"][$AxisID]["Margin"]; }
1134 1134
 
1135
-       $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
1135
+        $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
1136 1136
 
1137
-       if ( $Border )
1137
+        if ( $Border )
1138 1138
         {
1139
-         $this->pChartObject->drawLine($X1,$Y1,$X2,$Y1,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1140
-         $this->pChartObject->drawLine($X1,$Y2,$X2,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1139
+            $this->pChartObject->drawLine($X1,$Y1,$X2,$Y1,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1140
+            $this->pChartObject->drawLine($X1,$Y2,$X2,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1141 1141
         }
1142 1142
 
1143
-       if ( $AreaName != NULL )
1143
+        if ( $AreaName != NULL )
1144 1144
         {
1145
-         $XPos = ($X2-$X1)/2 + $X1;
1146
-         $YPos = ($Y2-$Y1)/2 + $Y1;
1145
+            $XPos = ($X2-$X1)/2 + $X1;
1146
+            $YPos = ($Y2-$Y1)/2 + $Y1;
1147 1147
 
1148
-         $this->pChartObject->Shadow = $RestoreShadow;
1149
-         $this->pChartObject->drawText($YPos,$XPos,$AreaName,array("R"=>$NameR,"G"=>$NameG,"B"=>$NameB,"Alpha"=>$NameAlpha,"Angle"=>0,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
1150
-         if ( $DisableShadowOnArea ) { $this->Shadow = FALSE; }
1148
+            $this->pChartObject->Shadow = $RestoreShadow;
1149
+            $this->pChartObject->drawText($YPos,$XPos,$AreaName,array("R"=>$NameR,"G"=>$NameG,"B"=>$NameB,"Alpha"=>$NameAlpha,"Angle"=>0,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
1150
+            if ( $DisableShadowOnArea ) { $this->Shadow = FALSE; }
1151 1151
         }
1152 1152
 
1153
-       $this->pChartObject->Shadow = $RestoreShadow;
1154
-       return(array("Y1"=>$Y1,"Y2"=>$Y2));
1155
-      }
1153
+        $this->pChartObject->Shadow = $RestoreShadow;
1154
+        return(array("Y1"=>$Y1,"Y2"=>$Y2));
1155
+        }
1156
+    }
1156 1157
     }
1157
-  }
1158 1158
 ?>
1159 1159
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +454 added lines, -454 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  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("SCATTER_MISSING_X_SERIE"	, 190001);
17
- define("SCATTER_MISSING_Y_SERIE"	, 190002);
16
+ define("SCATTER_MISSING_X_SERIE", 190001);
17
+ define("SCATTER_MISSING_Y_SERIE", 190002);
18 18
 
19 19
  /* pScatter class definition */
20 20
  class pScatter
@@ -23,24 +23,24 @@  discard block
 block discarded – undo
23 23
    var $pDataObject;
24 24
 
25 25
    /* Class creator */
26
-   function pScatter($pChartObject,$pDataObject)
26
+   function pScatter($pChartObject, $pDataObject)
27 27
     {
28 28
      $this->pChartObject = $pChartObject;
29 29
      $this->pDataObject  = $pDataObject;
30 30
     }
31 31
 
32 32
    /* Prepare the scale */
33
-   function drawScatterScale($Format="")
33
+   function drawScatterScale($Format = "")
34 34
     {
35
-     $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : SCALE_MODE_FLOATING;
36
-     $Floating		= isset($Format["Floating"]) ? $Format["Floating"] : FALSE;
37
-     $XLabelsRotation	= isset($Format["XLabelsRotation"]) ? $Format["XLabelsRotation"] : 90;
38
-     $MinDivHeight	= isset($Format["MinDivHeight"]) ? $Format["MinDivHeight"] : 20;
39
-     $Factors		= isset($Format["Factors"]) ? $Format["Factors"] : array(1,2,5);
40
-     $ManualScale	= isset($Format["ManualScale"]) ? $Format["ManualScale"] : array("0"=>array("Min"=>-100,"Max"=>100));
35
+     $Mode = isset($Format["Mode"]) ? $Format["Mode"] : SCALE_MODE_FLOATING;
36
+     $Floating = isset($Format["Floating"]) ? $Format["Floating"] : FALSE;
37
+     $XLabelsRotation = isset($Format["XLabelsRotation"]) ? $Format["XLabelsRotation"] : 90;
38
+     $MinDivHeight = isset($Format["MinDivHeight"]) ? $Format["MinDivHeight"] : 20;
39
+     $Factors		= isset($Format["Factors"]) ? $Format["Factors"] : array(1, 2, 5);
40
+     $ManualScale = isset($Format["ManualScale"]) ? $Format["ManualScale"] : array("0"=>array("Min"=>-100, "Max"=>100));
41 41
      $XMargin		= isset($Format["XMargin"]) ? $Format["XMargin"] : 0;
42 42
      $YMargin		= isset($Format["YMargin"]) ? $Format["YMargin"] : 0;
43
-     $ScaleSpacing	= isset($Format["ScaleSpacing"]) ? $Format["ScaleSpacing"] : 15;
43
+     $ScaleSpacing = isset($Format["ScaleSpacing"]) ? $Format["ScaleSpacing"] : 15;
44 44
      $InnerTickWidth	= isset($Format["InnerTickWidth"]) ? $Format["InnerTickWidth"] : 2;
45 45
      $OuterTickWidth	= isset($Format["OuterTickWidth"]) ? $Format["OuterTickWidth"] : 2;
46 46
      $DrawXLines	= isset($Format["DrawXLines"]) ? $Format["DrawXLines"] : ALL;
@@ -49,75 +49,75 @@  discard block
 block discarded – undo
49 49
      $GridR		= isset($Format["GridR"]) ? $Format["GridR"] : 255;
50 50
      $GridG		= isset($Format["GridG"]) ? $Format["GridG"] : 255;
51 51
      $GridB		= isset($Format["GridB"]) ? $Format["GridB"] : 255;
52
-     $GridAlpha		= isset($Format["GridAlpha"]) ? $Format["GridAlpha"] : 40;
52
+     $GridAlpha = isset($Format["GridAlpha"]) ? $Format["GridAlpha"] : 40;
53 53
      $AxisRo		= isset($Format["AxisR"]) ? $Format["AxisR"] : 0;
54 54
      $AxisGo		= isset($Format["AxisG"]) ? $Format["AxisG"] : 0;
55 55
      $AxisBo		= isset($Format["AxisB"]) ? $Format["AxisB"] : 0;
56
-     $AxisAlpha		= isset($Format["AxisAlpha"]) ? $Format["AxisAlpha"] : 100;
56
+     $AxisAlpha = isset($Format["AxisAlpha"]) ? $Format["AxisAlpha"] : 100;
57 57
      $TickRo		= isset($Format["TickR"]) ? $Format["TickR"] : 0;
58 58
      $TickGo		= isset($Format["TickG"]) ? $Format["TickG"] : 0;
59 59
      $TickBo		= isset($Format["TickB"]) ? $Format["TickB"] : 0;
60
-     $TickAlpha		= isset($Format["TickAlpha"]) ? $Format["TickAlpha"] : 100;
61
-     $DrawSubTicks	= isset($Format["DrawSubTicks"]) ? $Format["DrawSubTicks"] : FALSE;
60
+     $TickAlpha = isset($Format["TickAlpha"]) ? $Format["TickAlpha"] : 100;
61
+     $DrawSubTicks = isset($Format["DrawSubTicks"]) ? $Format["DrawSubTicks"] : FALSE;
62 62
      $InnerSubTickWidth	= isset($Format["InnerSubTickWidth"]) ? $Format["InnerSubTickWidth"] : 0;
63 63
      $OuterSubTickWidth	= isset($Format["OuterSubTickWidth"]) ? $Format["OuterSubTickWidth"] : 2;
64 64
      $SubTickR		= isset($Format["SubTickR"]) ? $Format["SubTickR"] : 255;
65 65
      $SubTickG		= isset($Format["SubTickG"]) ? $Format["SubTickG"] : 0;
66 66
      $SubTickB		= isset($Format["SubTickB"]) ? $Format["SubTickB"] : 0;
67
-     $SubTickAlpha	= isset($Format["SubTickAlpha"]) ? $Format["SubTickAlpha"] : 100;
67
+     $SubTickAlpha = isset($Format["SubTickAlpha"]) ? $Format["SubTickAlpha"] : 100;
68 68
      $XReleasePercent	= isset($Format["XReleasePercent"]) ? $Format["XReleasePercent"] : 1;
69
-     $DrawArrows	= isset($Format["DrawArrows"]) ? $Format["DrawArrows"] : FALSE;
70
-     $ArrowSize         = isset($Format["ArrowSize"]) ? $Format["ArrowSize"] : 8;
69
+     $DrawArrows = isset($Format["DrawArrows"]) ? $Format["DrawArrows"] : FALSE;
70
+     $ArrowSize = isset($Format["ArrowSize"]) ? $Format["ArrowSize"] : 8;
71 71
      $CycleBackground	= isset($Format["CycleBackground"]) ? $Format["CycleBackground"] : FALSE;
72 72
      $BackgroundR1	= isset($Format["BackgroundR1"]) ? $Format["BackgroundR1"] : 255;
73 73
      $BackgroundG1	= isset($Format["BackgroundG1"]) ? $Format["BackgroundG1"] : 255;
74 74
      $BackgroundB1	= isset($Format["BackgroundB1"]) ? $Format["BackgroundB1"] : 255;
75
-     $BackgroundAlpha1	= isset($Format["BackgroundAlpha1"]) ? $Format["BackgroundAlpha1"] : 10;
75
+     $BackgroundAlpha1 = isset($Format["BackgroundAlpha1"]) ? $Format["BackgroundAlpha1"] : 10;
76 76
      $BackgroundR2	= isset($Format["BackgroundR2"]) ? $Format["BackgroundR2"] : 230;
77 77
      $BackgroundG2	= isset($Format["BackgroundG2"]) ? $Format["BackgroundG2"] : 230;
78 78
      $BackgroundB2	= isset($Format["BackgroundB2"]) ? $Format["BackgroundB2"] : 230;
79
-     $BackgroundAlpha2	= isset($Format["BackgroundAlpha2"]) ? $Format["BackgroundAlpha2"] : 10;
79
+     $BackgroundAlpha2 = isset($Format["BackgroundAlpha2"]) ? $Format["BackgroundAlpha2"] : 10;
80 80
 
81 81
      /* Check if we have at least both one X and Y axis */
82 82
      $GotXAxis = FALSE; $GotYAxis = FALSE;
83
-     foreach($this->pDataObject->Data["Axis"] as $AxisID => $AxisSettings)
83
+     foreach ($this->pDataObject->Data["Axis"] as $AxisID => $AxisSettings)
84 84
       {
85
-       if ( $AxisSettings["Identity"] == AXIS_X ) { $GotXAxis = TRUE; }
86
-       if ( $AxisSettings["Identity"] == AXIS_Y ) { $GotYAxis = TRUE; }
85
+       if ($AxisSettings["Identity"] == AXIS_X) { $GotXAxis = TRUE; }
86
+       if ($AxisSettings["Identity"] == AXIS_Y) { $GotYAxis = TRUE; }
87 87
       }
88
-     if ( !$GotXAxis ) { return(SCATTER_MISSING_X_SERIE); }
89
-     if ( !$GotYAxis ) { return(SCATTER_MISSING_Y_SERIE); }
88
+     if (!$GotXAxis) { return(SCATTER_MISSING_X_SERIE); }
89
+     if (!$GotYAxis) { return(SCATTER_MISSING_Y_SERIE); }
90 90
 
91 91
      /* Skip a NOTICE event in case of an empty array */
92
-     if ( $DrawYLines == NONE ) { $DrawYLines = array("zarma"=>"31"); }
92
+     if ($DrawYLines == NONE) { $DrawYLines = array("zarma"=>"31"); }
93 93
 
94 94
      $Data = $this->pDataObject->getData();
95 95
 
96
-     foreach($Data["Axis"] as $AxisID => $AxisSettings)
96
+     foreach ($Data["Axis"] as $AxisID => $AxisSettings)
97 97
       {
98
-       if ( $AxisSettings["Identity"] == AXIS_X)
98
+       if ($AxisSettings["Identity"] == AXIS_X)
99 99
         { $Width = $this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin*2; }
100 100
        else
101 101
         { $Width = $this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1 - $YMargin*2; }
102 102
 
103 103
        $AxisMin = ABSOLUTE_MAX; $AxisMax = OUT_OF_SIGHT;
104
-       if ( $Mode == SCALE_MODE_FLOATING )
104
+       if ($Mode == SCALE_MODE_FLOATING)
105 105
         {
106
-         foreach($Data["Series"] as $SerieID => $SerieParameter)
106
+         foreach ($Data["Series"] as $SerieID => $SerieParameter)
107 107
           {
108
-           if ( $SerieParameter["Axis"] == $AxisID && $Data["Series"][$SerieID]["isDrawable"] )
108
+           if ($SerieParameter["Axis"] == $AxisID && $Data["Series"][$SerieID]["isDrawable"])
109 109
             {
110
-             $AxisMax = max($AxisMax,$Data["Series"][$SerieID]["Max"]);
111
-             $AxisMin = min($AxisMin,$Data["Series"][$SerieID]["Min"]);
110
+             $AxisMax = max($AxisMax, $Data["Series"][$SerieID]["Max"]);
111
+             $AxisMin = min($AxisMin, $Data["Series"][$SerieID]["Min"]);
112 112
             }
113 113
           }
114
-         $AutoMargin = (($AxisMax-$AxisMin)/100)*$XReleasePercent;
114
+         $AutoMargin = (($AxisMax - $AxisMin)/100)*$XReleasePercent;
115 115
 
116
-         $Data["Axis"][$AxisID]["Min"] = $AxisMin-$AutoMargin; $Data["Axis"][$AxisID]["Max"] = $AxisMax+$AutoMargin;
116
+         $Data["Axis"][$AxisID]["Min"] = $AxisMin - $AutoMargin; $Data["Axis"][$AxisID]["Max"] = $AxisMax + $AutoMargin;
117 117
         }
118
-       elseif ( $Mode == SCALE_MODE_MANUAL )
118
+       elseif ($Mode == SCALE_MODE_MANUAL)
119 119
         {
120
-         if ( isset($ManualScale[$AxisID]["Min"]) && isset($ManualScale[$AxisID]["Max"]) )
120
+         if (isset($ManualScale[$AxisID]["Min"]) && isset($ManualScale[$AxisID]["Max"]))
121 121
           {
122 122
            $Data["Axis"][$AxisID]["Min"] = $ManualScale[$AxisID]["Min"];
123 123
            $Data["Axis"][$AxisID]["Max"] = $ManualScale[$AxisID]["Max"];
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
         }
128 128
 
129 129
        /* Full manual scale */
130
-       if ( isset($ManualScale[$AxisID]["Rows"]) && isset($ManualScale[$AxisID]["RowHeight"]) )
131
-        $Scale = array("Rows"=>$ManualScale[$AxisID]["Rows"],"RowHeight"=>$ManualScale[$AxisID]["RowHeight"],"XMin"=>$ManualScale[$AxisID]["Min"],"XMax"=>$ManualScale[$AxisID]["Max"]);
130
+       if (isset($ManualScale[$AxisID]["Rows"]) && isset($ManualScale[$AxisID]["RowHeight"]))
131
+        $Scale = array("Rows"=>$ManualScale[$AxisID]["Rows"], "RowHeight"=>$ManualScale[$AxisID]["RowHeight"], "XMin"=>$ManualScale[$AxisID]["Min"], "XMax"=>$ManualScale[$AxisID]["Max"]);
132 132
        else
133 133
         {
134 134
          $MaxDivs = floor($Width/$MinDivHeight);
135
-         $Scale   = $this->pChartObject->computeScale($Data["Axis"][$AxisID]["Min"],$Data["Axis"][$AxisID]["Max"],$MaxDivs,$Factors,$AxisID);
135
+         $Scale   = $this->pChartObject->computeScale($Data["Axis"][$AxisID]["Min"], $Data["Axis"][$AxisID]["Max"], $MaxDivs, $Factors, $AxisID);
136 136
         }
137 137
 
138 138
        $Data["Axis"][$AxisID]["Margin"]    = $AxisSettings["Identity"] == AXIS_X ? $XMargin : $YMargin;
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
        $Data["Axis"][$AxisID]["Rows"]      = $Scale["Rows"];
142 142
        $Data["Axis"][$AxisID]["RowHeight"] = $Scale["RowHeight"];
143 143
 
144
-       if ( isset($Scale["Format"]) ) { $Data["Axis"][$AxisID]["Format"] = $Scale["Format"]; }
144
+       if (isset($Scale["Format"])) { $Data["Axis"][$AxisID]["Format"] = $Scale["Format"]; }
145 145
 
146
-       if ( !isset($Data["Axis"][$AxisID]["Display"]) ) { $Data["Axis"][$AxisID]["Display"] = NULL; }
147
-       if ( !isset($Data["Axis"][$AxisID]["Format"]) )  { $Data["Axis"][$AxisID]["Format"] = NULL; }
148
-       if ( !isset($Data["Axis"][$AxisID]["Unit"]) )    { $Data["Axis"][$AxisID]["Unit"] = NULL; }
146
+       if (!isset($Data["Axis"][$AxisID]["Display"])) { $Data["Axis"][$AxisID]["Display"] = NULL; }
147
+       if (!isset($Data["Axis"][$AxisID]["Format"])) { $Data["Axis"][$AxisID]["Format"] = NULL; }
148
+       if (!isset($Data["Axis"][$AxisID]["Unit"])) { $Data["Axis"][$AxisID]["Unit"] = NULL; }
149 149
       }
150 150
 
151 151
      /* Get the default font color */
@@ -154,67 +154,67 @@  discard block
 block discarded – undo
154 154
      /* Set the original boundaries */
155 155
      $AxisPos["L"] = $this->pChartObject->GraphAreaX1; $AxisPos["R"] = $this->pChartObject->GraphAreaX2; $AxisPos["T"] = $this->pChartObject->GraphAreaY1; $AxisPos["B"] = $this->pChartObject->GraphAreaY2;
156 156
 
157
-     foreach($Data["Axis"] as $AxisID => $AxisSettings)
157
+     foreach ($Data["Axis"] as $AxisID => $AxisSettings)
158 158
       {
159
-       if ( isset($AxisSettings["Color"]) )
159
+       if (isset($AxisSettings["Color"]))
160 160
         {
161 161
          $AxisR = $AxisSettings["Color"]["R"]; $AxisG = $AxisSettings["Color"]["G"]; $AxisB = $AxisSettings["Color"]["B"];
162 162
          $TickR = $AxisSettings["Color"]["R"]; $TickG = $AxisSettings["Color"]["G"]; $TickB = $AxisSettings["Color"]["B"];
163
-         $this->pChartObject->setFontProperties(array("R"=>$AxisSettings["Color"]["R"],"G"=>$AxisSettings["Color"]["G"],"B"=>$AxisSettings["Color"]["B"]));
163
+         $this->pChartObject->setFontProperties(array("R"=>$AxisSettings["Color"]["R"], "G"=>$AxisSettings["Color"]["G"], "B"=>$AxisSettings["Color"]["B"]));
164 164
         }
165 165
        else
166 166
         {
167 167
          $AxisR = $AxisRo; $AxisG = $AxisGo; $AxisB = $AxisBo;
168 168
          $TickR = $TickRo; $TickG = $TickGo; $TickB = $TickBo;
169
-         $this->pChartObject->setFontProperties(array("R"=>$FontColorRo,"G"=>$FontColorGo,"B"=>$FontColorBo));
169
+         $this->pChartObject->setFontProperties(array("R"=>$FontColorRo, "G"=>$FontColorGo, "B"=>$FontColorBo));
170 170
         }
171 171
 
172 172
        $LastValue = "w00t"; $ID = 1;
173
-       if ( $AxisSettings["Identity"] == AXIS_X )
173
+       if ($AxisSettings["Identity"] == AXIS_X)
174 174
         {
175
-         if ( $AxisSettings["Position"] == AXIS_POSITION_BOTTOM )
175
+         if ($AxisSettings["Position"] == AXIS_POSITION_BOTTOM)
176 176
           {
177
-           if ( $XLabelsRotation == 0 )				   { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $LabelOffset = 2; }
178
-           if ( $XLabelsRotation > 0 && $XLabelsRotation < 190 )   { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $LabelOffset = 5; }
179
-           if ( $XLabelsRotation == 180 )			   { $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $LabelOffset = 5; }
180
-           if ( $XLabelsRotation > 180 && $XLabelsRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $LabelOffset = 2; }
177
+           if ($XLabelsRotation == 0) { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $LabelOffset = 2; }
178
+           if ($XLabelsRotation > 0 && $XLabelsRotation < 190) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $LabelOffset = 5; }
179
+           if ($XLabelsRotation == 180) { $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $LabelOffset = 5; }
180
+           if ($XLabelsRotation > 180 && $XLabelsRotation < 360) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $LabelOffset = 2; }
181 181
 
182
-           if ( $Floating )
183
-            { $FloatingOffset = $YMargin; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$AxisSettings["Margin"],$AxisPos["B"],$this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
182
+           if ($Floating)
183
+            { $FloatingOffset = $YMargin; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"], $AxisPos["B"], $this->pChartObject->GraphAreaX2 - $AxisSettings["Margin"], $AxisPos["B"], array("R"=>$AxisR, "G"=>$AxisG, "B"=>$AxisB, "Alpha"=>$AxisAlpha)); }
184 184
            else
185
-            { $FloatingOffset = 0; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1,$AxisPos["B"],$this->pChartObject->GraphAreaX2,$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
185
+            { $FloatingOffset = 0; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1, $AxisPos["B"], $this->pChartObject->GraphAreaX2, $AxisPos["B"], array("R"=>$AxisR, "G"=>$AxisG, "B"=>$AxisB, "Alpha"=>$AxisAlpha)); }
186 186
 
187
-           if ( $DrawArrows ) { $this->pChartObject->drawArrow($this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["B"],$this->pChartObject->GraphAreaX2+($ArrowSize*2),$AxisPos["B"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
187
+           if ($DrawArrows) { $this->pChartObject->drawArrow($this->pChartObject->GraphAreaX2 - $AxisSettings["Margin"], $AxisPos["B"], $this->pChartObject->GraphAreaX2 + ($ArrowSize*2), $AxisPos["B"], array("FillR"=>$AxisR, "FillG"=>$AxisG, "FillB"=>$AxisB, "Size"=>$ArrowSize)); }
188 188
 
189 189
            $Width = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $AxisSettings["Margin"]*2;
190
-           $Step   = $Width / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MaxBottom = $AxisPos["B"];
190
+           $Step   = $Width/$AxisSettings["Rows"]; $SubTicksSize = $Step/2; $MaxBottom = $AxisPos["B"];
191 191
            $LastX  = NULL;
192
-           for($i=0;$i<=$AxisSettings["Rows"];$i++)
192
+           for ($i = 0; $i <= $AxisSettings["Rows"]; $i++)
193 193
             {
194 194
              $XPos  = $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"] + $Step*$i;
195 195
              $YPos  = $AxisPos["B"];
196
-             $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
196
+             $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i, $AxisSettings["Display"], $AxisSettings["Format"], $AxisSettings["Unit"]);
197 197
 
198
-             if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
199
-             if ( $LastX != NULL && $CycleBackground  && ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) )) { $this->pChartObject->drawFilledRectangle($LastX,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,$BGColor); }
198
+             if ($i%2 == 1) { $BGColor = array("R"=>$BackgroundR1, "G"=>$BackgroundG1, "B"=>$BackgroundB1, "Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2, "G"=>$BackgroundG2, "B"=>$BackgroundB2, "Alpha"=>$BackgroundAlpha2); }
199
+             if ($LastX != NULL && $CycleBackground && ($DrawXLines == ALL || in_array($AxisID, $DrawXLines))) { $this->pChartObject->drawFilledRectangle($LastX, $this->pChartObject->GraphAreaY1 + $FloatingOffset, $XPos, $this->pChartObject->GraphAreaY2 - $FloatingOffset, $BGColor); }
200 200
 
201
-             if ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) ) { $this->pChartObject->drawLine($XPos,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
202
-             if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
203
-              $this->pChartObject->drawLine($XPos+$SubTicksSize,$YPos-$InnerSubTickWidth,$XPos+$SubTicksSize,$YPos+$OuterSubTickWidth,array("R"=>$SubTickR,"G"=>$SubTickG,"B"=>$SubTickB,"Alpha"=>$SubTickAlpha));
201
+             if ($DrawXLines == ALL || in_array($AxisID, $DrawXLines)) { $this->pChartObject->drawLine($XPos, $this->pChartObject->GraphAreaY1 + $FloatingOffset, $XPos, $this->pChartObject->GraphAreaY2 - $FloatingOffset, array("R"=>$GridR, "G"=>$GridG, "B"=>$GridB, "Alpha"=>$GridAlpha, "Ticks"=>$GridTicks)); }
202
+             if ($DrawSubTicks && $i != $AxisSettings["Rows"])
203
+              $this->pChartObject->drawLine($XPos + $SubTicksSize, $YPos - $InnerSubTickWidth, $XPos + $SubTicksSize, $YPos + $OuterSubTickWidth, array("R"=>$SubTickR, "G"=>$SubTickG, "B"=>$SubTickB, "Alpha"=>$SubTickAlpha));
204 204
 
205
-             $this->pChartObject->drawLine($XPos,$YPos-$InnerTickWidth,$XPos,$YPos+$OuterTickWidth,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha));
206
-             $Bounds    = $this->pChartObject->drawText($XPos,$YPos+$OuterTickWidth+$LabelOffset,$Value,array("Angle"=>$XLabelsRotation,"Align"=>$LabelAlign));
207
-             $TxtBottom = $YPos+2+$OuterTickWidth+2+($Bounds[0]["Y"]-$Bounds[2]["Y"]);
208
-             $MaxBottom = max($MaxBottom,$TxtBottom);
205
+             $this->pChartObject->drawLine($XPos, $YPos - $InnerTickWidth, $XPos, $YPos + $OuterTickWidth, array("R"=>$TickR, "G"=>$TickG, "B"=>$TickB, "Alpha"=>$TickAlpha));
206
+             $Bounds    = $this->pChartObject->drawText($XPos, $YPos + $OuterTickWidth + $LabelOffset, $Value, array("Angle"=>$XLabelsRotation, "Align"=>$LabelAlign));
207
+             $TxtBottom = $YPos + 2 + $OuterTickWidth + 2 + ($Bounds[0]["Y"] - $Bounds[2]["Y"]);
208
+             $MaxBottom = max($MaxBottom, $TxtBottom);
209 209
 
210 210
              $LastX = $XPos;
211 211
             }
212 212
 
213
-           if ( isset($AxisSettings["Name"]) )
213
+           if (isset($AxisSettings["Name"]))
214 214
             {
215
-             $YPos   = $MaxBottom+2;
216
-             $XPos   = $this->pChartObject->GraphAreaX1+($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1)/2;
217
-             $Bounds = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_TOPMIDDLE));
215
+             $YPos   = $MaxBottom + 2;
216
+             $XPos   = $this->pChartObject->GraphAreaX1 + ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1)/2;
217
+             $Bounds = $this->pChartObject->drawText($XPos, $YPos, $AxisSettings["Name"], array("Align"=>TEXT_ALIGN_TOPMIDDLE));
218 218
              $MaxBottom = $Bounds[0]["Y"];
219 219
 
220 220
              $this->pDataObject->Data["GraphArea"]["Y2"] = $MaxBottom + $this->pChartObject->FontSize;
@@ -222,50 +222,50 @@  discard block
 block discarded – undo
222 222
 
223 223
            $AxisPos["B"] = $MaxBottom + $ScaleSpacing;
224 224
           }
225
-         elseif ( $AxisSettings["Position"] == AXIS_POSITION_TOP )
225
+         elseif ($AxisSettings["Position"] == AXIS_POSITION_TOP)
226 226
           {
227
-           if ( $XLabelsRotation == 0 )					{ $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $LabelOffset = 2; }
228
-           if ( $XLabelsRotation > 0 && $XLabelsRotation < 190 )	{ $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $LabelOffset = 2; }
229
-           if ( $XLabelsRotation == 180 )				{ $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $LabelOffset = 5; }
230
-           if ( $XLabelsRotation > 180 && $SLabelxRotation < 360 )	{ $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $LabelOffset = 5; }
227
+           if ($XLabelsRotation == 0) { $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $LabelOffset = 2; }
228
+           if ($XLabelsRotation > 0 && $XLabelsRotation < 190) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $LabelOffset = 2; }
229
+           if ($XLabelsRotation == 180) { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $LabelOffset = 5; }
230
+           if ($XLabelsRotation > 180 && $SLabelxRotation < 360) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $LabelOffset = 5; }
231 231
 
232
-           if ( $Floating )
233
-            { $FloatingOffset = $YMargin; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$AxisSettings["Margin"],$AxisPos["T"],$this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
232
+           if ($Floating)
233
+            { $FloatingOffset = $YMargin; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"], $AxisPos["T"], $this->pChartObject->GraphAreaX2 - $AxisSettings["Margin"], $AxisPos["T"], array("R"=>$AxisR, "G"=>$AxisG, "B"=>$AxisB, "Alpha"=>$AxisAlpha)); }
234 234
            else
235
-            { $FloatingOffset = 0; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1,$AxisPos["T"],$this->pChartObject->GraphAreaX2,$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
235
+            { $FloatingOffset = 0; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1, $AxisPos["T"], $this->pChartObject->GraphAreaX2, $AxisPos["T"], array("R"=>$AxisR, "G"=>$AxisG, "B"=>$AxisB, "Alpha"=>$AxisAlpha)); }
236 236
 
237
-           if ( $DrawArrows ) { $this->pChartObject->drawArrow($this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["T"],$this->pChartObject->GraphAreaX2+($ArrowSize*2),$AxisPos["T"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
237
+           if ($DrawArrows) { $this->pChartObject->drawArrow($this->pChartObject->GraphAreaX2 - $AxisSettings["Margin"], $AxisPos["T"], $this->pChartObject->GraphAreaX2 + ($ArrowSize*2), $AxisPos["T"], array("FillR"=>$AxisR, "FillG"=>$AxisG, "FillB"=>$AxisB, "Size"=>$ArrowSize)); }
238 238
 
239 239
            $Width = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $AxisSettings["Margin"]*2;
240
-           $Step   = $Width / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MinTop = $AxisPos["T"];
240
+           $Step   = $Width/$AxisSettings["Rows"]; $SubTicksSize = $Step/2; $MinTop = $AxisPos["T"];
241 241
            $LastX  = NULL;
242
-           for($i=0;$i<=$AxisSettings["Rows"];$i++)
242
+           for ($i = 0; $i <= $AxisSettings["Rows"]; $i++)
243 243
             {
244 244
              $XPos  = $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"] + $Step*$i;
245 245
              $YPos  = $AxisPos["T"];
246
-             $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
246
+             $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i, $AxisSettings["Display"], $AxisSettings["Format"], $AxisSettings["Unit"]);
247 247
 
248
-             if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
249
-             if ( $LastX != NULL && $CycleBackground  && ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) )) { $this->pChartObject->drawFilledRectangle($LastX,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,$BGColor); }
248
+             if ($i%2 == 1) { $BGColor = array("R"=>$BackgroundR1, "G"=>$BackgroundG1, "B"=>$BackgroundB1, "Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2, "G"=>$BackgroundG2, "B"=>$BackgroundB2, "Alpha"=>$BackgroundAlpha2); }
249
+             if ($LastX != NULL && $CycleBackground && ($DrawXLines == ALL || in_array($AxisID, $DrawXLines))) { $this->pChartObject->drawFilledRectangle($LastX, $this->pChartObject->GraphAreaY1 + $FloatingOffset, $XPos, $this->pChartObject->GraphAreaY2 - $FloatingOffset, $BGColor); }
250 250
 
251
-             if ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) ) { $this->pChartObject->drawLine($XPos,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
251
+             if ($DrawXLines == ALL || in_array($AxisID, $DrawXLines)) { $this->pChartObject->drawLine($XPos, $this->pChartObject->GraphAreaY1 + $FloatingOffset, $XPos, $this->pChartObject->GraphAreaY2 - $FloatingOffset, array("R"=>$GridR, "G"=>$GridG, "B"=>$GridB, "Alpha"=>$GridAlpha, "Ticks"=>$GridTicks)); }
252 252
 
253
-             if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
254
-              $this->pChartObject->drawLine($XPos+$SubTicksSize,$YPos-$OuterSubTickWidth,$XPos+$SubTicksSize,$YPos+$InnerSubTickWidth,array("R"=>$SubTickR,"G"=>$SubTickG,"B"=>$SubTickB,"Alpha"=>$SubTickAlpha));
253
+             if ($DrawSubTicks && $i != $AxisSettings["Rows"])
254
+              $this->pChartObject->drawLine($XPos + $SubTicksSize, $YPos - $OuterSubTickWidth, $XPos + $SubTicksSize, $YPos + $InnerSubTickWidth, array("R"=>$SubTickR, "G"=>$SubTickG, "B"=>$SubTickB, "Alpha"=>$SubTickAlpha));
255 255
 
256
-             $this->pChartObject->drawLine($XPos,$YPos-$OuterTickWidth,$XPos,$YPos+$InnerTickWidth,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha));
257
-             $Bounds = $this->pChartObject->drawText($XPos,$YPos-$OuterTickWidth-$LabelOffset,$Value,array("Angle"=>$XLabelsRotation,"Align"=>$LabelAlign));
258
-             $TxtBox = $YPos-$OuterTickWidth-4-($Bounds[0]["Y"]-$Bounds[2]["Y"]);
259
-             $MinTop = min($MinTop,$TxtBox);
256
+             $this->pChartObject->drawLine($XPos, $YPos - $OuterTickWidth, $XPos, $YPos + $InnerTickWidth, array("R"=>$TickR, "G"=>$TickG, "B"=>$TickB, "Alpha"=>$TickAlpha));
257
+             $Bounds = $this->pChartObject->drawText($XPos, $YPos - $OuterTickWidth - $LabelOffset, $Value, array("Angle"=>$XLabelsRotation, "Align"=>$LabelAlign));
258
+             $TxtBox = $YPos - $OuterTickWidth - 4 - ($Bounds[0]["Y"] - $Bounds[2]["Y"]);
259
+             $MinTop = min($MinTop, $TxtBox);
260 260
 
261 261
              $LastX = $XPos;
262 262
             }
263 263
 
264
-           if ( isset($AxisSettings["Name"]) )
264
+           if (isset($AxisSettings["Name"]))
265 265
             {
266
-             $YPos   = $MinTop-2;
267
-             $XPos   = $this->pChartObject->GraphAreaX1+($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1)/2;
268
-             $Bounds = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
266
+             $YPos   = $MinTop - 2;
267
+             $XPos   = $this->pChartObject->GraphAreaX1 + ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1)/2;
268
+             $Bounds = $this->pChartObject->drawText($XPos, $YPos, $AxisSettings["Name"], array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
269 269
              $MinTop = $Bounds[2]["Y"];
270 270
 
271 271
              $this->pDataObject->Data["GraphArea"]["Y1"] = $MinTop;
@@ -274,48 +274,48 @@  discard block
 block discarded – undo
274 274
            $AxisPos["T"] = $MinTop - $ScaleSpacing;
275 275
           }
276 276
         }
277
-       elseif ( $AxisSettings["Identity"] == AXIS_Y )
277
+       elseif ($AxisSettings["Identity"] == AXIS_Y)
278 278
         {
279
-         if ( $AxisSettings["Position"] == AXIS_POSITION_LEFT )
279
+         if ($AxisSettings["Position"] == AXIS_POSITION_LEFT)
280 280
           {
281 281
 
282
-           if ( $Floating )
283
-            { $FloatingOffset = $XMargin; $this->pChartObject->drawLine($AxisPos["L"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["L"],$this->pChartObject->GraphAreaY2-$AxisSettings["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
282
+           if ($Floating)
283
+            { $FloatingOffset = $XMargin; $this->pChartObject->drawLine($AxisPos["L"], $this->pChartObject->GraphAreaY1 + $AxisSettings["Margin"], $AxisPos["L"], $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"], array("R"=>$AxisR, "G"=>$AxisG, "B"=>$AxisB, "Alpha"=>$AxisAlpha)); }
284 284
            else
285
-            { $FloatingOffset = 0; $this->pChartObject->drawLine($AxisPos["L"],$this->pChartObject->GraphAreaY1,$AxisPos["L"],$this->pChartObject->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
285
+            { $FloatingOffset = 0; $this->pChartObject->drawLine($AxisPos["L"], $this->pChartObject->GraphAreaY1, $AxisPos["L"], $this->pChartObject->GraphAreaY2, array("R"=>$AxisR, "G"=>$AxisG, "B"=>$AxisB, "Alpha"=>$AxisAlpha)); }
286 286
 
287
-           if ( $DrawArrows ) { $this->pChartObject->drawArrow($AxisPos["L"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["L"],$this->pChartObject->GraphAreaY1-($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
287
+           if ($DrawArrows) { $this->pChartObject->drawArrow($AxisPos["L"], $this->pChartObject->GraphAreaY1 + $AxisSettings["Margin"], $AxisPos["L"], $this->pChartObject->GraphAreaY1 - ($ArrowSize*2), array("FillR"=>$AxisR, "FillG"=>$AxisG, "FillB"=>$AxisB, "Size"=>$ArrowSize)); }
288 288
 
289 289
            $Height = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $AxisSettings["Margin"]*2;
290
-           $Step   = $Height / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MinLeft = $AxisPos["L"];
290
+           $Step   = $Height/$AxisSettings["Rows"]; $SubTicksSize = $Step/2; $MinLeft = $AxisPos["L"];
291 291
            $LastY  = NULL;
292
-           for($i=0;$i<=$AxisSettings["Rows"];$i++)
292
+           for ($i = 0; $i <= $AxisSettings["Rows"]; $i++)
293 293
             {
294 294
              $YPos  = $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"] - $Step*$i;
295 295
              $XPos  = $AxisPos["L"];
296
-             $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
296
+             $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i, $AxisSettings["Display"], $AxisSettings["Format"], $AxisSettings["Unit"]);
297 297
 
298
-             if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
299
-             if ( $LastY != NULL && $CycleBackground && ( $DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawFilledRectangle($this->pChartObject->GraphAreaX1+$FloatingOffset,$LastY,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,$BGColor); }
298
+             if ($i%2 == 1) { $BGColor = array("R"=>$BackgroundR1, "G"=>$BackgroundG1, "B"=>$BackgroundB1, "Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2, "G"=>$BackgroundG2, "B"=>$BackgroundB2, "Alpha"=>$BackgroundAlpha2); }
299
+             if ($LastY != NULL && $CycleBackground && ($DrawYLines == ALL || in_array($AxisID, $DrawYLines))) { $this->pChartObject->drawFilledRectangle($this->pChartObject->GraphAreaX1 + $FloatingOffset, $LastY, $this->pChartObject->GraphAreaX2 - $FloatingOffset, $YPos, $BGColor); }
300 300
 
301
-             if ( ($YPos != $this->pChartObject->GraphAreaY1 && $YPos != $this->pChartObject->GraphAreaY2) && ($DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$FloatingOffset,$YPos,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
301
+             if (($YPos != $this->pChartObject->GraphAreaY1 && $YPos != $this->pChartObject->GraphAreaY2) && ($DrawYLines == ALL || in_array($AxisID, $DrawYLines))) { $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1 + $FloatingOffset, $YPos, $this->pChartObject->GraphAreaX2 - $FloatingOffset, $YPos, array("R"=>$GridR, "G"=>$GridG, "B"=>$GridB, "Alpha"=>$GridAlpha, "Ticks"=>$GridTicks)); }
302 302
 
303
-             if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
304
-              $this->pChartObject->drawLine($XPos-$OuterSubTickWidth,$YPos-$SubTicksSize,$XPos+$InnerSubTickWidth,$YPos-$SubTicksSize,array("R"=>$SubTickR,"G"=>$SubTickG,"B"=>$SubTickB,"Alpha"=>$SubTickAlpha));
303
+             if ($DrawSubTicks && $i != $AxisSettings["Rows"])
304
+              $this->pChartObject->drawLine($XPos - $OuterSubTickWidth, $YPos - $SubTicksSize, $XPos + $InnerSubTickWidth, $YPos - $SubTicksSize, array("R"=>$SubTickR, "G"=>$SubTickG, "B"=>$SubTickB, "Alpha"=>$SubTickAlpha));
305 305
 
306
-             $this->pChartObject->drawLine($XPos-$OuterTickWidth,$YPos,$XPos+$InnerTickWidth,$YPos,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha));
307
-             $Bounds  = $this->pChartObject->drawText($XPos-$OuterTickWidth-2,$YPos,$Value,array("Align"=>TEXT_ALIGN_MIDDLERIGHT));
308
-             $TxtLeft = $XPos-$OuterTickWidth-2-($Bounds[1]["X"]-$Bounds[0]["X"]);
309
-             $MinLeft = min($MinLeft,$TxtLeft);
306
+             $this->pChartObject->drawLine($XPos - $OuterTickWidth, $YPos, $XPos + $InnerTickWidth, $YPos, array("R"=>$TickR, "G"=>$TickG, "B"=>$TickB, "Alpha"=>$TickAlpha));
307
+             $Bounds  = $this->pChartObject->drawText($XPos - $OuterTickWidth - 2, $YPos, $Value, array("Align"=>TEXT_ALIGN_MIDDLERIGHT));
308
+             $TxtLeft = $XPos - $OuterTickWidth - 2 - ($Bounds[1]["X"] - $Bounds[0]["X"]);
309
+             $MinLeft = min($MinLeft, $TxtLeft);
310 310
 
311 311
              $LastY = $YPos;
312 312
             }
313 313
 
314
-           if ( isset($AxisSettings["Name"]) )
314
+           if (isset($AxisSettings["Name"]))
315 315
             {
316
-             $XPos    = $MinLeft-2;
317
-             $YPos    = $this->pChartObject->GraphAreaY1+($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1)/2;
318
-             $Bounds  = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>90));
316
+             $XPos    = $MinLeft - 2;
317
+             $YPos    = $this->pChartObject->GraphAreaY1 + ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1)/2;
318
+             $Bounds  = $this->pChartObject->drawText($XPos, $YPos, $AxisSettings["Name"], array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE, "Angle"=>90));
319 319
              $MinLeft = $Bounds[2]["X"];
320 320
 
321 321
              $this->pDataObject->Data["GraphArea"]["X1"] = $MinLeft;
@@ -323,46 +323,46 @@  discard block
 block discarded – undo
323 323
 
324 324
            $AxisPos["L"] = $MinLeft - $ScaleSpacing;
325 325
           }
326
-         elseif ( $AxisSettings["Position"] == AXIS_POSITION_RIGHT )
326
+         elseif ($AxisSettings["Position"] == AXIS_POSITION_RIGHT)
327 327
           {
328 328
 
329
-           if ( $Floating )
330
-            { $FloatingOffset = $XMargin; $this->pChartObject->drawLine($AxisPos["R"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["R"],$this->pChartObject->GraphAreaY2-$AxisSettings["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
329
+           if ($Floating)
330
+            { $FloatingOffset = $XMargin; $this->pChartObject->drawLine($AxisPos["R"], $this->pChartObject->GraphAreaY1 + $AxisSettings["Margin"], $AxisPos["R"], $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"], array("R"=>$AxisR, "G"=>$AxisG, "B"=>$AxisB, "Alpha"=>$AxisAlpha)); }
331 331
            else
332
-            { $FloatingOffset = 0; $this->pChartObject->drawLine($AxisPos["R"],$this->pChartObject->GraphAreaY1,$AxisPos["R"],$this->pChartObject->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
332
+            { $FloatingOffset = 0; $this->pChartObject->drawLine($AxisPos["R"], $this->pChartObject->GraphAreaY1, $AxisPos["R"], $this->pChartObject->GraphAreaY2, array("R"=>$AxisR, "G"=>$AxisG, "B"=>$AxisB, "Alpha"=>$AxisAlpha)); }
333 333
 
334
-           if ( $DrawArrows ) { $this->pChartObject->drawArrow($AxisPos["R"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["R"],$this->pChartObject->GraphAreaY1-($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
334
+           if ($DrawArrows) { $this->pChartObject->drawArrow($AxisPos["R"], $this->pChartObject->GraphAreaY1 + $AxisSettings["Margin"], $AxisPos["R"], $this->pChartObject->GraphAreaY1 - ($ArrowSize*2), array("FillR"=>$AxisR, "FillG"=>$AxisG, "FillB"=>$AxisB, "Size"=>$ArrowSize)); }
335 335
 
336 336
            $Height = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $AxisSettings["Margin"]*2;
337
-           $Step   = $Height / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MaxLeft = $AxisPos["R"];
337
+           $Step   = $Height/$AxisSettings["Rows"]; $SubTicksSize = $Step/2; $MaxLeft = $AxisPos["R"];
338 338
            $LastY  = NULL;
339
-           for($i=0;$i<=$AxisSettings["Rows"];$i++)
339
+           for ($i = 0; $i <= $AxisSettings["Rows"]; $i++)
340 340
             {
341 341
              $YPos  = $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"] - $Step*$i;
342 342
              $XPos  = $AxisPos["R"];
343
-             $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
343
+             $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i, $AxisSettings["Display"], $AxisSettings["Format"], $AxisSettings["Unit"]);
344 344
 
345
-             if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
346
-             if ( $LastY != NULL && $CycleBackground  && ( $DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawFilledRectangle($this->pChartObject->GraphAreaX1+$FloatingOffset,$LastY,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,$BGColor); }
345
+             if ($i%2 == 1) { $BGColor = array("R"=>$BackgroundR1, "G"=>$BackgroundG1, "B"=>$BackgroundB1, "Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2, "G"=>$BackgroundG2, "B"=>$BackgroundB2, "Alpha"=>$BackgroundAlpha2); }
346
+             if ($LastY != NULL && $CycleBackground && ($DrawYLines == ALL || in_array($AxisID, $DrawYLines))) { $this->pChartObject->drawFilledRectangle($this->pChartObject->GraphAreaX1 + $FloatingOffset, $LastY, $this->pChartObject->GraphAreaX2 - $FloatingOffset, $YPos, $BGColor); }
347 347
 
348
-             if ( ($YPos != $this->pChartObject->GraphAreaY1 && $YPos != $this->pChartObject->GraphAreaY2) && ($DrawYLines == ALL || in_array($AxisID,$DrawYLines)) ) { $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$FloatingOffset,$YPos,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
348
+             if (($YPos != $this->pChartObject->GraphAreaY1 && $YPos != $this->pChartObject->GraphAreaY2) && ($DrawYLines == ALL || in_array($AxisID, $DrawYLines))) { $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1 + $FloatingOffset, $YPos, $this->pChartObject->GraphAreaX2 - $FloatingOffset, $YPos, array("R"=>$GridR, "G"=>$GridG, "B"=>$GridB, "Alpha"=>$GridAlpha, "Ticks"=>$GridTicks)); }
349 349
 
350
-             if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
351
-              $this->pChartObject->drawLine($XPos-$InnerSubTickWidth,$YPos-$SubTicksSize,$XPos+$OuterSubTickWidth,$YPos-$SubTicksSize,array("R"=>$SubTickR,"G"=>$SubTickG,"B"=>$SubTickB,"Alpha"=>$SubTickAlpha));
350
+             if ($DrawSubTicks && $i != $AxisSettings["Rows"])
351
+              $this->pChartObject->drawLine($XPos - $InnerSubTickWidth, $YPos - $SubTicksSize, $XPos + $OuterSubTickWidth, $YPos - $SubTicksSize, array("R"=>$SubTickR, "G"=>$SubTickG, "B"=>$SubTickB, "Alpha"=>$SubTickAlpha));
352 352
 
353
-             $this->pChartObject->drawLine($XPos-$InnerTickWidth,$YPos,$XPos+$OuterTickWidth,$YPos,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha));
354
-             $Bounds  = $this->pChartObject->drawText($XPos+$OuterTickWidth+2,$YPos,$Value,array("Align"=>TEXT_ALIGN_MIDDLELEFT));
355
-             $TxtLeft = $XPos+$OuterTickWidth+2+($Bounds[1]["X"]-$Bounds[0]["X"]);
356
-             $MaxLeft = max($MaxLeft,$TxtLeft);
353
+             $this->pChartObject->drawLine($XPos - $InnerTickWidth, $YPos, $XPos + $OuterTickWidth, $YPos, array("R"=>$TickR, "G"=>$TickG, "B"=>$TickB, "Alpha"=>$TickAlpha));
354
+             $Bounds  = $this->pChartObject->drawText($XPos + $OuterTickWidth + 2, $YPos, $Value, array("Align"=>TEXT_ALIGN_MIDDLELEFT));
355
+             $TxtLeft = $XPos + $OuterTickWidth + 2 + ($Bounds[1]["X"] - $Bounds[0]["X"]);
356
+             $MaxLeft = max($MaxLeft, $TxtLeft);
357 357
 
358 358
              $LastY = $YPos;
359 359
             }
360 360
 
361
-           if ( isset($AxisSettings["Name"]) )
361
+           if (isset($AxisSettings["Name"]))
362 362
             {
363
-             $XPos    = $MaxLeft+6;
364
-             $YPos    = $this->pChartObject->GraphAreaY1+($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1)/2;
365
-             $Bounds  = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>270));
363
+             $XPos    = $MaxLeft + 6;
364
+             $YPos    = $this->pChartObject->GraphAreaY1 + ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1)/2;
365
+             $Bounds  = $this->pChartObject->drawText($XPos, $YPos, $AxisSettings["Name"], array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE, "Angle"=>270));
366 366
              $MaxLeft = $Bounds[2]["X"];
367 367
 
368 368
              $this->pDataObject->Data["GraphArea"]["X2"] = $MaxLeft + $this->pChartObject->FontSize;
@@ -377,64 +377,64 @@  discard block
 block discarded – undo
377 377
     }
378 378
 
379 379
    /* Draw a scatter plot chart */
380
-   function drawScatterPlotChart($Format=NULL)
380
+   function drawScatterPlotChart($Format = NULL)
381 381
     {
382
-     $PlotSize		= isset($Format["PlotSize"]) ? $Format["PlotSize"] : 3;
383
-     $PlotBorder	= isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : FALSE;
382
+     $PlotSize = isset($Format["PlotSize"]) ? $Format["PlotSize"] : 3;
383
+     $PlotBorder = isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : FALSE;
384 384
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 250;
385 385
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 250;
386 386
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 250;
387 387
      $BorderAlpha	= isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30;
388
-     $BorderSize	= isset($Format["BorderSize"]) ? $Format["BorderSize"] : 1;
388
+     $BorderSize = isset($Format["BorderSize"]) ? $Format["BorderSize"] : 1;
389 389
      $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
390
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
391
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
390
+     $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
391
+     $ImageMapTitle = isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
392 392
      $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
393 393
 
394 394
      $Data    = $this->pDataObject->getData();
395 395
      $Palette = $this->pDataObject->getPalette();
396 396
 
397
-     $BorderColor = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
397
+     $BorderColor = array("R"=>$BorderR, "G"=>$BorderG, "B"=>$BorderB, "Alpha"=>$BorderAlpha);
398 398
 
399
-     foreach($Data["ScatterSeries"] as $Key => $Series)
399
+     foreach ($Data["ScatterSeries"] as $Key => $Series)
400 400
       {
401
-       if ( $Series["isDrawable"] == TRUE )
401
+       if ($Series["isDrawable"] == TRUE)
402 402
         {
403 403
          $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
404 404
          $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
405 405
 
406
-         if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
406
+         if ($ImageMapTitle == NULL) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
407 407
          
408
-         if ( isset($Series["Picture"]) && $Series["Picture"] != "" )
409
-          { $Picture = $Series["Picture"]; list($PicWidth,$PicHeight,$PicType) = $this->pChartObject->getPicInfo($Picture); }
408
+         if (isset($Series["Picture"]) && $Series["Picture"] != "")
409
+          { $Picture = $Series["Picture"]; list($PicWidth, $PicHeight, $PicType) = $this->pChartObject->getPicInfo($Picture); }
410 410
          else
411 411
           { $Picture = NULL; }
412 412
 
413
-         $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
414
-         if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
415
-         $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
416
-         if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
413
+         $PosArrayX = $this->getPosArray($SerieValuesX, $SerieXAxis);
414
+         if (!is_array($PosArrayX)) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
415
+         $PosArrayY = $this->getPosArray($SerieValuesY, $SerieYAxis);
416
+         if (!is_array($PosArrayY)) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
417 417
 
418
-         $Color = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
418
+         $Color = array("R"=>$Series["Color"]["R"], "G"=>$Series["Color"]["G"], "B"=>$Series["Color"]["B"], "Alpha"=>$Series["Color"]["Alpha"]);
419 419
 
420
-         foreach($PosArrayX as $Key => $Value)
420
+         foreach ($PosArrayX as $Key => $Value)
421 421
           {
422 422
            $X = $Value; $Y = $PosArrayY[$Key];
423 423
 
424
-           if ( $X != VOID && $Y != VOID )
424
+           if ($X != VOID && $Y != VOID)
425 425
             {
426
-             $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key],2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key],2);
427
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".floor($PlotSize+$BorderSize),$this->pChartObject->toHTMLColor($Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"]),$Description,$RealValue); }
426
+             $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key], 2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key], 2);
427
+             if ($RecordImageMap) { $this->pChartObject->addToImageMap("CIRCLE", floor($X).",".floor($Y).",".floor($PlotSize + $BorderSize), $this->pChartObject->toHTMLColor($Series["Color"]["R"], $Series["Color"]["G"], $Series["Color"]["B"]), $Description, $RealValue); }
428 428
 
429
-             if( isset($Series["Shape"]) )
430
-              { $this->pChartObject->drawShape($X,$Y,$Series["Shape"],$PlotSize,$PlotBorder,$BorderSize,$Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"],$Series["Color"]["Alpha"],$BorderR,$BorderG,$BorderB,$BorderAlpha); }
431
-             elseif ( $Picture == NULL )
429
+             if (isset($Series["Shape"]))
430
+              { $this->pChartObject->drawShape($X, $Y, $Series["Shape"], $PlotSize, $PlotBorder, $BorderSize, $Series["Color"]["R"], $Series["Color"]["G"], $Series["Color"]["B"], $Series["Color"]["Alpha"], $BorderR, $BorderG, $BorderB, $BorderAlpha); }
431
+             elseif ($Picture == NULL)
432 432
               {
433
-               if ( $PlotBorder ) { $this->pChartObject->drawFilledCircle($X,$Y,$PlotSize+$BorderSize,$BorderColor); }
434
-               $this->pChartObject->drawFilledCircle($X,$Y,$PlotSize,$Color);
433
+               if ($PlotBorder) { $this->pChartObject->drawFilledCircle($X, $Y, $PlotSize + $BorderSize, $BorderColor); }
434
+               $this->pChartObject->drawFilledCircle($X, $Y, $PlotSize, $Color);
435 435
               }
436 436
              else
437
-              { $this->pChartObject->drawFromPicture($PicType,$Picture,$X-$PicWidth/2,$Y-$PicHeight/2); }
437
+              { $this->pChartObject->drawFromPicture($PicType, $Picture, $X - $PicWidth/2, $Y - $PicHeight/2); }
438 438
             }
439 439
           }
440 440
         }
@@ -442,49 +442,49 @@  discard block
 block discarded – undo
442 442
     }
443 443
 
444 444
    /* Draw a scatter line chart */
445
-   function drawScatterLineChart($Format=NULL)
445
+   function drawScatterLineChart($Format = NULL)
446 446
     {
447
-     $Data		= $this->pDataObject->getData();
448
-     $Palette		= $this->pDataObject->getPalette();
449
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
450
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
451
-     $ImageMapPlotSize	= isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 10;
447
+     $Data = $this->pDataObject->getData();
448
+     $Palette = $this->pDataObject->getPalette();
449
+     $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
450
+     $ImageMapTitle = isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
451
+     $ImageMapPlotSize = isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 10;
452 452
      $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
453 453
 
454 454
      /* Parse all the series to draw */
455
-     foreach($Data["ScatterSeries"] as $Key => $Series)
455
+     foreach ($Data["ScatterSeries"] as $Key => $Series)
456 456
       {
457
-       if ( $Series["isDrawable"] == TRUE )
457
+       if ($Series["isDrawable"] == TRUE)
458 458
         {
459 459
          $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
460 460
          $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
461 461
          $Ticks  = $Series["Ticks"];
462 462
          $Weight = $Series["Weight"];
463 463
 
464
-         if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
464
+         if ($ImageMapTitle == NULL) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
465 465
 
466
-         $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
467
-         if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
468
-         $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
469
-         if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
466
+         $PosArrayX = $this->getPosArray($SerieValuesX, $SerieXAxis);
467
+         if (!is_array($PosArrayX)) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
468
+         $PosArrayY = $this->getPosArray($SerieValuesY, $SerieYAxis);
469
+         if (!is_array($PosArrayY)) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
470 470
 
471
-         $Color = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
472
-         if ( $Ticks != 0 )  { $Color["Ticks"]  = $Ticks; }
473
-         if ( $Weight != 0 ) { $Color["Weight"] = $Weight; }
471
+         $Color = array("R"=>$Series["Color"]["R"], "G"=>$Series["Color"]["G"], "B"=>$Series["Color"]["B"], "Alpha"=>$Series["Color"]["Alpha"]);
472
+         if ($Ticks != 0) { $Color["Ticks"]  = $Ticks; }
473
+         if ($Weight != 0) { $Color["Weight"] = $Weight; }
474 474
 
475 475
          $LastX = VOID; $LastY = VOID;
476
-         foreach($PosArrayX as $Key => $Value)
476
+         foreach ($PosArrayX as $Key => $Value)
477 477
           {
478 478
            $X = $Value; $Y = $PosArrayY[$Key];
479 479
 
480
-           if ( $X != VOID && $Y != VOID )
480
+           if ($X != VOID && $Y != VOID)
481 481
             {
482
-             $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key],2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key],2);
483
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$ImageMapPlotSize,$this->pChartObject->toHTMLColor($Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"]),$Description,$RealValue); }
482
+             $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key], 2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key], 2);
483
+             if ($RecordImageMap) { $this->pChartObject->addToImageMap("CIRCLE", floor($X).",".floor($Y).",".$ImageMapPlotSize, $this->pChartObject->toHTMLColor($Series["Color"]["R"], $Series["Color"]["G"], $Series["Color"]["B"]), $Description, $RealValue); }
484 484
             }
485 485
 
486
-           if ( $X != VOID && $Y != VOID && $LastX != VOID && $LastY != VOID)
487
-            $this->pChartObject->drawLine($LastX,$LastY,$X,$Y,$Color);
486
+           if ($X != VOID && $Y != VOID && $LastX != VOID && $LastY != VOID)
487
+            $this->pChartObject->drawLine($LastX, $LastY, $X, $Y, $Color);
488 488
 
489 489
            $LastX = $X; $LastY = $Y;
490 490
           }
@@ -493,249 +493,249 @@  discard block
 block discarded – undo
493 493
     }
494 494
 
495 495
    /* Draw a scatter spline chart */
496
-   function drawScatterSplineChart($Format=NULL)
496
+   function drawScatterSplineChart($Format = NULL)
497 497
     {
498
-     $Data		= $this->pDataObject->getData();
499
-     $Palette		= $this->pDataObject->getPalette();
500
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
501
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
502
-     $ImageMapPlotSize	= isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 10;
498
+     $Data = $this->pDataObject->getData();
499
+     $Palette = $this->pDataObject->getPalette();
500
+     $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
501
+     $ImageMapTitle = isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
502
+     $ImageMapPlotSize = isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 10;
503 503
      $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
504 504
 
505
-     foreach($Data["ScatterSeries"] as $Key => $Series)
505
+     foreach ($Data["ScatterSeries"] as $Key => $Series)
506 506
       {
507
-       if ( $Series["isDrawable"] == TRUE )
507
+       if ($Series["isDrawable"] == TRUE)
508 508
         {
509 509
          $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
510 510
          $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
511 511
          $Ticks  = $Series["Ticks"];
512 512
          $Weight = $Series["Weight"];
513 513
 
514
-         if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
514
+         if ($ImageMapTitle == NULL) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
515 515
 
516
-         $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
517
-         if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
518
-         $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
519
-         if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
516
+         $PosArrayX = $this->getPosArray($SerieValuesX, $SerieXAxis);
517
+         if (!is_array($PosArrayX)) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
518
+         $PosArrayY = $this->getPosArray($SerieValuesY, $SerieYAxis);
519
+         if (!is_array($PosArrayY)) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
520 520
 
521
-         $SplineSettings = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
522
-         if ( $Ticks != 0 )  { $SplineSettings["Ticks"]  = $Ticks; }
523
-         if ( $Weight != 0 ) { $SplineSettings["Weight"] = $Weight; }
521
+         $SplineSettings = array("R"=>$Series["Color"]["R"], "G"=>$Series["Color"]["G"], "B"=>$Series["Color"]["B"], "Alpha"=>$Series["Color"]["Alpha"]);
522
+         if ($Ticks != 0) { $SplineSettings["Ticks"]  = $Ticks; }
523
+         if ($Weight != 0) { $SplineSettings["Weight"] = $Weight; }
524 524
 
525 525
          $LastX = VOID; $LastY = VOID; $WayPoints = ""; $Forces = "";
526
-         foreach($PosArrayX as $Key => $Value)
526
+         foreach ($PosArrayX as $Key => $Value)
527 527
           {
528 528
            $X = $Value; $Y = $PosArrayY[$Key];
529
-           $Force = $this->pChartObject->getLength($LastX,$LastY,$X,$Y)/5;
529
+           $Force = $this->pChartObject->getLength($LastX, $LastY, $X, $Y)/5;
530 530
 
531
-           if ( $X != VOID && $Y != VOID )
531
+           if ($X != VOID && $Y != VOID)
532 532
             {
533
-             $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key],2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key],2);
534
-             if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$ImageMapPlotSize,$this->pChartObject->toHTMLColor($Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"]),$Description,$RealValue); }
533
+             $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key], 2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key], 2);
534
+             if ($RecordImageMap) { $this->pChartObject->addToImageMap("CIRCLE", floor($X).",".floor($Y).",".$ImageMapPlotSize, $this->pChartObject->toHTMLColor($Series["Color"]["R"], $Series["Color"]["G"], $Series["Color"]["B"]), $Description, $RealValue); }
535 535
             }
536 536
 
537
-           if ( $X != VOID && $Y != VOID )
538
-            { $WayPoints[] = array($X,$Y); $Forces[] = $Force; }
537
+           if ($X != VOID && $Y != VOID)
538
+            { $WayPoints[] = array($X, $Y); $Forces[] = $Force; }
539 539
 
540
-           if ( $Y == VOID || $X == VOID )
541
-            { $SplineSettings["Forces"] = $Forces; $this->pChartObject->drawSpline($WayPoints,$SplineSettings); $WayPoints = ""; $Forces = "";}
540
+           if ($Y == VOID || $X == VOID)
541
+            { $SplineSettings["Forces"] = $Forces; $this->pChartObject->drawSpline($WayPoints, $SplineSettings); $WayPoints = ""; $Forces = ""; }
542 542
 
543 543
            $LastX = $X; $LastY = $Y;
544 544
           }
545 545
          $SplineSettings["Forces"] = $Forces; 
546
-         $this->pChartObject->drawSpline($WayPoints,$SplineSettings);
546
+         $this->pChartObject->drawSpline($WayPoints, $SplineSettings);
547 547
         }
548 548
       }
549 549
     }
550 550
 
551 551
    /* Return the scaled plot position */
552
-   function getPosArray($Values,$AxisID)
552
+   function getPosArray($Values, $AxisID)
553 553
     {
554 554
      $Data = $this->pDataObject->getData();
555 555
 
556
-     if ( !is_array($Values) ) { $Values = array($Values); }
556
+     if (!is_array($Values)) { $Values = array($Values); }
557 557
 
558
-     if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X )
558
+     if ($Data["Axis"][$AxisID]["Identity"] == AXIS_X)
559 559
       {
560 560
        $Height      = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $Data["Axis"][$AxisID]["Margin"]*2;
561 561
        $ScaleHeight = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"];
562
-       $Step        = $Height / $ScaleHeight;
562
+       $Step        = $Height/$ScaleHeight;
563 563
 
564 564
        $Result = "";
565
-       foreach($Values as $Key => $Value)
565
+       foreach ($Values as $Key => $Value)
566 566
         {
567
-         if ( $Value == VOID ) 
567
+         if ($Value == VOID) 
568 568
           $Result[] = VOID;
569 569
          else
570
-          $Result[] = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"] + ($Step * ($Value-$Data["Axis"][$AxisID]["ScaleMin"]));
570
+          $Result[] = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"] + ($Step*($Value - $Data["Axis"][$AxisID]["ScaleMin"]));
571 571
         }
572 572
 
573
-       if ( count($Result) == 1 ) { return($Result[0]); } else { return($Result); }
573
+       if (count($Result) == 1) { return($Result[0]); } else { return($Result); }
574 574
       }
575 575
      else
576 576
       {
577 577
        $Height      = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $Data["Axis"][$AxisID]["Margin"]*2;
578 578
        $ScaleHeight = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"];
579
-       $Step        = $Height / $ScaleHeight;
579
+       $Step        = $Height/$ScaleHeight;
580 580
 
581 581
        $Result = "";
582
-       foreach($Values as $Key => $Value)
582
+       foreach ($Values as $Key => $Value)
583 583
         {
584
-         if ( $Value == VOID ) 
584
+         if ($Value == VOID) 
585 585
           $Result[] = VOID;
586 586
          else
587
-          $Result[] = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"] - ($Step * ($Value-$Data["Axis"][$AxisID]["ScaleMin"]));
587
+          $Result[] = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"] - ($Step*($Value - $Data["Axis"][$AxisID]["ScaleMin"]));
588 588
         }
589 589
 
590
-       if ( count($Result) == 1 ) { return($Result[0]); } else { return($Result); }
590
+       if (count($Result) == 1) { return($Result[0]); } else { return($Result); }
591 591
       }
592 592
     }
593 593
 
594 594
    /* Draw the legend of the active series */
595
-   function drawScatterLegend($X,$Y,$Format="")
595
+   function drawScatterLegend($X, $Y, $Format = "")
596 596
     {
597
-     $Family		= isset($Format["Family"]) ? $Format["Family"] : LEGEND_FAMILY_BOX;
597
+     $Family = isset($Format["Family"]) ? $Format["Family"] : LEGEND_FAMILY_BOX;
598 598
      $FontName		= isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
599 599
      $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
600 600
      $FontR		= isset($Format["FontR"]) ? $Format["FontR"] : $this->pChartObject->FontColorR;
601 601
      $FontG		= isset($Format["FontG"]) ? $Format["FontG"] : $this->pChartObject->FontColorG;
602 602
      $FontB		= isset($Format["FontB"]) ? $Format["FontB"] : $this->pChartObject->FontColorB;
603
-     $BoxWidth		= isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 5;
604
-     $BoxHeight		= isset($Format["BoxHeight"]) ? $Format["BoxHeight"] : 5;
605
-     $IconAreaWidth	= isset($Format["IconAreaWidth"]) ? $Format["IconAreaWidth"] : $BoxWidth;
606
-     $IconAreaHeight	= isset($Format["IconAreaHeight"]) ? $Format["IconAreaHeight"] : $BoxHeight;
607
-     $XSpacing		= isset($Format["XSpacing"]) ? $Format["XSpacing"] : 5;
608
-     $Margin		= isset($Format["Margin"]) ? $Format["Margin"] : 5;
603
+     $BoxWidth = isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 5;
604
+     $BoxHeight = isset($Format["BoxHeight"]) ? $Format["BoxHeight"] : 5;
605
+     $IconAreaWidth = isset($Format["IconAreaWidth"]) ? $Format["IconAreaWidth"] : $BoxWidth;
606
+     $IconAreaHeight = isset($Format["IconAreaHeight"]) ? $Format["IconAreaHeight"] : $BoxHeight;
607
+     $XSpacing = isset($Format["XSpacing"]) ? $Format["XSpacing"] : 5;
608
+     $Margin = isset($Format["Margin"]) ? $Format["Margin"] : 5;
609 609
      $R			= isset($Format["R"]) ? $Format["R"] : 200;
610 610
      $G			= isset($Format["G"]) ? $Format["G"] : 200;
611 611
      $B			= isset($Format["B"]) ? $Format["B"] : 200;
612
-     $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
612
+     $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
613 613
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
614 614
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
615 615
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
616
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
617
-     $Style		= isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND;
618
-     $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
616
+     $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
617
+     $Style = isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND;
618
+     $Mode = isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
619 619
 
620
-     if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
620
+     if ($Surrounding != NULL) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
621 621
 
622 622
      $Data = $this->pDataObject->getData();
623 623
 
624
-     foreach($Data["ScatterSeries"] as $Key => $Series)
624
+     foreach ($Data["ScatterSeries"] as $Key => $Series)
625 625
       {
626
-       if ( $Series["isDrawable"] == TRUE && isset($Series["Picture"]))
626
+       if ($Series["isDrawable"] == TRUE && isset($Series["Picture"]))
627 627
         {
628
-         list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Series["Picture"]);
629
-         if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; }
630
-         if ( $IconAreaHeight < $PicHeight ) { $IconAreaHeight = $PicHeight; }
628
+         list($PicWidth, $PicHeight) = $this->pChartObject->getPicInfo($Series["Picture"]);
629
+         if ($IconAreaWidth < $PicWidth) { $IconAreaWidth = $PicWidth; }
630
+         if ($IconAreaHeight < $PicHeight) { $IconAreaHeight = $PicHeight; }
631 631
         }
632 632
       }
633 633
 
634
-     $YStep = max($this->pChartObject->FontSize,$IconAreaHeight) + 5;
634
+     $YStep = max($this->pChartObject->FontSize, $IconAreaHeight) + 5;
635 635
      $XStep = $IconAreaWidth + 5;
636 636
      $XStep = $XSpacing;
637 637
 
638 638
      $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
639
-     foreach($Data["ScatterSeries"] as $Key => $Series)
639
+     foreach ($Data["ScatterSeries"] as $Key => $Series)
640 640
       {
641
-       if ( $Series["isDrawable"] == TRUE )
641
+       if ($Series["isDrawable"] == TRUE)
642 642
         {
643
-         if ( $Mode == LEGEND_VERTICAL )
643
+         if ($Mode == LEGEND_VERTICAL)
644 644
           {
645
-           $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+4,$vY+$IconAreaHeight/2,$FontName,$FontSize,0,$Series["Description"]);
645
+           $BoxArray = $this->pChartObject->getTextBox($vX + $IconAreaWidth + 4, $vY + $IconAreaHeight/2, $FontName, $FontSize, 0, $Series["Description"]);
646 646
 
647
-           if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
648
-           if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
649
-           if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$IconAreaHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$IconAreaHeight/2; }
647
+           if ($Boundaries["T"] > $BoxArray[2]["Y"] + $IconAreaHeight/2) { $Boundaries["T"] = $BoxArray[2]["Y"] + $IconAreaHeight/2; }
648
+           if ($Boundaries["R"] < $BoxArray[1]["X"] + 2) { $Boundaries["R"] = $BoxArray[1]["X"] + 2; }
649
+           if ($Boundaries["B"] < $BoxArray[1]["Y"] + 2 + $IconAreaHeight/2) { $Boundaries["B"] = $BoxArray[1]["Y"] + 2 + $IconAreaHeight/2; }
650 650
 
651
-           $Lines = preg_split("/\n/",$Series["Description"]);
652
-           $vY = $vY + max($this->pChartObject->FontSize*count($Lines),$IconAreaHeight) + 5;
651
+           $Lines = preg_split("/\n/", $Series["Description"]);
652
+           $vY = $vY + max($this->pChartObject->FontSize*count($Lines), $IconAreaHeight) + 5;
653 653
           }
654
-         elseif ( $Mode == LEGEND_HORIZONTAL )
654
+         elseif ($Mode == LEGEND_HORIZONTAL)
655 655
           {
656
-           $Lines = preg_split("/\n/",$Series["Description"]);
656
+           $Lines = preg_split("/\n/", $Series["Description"]);
657 657
            $Width = "";
658
-           foreach($Lines as $Key => $Value)
658
+           foreach ($Lines as $Key => $Value)
659 659
             {
660
-             $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+6,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$FontName,$FontSize,0,$Value);
660
+             $BoxArray = $this->pChartObject->getTextBox($vX + $IconAreaWidth + 6, $Y + $IconAreaHeight/2 + (($this->pChartObject->FontSize + 3)*$Key), $FontName, $FontSize, 0, $Value);
661 661
 
662
-             if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
663
-             if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
664
-             if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$IconAreaHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$IconAreaHeight/2; }
662
+             if ($Boundaries["T"] > $BoxArray[2]["Y"] + $IconAreaHeight/2) { $Boundaries["T"] = $BoxArray[2]["Y"] + $IconAreaHeight/2; }
663
+             if ($Boundaries["R"] < $BoxArray[1]["X"] + 2) { $Boundaries["R"] = $BoxArray[1]["X"] + 2; }
664
+             if ($Boundaries["B"] < $BoxArray[1]["Y"] + 2 + $IconAreaHeight/2) { $Boundaries["B"] = $BoxArray[1]["Y"] + 2 + $IconAreaHeight/2; }
665 665
 
666 666
              $Width[] = $BoxArray[1]["X"];
667 667
             }
668 668
 
669
-           $vX=max($Width)+$XStep;
669
+           $vX = max($Width) + $XStep;
670 670
           }
671 671
         }
672 672
       }
673
-     $vY=$vY-$YStep; $vX=$vX-$XStep;
673
+     $vY = $vY - $YStep; $vX = $vX - $XStep;
674 674
 
675
-     $TopOffset  = $Y - $Boundaries["T"];
676
-     if ( $Boundaries["B"]-($vY+$IconAreaHeight) < $TopOffset ) { $Boundaries["B"] = $vY+$IconAreaHeight+$TopOffset; }
675
+     $TopOffset = $Y - $Boundaries["T"];
676
+     if ($Boundaries["B"] - ($vY + $IconAreaHeight) < $TopOffset) { $Boundaries["B"] = $vY + $IconAreaHeight + $TopOffset; }
677 677
 
678
-     if ( $Style == LEGEND_ROUND )
679
-      $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));
680
-     elseif ( $Style == LEGEND_BOX )
681
-      $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));
678
+     if ($Style == LEGEND_ROUND)
679
+      $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));
680
+     elseif ($Style == LEGEND_BOX)
681
+      $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));
682 682
 
683 683
      $RestoreShadow = $this->pChartObject->Shadow; $this->Shadow = FALSE;
684
-     foreach($Data["ScatterSeries"] as $Key => $Series)
684
+     foreach ($Data["ScatterSeries"] as $Key => $Series)
685 685
       {
686
-       if ( $Series["isDrawable"] == TRUE )
686
+       if ($Series["isDrawable"] == TRUE)
687 687
         {
688 688
          $R = $Series["Color"]["R"]; $G = $Series["Color"]["G"]; $B = $Series["Color"]["B"];
689 689
          $Ticks = $Series["Ticks"]; $Weight = $Series["Weight"];
690 690
 
691
-         if ( isset($Series["Picture"]) )
691
+         if (isset($Series["Picture"]))
692 692
           {
693 693
            $Picture = $Series["Picture"];
694
-           list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Picture);
695
-           $PicX = $X+$IconAreaWidth/2; $PicY = $Y+$IconAreaHeight/2; 
694
+           list($PicWidth, $PicHeight) = $this->pChartObject->getPicInfo($Picture);
695
+           $PicX = $X + $IconAreaWidth/2; $PicY = $Y + $IconAreaHeight/2; 
696 696
 
697
-           $this->pChartObject->drawFromPNG($PicX-$PicWidth/2,$PicY-$PicHeight/2,$Picture);
697
+           $this->pChartObject->drawFromPNG($PicX - $PicWidth/2, $PicY - $PicHeight/2, $Picture);
698 698
           }
699 699
          else
700 700
           {
701
-           if ( $Family == LEGEND_FAMILY_BOX )
701
+           if ($Family == LEGEND_FAMILY_BOX)
702 702
             {
703
-             if ( $BoxWidth != $IconAreaWidth ) { $XOffset = floor(($IconAreaWidth-$BoxWidth)/2); } else { $XOffset = 0; }
704
-             if ( $BoxHeight != $IconAreaHeight ) { $YOffset = floor(($IconAreaHeight-$BoxHeight)/2); } else { $YOffset = 0; }
703
+             if ($BoxWidth != $IconAreaWidth) { $XOffset = floor(($IconAreaWidth - $BoxWidth)/2); } else { $XOffset = 0; }
704
+             if ($BoxHeight != $IconAreaHeight) { $YOffset = floor(($IconAreaHeight - $BoxHeight)/2); } else { $YOffset = 0; }
705 705
 
706
-             $this->pChartObject->drawFilledRectangle($X+1+$XOffset,$Y+1+$YOffset,$X+$BoxWidth+$XOffset+1,$Y+$BoxHeight+1+$YOffset,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
707
-             $this->pChartObject->drawFilledRectangle($X+$XOffset,$Y+$YOffset,$X+$BoxWidth+$XOffset,$Y+$BoxHeight+$YOffset,array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
706
+             $this->pChartObject->drawFilledRectangle($X + 1 + $XOffset, $Y + 1 + $YOffset, $X + $BoxWidth + $XOffset + 1, $Y + $BoxHeight + 1 + $YOffset, array("R"=>0, "G"=>0, "B"=>0, "Alpha"=>20));
707
+             $this->pChartObject->drawFilledRectangle($X + $XOffset, $Y + $YOffset, $X + $BoxWidth + $XOffset, $Y + $BoxHeight + $YOffset, array("R"=>$R, "G"=>$G, "B"=>$B, "Surrounding"=>20));
708 708
             }
709
-           elseif ( $Family == LEGEND_FAMILY_CIRCLE )
709
+           elseif ($Family == LEGEND_FAMILY_CIRCLE)
710 710
             {
711
-             $this->pChartObject->drawFilledCircle($X+1+$IconAreaWidth/2,$Y+1+$IconAreaHeight/2,min($IconAreaHeight/2,$IconAreaWidth/2),array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
712
-             $this->pChartObject->drawFilledCircle($X+$IconAreaWidth/2,$Y+$IconAreaHeight/2,min($IconAreaHeight/2,$IconAreaWidth/2),array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
711
+             $this->pChartObject->drawFilledCircle($X + 1 + $IconAreaWidth/2, $Y + 1 + $IconAreaHeight/2, min($IconAreaHeight/2, $IconAreaWidth/2), array("R"=>0, "G"=>0, "B"=>0, "Alpha"=>20));
712
+             $this->pChartObject->drawFilledCircle($X + $IconAreaWidth/2, $Y + $IconAreaHeight/2, min($IconAreaHeight/2, $IconAreaWidth/2), array("R"=>$R, "G"=>$G, "B"=>$B, "Surrounding"=>20));
713 713
             }
714
-           elseif ( $Family == LEGEND_FAMILY_LINE )
714
+           elseif ($Family == LEGEND_FAMILY_LINE)
715 715
             {
716
-             $this->pChartObject->drawLine($X+1,$Y+1+$IconAreaHeight/2,$X+1+$IconAreaWidth,$Y+1+$IconAreaHeight/2,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20,"Ticks"=>$Ticks,"Weight"=>$Weight));
717
-             $this->pChartObject->drawLine($X,$Y+$IconAreaHeight/2,$X+$IconAreaWidth,$Y+$IconAreaHeight/2,array("R"=>$R,"G"=>$G,"B"=>$B,"Ticks"=>$Ticks,"Weight"=>$Weight));
716
+             $this->pChartObject->drawLine($X + 1, $Y + 1 + $IconAreaHeight/2, $X + 1 + $IconAreaWidth, $Y + 1 + $IconAreaHeight/2, array("R"=>0, "G"=>0, "B"=>0, "Alpha"=>20, "Ticks"=>$Ticks, "Weight"=>$Weight));
717
+             $this->pChartObject->drawLine($X, $Y + $IconAreaHeight/2, $X + $IconAreaWidth, $Y + $IconAreaHeight/2, array("R"=>$R, "G"=>$G, "B"=>$B, "Ticks"=>$Ticks, "Weight"=>$Weight));
718 718
             }
719 719
           }
720 720
 
721
-         if ( $Mode == LEGEND_VERTICAL )
721
+         if ($Mode == LEGEND_VERTICAL)
722 722
           {
723
-           $Lines = preg_split("/\n/",$Series["Description"]);
724
-           foreach($Lines as $Key => $Value)
725
-            $this->pChartObject->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT));
723
+           $Lines = preg_split("/\n/", $Series["Description"]);
724
+           foreach ($Lines as $Key => $Value)
725
+            $this->pChartObject->drawText($X + $IconAreaWidth + 4, $Y + $IconAreaHeight/2 + (($this->pChartObject->FontSize + 3)*$Key), $Value, array("R"=>$FontR, "G"=>$FontG, "B"=>$FontB, "Align"=>TEXT_ALIGN_MIDDLELEFT));
726 726
 
727
-           $Y=$Y+max($this->pChartObject->FontSize*count($Lines),$IconAreaHeight) + 5;
727
+           $Y = $Y + max($this->pChartObject->FontSize*count($Lines), $IconAreaHeight) + 5;
728 728
           }
729
-         elseif ( $Mode == LEGEND_HORIZONTAL )
729
+         elseif ($Mode == LEGEND_HORIZONTAL)
730 730
           {
731
-           $Lines = preg_split("/\n/",$Series["Description"]);
731
+           $Lines = preg_split("/\n/", $Series["Description"]);
732 732
            $Width = "";
733
-           foreach($Lines as $Key => $Value)
733
+           foreach ($Lines as $Key => $Value)
734 734
             {
735
-             $BoxArray = $this->pChartObject->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT));
735
+             $BoxArray = $this->pChartObject->drawText($X + $IconAreaWidth + 4, $Y + $IconAreaHeight/2 + (($this->pChartObject->FontSize + 3)*$Key), $Value, array("R"=>$FontR, "G"=>$FontG, "B"=>$FontB, "Align"=>TEXT_ALIGN_MIDDLELEFT));
736 736
              $Width[] = $BoxArray[1]["X"];
737 737
             }
738
-           $X=max($Width)+2+$XStep;
738
+           $X = max($Width) + 2 + $XStep;
739 739
           }
740 740
         }
741 741
       }
@@ -744,104 +744,104 @@  discard block
 block discarded – undo
744 744
     }
745 745
 
746 746
    /* Get the legend box size */
747
-   function getScatterLegendSize($Format="")
747
+   function getScatterLegendSize($Format = "")
748 748
     {
749 749
      $FontName	= isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
750 750
      $FontSize	= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
751
-     $BoxSize	= isset($Format["BoxSize"]) ? $Format["BoxSize"] : 5;
752
-     $Margin	= isset($Format["Margin"]) ? $Format["Margin"] : 5;
751
+     $BoxSize = isset($Format["BoxSize"]) ? $Format["BoxSize"] : 5;
752
+     $Margin = isset($Format["Margin"]) ? $Format["Margin"] : 5;
753 753
      $Style	= isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND;
754
-     $Mode	= isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
754
+     $Mode = isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
755 755
 
756
-     $YStep = max($this->pChartObject->FontSize,$BoxSize) + 5;
756
+     $YStep = max($this->pChartObject->FontSize, $BoxSize) + 5;
757 757
      $XStep = $BoxSize + 5;
758 758
 
759
-     $X=100; $Y=100;
759
+     $X = 100; $Y = 100;
760 760
 
761 761
      $Data = $this->pDataObject->getData();
762 762
 
763
-     foreach($Data["ScatterSeries"] as $Key => $Series)
763
+     foreach ($Data["ScatterSeries"] as $Key => $Series)
764 764
       {
765
-       if ( $Series["isDrawable"] == TRUE && isset($Series["Picture"]))
765
+       if ($Series["isDrawable"] == TRUE && isset($Series["Picture"]))
766 766
         {
767
-         list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Series["Picture"]);
768
-         if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; }
769
-         if ( $IconAreaHeight < $PicHeight ) { $IconAreaHeight = $PicHeight; }
767
+         list($PicWidth, $PicHeight) = $this->pChartObject->getPicInfo($Series["Picture"]);
768
+         if ($IconAreaWidth < $PicWidth) { $IconAreaWidth = $PicWidth; }
769
+         if ($IconAreaHeight < $PicHeight) { $IconAreaHeight = $PicHeight; }
770 770
         }
771 771
       }
772 772
 
773
-     $YStep = max($this->pChartObject->FontSize,$IconAreaHeight) + 5;
773
+     $YStep = max($this->pChartObject->FontSize, $IconAreaHeight) + 5;
774 774
      $XStep = $IconAreaWidth + 5;
775 775
      $XStep = $XSpacing;
776 776
 
777 777
      $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
778
-     foreach($Data["ScatterSeries"] as $Key => $Series)
778
+     foreach ($Data["ScatterSeries"] as $Key => $Series)
779 779
       {
780
-       if ( $Series["isDrawable"] == TRUE )
780
+       if ($Series["isDrawable"] == TRUE)
781 781
         {
782
-         if ( $Mode == LEGEND_VERTICAL )
782
+         if ($Mode == LEGEND_VERTICAL)
783 783
           {
784
-           $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+4,$vY+$IconAreaHeight/2,$FontName,$FontSize,0,$Series["Description"]);
784
+           $BoxArray = $this->pChartObject->getTextBox($vX + $IconAreaWidth + 4, $vY + $IconAreaHeight/2, $FontName, $FontSize, 0, $Series["Description"]);
785 785
 
786
-           if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
787
-           if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
788
-           if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$IconAreaHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$IconAreaHeight/2; }
786
+           if ($Boundaries["T"] > $BoxArray[2]["Y"] + $IconAreaHeight/2) { $Boundaries["T"] = $BoxArray[2]["Y"] + $IconAreaHeight/2; }
787
+           if ($Boundaries["R"] < $BoxArray[1]["X"] + 2) { $Boundaries["R"] = $BoxArray[1]["X"] + 2; }
788
+           if ($Boundaries["B"] < $BoxArray[1]["Y"] + 2 + $IconAreaHeight/2) { $Boundaries["B"] = $BoxArray[1]["Y"] + 2 + $IconAreaHeight/2; }
789 789
 
790
-           $Lines = preg_split("/\n/",$Series["Description"]);
791
-           $vY = $vY + max($this->pChartObject->FontSize*count($Lines),$IconAreaHeight) + 5;
790
+           $Lines = preg_split("/\n/", $Series["Description"]);
791
+           $vY = $vY + max($this->pChartObject->FontSize*count($Lines), $IconAreaHeight) + 5;
792 792
           }
793
-         elseif ( $Mode == LEGEND_HORIZONTAL )
793
+         elseif ($Mode == LEGEND_HORIZONTAL)
794 794
           {
795
-           $Lines = preg_split("/\n/",$Series["Description"]);
795
+           $Lines = preg_split("/\n/", $Series["Description"]);
796 796
            $Width = "";
797
-           foreach($Lines as $Key => $Value)
797
+           foreach ($Lines as $Key => $Value)
798 798
             {
799
-             $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+6,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$FontName,$FontSize,0,$Value);
799
+             $BoxArray = $this->pChartObject->getTextBox($vX + $IconAreaWidth + 6, $Y + $IconAreaHeight/2 + (($this->pChartObject->FontSize + 3)*$Key), $FontName, $FontSize, 0, $Value);
800 800
 
801
-             if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
802
-             if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
803
-             if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$IconAreaHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$IconAreaHeight/2; }
801
+             if ($Boundaries["T"] > $BoxArray[2]["Y"] + $IconAreaHeight/2) { $Boundaries["T"] = $BoxArray[2]["Y"] + $IconAreaHeight/2; }
802
+             if ($Boundaries["R"] < $BoxArray[1]["X"] + 2) { $Boundaries["R"] = $BoxArray[1]["X"] + 2; }
803
+             if ($Boundaries["B"] < $BoxArray[1]["Y"] + 2 + $IconAreaHeight/2) { $Boundaries["B"] = $BoxArray[1]["Y"] + 2 + $IconAreaHeight/2; }
804 804
 
805 805
              $Width[] = $BoxArray[1]["X"];
806 806
             }
807 807
 
808
-           $vX=max($Width)+$XStep;
808
+           $vX = max($Width) + $XStep;
809 809
           }
810 810
         }
811 811
       }
812
-     $vY=$vY-$YStep; $vX=$vX-$XStep;
812
+     $vY = $vY - $YStep; $vX = $vX - $XStep;
813 813
 
814
-     $TopOffset  = $Y - $Boundaries["T"];
815
-     if ( $Boundaries["B"]-($vY+$BoxSize) < $TopOffset ) { $Boundaries["B"] = $vY+$BoxSize+$TopOffset; }
814
+     $TopOffset = $Y - $Boundaries["T"];
815
+     if ($Boundaries["B"] - ($vY + $BoxSize) < $TopOffset) { $Boundaries["B"] = $vY + $BoxSize + $TopOffset; }
816 816
 
817
-     $Width  = ($Boundaries["R"]+$Margin) - ($Boundaries["L"]-$Margin);
818
-     $Height = ($Boundaries["B"]+$Margin) - ($Boundaries["T"]-$Margin);
817
+     $Width  = ($Boundaries["R"] + $Margin) - ($Boundaries["L"] - $Margin);
818
+     $Height = ($Boundaries["B"] + $Margin) - ($Boundaries["T"] - $Margin);
819 819
 
820
-     return(array("Width"=>$Width,"Height"=>$Height));
820
+     return(array("Width"=>$Width, "Height"=>$Height));
821 821
     }
822 822
 
823 823
    /* Draw the line of best fit */
824
-   function drawScatterBestFit($Format="")
824
+   function drawScatterBestFit($Format = "")
825 825
     {
826
-     $Ticks	= isset($Format["Ticks"]) ? $Format["Ticks"] : 0;
826
+     $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : 0;
827 827
 
828
-     $Data    = $this->pDataObject->getData();
828
+     $Data = $this->pDataObject->getData();
829 829
 
830
-     foreach($Data["ScatterSeries"] as $Key => $Series)
830
+     foreach ($Data["ScatterSeries"] as $Key => $Series)
831 831
       {
832
-       if ( $Series["isDrawable"] == TRUE )
832
+       if ($Series["isDrawable"] == TRUE)
833 833
         {
834 834
          $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
835 835
          $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
836 836
 
837
-         $Color = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
837
+         $Color = array("R"=>$Series["Color"]["R"], "G"=>$Series["Color"]["G"], "B"=>$Series["Color"]["B"], "Alpha"=>$Series["Color"]["Alpha"]);
838 838
          $Color["Ticks"] = $Ticks;
839 839
 
840 840
          $PosArrayX = $Data["Series"][$Series["X"]]["Data"];
841 841
          $PosArrayY = $Data["Series"][$Series["Y"]]["Data"];
842 842
 
843 843
          $Sxy = 0; $Sx = 0; $Sy = 0; $Sxx = 0;
844
-         foreach($PosArrayX as $Key => $Value)
844
+         foreach ($PosArrayX as $Key => $Value)
845 845
           {
846 846
            $X = $Value; $Y = $PosArrayY[$Key];
847 847
 
@@ -855,68 +855,68 @@  discard block
 block discarded – undo
855 855
 
856 856
          if ((($n*$Sxx) == ($Sx*$Sx)))
857 857
           {
858
-           $X1 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMin"],$SerieXAxis);
858
+           $X1 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMin"], $SerieXAxis);
859 859
            $X2 = $X1;
860 860
            $Y1 = $this->pChartObject->GraphAreaY1;
861 861
            $Y2 = $this->pChartObject->GraphAreaY2;
862 862
           }
863 863
          else
864 864
           {
865
-           $M = (($n*$Sxy)-($Sx*$Sy)) / (($n*$Sxx)-($Sx*$Sx));
866
-           $B = (($Sy)-($M*$Sx))/($n);
865
+           $M = (($n*$Sxy) - ($Sx*$Sy))/(($n*$Sxx) - ($Sx*$Sx));
866
+           $B = (($Sy) - ($M*$Sx))/($n);
867 867
 
868
-           $X1 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMin"],$SerieXAxis);
869
-           $Y1 = $this->getPosArray($M * $Data["Axis"][$SerieXAxis]["ScaleMin"] + $B,$SerieYAxis);
870
-           $X2 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMax"],$SerieXAxis);
871
-           $Y2 = $this->getPosArray($M * $Data["Axis"][$SerieXAxis]["ScaleMax"] + $B,$SerieYAxis);
868
+           $X1 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMin"], $SerieXAxis);
869
+           $Y1 = $this->getPosArray($M*$Data["Axis"][$SerieXAxis]["ScaleMin"] + $B, $SerieYAxis);
870
+           $X2 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMax"], $SerieXAxis);
871
+           $Y2 = $this->getPosArray($M*$Data["Axis"][$SerieXAxis]["ScaleMax"] + $B, $SerieYAxis);
872 872
 
873
-           $RealM = -($Y2-$Y1)/($X2-$X1);
873
+           $RealM = -($Y2 - $Y1)/($X2 - $X1);
874 874
 
875
-           if ( $Y1 < $this->pChartObject->GraphAreaY1 ) { $X1 = $X1 + ($this->pChartObject->GraphAreaY1-$Y1/$RealM); $Y1 = $this->pChartObject->GraphAreaY1; }
876
-           if ( $Y1 > $this->pChartObject->GraphAreaY2 ) { $X1 = $X1 + ($Y1-$this->pChartObject->GraphAreaY2)/$RealM; $Y1 = $this->pChartObject->GraphAreaY2; }
877
-           if ( $Y2 < $this->pChartObject->GraphAreaY1 ) { $X2 = $X2 - ($this->pChartObject->GraphAreaY1-$Y2)/$RealM; $Y2 = $this->pChartObject->GraphAreaY1; }
878
-           if ( $Y2 > $this->pChartObject->GraphAreaY2 ) { $X2 = $X2 - ($Y2-$this->pChartObject->GraphAreaY2)/$RealM; $Y2 = $this->pChartObject->GraphAreaY2; }
875
+           if ($Y1 < $this->pChartObject->GraphAreaY1) { $X1 = $X1 + ($this->pChartObject->GraphAreaY1 - $Y1/$RealM); $Y1 = $this->pChartObject->GraphAreaY1; }
876
+           if ($Y1 > $this->pChartObject->GraphAreaY2) { $X1 = $X1 + ($Y1 - $this->pChartObject->GraphAreaY2)/$RealM; $Y1 = $this->pChartObject->GraphAreaY2; }
877
+           if ($Y2 < $this->pChartObject->GraphAreaY1) { $X2 = $X2 - ($this->pChartObject->GraphAreaY1 - $Y2)/$RealM; $Y2 = $this->pChartObject->GraphAreaY1; }
878
+           if ($Y2 > $this->pChartObject->GraphAreaY2) { $X2 = $X2 - ($Y2 - $this->pChartObject->GraphAreaY2)/$RealM; $Y2 = $this->pChartObject->GraphAreaY2; }
879 879
           }
880 880
 
881
-         $this->pChartObject->drawLine($X1,$Y1,$X2,$Y2,$Color);
881
+         $this->pChartObject->drawLine($X1, $Y1, $X2, $Y2, $Color);
882 882
         }
883 883
       }
884 884
     }
885 885
 
886
-   function writeScatterLabel($ScatterSerieID,$Points,$Format="")
886
+   function writeScatterLabel($ScatterSerieID, $Points, $Format = "")
887 887
     {
888
-     $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
889
-     $DrawPoint		= isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
890
-     $Decimals		= isset($Format["Decimals"]) ? $Format["Decimals"] : NULL;
888
+     $OverrideTitle = isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
889
+     $DrawPoint = isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
890
+     $Decimals = isset($Format["Decimals"]) ? $Format["Decimals"] : NULL;
891 891
 
892 892
      $Data    = $this->pDataObject->getData();
893 893
      $Palette = $this->pDataObject->getPalette();
894 894
 
895
-     if ( !is_array($Points) ) { $Point = $Points; $Points = ""; $Points[0] = $Point; }
895
+     if (!is_array($Points)) { $Point = $Points; $Points = ""; $Points[0] = $Point; }
896 896
 
897
-     if ( !isset($Data["ScatterSeries"][$ScatterSerieID]) ) 
897
+     if (!isset($Data["ScatterSeries"][$ScatterSerieID])) 
898 898
       return(0);
899 899
 
900 900
      $Series = $Data["ScatterSeries"][$ScatterSerieID];
901 901
      $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
902 902
      $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
903 903
 
904
-     $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
905
-     if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
906
-     $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
907
-     if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
904
+     $PosArrayX = $this->getPosArray($SerieValuesX, $SerieXAxis);
905
+     if (!is_array($PosArrayX)) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
906
+     $PosArrayY = $this->getPosArray($SerieValuesY, $SerieYAxis);
907
+     if (!is_array($PosArrayY)) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
908 908
 
909
-     foreach($Points as $Key => $Point)
909
+     foreach ($Points as $Key => $Point)
910 910
       {
911
-       if ( isset($PosArrayX[$Point]) && isset($PosArrayY[$Point]) )
911
+       if (isset($PosArrayX[$Point]) && isset($PosArrayY[$Point]))
912 912
         {
913 913
          $X = floor($PosArrayX[$Point]);
914 914
          $Y = floor($PosArrayY[$Point]);
915 915
 
916
-         if ( $DrawPoint == LABEL_POINT_CIRCLE )
917
-          $this->pChartObject->drawFilledCircle($X,$Y,3,array("R"=>255,"G"=>255,"B"=>255,"BorderR"=>0,"BorderG"=>0,"BorderB"=>0));
918
-         elseif ( $DrawPoint == LABEL_POINT_BOX )
919
-          $this->pChartObject->drawFilledRectangle($X-2,$Y-2,$X+2,$Y+2,array("R"=>255,"G"=>255,"B"=>255,"BorderR"=>0,"BorderG"=>0,"BorderB"=>0));
916
+         if ($DrawPoint == LABEL_POINT_CIRCLE)
917
+          $this->pChartObject->drawFilledCircle($X, $Y, 3, array("R"=>255, "G"=>255, "B"=>255, "BorderR"=>0, "BorderG"=>0, "BorderB"=>0));
918
+         elseif ($DrawPoint == LABEL_POINT_BOX)
919
+          $this->pChartObject->drawFilledRectangle($X - 2, $Y - 2, $X + 2, $Y + 2, array("R"=>255, "G"=>255, "B"=>255, "BorderR"=>0, "BorderG"=>0, "BorderB"=>0));
920 920
 
921 921
          $Serie = "";
922 922
          $Serie["R"] = $Series["Color"]["R"];
@@ -927,125 +927,125 @@  discard block
 block discarded – undo
927 927
          $XAxisMode   = $Data["Axis"][$SerieXAxis]["Display"];
928 928
          $XAxisFormat = $Data["Axis"][$SerieXAxis]["Format"];
929 929
          $XAxisUnit   = $Data["Axis"][$SerieXAxis]["Unit"];
930
-         if ( $Decimals == NULL ) { $XValue = $SerieValuesX[$Point]; } else { $XValue = round($SerieValuesX[$Point],$Decimals); }
931
-         $XValue      = $this->pChartObject->scaleFormat($XValue,$XAxisMode,$XAxisFormat,$XAxisUnit);
930
+         if ($Decimals == NULL) { $XValue = $SerieValuesX[$Point]; } else { $XValue = round($SerieValuesX[$Point], $Decimals); }
931
+         $XValue      = $this->pChartObject->scaleFormat($XValue, $XAxisMode, $XAxisFormat, $XAxisUnit);
932 932
 
933 933
          $YAxisMode   = $Data["Axis"][$SerieYAxis]["Display"];
934 934
          $YAxisFormat = $Data["Axis"][$SerieYAxis]["Format"];
935 935
          $YAxisUnit   = $Data["Axis"][$SerieYAxis]["Unit"];
936
-         if ( $Decimals == NULL ) { $YValue = $SerieValuesY[$Point]; } else { $YValue = round($SerieValuesY[$Point],$Decimals); }
937
-         $YValue      = $this->pChartObject->scaleFormat($YValue,$YAxisMode,$YAxisFormat,$YAxisUnit);
936
+         if ($Decimals == NULL) { $YValue = $SerieValuesY[$Point]; } else { $YValue = round($SerieValuesY[$Point], $Decimals); }
937
+         $YValue      = $this->pChartObject->scaleFormat($YValue, $YAxisMode, $YAxisFormat, $YAxisUnit);
938 938
 
939 939
          $Caption = $XValue." / ".$YValue;
940 940
 
941
-         if ( isset($Series["Description"]) )
941
+         if (isset($Series["Description"]))
942 942
           $Description = $Series["Description"];
943 943
          else
944 944
           $Description = "No description";
945 945
 
946 946
          $Series = "";
947
-         $Series[] = array("Format"=>$Serie,"Caption"=>$Caption);
947
+         $Series[] = array("Format"=>$Serie, "Caption"=>$Caption);
948 948
 
949
-         $this->pChartObject->drawLabelBox($X,$Y-3,$Description,$Series,$Format);
949
+         $this->pChartObject->drawLabelBox($X, $Y - 3, $Description, $Series, $Format);
950 950
         }
951 951
       }
952 952
     }
953 953
 
954 954
    /* Draw a Scatter threshold */
955
-   function drawScatterThreshold($Value,$Format="")
955
+   function drawScatterThreshold($Value, $Format = "")
956 956
     {
957
-     $AxisID		= isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
957
+     $AxisID = isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
958 958
      $R			= isset($Format["R"]) ? $Format["R"] : 255;
959 959
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
960 960
      $B			= isset($Format["B"]) ? $Format["B"] : 0;
961 961
      $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 50;
962
-     $Weight		= isset($Format["Weight"]) ? $Format["Weight"] : NULL;
962
+     $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL;
963 963
      $Ticks		= isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
964
-     $Wide		= isset($Format["Wide"]) ? $Format["Wide"] : FALSE;
965
-     $WideFactor	= isset($Format["WideFactor"]) ? $Format["WideFactor"] : 5;
964
+     $Wide = isset($Format["Wide"]) ? $Format["Wide"] : FALSE;
965
+     $WideFactor = isset($Format["WideFactor"]) ? $Format["WideFactor"] : 5;
966 966
      $WriteCaption	= isset($Format["WriteCaption"]) ? $Format["WriteCaption"] : FALSE;
967
-     $Caption		= isset($Format["Caption"]) ? $Format["Caption"] : NULL;
967
+     $Caption = isset($Format["Caption"]) ? $Format["Caption"] : NULL;
968 968
      $CaptionAlign	= isset($Format["CaptionAlign"]) ? $Format["CaptionAlign"] : CAPTION_LEFT_TOP;
969
-     $CaptionOffset     = isset($Format["CaptionOffset"]) ? $Format["CaptionOffset"] : 10;
969
+     $CaptionOffset = isset($Format["CaptionOffset"]) ? $Format["CaptionOffset"] : 10;
970 970
      $CaptionR		= isset($Format["CaptionR"]) ? $Format["CaptionR"] : 255;
971 971
      $CaptionG		= isset($Format["CaptionG"]) ? $Format["CaptionG"] : 255;
972 972
      $CaptionB		= isset($Format["CaptionB"]) ? $Format["CaptionB"] : 255;
973 973
      $CaptionAlpha	= isset($Format["CaptionAlpha"]) ? $Format["CaptionAlpha"] : 100;
974
-     $DrawBox		= isset($Format["DrawBox"]) ? $Format["DrawBox"] : TRUE;
974
+     $DrawBox = isset($Format["DrawBox"]) ? $Format["DrawBox"] : TRUE;
975 975
      $DrawBoxBorder	= isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : FALSE;
976 976
      $BorderOffset	= isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 5;
977
-     $BoxRounded	= isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : TRUE;
977
+     $BoxRounded = isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : TRUE;
978 978
      $RoundedRadius	= isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 3;
979 979
      $BoxR		= isset($Format["BoxR"]) ? $Format["BoxR"] : 0;
980 980
      $BoxG		= isset($Format["BoxG"]) ? $Format["BoxG"] : 0;
981 981
      $BoxB		= isset($Format["BoxB"]) ? $Format["BoxB"] : 0;
982
-     $BoxAlpha		= isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 20;
983
-     $BoxSurrounding	= isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : "";
982
+     $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 20;
983
+     $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : "";
984 984
      $BoxBorderR	= isset($Format["BoxBorderR"]) ? $Format["BoxBorderR"] : 255;
985 985
      $BoxBorderG	= isset($Format["BoxBorderG"]) ? $Format["BoxBorderG"] : 255;
986 986
      $BoxBorderB	= isset($Format["BoxBorderB"]) ? $Format["BoxBorderB"] : 255;
987
-     $BoxBorderAlpha	= isset($Format["BoxBorderAlpha"]) ? $Format["BoxBorderAlpha"] : 100;
987
+     $BoxBorderAlpha = isset($Format["BoxBorderAlpha"]) ? $Format["BoxBorderAlpha"] : 100;
988 988
 
989
-     $CaptionSettings = array("DrawBox"=>$DrawBox,"DrawBoxBorder"=>$DrawBoxBorder,"BorderOffset"=>$BorderOffset,"BoxRounded"=>$BoxRounded,"RoundedRadius"=>$RoundedRadius,
990
-                              "BoxR"=>$BoxR,"BoxG"=>$BoxG,"BoxB"=>$BoxB,"BoxAlpha"=>$BoxAlpha,"BoxSurrounding"=>$BoxSurrounding,
991
-                              "BoxBorderR"=>$BoxBorderR,"BoxBorderG"=>$BoxBorderG,"BoxBorderB"=>$BoxBorderB,"BoxBorderAlpha"=>$BoxBorderAlpha,
992
-                              "R"=>$CaptionR,"G"=>$CaptionG,"B"=>$CaptionB,"Alpha"=>$CaptionAlpha);
989
+     $CaptionSettings = array("DrawBox"=>$DrawBox, "DrawBoxBorder"=>$DrawBoxBorder, "BorderOffset"=>$BorderOffset, "BoxRounded"=>$BoxRounded, "RoundedRadius"=>$RoundedRadius,
990
+                              "BoxR"=>$BoxR, "BoxG"=>$BoxG, "BoxB"=>$BoxB, "BoxAlpha"=>$BoxAlpha, "BoxSurrounding"=>$BoxSurrounding,
991
+                              "BoxBorderR"=>$BoxBorderR, "BoxBorderG"=>$BoxBorderG, "BoxBorderB"=>$BoxBorderB, "BoxBorderAlpha"=>$BoxBorderAlpha,
992
+                              "R"=>$CaptionR, "G"=>$CaptionG, "B"=>$CaptionB, "Alpha"=>$CaptionAlpha);
993 993
 
994
-     if ( $Caption == NULL ) { $Caption = $Value; }
994
+     if ($Caption == NULL) { $Caption = $Value; }
995 995
 
996 996
      $Data = $this->pDataObject->getData();
997 997
 
998
-     if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); }
998
+     if (!isset($Data["Axis"][$AxisID])) { return(-1); }
999 999
  
1000
-     if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_Y )
1000
+     if ($Data["Axis"][$AxisID]["Identity"] == AXIS_Y)
1001 1001
       {
1002 1002
        $X1 = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"];
1003 1003
        $X2 = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"];
1004
-       $Y  = $this->getPosArray($Value,$AxisID);
1004
+       $Y  = $this->getPosArray($Value, $AxisID);
1005 1005
 
1006
-       $this->pChartObject->drawLine($X1,$Y,$X2,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
1006
+       $this->pChartObject->drawLine($X1, $Y, $X2, $Y, array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha, "Ticks"=>$Ticks, "Weight"=>$Weight));
1007 1007
 
1008
-       if ( $Wide )
1008
+       if ($Wide)
1009 1009
         {
1010
-         $this->pChartObject->drawLine($X1,$Y-1,$X2,$Y-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1011
-         $this->pChartObject->drawLine($X1,$Y+1,$X2,$Y+1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1010
+         $this->pChartObject->drawLine($X1, $Y - 1, $X2, $Y - 1, array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha/$WideFactor, "Ticks"=>$Ticks));
1011
+         $this->pChartObject->drawLine($X1, $Y + 1, $X2, $Y + 1, array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha/$WideFactor, "Ticks"=>$Ticks));
1012 1012
         }
1013 1013
 
1014
-       if ( $WriteCaption )
1014
+       if ($WriteCaption)
1015 1015
         {
1016
-         if ( $CaptionAlign == CAPTION_LEFT_TOP )
1016
+         if ($CaptionAlign == CAPTION_LEFT_TOP)
1017 1017
           { $X = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"] + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
1018 1018
          else 
1019 1019
           { $X = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"] - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
1020 1020
 
1021
-         $this->pChartObject->drawText($X,$Y,$Caption,$CaptionSettings);
1021
+         $this->pChartObject->drawText($X, $Y, $Caption, $CaptionSettings);
1022 1022
         }
1023 1023
 
1024 1024
        return(array("Y"=>$Y));
1025 1025
       }
1026
-     elseif ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X )
1026
+     elseif ($Data["Axis"][$AxisID]["Identity"] == AXIS_X)
1027 1027
       {
1028
-       $X  = $this->getPosArray($Value,$AxisID);
1028
+       $X  = $this->getPosArray($Value, $AxisID);
1029 1029
        $Y1 = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"];
1030 1030
        $Y2 = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"];
1031 1031
 
1032
-       $this->pChartObject->drawLine($X,$Y1,$X,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
1032
+       $this->pChartObject->drawLine($X, $Y1, $X, $Y2, array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha, "Ticks"=>$Ticks, "Weight"=>$Weight));
1033 1033
 
1034
-       if ( $Wide )
1034
+       if ($Wide)
1035 1035
         {
1036
-         $this->pChartObject->drawLine($X-1,$Y1,$X-1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1037
-         $this->pChartObject->drawLine($X+1,$Y1,$X+1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1036
+         $this->pChartObject->drawLine($X - 1, $Y1, $X - 1, $Y2, array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha/$WideFactor, "Ticks"=>$Ticks));
1037
+         $this->pChartObject->drawLine($X + 1, $Y1, $X + 1, $Y2, array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha/$WideFactor, "Ticks"=>$Ticks));
1038 1038
         }
1039 1039
 
1040
-       if ( $WriteCaption )
1040
+       if ($WriteCaption)
1041 1041
         {
1042
-         if ( $CaptionAlign == CAPTION_LEFT_TOP )
1042
+         if ($CaptionAlign == CAPTION_LEFT_TOP)
1043 1043
           { $Y = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"] + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
1044 1044
          else 
1045 1045
           { $Y = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"] - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
1046 1046
 
1047 1047
          $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE;
1048
-         $this->pChartObject->drawText($X,$Y,$Caption,$CaptionSettings);
1048
+         $this->pChartObject->drawText($X, $Y, $Caption, $CaptionSettings);
1049 1049
         }
1050 1050
 
1051 1051
        return(array("X"=>$X));
@@ -1053,13 +1053,13 @@  discard block
 block discarded – undo
1053 1053
     }
1054 1054
 
1055 1055
    /* Draw a Scatter threshold area */
1056
-   function drawScatterThresholdArea($Value1,$Value2,$Format="")
1056
+   function drawScatterThresholdArea($Value1, $Value2, $Format = "")
1057 1057
     {
1058
-     $AxisID	= isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
1058
+     $AxisID = isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
1059 1059
      $R		= isset($Format["R"]) ? $Format["R"] : 255;
1060 1060
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
1061 1061
      $B		= isset($Format["B"]) ? $Format["B"] : 0;
1062
-     $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 20;
1062
+     $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 20;
1063 1063
      $Border    = isset($Format["Border"]) ? $Format["Border"] : TRUE;
1064 1064
      $BorderR   = isset($Format["BorderR"]) ? $Format["BorderR"] : $R;
1065 1065
      $BorderG   = isset($Format["BorderG"]) ? $Format["BorderG"] : $G;
@@ -1071,87 +1071,87 @@  discard block
 block discarded – undo
1071 1071
      $NameR	= isset($Format["NameR"]) ? $Format["NameR"] : 255;
1072 1072
      $NameG	= isset($Format["NameG"]) ? $Format["NameG"] : 255;
1073 1073
      $NameB	= isset($Format["NameB"]) ? $Format["NameB"] : 255;
1074
-     $NameAlpha	= isset($Format["NameAlpha"]) ? $Format["NameAlpha"] : 100;
1074
+     $NameAlpha = isset($Format["NameAlpha"]) ? $Format["NameAlpha"] : 100;
1075 1075
      $DisableShadowOnArea = isset($Format["DisableShadowOnArea"]) ? $Format["DisableShadowOnArea"] : TRUE;
1076 1076
 
1077 1077
      if ($Value1 > $Value2) { list($Value1, $Value2) = array($Value2, $Value1); }
1078 1078
 
1079 1079
      $RestoreShadow = $this->pChartObject->Shadow;
1080
-     if ( $DisableShadowOnArea && $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = FALSE; }
1080
+     if ($DisableShadowOnArea && $this->pChartObject->Shadow) { $this->pChartObject->Shadow = FALSE; }
1081 1081
 
1082
-     if ($BorderAlpha >100) { $BorderAlpha = 100;}
1082
+     if ($BorderAlpha > 100) { $BorderAlpha = 100; }
1083 1083
 
1084 1084
      $Data = $this->pDataObject->getData();
1085 1085
 
1086
-     if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); }
1086
+     if (!isset($Data["Axis"][$AxisID])) { return(-1); }
1087 1087
  
1088
-     if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X )
1088
+     if ($Data["Axis"][$AxisID]["Identity"] == AXIS_X)
1089 1089
       {
1090 1090
        $Y1 = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"];
1091 1091
        $Y2 = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"];
1092
-       $X1  = $this->getPosArray($Value1,$AxisID);
1093
-       $X2  = $this->getPosArray($Value2,$AxisID);
1092
+       $X1  = $this->getPosArray($Value1, $AxisID);
1093
+       $X2  = $this->getPosArray($Value2, $AxisID);
1094 1094
 
1095
-       if ( $X1 <= $this->pChartObject->GraphAreaX1 ) { $X1 = $this->pChartObject->GraphAreaX1+$Data["Axis"][$AxisID]["Margin"]; }
1096
-       if ( $X2 >= $this->pChartObject->GraphAreaX2 ) { $X2 = $this->pChartObject->GraphAreaX2-$Data["Axis"][$AxisID]["Margin"]; }
1095
+       if ($X1 <= $this->pChartObject->GraphAreaX1) { $X1 = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"]; }
1096
+       if ($X2 >= $this->pChartObject->GraphAreaX2) { $X2 = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"]; }
1097 1097
 
1098
-       $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
1098
+       $this->pChartObject->drawFilledRectangle($X1, $Y1, $X2, $Y2, array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha));
1099 1099
 
1100
-       if ( $Border )
1100
+       if ($Border)
1101 1101
         {
1102
-         $this->pChartObject->drawLine($X1,$Y1,$X1,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1103
-         $this->pChartObject->drawLine($X2,$Y1,$X2,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1102
+         $this->pChartObject->drawLine($X1, $Y1, $X1, $Y2, array("R"=>$BorderR, "G"=>$BorderG, "B"=>$BorderB, "Alpha"=>$BorderAlpha, "Ticks"=>$BorderTicks));
1103
+         $this->pChartObject->drawLine($X2, $Y1, $X2, $Y2, array("R"=>$BorderR, "G"=>$BorderG, "B"=>$BorderB, "Alpha"=>$BorderAlpha, "Ticks"=>$BorderTicks));
1104 1104
         }
1105 1105
 
1106
-       if ( $AreaName != NULL )
1106
+       if ($AreaName != NULL)
1107 1107
         {
1108
-         $XPos = ($X2-$X1)/2 + $X1;
1109
-         $YPos = ($Y2-$Y1)/2 + $Y1;
1108
+         $XPos = ($X2 - $X1)/2 + $X1;
1109
+         $YPos = ($Y2 - $Y1)/2 + $Y1;
1110 1110
 
1111
-         if ( $NameAngle == ZONE_NAME_ANGLE_AUTO )
1111
+         if ($NameAngle == ZONE_NAME_ANGLE_AUTO)
1112 1112
           {
1113
-           $TxtPos   = $this->pChartObject->getTextBox($XPos,$YPos,$this->pChartObject->FontName,$this->pChartObject->FontSize,0,$AreaName);
1113
+           $TxtPos   = $this->pChartObject->getTextBox($XPos, $YPos, $this->pChartObject->FontName, $this->pChartObject->FontSize, 0, $AreaName);
1114 1114
            $TxtWidth = $TxtPos[1]["X"] - $TxtPos[0]["X"];
1115
-           if ( abs($X2 - $X1) > $TxtWidth ) { $NameAngle = 0; } else { $NameAngle = 90; }
1115
+           if (abs($X2 - $X1) > $TxtWidth) { $NameAngle = 0; } else { $NameAngle = 90; }
1116 1116
           }
1117 1117
          $this->pChartObject->Shadow = $RestoreShadow;
1118
-         $this->pChartObject->drawText($XPos,$YPos,$AreaName,array("R"=>$NameR,"G"=>$NameG,"B"=>$NameB,"Alpha"=>$NameAlpha,"Angle"=>$NameAngle,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
1119
-         if ( $DisableShadowOnArea ) { $this->pChartObject->Shadow = FALSE; }
1118
+         $this->pChartObject->drawText($XPos, $YPos, $AreaName, array("R"=>$NameR, "G"=>$NameG, "B"=>$NameB, "Alpha"=>$NameAlpha, "Angle"=>$NameAngle, "Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
1119
+         if ($DisableShadowOnArea) { $this->pChartObject->Shadow = FALSE; }
1120 1120
         }
1121 1121
 
1122 1122
        $this->pChartObject->Shadow = $RestoreShadow;
1123
-       return(array("X1"=>$X1,"X2"=>$X2));
1123
+       return(array("X1"=>$X1, "X2"=>$X2));
1124 1124
       }
1125
-     elseif ( $Data["Axis"][$AxisID]["Identity"] == AXIS_Y )
1125
+     elseif ($Data["Axis"][$AxisID]["Identity"] == AXIS_Y)
1126 1126
       {
1127 1127
        $X1 = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"];
1128 1128
        $X2 = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"];
1129
-       $Y1 = $this->getPosArray($Value1,$AxisID);
1130
-       $Y2 = $this->getPosArray($Value2,$AxisID);
1129
+       $Y1 = $this->getPosArray($Value1, $AxisID);
1130
+       $Y2 = $this->getPosArray($Value2, $AxisID);
1131 1131
 
1132
-       if ( $Y1 >= $this->pChartObject->GraphAreaY2 ) { $Y1 = $this->pChartObject->GraphAreaY2-$Data["Axis"][$AxisID]["Margin"]; }
1133
-       if ( $Y2 <= $this->pChartObject->GraphAreaY1 ) { $Y2 = $this->pChartObject->GraphAreaY1+$Data["Axis"][$AxisID]["Margin"]; }
1132
+       if ($Y1 >= $this->pChartObject->GraphAreaY2) { $Y1 = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"]; }
1133
+       if ($Y2 <= $this->pChartObject->GraphAreaY1) { $Y2 = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"]; }
1134 1134
 
1135
-       $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
1135
+       $this->pChartObject->drawFilledRectangle($X1, $Y1, $X2, $Y2, array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha));
1136 1136
 
1137
-       if ( $Border )
1137
+       if ($Border)
1138 1138
         {
1139
-         $this->pChartObject->drawLine($X1,$Y1,$X2,$Y1,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1140
-         $this->pChartObject->drawLine($X1,$Y2,$X2,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1139
+         $this->pChartObject->drawLine($X1, $Y1, $X2, $Y1, array("R"=>$BorderR, "G"=>$BorderG, "B"=>$BorderB, "Alpha"=>$BorderAlpha, "Ticks"=>$BorderTicks));
1140
+         $this->pChartObject->drawLine($X1, $Y2, $X2, $Y2, array("R"=>$BorderR, "G"=>$BorderG, "B"=>$BorderB, "Alpha"=>$BorderAlpha, "Ticks"=>$BorderTicks));
1141 1141
         }
1142 1142
 
1143
-       if ( $AreaName != NULL )
1143
+       if ($AreaName != NULL)
1144 1144
         {
1145
-         $XPos = ($X2-$X1)/2 + $X1;
1146
-         $YPos = ($Y2-$Y1)/2 + $Y1;
1145
+         $XPos = ($X2 - $X1)/2 + $X1;
1146
+         $YPos = ($Y2 - $Y1)/2 + $Y1;
1147 1147
 
1148 1148
          $this->pChartObject->Shadow = $RestoreShadow;
1149
-         $this->pChartObject->drawText($YPos,$XPos,$AreaName,array("R"=>$NameR,"G"=>$NameG,"B"=>$NameB,"Alpha"=>$NameAlpha,"Angle"=>0,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
1150
-         if ( $DisableShadowOnArea ) { $this->Shadow = FALSE; }
1149
+         $this->pChartObject->drawText($YPos, $XPos, $AreaName, array("R"=>$NameR, "G"=>$NameG, "B"=>$NameB, "Alpha"=>$NameAlpha, "Angle"=>0, "Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
1150
+         if ($DisableShadowOnArea) { $this->Shadow = FALSE; }
1151 1151
         }
1152 1152
 
1153 1153
        $this->pChartObject->Shadow = $RestoreShadow;
1154
-       return(array("Y1"=>$Y1,"Y2"=>$Y2));
1154
+       return(array("Y1"=>$Y1, "Y2"=>$Y2));
1155 1155
       }
1156 1156
     }
1157 1157
   }
Please login to merge, or discard this patch.
Braces   +112 added lines, -236 removed lines patch added patch discarded remove patch
@@ -17,21 +17,18 @@  discard block
 block discarded – undo
17 17
  define("SCATTER_MISSING_Y_SERIE"	, 190002);
18 18
 
19 19
  /* pScatter class definition */
20
- class pScatter
21
-  {
20
+ class pScatter {
22 21
    var $pChartObject;
23 22
    var $pDataObject;
24 23
 
25 24
    /* Class creator */
26
-   function pScatter($pChartObject,$pDataObject)
27
-    {
25
+   function pScatter($pChartObject,$pDataObject) {
28 26
      $this->pChartObject = $pChartObject;
29 27
      $this->pDataObject  = $pDataObject;
30 28
     }
31 29
 
32 30
    /* Prepare the scale */
33
-   function drawScatterScale($Format="")
34
-    {
31
+   function drawScatterScale($Format="") {
35 32
      $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : SCALE_MODE_FLOATING;
36 33
      $Floating		= isset($Format["Floating"]) ? $Format["Floating"] : FALSE;
37 34
      $XLabelsRotation	= isset($Format["XLabelsRotation"]) ? $Format["XLabelsRotation"] : 90;
@@ -80,8 +77,7 @@  discard block
 block discarded – undo
80 77
 
81 78
      /* Check if we have at least both one X and Y axis */
82 79
      $GotXAxis = FALSE; $GotYAxis = FALSE;
83
-     foreach($this->pDataObject->Data["Axis"] as $AxisID => $AxisSettings)
84
-      {
80
+     foreach($this->pDataObject->Data["Axis"] as $AxisID => $AxisSettings) {
85 81
        if ( $AxisSettings["Identity"] == AXIS_X ) { $GotXAxis = TRUE; }
86 82
        if ( $AxisSettings["Identity"] == AXIS_Y ) { $GotYAxis = TRUE; }
87 83
       }
@@ -93,20 +89,15 @@  discard block
 block discarded – undo
93 89
 
94 90
      $Data = $this->pDataObject->getData();
95 91
 
96
-     foreach($Data["Axis"] as $AxisID => $AxisSettings)
97
-      {
92
+     foreach($Data["Axis"] as $AxisID => $AxisSettings) {
98 93
        if ( $AxisSettings["Identity"] == AXIS_X)
99
-        { $Width = $this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin*2; }
100
-       else
94
+        { $Width = $this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin*2; } else
101 95
         { $Width = $this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1 - $YMargin*2; }
102 96
 
103 97
        $AxisMin = ABSOLUTE_MAX; $AxisMax = OUT_OF_SIGHT;
104
-       if ( $Mode == SCALE_MODE_FLOATING )
105
-        {
106
-         foreach($Data["Series"] as $SerieID => $SerieParameter)
107
-          {
108
-           if ( $SerieParameter["Axis"] == $AxisID && $Data["Series"][$SerieID]["isDrawable"] )
109
-            {
98
+       if ( $Mode == SCALE_MODE_FLOATING ) {
99
+         foreach($Data["Series"] as $SerieID => $SerieParameter) {
100
+           if ( $SerieParameter["Axis"] == $AxisID && $Data["Series"][$SerieID]["isDrawable"] ) {
110 101
              $AxisMax = max($AxisMax,$Data["Series"][$SerieID]["Max"]);
111 102
              $AxisMin = min($AxisMin,$Data["Series"][$SerieID]["Min"]);
112 103
             }
@@ -114,23 +105,18 @@  discard block
 block discarded – undo
114 105
          $AutoMargin = (($AxisMax-$AxisMin)/100)*$XReleasePercent;
115 106
 
116 107
          $Data["Axis"][$AxisID]["Min"] = $AxisMin-$AutoMargin; $Data["Axis"][$AxisID]["Max"] = $AxisMax+$AutoMargin;
117
-        }
118
-       elseif ( $Mode == SCALE_MODE_MANUAL )
119
-        {
120
-         if ( isset($ManualScale[$AxisID]["Min"]) && isset($ManualScale[$AxisID]["Max"]) )
121
-          {
108
+        } elseif ( $Mode == SCALE_MODE_MANUAL ) {
109
+         if ( isset($ManualScale[$AxisID]["Min"]) && isset($ManualScale[$AxisID]["Max"]) ) {
122 110
            $Data["Axis"][$AxisID]["Min"] = $ManualScale[$AxisID]["Min"];
123 111
            $Data["Axis"][$AxisID]["Max"] = $ManualScale[$AxisID]["Max"];
124
-          }
125
-         else
112
+          } else
126 113
           { echo "Manual scale boundaries not set."; exit(); }
127 114
         }
128 115
 
129 116
        /* Full manual scale */
130 117
        if ( isset($ManualScale[$AxisID]["Rows"]) && isset($ManualScale[$AxisID]["RowHeight"]) )
131 118
         $Scale = array("Rows"=>$ManualScale[$AxisID]["Rows"],"RowHeight"=>$ManualScale[$AxisID]["RowHeight"],"XMin"=>$ManualScale[$AxisID]["Min"],"XMax"=>$ManualScale[$AxisID]["Max"]);
132
-       else
133
-        {
119
+       else {
134 120
          $MaxDivs = floor($Width/$MinDivHeight);
135 121
          $Scale   = $this->pChartObject->computeScale($Data["Axis"][$AxisID]["Min"],$Data["Axis"][$AxisID]["Max"],$MaxDivs,$Factors,$AxisID);
136 122
         }
@@ -154,34 +140,27 @@  discard block
 block discarded – undo
154 140
      /* Set the original boundaries */
155 141
      $AxisPos["L"] = $this->pChartObject->GraphAreaX1; $AxisPos["R"] = $this->pChartObject->GraphAreaX2; $AxisPos["T"] = $this->pChartObject->GraphAreaY1; $AxisPos["B"] = $this->pChartObject->GraphAreaY2;
156 142
 
157
-     foreach($Data["Axis"] as $AxisID => $AxisSettings)
158
-      {
159
-       if ( isset($AxisSettings["Color"]) )
160
-        {
143
+     foreach($Data["Axis"] as $AxisID => $AxisSettings) {
144
+       if ( isset($AxisSettings["Color"]) ) {
161 145
          $AxisR = $AxisSettings["Color"]["R"]; $AxisG = $AxisSettings["Color"]["G"]; $AxisB = $AxisSettings["Color"]["B"];
162 146
          $TickR = $AxisSettings["Color"]["R"]; $TickG = $AxisSettings["Color"]["G"]; $TickB = $AxisSettings["Color"]["B"];
163 147
          $this->pChartObject->setFontProperties(array("R"=>$AxisSettings["Color"]["R"],"G"=>$AxisSettings["Color"]["G"],"B"=>$AxisSettings["Color"]["B"]));
164
-        }
165
-       else
166
-        {
148
+        } else {
167 149
          $AxisR = $AxisRo; $AxisG = $AxisGo; $AxisB = $AxisBo;
168 150
          $TickR = $TickRo; $TickG = $TickGo; $TickB = $TickBo;
169 151
          $this->pChartObject->setFontProperties(array("R"=>$FontColorRo,"G"=>$FontColorGo,"B"=>$FontColorBo));
170 152
         }
171 153
 
172 154
        $LastValue = "w00t"; $ID = 1;
173
-       if ( $AxisSettings["Identity"] == AXIS_X )
174
-        {
175
-         if ( $AxisSettings["Position"] == AXIS_POSITION_BOTTOM )
176
-          {
155
+       if ( $AxisSettings["Identity"] == AXIS_X ) {
156
+         if ( $AxisSettings["Position"] == AXIS_POSITION_BOTTOM ) {
177 157
            if ( $XLabelsRotation == 0 )				   { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $LabelOffset = 2; }
178 158
            if ( $XLabelsRotation > 0 && $XLabelsRotation < 190 )   { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $LabelOffset = 5; }
179 159
            if ( $XLabelsRotation == 180 )			   { $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $LabelOffset = 5; }
180 160
            if ( $XLabelsRotation > 180 && $XLabelsRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $LabelOffset = 2; }
181 161
 
182 162
            if ( $Floating )
183
-            { $FloatingOffset = $YMargin; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$AxisSettings["Margin"],$AxisPos["B"],$this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
184
-           else
163
+            { $FloatingOffset = $YMargin; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$AxisSettings["Margin"],$AxisPos["B"],$this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else
185 164
             { $FloatingOffset = 0; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1,$AxisPos["B"],$this->pChartObject->GraphAreaX2,$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
186 165
 
187 166
            if ( $DrawArrows ) { $this->pChartObject->drawArrow($this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["B"],$this->pChartObject->GraphAreaX2+($ArrowSize*2),$AxisPos["B"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
@@ -189,8 +168,7 @@  discard block
 block discarded – undo
189 168
            $Width = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $AxisSettings["Margin"]*2;
190 169
            $Step   = $Width / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MaxBottom = $AxisPos["B"];
191 170
            $LastX  = NULL;
192
-           for($i=0;$i<=$AxisSettings["Rows"];$i++)
193
-            {
171
+           for($i=0;$i<=$AxisSettings["Rows"];$i++) {
194 172
              $XPos  = $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"] + $Step*$i;
195 173
              $YPos  = $AxisPos["B"];
196 174
              $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
@@ -210,8 +188,7 @@  discard block
 block discarded – undo
210 188
              $LastX = $XPos;
211 189
             }
212 190
 
213
-           if ( isset($AxisSettings["Name"]) )
214
-            {
191
+           if ( isset($AxisSettings["Name"]) ) {
215 192
              $YPos   = $MaxBottom+2;
216 193
              $XPos   = $this->pChartObject->GraphAreaX1+($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1)/2;
217 194
              $Bounds = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_TOPMIDDLE));
@@ -221,17 +198,14 @@  discard block
 block discarded – undo
221 198
             }
222 199
 
223 200
            $AxisPos["B"] = $MaxBottom + $ScaleSpacing;
224
-          }
225
-         elseif ( $AxisSettings["Position"] == AXIS_POSITION_TOP )
226
-          {
201
+          } elseif ( $AxisSettings["Position"] == AXIS_POSITION_TOP ) {
227 202
            if ( $XLabelsRotation == 0 )					{ $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $LabelOffset = 2; }
228 203
            if ( $XLabelsRotation > 0 && $XLabelsRotation < 190 )	{ $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $LabelOffset = 2; }
229 204
            if ( $XLabelsRotation == 180 )				{ $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $LabelOffset = 5; }
230 205
            if ( $XLabelsRotation > 180 && $SLabelxRotation < 360 )	{ $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $LabelOffset = 5; }
231 206
 
232 207
            if ( $Floating )
233
-            { $FloatingOffset = $YMargin; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$AxisSettings["Margin"],$AxisPos["T"],$this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
234
-           else
208
+            { $FloatingOffset = $YMargin; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$AxisSettings["Margin"],$AxisPos["T"],$this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else
235 209
             { $FloatingOffset = 0; $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1,$AxisPos["T"],$this->pChartObject->GraphAreaX2,$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
236 210
 
237 211
            if ( $DrawArrows ) { $this->pChartObject->drawArrow($this->pChartObject->GraphAreaX2-$AxisSettings["Margin"],$AxisPos["T"],$this->pChartObject->GraphAreaX2+($ArrowSize*2),$AxisPos["T"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
@@ -239,8 +213,7 @@  discard block
 block discarded – undo
239 213
            $Width = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $AxisSettings["Margin"]*2;
240 214
            $Step   = $Width / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MinTop = $AxisPos["T"];
241 215
            $LastX  = NULL;
242
-           for($i=0;$i<=$AxisSettings["Rows"];$i++)
243
-            {
216
+           for($i=0;$i<=$AxisSettings["Rows"];$i++) {
244 217
              $XPos  = $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"] + $Step*$i;
245 218
              $YPos  = $AxisPos["T"];
246 219
              $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
@@ -261,8 +234,7 @@  discard block
 block discarded – undo
261 234
              $LastX = $XPos;
262 235
             }
263 236
 
264
-           if ( isset($AxisSettings["Name"]) )
265
-            {
237
+           if ( isset($AxisSettings["Name"]) ) {
266 238
              $YPos   = $MinTop-2;
267 239
              $XPos   = $this->pChartObject->GraphAreaX1+($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1)/2;
268 240
              $Bounds = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
@@ -273,15 +245,11 @@  discard block
 block discarded – undo
273 245
 
274 246
            $AxisPos["T"] = $MinTop - $ScaleSpacing;
275 247
           }
276
-        }
277
-       elseif ( $AxisSettings["Identity"] == AXIS_Y )
278
-        {
279
-         if ( $AxisSettings["Position"] == AXIS_POSITION_LEFT )
280
-          {
248
+        } elseif ( $AxisSettings["Identity"] == AXIS_Y ) {
249
+         if ( $AxisSettings["Position"] == AXIS_POSITION_LEFT ) {
281 250
 
282 251
            if ( $Floating )
283
-            { $FloatingOffset = $XMargin; $this->pChartObject->drawLine($AxisPos["L"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["L"],$this->pChartObject->GraphAreaY2-$AxisSettings["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
284
-           else
252
+            { $FloatingOffset = $XMargin; $this->pChartObject->drawLine($AxisPos["L"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["L"],$this->pChartObject->GraphAreaY2-$AxisSettings["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else
285 253
             { $FloatingOffset = 0; $this->pChartObject->drawLine($AxisPos["L"],$this->pChartObject->GraphAreaY1,$AxisPos["L"],$this->pChartObject->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
286 254
 
287 255
            if ( $DrawArrows ) { $this->pChartObject->drawArrow($AxisPos["L"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["L"],$this->pChartObject->GraphAreaY1-($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
@@ -289,8 +257,7 @@  discard block
 block discarded – undo
289 257
            $Height = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $AxisSettings["Margin"]*2;
290 258
            $Step   = $Height / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MinLeft = $AxisPos["L"];
291 259
            $LastY  = NULL;
292
-           for($i=0;$i<=$AxisSettings["Rows"];$i++)
293
-            {
260
+           for($i=0;$i<=$AxisSettings["Rows"];$i++) {
294 261
              $YPos  = $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"] - $Step*$i;
295 262
              $XPos  = $AxisPos["L"];
296 263
              $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
@@ -311,8 +278,7 @@  discard block
 block discarded – undo
311 278
              $LastY = $YPos;
312 279
             }
313 280
 
314
-           if ( isset($AxisSettings["Name"]) )
315
-            {
281
+           if ( isset($AxisSettings["Name"]) ) {
316 282
              $XPos    = $MinLeft-2;
317 283
              $YPos    = $this->pChartObject->GraphAreaY1+($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1)/2;
318 284
              $Bounds  = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>90));
@@ -322,13 +288,10 @@  discard block
 block discarded – undo
322 288
             }
323 289
 
324 290
            $AxisPos["L"] = $MinLeft - $ScaleSpacing;
325
-          }
326
-         elseif ( $AxisSettings["Position"] == AXIS_POSITION_RIGHT )
327
-          {
291
+          } elseif ( $AxisSettings["Position"] == AXIS_POSITION_RIGHT ) {
328 292
 
329 293
            if ( $Floating )
330
-            { $FloatingOffset = $XMargin; $this->pChartObject->drawLine($AxisPos["R"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["R"],$this->pChartObject->GraphAreaY2-$AxisSettings["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
331
-           else
294
+            { $FloatingOffset = $XMargin; $this->pChartObject->drawLine($AxisPos["R"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["R"],$this->pChartObject->GraphAreaY2-$AxisSettings["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else
332 295
             { $FloatingOffset = 0; $this->pChartObject->drawLine($AxisPos["R"],$this->pChartObject->GraphAreaY1,$AxisPos["R"],$this->pChartObject->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
333 296
 
334 297
            if ( $DrawArrows ) { $this->pChartObject->drawArrow($AxisPos["R"],$this->pChartObject->GraphAreaY1+$AxisSettings["Margin"],$AxisPos["R"],$this->pChartObject->GraphAreaY1-($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
@@ -336,8 +299,7 @@  discard block
 block discarded – undo
336 299
            $Height = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $AxisSettings["Margin"]*2;
337 300
            $Step   = $Height / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MaxLeft = $AxisPos["R"];
338 301
            $LastY  = NULL;
339
-           for($i=0;$i<=$AxisSettings["Rows"];$i++)
340
-            {
302
+           for($i=0;$i<=$AxisSettings["Rows"];$i++) {
341 303
              $YPos  = $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"] - $Step*$i;
342 304
              $XPos  = $AxisPos["R"];
343 305
              $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
@@ -358,8 +320,7 @@  discard block
 block discarded – undo
358 320
              $LastY = $YPos;
359 321
             }
360 322
 
361
-           if ( isset($AxisSettings["Name"]) )
362
-            {
323
+           if ( isset($AxisSettings["Name"]) ) {
363 324
              $XPos    = $MaxLeft+6;
364 325
              $YPos    = $this->pChartObject->GraphAreaY1+($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1)/2;
365 326
              $Bounds  = $this->pChartObject->drawText($XPos,$YPos,$AxisSettings["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>270));
@@ -377,8 +338,7 @@  discard block
 block discarded – undo
377 338
     }
378 339
 
379 340
    /* Draw a scatter plot chart */
380
-   function drawScatterPlotChart($Format=NULL)
381
-    {
341
+   function drawScatterPlotChart($Format=NULL) {
382 342
      $PlotSize		= isset($Format["PlotSize"]) ? $Format["PlotSize"] : 3;
383 343
      $PlotBorder	= isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : FALSE;
384 344
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 250;
@@ -396,18 +356,15 @@  discard block
 block discarded – undo
396 356
 
397 357
      $BorderColor = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
398 358
 
399
-     foreach($Data["ScatterSeries"] as $Key => $Series)
400
-      {
401
-       if ( $Series["isDrawable"] == TRUE )
402
-        {
359
+     foreach($Data["ScatterSeries"] as $Key => $Series) {
360
+       if ( $Series["isDrawable"] == TRUE ) {
403 361
          $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
404 362
          $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
405 363
 
406 364
          if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
407 365
          
408 366
          if ( isset($Series["Picture"]) && $Series["Picture"] != "" )
409
-          { $Picture = $Series["Picture"]; list($PicWidth,$PicHeight,$PicType) = $this->pChartObject->getPicInfo($Picture); }
410
-         else
367
+          { $Picture = $Series["Picture"]; list($PicWidth,$PicHeight,$PicType) = $this->pChartObject->getPicInfo($Picture); } else
411 368
           { $Picture = NULL; }
412 369
 
413 370
          $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
@@ -417,23 +374,18 @@  discard block
 block discarded – undo
417 374
 
418 375
          $Color = array("R"=>$Series["Color"]["R"],"G"=>$Series["Color"]["G"],"B"=>$Series["Color"]["B"],"Alpha"=>$Series["Color"]["Alpha"]);
419 376
 
420
-         foreach($PosArrayX as $Key => $Value)
421
-          {
377
+         foreach($PosArrayX as $Key => $Value) {
422 378
            $X = $Value; $Y = $PosArrayY[$Key];
423 379
 
424
-           if ( $X != VOID && $Y != VOID )
425
-            {
380
+           if ( $X != VOID && $Y != VOID ) {
426 381
              $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key],2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key],2);
427 382
              if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".floor($PlotSize+$BorderSize),$this->pChartObject->toHTMLColor($Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"]),$Description,$RealValue); }
428 383
 
429 384
              if( isset($Series["Shape"]) )
430
-              { $this->pChartObject->drawShape($X,$Y,$Series["Shape"],$PlotSize,$PlotBorder,$BorderSize,$Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"],$Series["Color"]["Alpha"],$BorderR,$BorderG,$BorderB,$BorderAlpha); }
431
-             elseif ( $Picture == NULL )
432
-              {
385
+              { $this->pChartObject->drawShape($X,$Y,$Series["Shape"],$PlotSize,$PlotBorder,$BorderSize,$Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"],$Series["Color"]["Alpha"],$BorderR,$BorderG,$BorderB,$BorderAlpha); } elseif ( $Picture == NULL ) {
433 386
                if ( $PlotBorder ) { $this->pChartObject->drawFilledCircle($X,$Y,$PlotSize+$BorderSize,$BorderColor); }
434 387
                $this->pChartObject->drawFilledCircle($X,$Y,$PlotSize,$Color);
435
-              }
436
-             else
388
+              } else
437 389
               { $this->pChartObject->drawFromPicture($PicType,$Picture,$X-$PicWidth/2,$Y-$PicHeight/2); }
438 390
             }
439 391
           }
@@ -442,8 +394,7 @@  discard block
 block discarded – undo
442 394
     }
443 395
 
444 396
    /* Draw a scatter line chart */
445
-   function drawScatterLineChart($Format=NULL)
446
-    {
397
+   function drawScatterLineChart($Format=NULL) {
447 398
      $Data		= $this->pDataObject->getData();
448 399
      $Palette		= $this->pDataObject->getPalette();
449 400
      $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
@@ -452,10 +403,8 @@  discard block
 block discarded – undo
452 403
      $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
453 404
 
454 405
      /* Parse all the series to draw */
455
-     foreach($Data["ScatterSeries"] as $Key => $Series)
456
-      {
457
-       if ( $Series["isDrawable"] == TRUE )
458
-        {
406
+     foreach($Data["ScatterSeries"] as $Key => $Series) {
407
+       if ( $Series["isDrawable"] == TRUE ) {
459 408
          $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
460 409
          $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
461 410
          $Ticks  = $Series["Ticks"];
@@ -473,12 +422,10 @@  discard block
 block discarded – undo
473 422
          if ( $Weight != 0 ) { $Color["Weight"] = $Weight; }
474 423
 
475 424
          $LastX = VOID; $LastY = VOID;
476
-         foreach($PosArrayX as $Key => $Value)
477
-          {
425
+         foreach($PosArrayX as $Key => $Value) {
478 426
            $X = $Value; $Y = $PosArrayY[$Key];
479 427
 
480
-           if ( $X != VOID && $Y != VOID )
481
-            {
428
+           if ( $X != VOID && $Y != VOID ) {
482 429
              $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key],2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key],2);
483 430
              if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$ImageMapPlotSize,$this->pChartObject->toHTMLColor($Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"]),$Description,$RealValue); }
484 431
             }
@@ -493,8 +440,7 @@  discard block
 block discarded – undo
493 440
     }
494 441
 
495 442
    /* Draw a scatter spline chart */
496
-   function drawScatterSplineChart($Format=NULL)
497
-    {
443
+   function drawScatterSplineChart($Format=NULL) {
498 444
      $Data		= $this->pDataObject->getData();
499 445
      $Palette		= $this->pDataObject->getPalette();
500 446
      $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
@@ -502,10 +448,8 @@  discard block
 block discarded – undo
502 448
      $ImageMapPlotSize	= isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 10;
503 449
      $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
504 450
 
505
-     foreach($Data["ScatterSeries"] as $Key => $Series)
506
-      {
507
-       if ( $Series["isDrawable"] == TRUE )
508
-        {
451
+     foreach($Data["ScatterSeries"] as $Key => $Series) {
452
+       if ( $Series["isDrawable"] == TRUE ) {
509 453
          $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
510 454
          $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
511 455
          $Ticks  = $Series["Ticks"];
@@ -523,13 +467,11 @@  discard block
 block discarded – undo
523 467
          if ( $Weight != 0 ) { $SplineSettings["Weight"] = $Weight; }
524 468
 
525 469
          $LastX = VOID; $LastY = VOID; $WayPoints = ""; $Forces = "";
526
-         foreach($PosArrayX as $Key => $Value)
527
-          {
470
+         foreach($PosArrayX as $Key => $Value) {
528 471
            $X = $Value; $Y = $PosArrayY[$Key];
529 472
            $Force = $this->pChartObject->getLength($LastX,$LastY,$X,$Y)/5;
530 473
 
531
-           if ( $X != VOID && $Y != VOID )
532
-            {
474
+           if ( $X != VOID && $Y != VOID ) {
533 475
              $RealValue = round($Data["Series"][$Series["X"]]["Data"][$Key],2)." / ".round($Data["Series"][$Series["Y"]]["Data"][$Key],2);
534 476
              if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$ImageMapPlotSize,$this->pChartObject->toHTMLColor($Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"]),$Description,$RealValue); }
535 477
             }
@@ -549,21 +491,18 @@  discard block
 block discarded – undo
549 491
     }
550 492
 
551 493
    /* Return the scaled plot position */
552
-   function getPosArray($Values,$AxisID)
553
-    {
494
+   function getPosArray($Values,$AxisID) {
554 495
      $Data = $this->pDataObject->getData();
555 496
 
556 497
      if ( !is_array($Values) ) { $Values = array($Values); }
557 498
 
558
-     if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X )
559
-      {
499
+     if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X ) {
560 500
        $Height      = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $Data["Axis"][$AxisID]["Margin"]*2;
561 501
        $ScaleHeight = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"];
562 502
        $Step        = $Height / $ScaleHeight;
563 503
 
564 504
        $Result = "";
565
-       foreach($Values as $Key => $Value)
566
-        {
505
+       foreach($Values as $Key => $Value) {
567 506
          if ( $Value == VOID ) 
568 507
           $Result[] = VOID;
569 508
          else
@@ -571,16 +510,13 @@  discard block
 block discarded – undo
571 510
         }
572 511
 
573 512
        if ( count($Result) == 1 ) { return($Result[0]); } else { return($Result); }
574
-      }
575
-     else
576
-      {
513
+      } else {
577 514
        $Height      = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $Data["Axis"][$AxisID]["Margin"]*2;
578 515
        $ScaleHeight = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"];
579 516
        $Step        = $Height / $ScaleHeight;
580 517
 
581 518
        $Result = "";
582
-       foreach($Values as $Key => $Value)
583
-        {
519
+       foreach($Values as $Key => $Value) {
584 520
          if ( $Value == VOID ) 
585 521
           $Result[] = VOID;
586 522
          else
@@ -592,8 +528,7 @@  discard block
 block discarded – undo
592 528
     }
593 529
 
594 530
    /* Draw the legend of the active series */
595
-   function drawScatterLegend($X,$Y,$Format="")
596
-    {
531
+   function drawScatterLegend($X,$Y,$Format="") {
597 532
      $Family		= isset($Format["Family"]) ? $Format["Family"] : LEGEND_FAMILY_BOX;
598 533
      $FontName		= isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
599 534
      $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
@@ -621,10 +556,8 @@  discard block
 block discarded – undo
621 556
 
622 557
      $Data = $this->pDataObject->getData();
623 558
 
624
-     foreach($Data["ScatterSeries"] as $Key => $Series)
625
-      {
626
-       if ( $Series["isDrawable"] == TRUE && isset($Series["Picture"]))
627
-        {
559
+     foreach($Data["ScatterSeries"] as $Key => $Series) {
560
+       if ( $Series["isDrawable"] == TRUE && isset($Series["Picture"])) {
628 561
          list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Series["Picture"]);
629 562
          if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; }
630 563
          if ( $IconAreaHeight < $PicHeight ) { $IconAreaHeight = $PicHeight; }
@@ -636,12 +569,9 @@  discard block
 block discarded – undo
636 569
      $XStep = $XSpacing;
637 570
 
638 571
      $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
639
-     foreach($Data["ScatterSeries"] as $Key => $Series)
640
-      {
641
-       if ( $Series["isDrawable"] == TRUE )
642
-        {
643
-         if ( $Mode == LEGEND_VERTICAL )
644
-          {
572
+     foreach($Data["ScatterSeries"] as $Key => $Series) {
573
+       if ( $Series["isDrawable"] == TRUE ) {
574
+         if ( $Mode == LEGEND_VERTICAL ) {
645 575
            $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+4,$vY+$IconAreaHeight/2,$FontName,$FontSize,0,$Series["Description"]);
646 576
 
647 577
            if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
@@ -650,13 +580,10 @@  discard block
 block discarded – undo
650 580
 
651 581
            $Lines = preg_split("/\n/",$Series["Description"]);
652 582
            $vY = $vY + max($this->pChartObject->FontSize*count($Lines),$IconAreaHeight) + 5;
653
-          }
654
-         elseif ( $Mode == LEGEND_HORIZONTAL )
655
-          {
583
+          } elseif ( $Mode == LEGEND_HORIZONTAL ) {
656 584
            $Lines = preg_split("/\n/",$Series["Description"]);
657 585
            $Width = "";
658
-           foreach($Lines as $Key => $Value)
659
-            {
586
+           foreach($Lines as $Key => $Value) {
660 587
              $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+6,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$FontName,$FontSize,0,$Value);
661 588
 
662 589
              if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
@@ -681,57 +608,44 @@  discard block
 block discarded – undo
681 608
       $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));
682 609
 
683 610
      $RestoreShadow = $this->pChartObject->Shadow; $this->Shadow = FALSE;
684
-     foreach($Data["ScatterSeries"] as $Key => $Series)
685
-      {
686
-       if ( $Series["isDrawable"] == TRUE )
687
-        {
611
+     foreach($Data["ScatterSeries"] as $Key => $Series) {
612
+       if ( $Series["isDrawable"] == TRUE ) {
688 613
          $R = $Series["Color"]["R"]; $G = $Series["Color"]["G"]; $B = $Series["Color"]["B"];
689 614
          $Ticks = $Series["Ticks"]; $Weight = $Series["Weight"];
690 615
 
691
-         if ( isset($Series["Picture"]) )
692
-          {
616
+         if ( isset($Series["Picture"]) ) {
693 617
            $Picture = $Series["Picture"];
694 618
            list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Picture);
695 619
            $PicX = $X+$IconAreaWidth/2; $PicY = $Y+$IconAreaHeight/2; 
696 620
 
697 621
            $this->pChartObject->drawFromPNG($PicX-$PicWidth/2,$PicY-$PicHeight/2,$Picture);
698
-          }
699
-         else
700
-          {
701
-           if ( $Family == LEGEND_FAMILY_BOX )
702
-            {
622
+          } else {
623
+           if ( $Family == LEGEND_FAMILY_BOX ) {
703 624
              if ( $BoxWidth != $IconAreaWidth ) { $XOffset = floor(($IconAreaWidth-$BoxWidth)/2); } else { $XOffset = 0; }
704 625
              if ( $BoxHeight != $IconAreaHeight ) { $YOffset = floor(($IconAreaHeight-$BoxHeight)/2); } else { $YOffset = 0; }
705 626
 
706 627
              $this->pChartObject->drawFilledRectangle($X+1+$XOffset,$Y+1+$YOffset,$X+$BoxWidth+$XOffset+1,$Y+$BoxHeight+1+$YOffset,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
707 628
              $this->pChartObject->drawFilledRectangle($X+$XOffset,$Y+$YOffset,$X+$BoxWidth+$XOffset,$Y+$BoxHeight+$YOffset,array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
708
-            }
709
-           elseif ( $Family == LEGEND_FAMILY_CIRCLE )
710
-            {
629
+            } elseif ( $Family == LEGEND_FAMILY_CIRCLE ) {
711 630
              $this->pChartObject->drawFilledCircle($X+1+$IconAreaWidth/2,$Y+1+$IconAreaHeight/2,min($IconAreaHeight/2,$IconAreaWidth/2),array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
712 631
              $this->pChartObject->drawFilledCircle($X+$IconAreaWidth/2,$Y+$IconAreaHeight/2,min($IconAreaHeight/2,$IconAreaWidth/2),array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
713
-            }
714
-           elseif ( $Family == LEGEND_FAMILY_LINE )
715
-            {
632
+            } elseif ( $Family == LEGEND_FAMILY_LINE ) {
716 633
              $this->pChartObject->drawLine($X+1,$Y+1+$IconAreaHeight/2,$X+1+$IconAreaWidth,$Y+1+$IconAreaHeight/2,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20,"Ticks"=>$Ticks,"Weight"=>$Weight));
717 634
              $this->pChartObject->drawLine($X,$Y+$IconAreaHeight/2,$X+$IconAreaWidth,$Y+$IconAreaHeight/2,array("R"=>$R,"G"=>$G,"B"=>$B,"Ticks"=>$Ticks,"Weight"=>$Weight));
718 635
             }
719 636
           }
720 637
 
721
-         if ( $Mode == LEGEND_VERTICAL )
722
-          {
638
+         if ( $Mode == LEGEND_VERTICAL ) {
723 639
            $Lines = preg_split("/\n/",$Series["Description"]);
724
-           foreach($Lines as $Key => $Value)
725
-            $this->pChartObject->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT));
640
+           foreach($Lines as $Key => $Value) {
641
+                       $this->pChartObject->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT));
642
+           }
726 643
 
727 644
            $Y=$Y+max($this->pChartObject->FontSize*count($Lines),$IconAreaHeight) + 5;
728
-          }
729
-         elseif ( $Mode == LEGEND_HORIZONTAL )
730
-          {
645
+          } elseif ( $Mode == LEGEND_HORIZONTAL ) {
731 646
            $Lines = preg_split("/\n/",$Series["Description"]);
732 647
            $Width = "";
733
-           foreach($Lines as $Key => $Value)
734
-            {
648
+           foreach($Lines as $Key => $Value) {
735 649
              $BoxArray = $this->pChartObject->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT));
736 650
              $Width[] = $BoxArray[1]["X"];
737 651
             }
@@ -744,8 +658,7 @@  discard block
 block discarded – undo
744 658
     }
745 659
 
746 660
    /* Get the legend box size */
747
-   function getScatterLegendSize($Format="")
748
-    {
661
+   function getScatterLegendSize($Format="") {
749 662
      $FontName	= isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
750 663
      $FontSize	= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
751 664
      $BoxSize	= isset($Format["BoxSize"]) ? $Format["BoxSize"] : 5;
@@ -760,10 +673,8 @@  discard block
 block discarded – undo
760 673
 
761 674
      $Data = $this->pDataObject->getData();
762 675
 
763
-     foreach($Data["ScatterSeries"] as $Key => $Series)
764
-      {
765
-       if ( $Series["isDrawable"] == TRUE && isset($Series["Picture"]))
766
-        {
676
+     foreach($Data["ScatterSeries"] as $Key => $Series) {
677
+       if ( $Series["isDrawable"] == TRUE && isset($Series["Picture"])) {
767 678
          list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Series["Picture"]);
768 679
          if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; }
769 680
          if ( $IconAreaHeight < $PicHeight ) { $IconAreaHeight = $PicHeight; }
@@ -775,12 +686,9 @@  discard block
 block discarded – undo
775 686
      $XStep = $XSpacing;
776 687
 
777 688
      $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
778
-     foreach($Data["ScatterSeries"] as $Key => $Series)
779
-      {
780
-       if ( $Series["isDrawable"] == TRUE )
781
-        {
782
-         if ( $Mode == LEGEND_VERTICAL )
783
-          {
689
+     foreach($Data["ScatterSeries"] as $Key => $Series) {
690
+       if ( $Series["isDrawable"] == TRUE ) {
691
+         if ( $Mode == LEGEND_VERTICAL ) {
784 692
            $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+4,$vY+$IconAreaHeight/2,$FontName,$FontSize,0,$Series["Description"]);
785 693
 
786 694
            if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
@@ -789,13 +697,10 @@  discard block
 block discarded – undo
789 697
 
790 698
            $Lines = preg_split("/\n/",$Series["Description"]);
791 699
            $vY = $vY + max($this->pChartObject->FontSize*count($Lines),$IconAreaHeight) + 5;
792
-          }
793
-         elseif ( $Mode == LEGEND_HORIZONTAL )
794
-          {
700
+          } elseif ( $Mode == LEGEND_HORIZONTAL ) {
795 701
            $Lines = preg_split("/\n/",$Series["Description"]);
796 702
            $Width = "";
797
-           foreach($Lines as $Key => $Value)
798
-            {
703
+           foreach($Lines as $Key => $Value) {
799 704
              $BoxArray = $this->pChartObject->getTextBox($vX+$IconAreaWidth+6,$Y+$IconAreaHeight/2+(($this->pChartObject->FontSize+3)*$Key),$FontName,$FontSize,0,$Value);
800 705
 
801 706
              if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
@@ -821,16 +726,13 @@  discard block
 block discarded – undo
821 726
     }
822 727
 
823 728
    /* Draw the line of best fit */
824
-   function drawScatterBestFit($Format="")
825
-    {
729
+   function drawScatterBestFit($Format="") {
826 730
      $Ticks	= isset($Format["Ticks"]) ? $Format["Ticks"] : 0;
827 731
 
828 732
      $Data    = $this->pDataObject->getData();
829 733
 
830
-     foreach($Data["ScatterSeries"] as $Key => $Series)
831
-      {
832
-       if ( $Series["isDrawable"] == TRUE )
833
-        {
734
+     foreach($Data["ScatterSeries"] as $Key => $Series) {
735
+       if ( $Series["isDrawable"] == TRUE ) {
834 736
          $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
835 737
          $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
836 738
 
@@ -841,8 +743,7 @@  discard block
 block discarded – undo
841 743
          $PosArrayY = $Data["Series"][$Series["Y"]]["Data"];
842 744
 
843 745
          $Sxy = 0; $Sx = 0; $Sy = 0; $Sxx = 0;
844
-         foreach($PosArrayX as $Key => $Value)
845
-          {
746
+         foreach($PosArrayX as $Key => $Value) {
846 747
            $X = $Value; $Y = $PosArrayY[$Key];
847 748
 
848 749
            $Sxy = $Sxy + $X*$Y;
@@ -853,15 +754,12 @@  discard block
 block discarded – undo
853 754
 
854 755
          $n = count($PosArrayX);
855 756
 
856
-         if ((($n*$Sxx) == ($Sx*$Sx)))
857
-          {
757
+         if ((($n*$Sxx) == ($Sx*$Sx))) {
858 758
            $X1 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMin"],$SerieXAxis);
859 759
            $X2 = $X1;
860 760
            $Y1 = $this->pChartObject->GraphAreaY1;
861 761
            $Y2 = $this->pChartObject->GraphAreaY2;
862
-          }
863
-         else
864
-          {
762
+          } else {
865 763
            $M = (($n*$Sxy)-($Sx*$Sy)) / (($n*$Sxx)-($Sx*$Sx));
866 764
            $B = (($Sy)-($M*$Sx))/($n);
867 765
 
@@ -883,8 +781,7 @@  discard block
 block discarded – undo
883 781
       }
884 782
     }
885 783
 
886
-   function writeScatterLabel($ScatterSerieID,$Points,$Format="")
887
-    {
784
+   function writeScatterLabel($ScatterSerieID,$Points,$Format="") {
888 785
      $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
889 786
      $DrawPoint		= isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
890 787
      $Decimals		= isset($Format["Decimals"]) ? $Format["Decimals"] : NULL;
@@ -906,10 +803,8 @@  discard block
 block discarded – undo
906 803
      $PosArrayY = $this->getPosArray($SerieValuesY,$SerieYAxis);
907 804
      if ( !is_array($PosArrayY) ) { $Value = $PosArrayY; $PosArrayY = ""; $PosArrayY[0] = $Value; }
908 805
 
909
-     foreach($Points as $Key => $Point)
910
-      {
911
-       if ( isset($PosArrayX[$Point]) && isset($PosArrayY[$Point]) )
912
-        {
806
+     foreach($Points as $Key => $Point) {
807
+       if ( isset($PosArrayX[$Point]) && isset($PosArrayY[$Point]) ) {
913 808
          $X = floor($PosArrayX[$Point]);
914 809
          $Y = floor($PosArrayY[$Point]);
915 810
 
@@ -952,8 +847,7 @@  discard block
 block discarded – undo
952 847
     }
953 848
 
954 849
    /* Draw a Scatter threshold */
955
-   function drawScatterThreshold($Value,$Format="")
956
-    {
850
+   function drawScatterThreshold($Value,$Format="") {
957 851
      $AxisID		= isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
958 852
      $R			= isset($Format["R"]) ? $Format["R"] : 255;
959 853
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
@@ -997,51 +891,42 @@  discard block
 block discarded – undo
997 891
 
998 892
      if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); }
999 893
  
1000
-     if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_Y )
1001
-      {
894
+     if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_Y ) {
1002 895
        $X1 = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"];
1003 896
        $X2 = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"];
1004 897
        $Y  = $this->getPosArray($Value,$AxisID);
1005 898
 
1006 899
        $this->pChartObject->drawLine($X1,$Y,$X2,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
1007 900
 
1008
-       if ( $Wide )
1009
-        {
901
+       if ( $Wide ) {
1010 902
          $this->pChartObject->drawLine($X1,$Y-1,$X2,$Y-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1011 903
          $this->pChartObject->drawLine($X1,$Y+1,$X2,$Y+1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1012 904
         }
1013 905
 
1014
-       if ( $WriteCaption )
1015
-        {
906
+       if ( $WriteCaption ) {
1016 907
          if ( $CaptionAlign == CAPTION_LEFT_TOP )
1017
-          { $X = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"] + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
1018
-         else 
908
+          { $X = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"] + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; } else 
1019 909
           { $X = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"] - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
1020 910
 
1021 911
          $this->pChartObject->drawText($X,$Y,$Caption,$CaptionSettings);
1022 912
         }
1023 913
 
1024 914
        return(array("Y"=>$Y));
1025
-      }
1026
-     elseif ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X )
1027
-      {
915
+      } elseif ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X ) {
1028 916
        $X  = $this->getPosArray($Value,$AxisID);
1029 917
        $Y1 = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"];
1030 918
        $Y2 = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"];
1031 919
 
1032 920
        $this->pChartObject->drawLine($X,$Y1,$X,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
1033 921
 
1034
-       if ( $Wide )
1035
-        {
922
+       if ( $Wide ) {
1036 923
          $this->pChartObject->drawLine($X-1,$Y1,$X-1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1037 924
          $this->pChartObject->drawLine($X+1,$Y1,$X+1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
1038 925
         }
1039 926
 
1040
-       if ( $WriteCaption )
1041
-        {
927
+       if ( $WriteCaption ) {
1042 928
          if ( $CaptionAlign == CAPTION_LEFT_TOP )
1043
-          { $Y = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"] + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
1044
-         else 
929
+          { $Y = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"] + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; } else 
1045 930
           { $Y = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"] - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
1046 931
 
1047 932
          $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE;
@@ -1053,8 +938,7 @@  discard block
 block discarded – undo
1053 938
     }
1054 939
 
1055 940
    /* Draw a Scatter threshold area */
1056
-   function drawScatterThresholdArea($Value1,$Value2,$Format="")
1057
-    {
941
+   function drawScatterThresholdArea($Value1,$Value2,$Format="") {
1058 942
      $AxisID	= isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
1059 943
      $R		= isset($Format["R"]) ? $Format["R"] : 255;
1060 944
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
@@ -1085,8 +969,7 @@  discard block
 block discarded – undo
1085 969
 
1086 970
      if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); }
1087 971
  
1088
-     if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X )
1089
-      {
972
+     if ( $Data["Axis"][$AxisID]["Identity"] == AXIS_X ) {
1090 973
        $Y1 = $this->pChartObject->GraphAreaY1 + $Data["Axis"][$AxisID]["Margin"];
1091 974
        $Y2 = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"];
1092 975
        $X1  = $this->getPosArray($Value1,$AxisID);
@@ -1097,19 +980,16 @@  discard block
 block discarded – undo
1097 980
 
1098 981
        $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
1099 982
 
1100
-       if ( $Border )
1101
-        {
983
+       if ( $Border ) {
1102 984
          $this->pChartObject->drawLine($X1,$Y1,$X1,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1103 985
          $this->pChartObject->drawLine($X2,$Y1,$X2,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1104 986
         }
1105 987
 
1106
-       if ( $AreaName != NULL )
1107
-        {
988
+       if ( $AreaName != NULL ) {
1108 989
          $XPos = ($X2-$X1)/2 + $X1;
1109 990
          $YPos = ($Y2-$Y1)/2 + $Y1;
1110 991
 
1111
-         if ( $NameAngle == ZONE_NAME_ANGLE_AUTO )
1112
-          {
992
+         if ( $NameAngle == ZONE_NAME_ANGLE_AUTO ) {
1113 993
            $TxtPos   = $this->pChartObject->getTextBox($XPos,$YPos,$this->pChartObject->FontName,$this->pChartObject->FontSize,0,$AreaName);
1114 994
            $TxtWidth = $TxtPos[1]["X"] - $TxtPos[0]["X"];
1115 995
            if ( abs($X2 - $X1) > $TxtWidth ) { $NameAngle = 0; } else { $NameAngle = 90; }
@@ -1121,9 +1001,7 @@  discard block
 block discarded – undo
1121 1001
 
1122 1002
        $this->pChartObject->Shadow = $RestoreShadow;
1123 1003
        return(array("X1"=>$X1,"X2"=>$X2));
1124
-      }
1125
-     elseif ( $Data["Axis"][$AxisID]["Identity"] == AXIS_Y )
1126
-      {
1004
+      } elseif ( $Data["Axis"][$AxisID]["Identity"] == AXIS_Y ) {
1127 1005
        $X1 = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"];
1128 1006
        $X2 = $this->pChartObject->GraphAreaX2 - $Data["Axis"][$AxisID]["Margin"];
1129 1007
        $Y1 = $this->getPosArray($Value1,$AxisID);
@@ -1134,14 +1012,12 @@  discard block
 block discarded – undo
1134 1012
 
1135 1013
        $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
1136 1014
 
1137
-       if ( $Border )
1138
-        {
1015
+       if ( $Border ) {
1139 1016
          $this->pChartObject->drawLine($X1,$Y1,$X2,$Y1,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1140 1017
          $this->pChartObject->drawLine($X1,$Y2,$X2,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1141 1018
         }
1142 1019
 
1143
-       if ( $AreaName != NULL )
1144
-        {
1020
+       if ( $AreaName != NULL ) {
1145 1021
          $XPos = ($X2-$X1)/2 + $X1;
1146 1022
          $YPos = ($Y2-$Y1)/2 + $Y1;
1147 1023
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
    function drawScatterScale($Format="")
34 34
     {
35 35
      $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : SCALE_MODE_FLOATING;
36
-     $Floating		= isset($Format["Floating"]) ? $Format["Floating"] : FALSE;
36
+     $Floating		= isset($Format["Floating"]) ? $Format["Floating"] : false;
37 37
      $XLabelsRotation	= isset($Format["XLabelsRotation"]) ? $Format["XLabelsRotation"] : 90;
38 38
      $MinDivHeight	= isset($Format["MinDivHeight"]) ? $Format["MinDivHeight"] : 20;
39 39
      $Factors		= isset($Format["Factors"]) ? $Format["Factors"] : array(1,2,5);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      $TickGo		= isset($Format["TickG"]) ? $Format["TickG"] : 0;
59 59
      $TickBo		= isset($Format["TickB"]) ? $Format["TickB"] : 0;
60 60
      $TickAlpha		= isset($Format["TickAlpha"]) ? $Format["TickAlpha"] : 100;
61
-     $DrawSubTicks	= isset($Format["DrawSubTicks"]) ? $Format["DrawSubTicks"] : FALSE;
61
+     $DrawSubTicks	= isset($Format["DrawSubTicks"]) ? $Format["DrawSubTicks"] : false;
62 62
      $InnerSubTickWidth	= isset($Format["InnerSubTickWidth"]) ? $Format["InnerSubTickWidth"] : 0;
63 63
      $OuterSubTickWidth	= isset($Format["OuterSubTickWidth"]) ? $Format["OuterSubTickWidth"] : 2;
64 64
      $SubTickR		= isset($Format["SubTickR"]) ? $Format["SubTickR"] : 255;
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
      $SubTickB		= isset($Format["SubTickB"]) ? $Format["SubTickB"] : 0;
67 67
      $SubTickAlpha	= isset($Format["SubTickAlpha"]) ? $Format["SubTickAlpha"] : 100;
68 68
      $XReleasePercent	= isset($Format["XReleasePercent"]) ? $Format["XReleasePercent"] : 1;
69
-     $DrawArrows	= isset($Format["DrawArrows"]) ? $Format["DrawArrows"] : FALSE;
69
+     $DrawArrows	= isset($Format["DrawArrows"]) ? $Format["DrawArrows"] : false;
70 70
      $ArrowSize         = isset($Format["ArrowSize"]) ? $Format["ArrowSize"] : 8;
71
-     $CycleBackground	= isset($Format["CycleBackground"]) ? $Format["CycleBackground"] : FALSE;
71
+     $CycleBackground	= isset($Format["CycleBackground"]) ? $Format["CycleBackground"] : false;
72 72
      $BackgroundR1	= isset($Format["BackgroundR1"]) ? $Format["BackgroundR1"] : 255;
73 73
      $BackgroundG1	= isset($Format["BackgroundG1"]) ? $Format["BackgroundG1"] : 255;
74 74
      $BackgroundB1	= isset($Format["BackgroundB1"]) ? $Format["BackgroundB1"] : 255;
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
      $BackgroundAlpha2	= isset($Format["BackgroundAlpha2"]) ? $Format["BackgroundAlpha2"] : 10;
80 80
 
81 81
      /* Check if we have at least both one X and Y axis */
82
-     $GotXAxis = FALSE; $GotYAxis = FALSE;
82
+     $GotXAxis = false; $GotYAxis = false;
83 83
      foreach($this->pDataObject->Data["Axis"] as $AxisID => $AxisSettings)
84 84
       {
85
-       if ( $AxisSettings["Identity"] == AXIS_X ) { $GotXAxis = TRUE; }
86
-       if ( $AxisSettings["Identity"] == AXIS_Y ) { $GotYAxis = TRUE; }
85
+       if ( $AxisSettings["Identity"] == AXIS_X ) { $GotXAxis = true; }
86
+       if ( $AxisSettings["Identity"] == AXIS_Y ) { $GotYAxis = true; }
87 87
       }
88 88
      if ( !$GotXAxis ) { return(SCATTER_MISSING_X_SERIE); }
89 89
      if ( !$GotYAxis ) { return(SCATTER_MISSING_Y_SERIE); }
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 
144 144
        if ( isset($Scale["Format"]) ) { $Data["Axis"][$AxisID]["Format"] = $Scale["Format"]; }
145 145
 
146
-       if ( !isset($Data["Axis"][$AxisID]["Display"]) ) { $Data["Axis"][$AxisID]["Display"] = NULL; }
147
-       if ( !isset($Data["Axis"][$AxisID]["Format"]) )  { $Data["Axis"][$AxisID]["Format"] = NULL; }
148
-       if ( !isset($Data["Axis"][$AxisID]["Unit"]) )    { $Data["Axis"][$AxisID]["Unit"] = NULL; }
146
+       if ( !isset($Data["Axis"][$AxisID]["Display"]) ) { $Data["Axis"][$AxisID]["Display"] = null; }
147
+       if ( !isset($Data["Axis"][$AxisID]["Format"]) )  { $Data["Axis"][$AxisID]["Format"] = null; }
148
+       if ( !isset($Data["Axis"][$AxisID]["Unit"]) )    { $Data["Axis"][$AxisID]["Unit"] = null; }
149 149
       }
150 150
 
151 151
      /* Get the default font color */
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
            $Width = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $AxisSettings["Margin"]*2;
190 190
            $Step   = $Width / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MaxBottom = $AxisPos["B"];
191
-           $LastX  = NULL;
191
+           $LastX  = null;
192 192
            for($i=0;$i<=$AxisSettings["Rows"];$i++)
193 193
             {
194 194
              $XPos  = $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"] + $Step*$i;
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
              $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
197 197
 
198 198
              if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
199
-             if ( $LastX != NULL && $CycleBackground  && ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) )) { $this->pChartObject->drawFilledRectangle($LastX,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,$BGColor); }
199
+             if ( $LastX != null && $CycleBackground  && ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) )) { $this->pChartObject->drawFilledRectangle($LastX,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,$BGColor); }
200 200
 
201 201
              if ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) ) { $this->pChartObject->drawLine($XPos,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
202 202
              if ( $DrawSubTicks && $i != $AxisSettings["Rows"] )
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
            $Width = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) - $AxisSettings["Margin"]*2;
240 240
            $Step   = $Width / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MinTop = $AxisPos["T"];
241
-           $LastX  = NULL;
241
+           $LastX  = null;
242 242
            for($i=0;$i<=$AxisSettings["Rows"];$i++)
243 243
             {
244 244
              $XPos  = $this->pChartObject->GraphAreaX1 + $AxisSettings["Margin"] + $Step*$i;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
              $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
247 247
 
248 248
              if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
249
-             if ( $LastX != NULL && $CycleBackground  && ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) )) { $this->pChartObject->drawFilledRectangle($LastX,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,$BGColor); }
249
+             if ( $LastX != null && $CycleBackground  && ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) )) { $this->pChartObject->drawFilledRectangle($LastX,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,$BGColor); }
250 250
 
251 251
              if ( $DrawXLines == ALL || in_array($AxisID,$DrawXLines) ) { $this->pChartObject->drawLine($XPos,$this->pChartObject->GraphAreaY1+$FloatingOffset,$XPos,$this->pChartObject->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
252 252
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
            $Height = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $AxisSettings["Margin"]*2;
290 290
            $Step   = $Height / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MinLeft = $AxisPos["L"];
291
-           $LastY  = NULL;
291
+           $LastY  = null;
292 292
            for($i=0;$i<=$AxisSettings["Rows"];$i++)
293 293
             {
294 294
              $YPos  = $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"] - $Step*$i;
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
              $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
297 297
 
298 298
              if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
299
-             if ( $LastY != NULL && $CycleBackground && ( $DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawFilledRectangle($this->pChartObject->GraphAreaX1+$FloatingOffset,$LastY,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,$BGColor); }
299
+             if ( $LastY != null && $CycleBackground && ( $DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawFilledRectangle($this->pChartObject->GraphAreaX1+$FloatingOffset,$LastY,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,$BGColor); }
300 300
 
301 301
              if ( ($YPos != $this->pChartObject->GraphAreaY1 && $YPos != $this->pChartObject->GraphAreaY2) && ($DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$FloatingOffset,$YPos,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
302 302
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 
336 336
            $Height = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) - $AxisSettings["Margin"]*2;
337 337
            $Step   = $Height / $AxisSettings["Rows"]; $SubTicksSize = $Step /2; $MaxLeft = $AxisPos["R"];
338
-           $LastY  = NULL;
338
+           $LastY  = null;
339 339
            for($i=0;$i<=$AxisSettings["Rows"];$i++)
340 340
             {
341 341
              $YPos  = $this->pChartObject->GraphAreaY2 - $AxisSettings["Margin"] - $Step*$i;
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
              $Value = $this->pChartObject->scaleFormat($AxisSettings["ScaleMin"] + $AxisSettings["RowHeight"]*$i,$AxisSettings["Display"],$AxisSettings["Format"],$AxisSettings["Unit"]);
344 344
 
345 345
              if ( $i%2 == 1 ) { $BGColor = array("R"=>$BackgroundR1,"G"=>$BackgroundG1,"B"=>$BackgroundB1,"Alpha"=>$BackgroundAlpha1); } else { $BGColor = array("R"=>$BackgroundR2,"G"=>$BackgroundG2,"B"=>$BackgroundB2,"Alpha"=>$BackgroundAlpha2); }
346
-             if ( $LastY != NULL && $CycleBackground  && ( $DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawFilledRectangle($this->pChartObject->GraphAreaX1+$FloatingOffset,$LastY,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,$BGColor); }
346
+             if ( $LastY != null && $CycleBackground  && ( $DrawYLines == ALL || in_array($AxisID,$DrawYLines) )) { $this->pChartObject->drawFilledRectangle($this->pChartObject->GraphAreaX1+$FloatingOffset,$LastY,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,$BGColor); }
347 347
 
348 348
              if ( ($YPos != $this->pChartObject->GraphAreaY1 && $YPos != $this->pChartObject->GraphAreaY2) && ($DrawYLines == ALL || in_array($AxisID,$DrawYLines)) ) { $this->pChartObject->drawLine($this->pChartObject->GraphAreaX1+$FloatingOffset,$YPos,$this->pChartObject->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
349 349
 
@@ -377,18 +377,18 @@  discard block
 block discarded – undo
377 377
     }
378 378
 
379 379
    /* Draw a scatter plot chart */
380
-   function drawScatterPlotChart($Format=NULL)
380
+   function drawScatterPlotChart($Format=null)
381 381
     {
382 382
      $PlotSize		= isset($Format["PlotSize"]) ? $Format["PlotSize"] : 3;
383
-     $PlotBorder	= isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : FALSE;
383
+     $PlotBorder	= isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : false;
384 384
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 250;
385 385
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 250;
386 386
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 250;
387 387
      $BorderAlpha	= isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30;
388 388
      $BorderSize	= isset($Format["BorderSize"]) ? $Format["BorderSize"] : 1;
389
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
390
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
391
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
389
+     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : null;
390
+     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
391
+     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : null;
392 392
      $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
393 393
 
394 394
      $Data    = $this->pDataObject->getData();
@@ -398,17 +398,17 @@  discard block
 block discarded – undo
398 398
 
399 399
      foreach($Data["ScatterSeries"] as $Key => $Series)
400 400
       {
401
-       if ( $Series["isDrawable"] == TRUE )
401
+       if ( $Series["isDrawable"] == true )
402 402
         {
403 403
          $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
404 404
          $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
405 405
 
406
-         if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
406
+         if ( $ImageMapTitle == null ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
407 407
          
408 408
          if ( isset($Series["Picture"]) && $Series["Picture"] != "" )
409 409
           { $Picture = $Series["Picture"]; list($PicWidth,$PicHeight,$PicType) = $this->pChartObject->getPicInfo($Picture); }
410 410
          else
411
-          { $Picture = NULL; }
411
+          { $Picture = null; }
412 412
 
413 413
          $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
414 414
          if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 
429 429
              if( isset($Series["Shape"]) )
430 430
               { $this->pChartObject->drawShape($X,$Y,$Series["Shape"],$PlotSize,$PlotBorder,$BorderSize,$Series["Color"]["R"],$Series["Color"]["G"],$Series["Color"]["B"],$Series["Color"]["Alpha"],$BorderR,$BorderG,$BorderB,$BorderAlpha); }
431
-             elseif ( $Picture == NULL )
431
+             elseif ( $Picture == null )
432 432
               {
433 433
                if ( $PlotBorder ) { $this->pChartObject->drawFilledCircle($X,$Y,$PlotSize+$BorderSize,$BorderColor); }
434 434
                $this->pChartObject->drawFilledCircle($X,$Y,$PlotSize,$Color);
@@ -442,26 +442,26 @@  discard block
 block discarded – undo
442 442
     }
443 443
 
444 444
    /* Draw a scatter line chart */
445
-   function drawScatterLineChart($Format=NULL)
445
+   function drawScatterLineChart($Format=null)
446 446
     {
447 447
      $Data		= $this->pDataObject->getData();
448 448
      $Palette		= $this->pDataObject->getPalette();
449
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
450
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
449
+     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
450
+     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : null;
451 451
      $ImageMapPlotSize	= isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 10;
452 452
      $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
453 453
 
454 454
      /* Parse all the series to draw */
455 455
      foreach($Data["ScatterSeries"] as $Key => $Series)
456 456
       {
457
-       if ( $Series["isDrawable"] == TRUE )
457
+       if ( $Series["isDrawable"] == true )
458 458
         {
459 459
          $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
460 460
          $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
461 461
          $Ticks  = $Series["Ticks"];
462 462
          $Weight = $Series["Weight"];
463 463
 
464
-         if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
464
+         if ( $ImageMapTitle == null ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
465 465
 
466 466
          $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
467 467
          if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
@@ -493,25 +493,25 @@  discard block
 block discarded – undo
493 493
     }
494 494
 
495 495
    /* Draw a scatter spline chart */
496
-   function drawScatterSplineChart($Format=NULL)
496
+   function drawScatterSplineChart($Format=null)
497 497
     {
498 498
      $Data		= $this->pDataObject->getData();
499 499
      $Palette		= $this->pDataObject->getPalette();
500
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
501
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : NULL;
500
+     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
501
+     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : null;
502 502
      $ImageMapPlotSize	= isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 10;
503 503
      $ImageMapPrecision = isset($Format["ImageMapPrecision"]) ? $Format["ImageMapPrecision"] : 2;
504 504
 
505 505
      foreach($Data["ScatterSeries"] as $Key => $Series)
506 506
       {
507
-       if ( $Series["isDrawable"] == TRUE )
507
+       if ( $Series["isDrawable"] == true )
508 508
         {
509 509
          $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
510 510
          $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
511 511
          $Ticks  = $Series["Ticks"];
512 512
          $Weight = $Series["Weight"];
513 513
 
514
-         if ( $ImageMapTitle == NULL ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
514
+         if ( $ImageMapTitle == null ) { $Description = $Data["Series"][$Series["X"]]["Description"]." / ".$Data["Series"][$Series["Y"]]["Description"]; } else { $Description = $ImageMapTitle; }
515 515
 
516 516
          $PosArrayX = $this->getPosArray($SerieValuesX,$SerieXAxis);
517 517
          if ( !is_array($PosArrayX) ) { $Value = $PosArrayX; $PosArrayX = ""; $PosArrayX[0] = $Value; }
@@ -613,17 +613,17 @@  discard block
 block discarded – undo
613 613
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
614 614
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
615 615
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
616
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
616
+     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : null;
617 617
      $Style		= isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND;
618 618
      $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
619 619
 
620
-     if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
620
+     if ( $Surrounding != null ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
621 621
 
622 622
      $Data = $this->pDataObject->getData();
623 623
 
624 624
      foreach($Data["ScatterSeries"] as $Key => $Series)
625 625
       {
626
-       if ( $Series["isDrawable"] == TRUE && isset($Series["Picture"]))
626
+       if ( $Series["isDrawable"] == true && isset($Series["Picture"]))
627 627
         {
628 628
          list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Series["Picture"]);
629 629
          if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; }
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
      $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
639 639
      foreach($Data["ScatterSeries"] as $Key => $Series)
640 640
       {
641
-       if ( $Series["isDrawable"] == TRUE )
641
+       if ( $Series["isDrawable"] == true )
642 642
         {
643 643
          if ( $Mode == LEGEND_VERTICAL )
644 644
           {
@@ -680,10 +680,10 @@  discard block
 block discarded – undo
680 680
      elseif ( $Style == LEGEND_BOX )
681 681
       $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));
682 682
 
683
-     $RestoreShadow = $this->pChartObject->Shadow; $this->Shadow = FALSE;
683
+     $RestoreShadow = $this->pChartObject->Shadow; $this->Shadow = false;
684 684
      foreach($Data["ScatterSeries"] as $Key => $Series)
685 685
       {
686
-       if ( $Series["isDrawable"] == TRUE )
686
+       if ( $Series["isDrawable"] == true )
687 687
         {
688 688
          $R = $Series["Color"]["R"]; $G = $Series["Color"]["G"]; $B = $Series["Color"]["B"];
689 689
          $Ticks = $Series["Ticks"]; $Weight = $Series["Weight"];
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 
763 763
      foreach($Data["ScatterSeries"] as $Key => $Series)
764 764
       {
765
-       if ( $Series["isDrawable"] == TRUE && isset($Series["Picture"]))
765
+       if ( $Series["isDrawable"] == true && isset($Series["Picture"]))
766 766
         {
767 767
          list($PicWidth,$PicHeight) = $this->pChartObject->getPicInfo($Series["Picture"]);
768 768
          if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; }
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
      $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
778 778
      foreach($Data["ScatterSeries"] as $Key => $Series)
779 779
       {
780
-       if ( $Series["isDrawable"] == TRUE )
780
+       if ( $Series["isDrawable"] == true )
781 781
         {
782 782
          if ( $Mode == LEGEND_VERTICAL )
783 783
           {
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 
830 830
      foreach($Data["ScatterSeries"] as $Key => $Series)
831 831
       {
832
-       if ( $Series["isDrawable"] == TRUE )
832
+       if ( $Series["isDrawable"] == true )
833 833
         {
834 834
          $SerieX = $Series["X"]; $SerieValuesX = $Data["Series"][$SerieX]["Data"]; $SerieXAxis = $Data["Series"][$SerieX]["Axis"];
835 835
          $SerieY = $Series["Y"]; $SerieValuesY = $Data["Series"][$SerieY]["Data"]; $SerieYAxis = $Data["Series"][$SerieY]["Axis"];
@@ -885,9 +885,9 @@  discard block
 block discarded – undo
885 885
 
886 886
    function writeScatterLabel($ScatterSerieID,$Points,$Format="")
887 887
     {
888
-     $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
888
+     $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : null;
889 889
      $DrawPoint		= isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
890
-     $Decimals		= isset($Format["Decimals"]) ? $Format["Decimals"] : NULL;
890
+     $Decimals		= isset($Format["Decimals"]) ? $Format["Decimals"] : null;
891 891
 
892 892
      $Data    = $this->pDataObject->getData();
893 893
      $Palette = $this->pDataObject->getPalette();
@@ -927,13 +927,13 @@  discard block
 block discarded – undo
927 927
          $XAxisMode   = $Data["Axis"][$SerieXAxis]["Display"];
928 928
          $XAxisFormat = $Data["Axis"][$SerieXAxis]["Format"];
929 929
          $XAxisUnit   = $Data["Axis"][$SerieXAxis]["Unit"];
930
-         if ( $Decimals == NULL ) { $XValue = $SerieValuesX[$Point]; } else { $XValue = round($SerieValuesX[$Point],$Decimals); }
930
+         if ( $Decimals == null ) { $XValue = $SerieValuesX[$Point]; } else { $XValue = round($SerieValuesX[$Point],$Decimals); }
931 931
          $XValue      = $this->pChartObject->scaleFormat($XValue,$XAxisMode,$XAxisFormat,$XAxisUnit);
932 932
 
933 933
          $YAxisMode   = $Data["Axis"][$SerieYAxis]["Display"];
934 934
          $YAxisFormat = $Data["Axis"][$SerieYAxis]["Format"];
935 935
          $YAxisUnit   = $Data["Axis"][$SerieYAxis]["Unit"];
936
-         if ( $Decimals == NULL ) { $YValue = $SerieValuesY[$Point]; } else { $YValue = round($SerieValuesY[$Point],$Decimals); }
936
+         if ( $Decimals == null ) { $YValue = $SerieValuesY[$Point]; } else { $YValue = round($SerieValuesY[$Point],$Decimals); }
937 937
          $YValue      = $this->pChartObject->scaleFormat($YValue,$YAxisMode,$YAxisFormat,$YAxisUnit);
938 938
 
939 939
          $Caption = $XValue." / ".$YValue;
@@ -959,22 +959,22 @@  discard block
 block discarded – undo
959 959
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
960 960
      $B			= isset($Format["B"]) ? $Format["B"] : 0;
961 961
      $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 50;
962
-     $Weight		= isset($Format["Weight"]) ? $Format["Weight"] : NULL;
962
+     $Weight		= isset($Format["Weight"]) ? $Format["Weight"] : null;
963 963
      $Ticks		= isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
964
-     $Wide		= isset($Format["Wide"]) ? $Format["Wide"] : FALSE;
964
+     $Wide		= isset($Format["Wide"]) ? $Format["Wide"] : false;
965 965
      $WideFactor	= isset($Format["WideFactor"]) ? $Format["WideFactor"] : 5;
966
-     $WriteCaption	= isset($Format["WriteCaption"]) ? $Format["WriteCaption"] : FALSE;
967
-     $Caption		= isset($Format["Caption"]) ? $Format["Caption"] : NULL;
966
+     $WriteCaption	= isset($Format["WriteCaption"]) ? $Format["WriteCaption"] : false;
967
+     $Caption		= isset($Format["Caption"]) ? $Format["Caption"] : null;
968 968
      $CaptionAlign	= isset($Format["CaptionAlign"]) ? $Format["CaptionAlign"] : CAPTION_LEFT_TOP;
969 969
      $CaptionOffset     = isset($Format["CaptionOffset"]) ? $Format["CaptionOffset"] : 10;
970 970
      $CaptionR		= isset($Format["CaptionR"]) ? $Format["CaptionR"] : 255;
971 971
      $CaptionG		= isset($Format["CaptionG"]) ? $Format["CaptionG"] : 255;
972 972
      $CaptionB		= isset($Format["CaptionB"]) ? $Format["CaptionB"] : 255;
973 973
      $CaptionAlpha	= isset($Format["CaptionAlpha"]) ? $Format["CaptionAlpha"] : 100;
974
-     $DrawBox		= isset($Format["DrawBox"]) ? $Format["DrawBox"] : TRUE;
975
-     $DrawBoxBorder	= isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : FALSE;
974
+     $DrawBox		= isset($Format["DrawBox"]) ? $Format["DrawBox"] : true;
975
+     $DrawBoxBorder	= isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : false;
976 976
      $BorderOffset	= isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 5;
977
-     $BoxRounded	= isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : TRUE;
977
+     $BoxRounded	= isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : true;
978 978
      $RoundedRadius	= isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 3;
979 979
      $BoxR		= isset($Format["BoxR"]) ? $Format["BoxR"] : 0;
980 980
      $BoxG		= isset($Format["BoxG"]) ? $Format["BoxG"] : 0;
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
                               "BoxBorderR"=>$BoxBorderR,"BoxBorderG"=>$BoxBorderG,"BoxBorderB"=>$BoxBorderB,"BoxBorderAlpha"=>$BoxBorderAlpha,
992 992
                               "R"=>$CaptionR,"G"=>$CaptionG,"B"=>$CaptionB,"Alpha"=>$CaptionAlpha);
993 993
 
994
-     if ( $Caption == NULL ) { $Caption = $Value; }
994
+     if ( $Caption == null ) { $Caption = $Value; }
995 995
 
996 996
      $Data = $this->pDataObject->getData();
997 997
 
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
1061 1061
      $B		= isset($Format["B"]) ? $Format["B"] : 0;
1062 1062
      $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 20;
1063
-     $Border    = isset($Format["Border"]) ? $Format["Border"] : TRUE;
1063
+     $Border    = isset($Format["Border"]) ? $Format["Border"] : true;
1064 1064
      $BorderR   = isset($Format["BorderR"]) ? $Format["BorderR"] : $R;
1065 1065
      $BorderG   = isset($Format["BorderG"]) ? $Format["BorderG"] : $G;
1066 1066
      $BorderB   = isset($Format["BorderB"]) ? $Format["BorderB"] : $B;
@@ -1072,12 +1072,12 @@  discard block
 block discarded – undo
1072 1072
      $NameG	= isset($Format["NameG"]) ? $Format["NameG"] : 255;
1073 1073
      $NameB	= isset($Format["NameB"]) ? $Format["NameB"] : 255;
1074 1074
      $NameAlpha	= isset($Format["NameAlpha"]) ? $Format["NameAlpha"] : 100;
1075
-     $DisableShadowOnArea = isset($Format["DisableShadowOnArea"]) ? $Format["DisableShadowOnArea"] : TRUE;
1075
+     $DisableShadowOnArea = isset($Format["DisableShadowOnArea"]) ? $Format["DisableShadowOnArea"] : true;
1076 1076
 
1077 1077
      if ($Value1 > $Value2) { list($Value1, $Value2) = array($Value2, $Value1); }
1078 1078
 
1079 1079
      $RestoreShadow = $this->pChartObject->Shadow;
1080
-     if ( $DisableShadowOnArea && $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = FALSE; }
1080
+     if ( $DisableShadowOnArea && $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = false; }
1081 1081
 
1082 1082
      if ($BorderAlpha >100) { $BorderAlpha = 100;}
1083 1083
 
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
          $this->pChartObject->drawLine($X2,$Y1,$X2,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1104 1104
         }
1105 1105
 
1106
-       if ( $AreaName != NULL )
1106
+       if ( $AreaName != null )
1107 1107
         {
1108 1108
          $XPos = ($X2-$X1)/2 + $X1;
1109 1109
          $YPos = ($Y2-$Y1)/2 + $Y1;
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
           }
1117 1117
          $this->pChartObject->Shadow = $RestoreShadow;
1118 1118
          $this->pChartObject->drawText($XPos,$YPos,$AreaName,array("R"=>$NameR,"G"=>$NameG,"B"=>$NameB,"Alpha"=>$NameAlpha,"Angle"=>$NameAngle,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
1119
-         if ( $DisableShadowOnArea ) { $this->pChartObject->Shadow = FALSE; }
1119
+         if ( $DisableShadowOnArea ) { $this->pChartObject->Shadow = false; }
1120 1120
         }
1121 1121
 
1122 1122
        $this->pChartObject->Shadow = $RestoreShadow;
@@ -1140,14 +1140,14 @@  discard block
 block discarded – undo
1140 1140
          $this->pChartObject->drawLine($X1,$Y2,$X2,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
1141 1141
         }
1142 1142
 
1143
-       if ( $AreaName != NULL )
1143
+       if ( $AreaName != null )
1144 1144
         {
1145 1145
          $XPos = ($X2-$X1)/2 + $X1;
1146 1146
          $YPos = ($Y2-$Y1)/2 + $Y1;
1147 1147
 
1148 1148
          $this->pChartObject->Shadow = $RestoreShadow;
1149 1149
          $this->pChartObject->drawText($YPos,$XPos,$AreaName,array("R"=>$NameR,"G"=>$NameG,"B"=>$NameB,"Alpha"=>$NameAlpha,"Angle"=>0,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
1150
-         if ( $DisableShadowOnArea ) { $this->Shadow = FALSE; }
1150
+         if ( $DisableShadowOnArea ) { $this->Shadow = false; }
1151 1151
         }
1152 1152
 
1153 1153
        $this->pChartObject->Shadow = $RestoreShadow;
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pSplit.class.php 4 patches
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.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  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 19
  /* pSplit class definition */
20 20
  class pSplit
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
     { }
27 27
 
28 28
    /* Create the encoded string */
29
-   function drawSplitPath($Object,$Values,$Format="")
29
+   function drawSplitPath($Object, $Values, $Format = "")
30 30
     {
31 31
      $this->pChartObject = $Object;
32 32
 
33 33
      $Spacing		= isset($Format["Spacing"]) ? $Format["Spacing"] : 20;
34
-     $TextPadding	= isset($Format["TextPadding"]) ? $Format["TextPadding"] : 2;
34
+     $TextPadding = isset($Format["TextPadding"]) ? $Format["TextPadding"] : 2;
35 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;
36
+     $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
37
+     $Force = isset($Format["Force"]) ? $Format["Force"] : 70;
38 38
      $Segments		= isset($Format["Segments"]) ? $Format["Segments"] : 15;
39 39
      $FontSize		= $Object->FontSize;
40 40
      $X1		= $Object->GraphAreaX1;
@@ -49,79 +49,79 @@  discard block
 block discarded – undo
49 49
      $LabelSerie = $Data["Abscissa"];
50 50
      $DataSerie  = "";
51 51
 
52
-     foreach($Data["Series"] as $SerieName => $Value)
53
-      { if ( $SerieName != $LabelSerie && $DataSerie == "" ) { $DataSerie = $SerieName; } }
52
+     foreach ($Data["Series"] as $SerieName => $Value)
53
+      { if ($SerieName != $LabelSerie && $DataSerie == "") { $DataSerie = $SerieName; } }
54 54
 
55 55
      $DataSerieSum   = array_sum($Data["Series"][$DataSerie]["Data"]);
56 56
      $DataSerieCount = count($Data["Series"][$DataSerie]["Data"]);
57 57
 
58 58
      /* Scale Processing */
59
-     if ( $TextPos == TEXT_POS_RIGHT )
60
-      $YScale     = (($Y2-$Y1) - (($DataSerieCount+1)*$Spacing)) / $DataSerieSum;
59
+     if ($TextPos == TEXT_POS_RIGHT)
60
+      $YScale     = (($Y2 - $Y1) - (($DataSerieCount + 1)*$Spacing))/$DataSerieSum;
61 61
      else
62
-      $YScale     = (($Y2-$Y1) - ($DataSerieCount*$Spacing)) / $DataSerieSum;
63
-     $LeftHeight = $DataSerieSum * $YScale;
62
+      $YScale     = (($Y2 - $Y1) - ($DataSerieCount*$Spacing))/$DataSerieSum;
63
+     $LeftHeight = $DataSerieSum*$YScale;
64 64
 
65 65
      /* Re-compute graph width depending of the text mode choosen */
66
-     if ( $TextPos == TEXT_POS_RIGHT )
66
+     if ($TextPos == TEXT_POS_RIGHT)
67 67
       {
68 68
        $MaxWidth = 0;
69
-       foreach($Data["Series"][$LabelSerie]["Data"] as $Key => $Label)
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 73
         }
74 74
        $X2 = $X2 - $MaxWidth;
75 75
       }
76 76
 
77 77
      /* Drawing */
78
-     $LeftY    = ((($Y2-$Y1) / 2) + $Y1) - ($LeftHeight/2);
78
+     $LeftY    = ((($Y2 - $Y1)/2) + $Y1) - ($LeftHeight/2);
79 79
      $RightY   = $Y1;
80
-     $VectorX  = (($X2-$X1) / 2);
80
+     $VectorX  = (($X2 - $X1)/2);
81 81
 
82
-     foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
82
+     foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
83 83
       {
84
-       if ( isset($Data["Series"][$LabelSerie]["Data"][$Key]) )
84
+       if (isset($Data["Series"][$LabelSerie]["Data"][$Key]))
85 85
         $Label = $Data["Series"][$LabelSerie]["Data"][$Key];
86 86
        else
87 87
         $Label = "-";
88 88
 
89 89
        $LeftY1 = $LeftY;
90
-       $LeftY2 = $LeftY + $Value * $YScale;
90
+       $LeftY2 = $LeftY + $Value*$YScale;
91 91
 
92 92
        $RightY1 = $RightY + $Spacing;
93
-       $RightY2 = $RightY + $Spacing + $Value * $YScale;;
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 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);
115
+       $Points = $Object->drawBezier($X1, $LeftY2, $X2, $RightY2, $VectorX1, $VectorY1, $VectorX2, $VectorY2, $Settings);
116 116
        $Points = array_reverse($Points);
117
-       foreach($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
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 )
122
-        $Object->drawText($X2+$TextPadding,($RightY2-$RightY1)/2+$RightY1,$Label,array("Align"=>TEXT_ALIGN_MIDDLELEFT));
121
+       if ($TextPos == TEXT_POS_RIGHT)
122
+        $Object->drawText($X2 + $TextPadding, ($RightY2 - $RightY1)/2 + $RightY1, $Label, array("Align"=>TEXT_ALIGN_MIDDLELEFT));
123 123
        else
124
-        $Object->drawText($X2,$RightY1-$TextPadding,$Label,array("Align"=>TEXT_ALIGN_BOTTOMRIGHT));
124
+        $Object->drawText($X2, $RightY1 - $TextPadding, $Label, array("Align"=>TEXT_ALIGN_BOTTOMRIGHT));
125 125
 
126 126
        $LeftY  = $LeftY2;
127 127
        $RightY = $RightY2;
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
  define("TEXT_POS_RIGHT"	, 690002);
18 18
 
19 19
  /* pSplit class definition */
20
- class pSplit
21
-  {
20
+ class pSplit {
22 21
    var $pChartObject;
23 22
 
24 23
    /* Class creator */
@@ -26,8 +25,7 @@  discard block
 block discarded – undo
26 25
     { }
27 26
 
28 27
    /* Create the encoded string */
29
-   function drawSplitPath($Object,$Values,$Format="")
30
-    {
28
+   function drawSplitPath($Object,$Values,$Format="") {
31 29
      $this->pChartObject = $Object;
32 30
 
33 31
      $Spacing		= isset($Format["Spacing"]) ? $Format["Spacing"] : 20;
@@ -63,11 +61,9 @@  discard block
 block discarded – undo
63 61
      $LeftHeight = $DataSerieSum * $YScale;
64 62
 
65 63
      /* Re-compute graph width depending of the text mode choosen */
66
-     if ( $TextPos == TEXT_POS_RIGHT )
67
-      {
64
+     if ( $TextPos == TEXT_POS_RIGHT ) {
68 65
        $MaxWidth = 0;
69
-       foreach($Data["Series"][$LabelSerie]["Data"] as $Key => $Label)
70
-        {
66
+       foreach($Data["Series"][$LabelSerie]["Data"] as $Key => $Label) {
71 67
          $Boundardies = $Object->getTextBox(0,0,$Object->FontName,$Object->FontSize,0,$Label);
72 68
          if ( $Boundardies[1]["X"] > $MaxWidth ) { $MaxWidth = $Boundardies[1]["X"] + $TextPadding*2; }
73 69
         }
@@ -79,8 +75,7 @@  discard block
 block discarded – undo
79 75
      $RightY   = $Y1;
80 76
      $VectorX  = (($X2-$X1) / 2);
81 77
 
82
-     foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
83
-      {
78
+     foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value) {
84 79
        if ( isset($Data["Series"][$LabelSerie]["Data"][$Key]) )
85 80
         $Label = $Data["Series"][$LabelSerie]["Data"][$Key];
86 81
        else
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      $Spacing		= isset($Format["Spacing"]) ? $Format["Spacing"] : 20;
34 34
      $TextPadding	= isset($Format["TextPadding"]) ? $Format["TextPadding"] : 2;
35 35
      $TextPos		= isset($Format["TextPos"]) ? $Format["TextPos"] : TEXT_POS_TOP;
36
-     $Surrounding       = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
36
+     $Surrounding       = isset($Format["Surrounding"]) ? $Format["Surrounding"] : null;
37 37
      $Force		= isset($Format["Force"]) ? $Format["Force"] : 70;
38 38
      $Segments		= isset($Format["Segments"]) ? $Format["Segments"] : 15;
39 39
      $FontSize		= $Object->FontSize;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
        $RightY1 = $RightY + $Spacing;
93 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 97
        $PolyGon = "";
98 98
 
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pImage.class.php 4 patches
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.
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -21,93 +21,93 @@  discard block
 block discarded – undo
21 21
   }
22 22
 
23 23
  /* Image map handling */
24
- define("IMAGE_MAP_STORAGE_FILE"	, 680001);
25
- define("IMAGE_MAP_STORAGE_SESSION"	, 680002);
24
+ define("IMAGE_MAP_STORAGE_FILE", 680001);
25
+ define("IMAGE_MAP_STORAGE_SESSION", 680002);
26 26
 
27 27
  /* Last generated chart layout */
28
- define("CHART_LAST_LAYOUT_REGULAR"	, 680011);
29
- define("CHART_LAST_LAYOUT_STACKED"	, 680012);
28
+ define("CHART_LAST_LAYOUT_REGULAR", 680011);
29
+ define("CHART_LAST_LAYOUT_STACKED", 680012);
30 30
 
31 31
  /* ImageMap string delimiter */
32
- define("IMAGE_MAP_DELIMITER"		, chr(1));
32
+ define("IMAGE_MAP_DELIMITER", chr(1));
33 33
 
34 34
  class pImage extends pDraw
35 35
   {
36 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
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 44
 
45 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
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 50
 
51 51
    /* Scale settings */
52
-   var $ScaleMinDivHeight = 20;				// Minimum height for scame divs
52
+   var $ScaleMinDivHeight = 20; // Minimum height for scame divs
53 53
 
54 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
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 62
 
63 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
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 71
 
72 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
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 77
 
78 78
    /* Data Set */
79
-   var $DataSet		= NULL;				// Attached dataset
79
+   var $DataSet = NULL; // Attached dataset
80 80
 
81 81
    /* Last generated chart info */
82
-   var $LastChartLayout	= CHART_LAST_LAYOUT_REGULAR;	// Last layout : regular or stacked
82
+   var $LastChartLayout = CHART_LAST_LAYOUT_REGULAR; // Last layout : regular or stacked
83 83
 
84 84
    /* Class constructor */
85
-   function pImage($XSize,$YSize,$DataSet=NULL,$TransparentBackground=FALSE)
85
+   function pImage($XSize, $YSize, $DataSet = NULL, $TransparentBackground = FALSE)
86 86
     {
87 87
      $this->TransparentBackground = $TransparentBackground;
88 88
 
89
-     if ( $DataSet != NULL ) { $this->DataSet = $DataSet; }
89
+     if ($DataSet != NULL) { $this->DataSet = $DataSet; }
90 90
 
91 91
      $this->XSize   = $XSize;
92 92
      $this->YSize   = $YSize;
93
-     $this->Picture = imagecreatetruecolor($XSize,$YSize);
93
+     $this->Picture = imagecreatetruecolor($XSize, $YSize);
94 94
 
95
-     if ( $this->TransparentBackground )
95
+     if ($this->TransparentBackground)
96 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); 
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 101
       }
102 102
      else
103 103
       {
104
-       $C_White = $this->AllocateColor($this->Picture,255,255,255);
105
-       imagefilledrectangle($this->Picture,0,0,$XSize,$YSize,$C_White);
104
+       $C_White = $this->AllocateColor($this->Picture, 255, 255, 255);
105
+       imagefilledrectangle($this->Picture, 0, 0, $XSize, $YSize, $C_White);
106 106
       }
107 107
     }
108 108
 
109 109
    /* Enable / Disable and set shadow properties */
110
-   function setShadow($Enabled=TRUE,$Format="")
110
+   function setShadow($Enabled = TRUE, $Format = "")
111 111
     {
112 112
      $X	    = isset($Format["X"]) ? $Format["X"] : 2;
113 113
      $Y	    = isset($Format["Y"]) ? $Format["Y"] : 2;
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
     }
127 127
 
128 128
    /* Set the graph area position */
129
-   function setGraphArea($X1,$Y1,$X2,$Y2)
129
+   function setGraphArea($X1, $Y1, $X2, $Y2)
130 130
     {
131
-     if ( $X2 < $X1 || $X1 == $X2 || $Y2 < $Y1 || $Y1 == $Y2 ) { return(-1); }
131
+     if ($X2 < $X1 || $X1 == $X2 || $Y2 < $Y1 || $Y1 == $Y2) { return(-1); }
132 132
 
133 133
      $this->GraphAreaX1 = $X1; $this->DataSet->Data["GraphArea"]["X1"] = $X1;
134 134
      $this->GraphAreaY1 = $Y1; $this->DataSet->Data["GraphArea"]["Y1"] = $Y1;
@@ -147,16 +147,16 @@  discard block
 block discarded – undo
147 147
    /* Render the picture to a file */
148 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 154
    /* Render the picture to a web browser stream */
155
-   function stroke($BrowserExpire=FALSE)
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 )
159
+     if ($BrowserExpire)
160 160
       {
161 161
        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
162 162
        header("Cache-Control: no-cache");
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     }
169 169
 
170 170
    /* Automatic output method based on the calling interface */
171
-   function autoOutput($FileName="output.png")
171
+   function autoOutput($FileName = "output.png")
172 172
     {
173 173
      if (php_sapi_name() == "cli")
174 174
       $this->Render($FileName);
@@ -177,86 +177,86 @@  discard block
 block discarded – undo
177 177
     }
178 178
 
179 179
    /* Return the length between two points */
180
-   function getLength($X1,$Y1,$X2,$Y2)
181
-    { return(sqrt(pow(max($X1,$X2)-min($X1,$X2),2)+pow(max($Y1,$Y2)-min($Y1,$Y2),2))); }
180
+   function getLength($X1, $Y1, $X2, $Y2)
181
+    { return(sqrt(pow(max($X1, $X2) - min($X1, $X2), 2) + pow(max($Y1, $Y2) - min($Y1, $Y2), 2))); }
182 182
 
183 183
    /* Return the orientation of a line */
184
-   function getAngle($X1,$Y1,$X2,$Y2)
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 190
    /* Return the surrounding box of text area */
191
-   function getTextBox_deprecated($X,$Y,$FontName,$FontSize,$Angle,$Text)
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 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"];
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 205
      return($RealPos);
206 206
     }
207 207
 
208 208
    /* Return the surrounding box of text area */
209
-   function getTextBox($X,$Y,$FontName,$FontSize,$Angle,$Text)
209
+   function getTextBox($X, $Y, $FontName, $FontSize, $Angle, $Text)
210 210
     {
211 211
      $coords = imagettfbbox($FontSize, 0, $FontName, $Text);
212 212
 
213 213
      $a = deg2rad($Angle); $ca = cos($a); $sa = sin($a); $RealPos = array();
214
-     for($i = 0; $i < 7; $i += 2)
214
+     for ($i = 0; $i < 7; $i += 2)
215 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);
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 218
       }
219 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"];
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 229
 
230 230
      return($RealPos);
231 231
     }
232 232
 
233 233
    /* Set current font properties */
234
-   function setFontProperties($Format="")
234
+   function setFontProperties($Format = "")
235 235
     {
236 236
      $R		= isset($Format["R"]) ? $Format["R"] : -1;
237 237
      $G		= isset($Format["G"]) ? $Format["G"] : -1;
238 238
      $B		= isset($Format["B"]) ? $Format["B"] : -1;
239
-     $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
239
+     $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
240 240
      $FontName	= isset($Format["FontName"]) ? $Format["FontName"] : NULL;
241 241
      $FontSize	= isset($Format["FontSize"]) ? $Format["FontSize"] : NULL;
242 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; }
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 247
 
248
-     if ( $FontName != NULL  )
248
+     if ($FontName != NULL)
249 249
       $this->FontName = $FontName;
250 250
  
251
-     if ( $FontSize != NULL  )
251
+     if ($FontSize != NULL)
252 252
       $this->FontSize = $FontSize;
253 253
     }
254 254
 
255 255
    /* Returns the 1st decimal values (used to correct AA bugs) */
256 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 262
    /* Attach a dataset to your pChart Object */
@@ -268,46 +268,46 @@  discard block
 block discarded – undo
268 268
     { print_r($this->DataSet); }
269 269
 
270 270
    /* Initialise the image map methods */
271
-   function initialiseImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp")
271
+   function initialiseImageMap($Name = "pChart", $StorageMode = IMAGE_MAP_STORAGE_SESSION, $UniqueID = "imageMap", $StorageFolder = "tmp")
272 272
     {
273
-     $this->ImageMapIndex 		= $Name;
274
-     $this->ImageMapStorageMode		= $StorageMode;
273
+     $this->ImageMapIndex = $Name;
274
+     $this->ImageMapStorageMode = $StorageMode;
275 275
 
276 276
      if ($StorageMode == IMAGE_MAP_STORAGE_SESSION)
277 277
       {
278
-       if(!isset($_SESSION)) { session_start(); }
279
-       $_SESSION[$this->ImageMapIndex]    = NULL;
278
+       if (!isset($_SESSION)) { session_start(); }
279
+       $_SESSION[$this->ImageMapIndex] = NULL;
280 280
       }
281
-     elseif($StorageMode == IMAGE_MAP_STORAGE_FILE)
281
+     elseif ($StorageMode == IMAGE_MAP_STORAGE_FILE)
282 282
       {
283
-       $this->ImageMapFileName 		= $UniqueID;
284
-       $this->ImageMapStorageFolder	= $StorageFolder;
283
+       $this->ImageMapFileName = $UniqueID;
284
+       $this->ImageMapStorageFolder = $StorageFolder;
285 285
 
286 286
        if (file_exists($StorageFolder."/".$UniqueID.".map")) { unlink($StorageFolder."/".$UniqueID.".map"); }
287 287
       }
288 288
     }
289 289
 
290 290
    /* Add a zone to the image map */
291
-   function addToImageMap($Type,$Plots,$Color=NULL,$Title=NULL,$Message=NULL,$HTMLEncode=FALSE)
291
+   function addToImageMap($Type, $Plots, $Color = NULL, $Title = NULL, $Message = NULL, $HTMLEncode = FALSE)
292 292
     {
293
-     if ( $this->ImageMapStorageMode == NULL ) { $this->initialiseImageMap(); }
293
+     if ($this->ImageMapStorageMode == NULL) { $this->initialiseImageMap(); }
294 294
 
295 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 )
296
+     $Title   = str_replace("&#8364;", "\u20AC", $Title);
297
+     $Title   = htmlentities($Title, ENT_QUOTES, "ISO-8859-15");
298
+     if ($HTMLEncode)
299 299
       {
300
-       $Message = htmlentities($Message,ENT_QUOTES,"ISO-8859-15");
301
-       $Message = str_replace("&lt;","<",$Message);
302
-       $Message = str_replace("&gt;",">",$Message);
300
+       $Message = htmlentities($Message, ENT_QUOTES, "ISO-8859-15");
301
+       $Message = str_replace("&lt;", "<", $Message);
302
+       $Message = str_replace("&gt;", ">", $Message);
303 303
       }
304 304
 
305
-     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
305
+     if ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION)
306 306
       {
307
-       if(!isset($_SESSION)) { $this->initialiseImageMap(); }
308
-       $_SESSION[$this->ImageMapIndex][] = array($Type,$Plots,$Color,$Title,$Message);
307
+       if (!isset($_SESSION)) { $this->initialiseImageMap(); }
308
+       $_SESSION[$this->ImageMapIndex][] = array($Type, $Plots, $Color, $Title, $Message);
309 309
       }
310
-     elseif($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE)
310
+     elseif ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE)
311 311
       {
312 312
        $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'a');
313 313
        fwrite($Handle, $Type.IMAGE_MAP_DELIMITER.$Plots.IMAGE_MAP_DELIMITER.$Color.IMAGE_MAP_DELIMITER.$Title.IMAGE_MAP_DELIMITER.$Message."\r\n");
@@ -318,30 +318,30 @@  discard block
 block discarded – undo
318 318
    /* Remove VOID values from an imagemap custom values array */
319 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 323
      $Result = "";
324
-     foreach($this->DataSet->Data["Series"][$SerieName]["Data"] as $Key => $Value)
325
-      { if ( $Value != VOID && isset($Values[$Key]) ) { $Result[] = $Values[$Key]; } }
324
+     foreach ($this->DataSet->Data["Series"][$SerieName]["Data"] as $Key => $Value)
325
+      { if ($Value != VOID && isset($Values[$Key])) { $Result[] = $Values[$Key]; } }
326 326
      return($Result);
327 327
     }
328 328
 
329 329
    /* Replace the title of one image map serie */
330 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 )
336
+     if ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION)
337 337
       {
338
-       if(!isset($_SESSION)) { return(-1); }
339
-       if ( is_array($NewTitle) )
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++; } } }
338
+       if (!isset($_SESSION)) { return(-1); }
339
+       if (is_array($NewTitle))
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 341
        else
342
-        { foreach($_SESSION[$this->ImageMapIndex] as $Key => $Settings) { if ( $Settings[3] == $OldTitle ) { $_SESSION[$this->ImageMapIndex][$Key][3] = $NewTitle; } } }
342
+        { foreach ($_SESSION[$this->ImageMapIndex] as $Key => $Settings) { if ($Settings[3] == $OldTitle) { $_SESSION[$this->ImageMapIndex][$Key][3] = $NewTitle; } } }
343 343
       }
344
-     elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE )
344
+     elseif ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE)
345 345
       {
346 346
        $TempArray = "";
347 347
        $Handle    = @fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", "r");
@@ -349,18 +349,18 @@  discard block
 block discarded – undo
349 349
         {
350 350
          while (($Buffer = fgets($Handle, 4096)) !== false)
351 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]);
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 354
           }
355 355
          fclose($Handle);
356 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++; } } }
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 359
          else
360
-          { foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $OldTitle ) { $TempArray[$Key][3] = $NewTitle; } } }
360
+          { foreach ($TempArray as $Key => $Settings) { if ($Settings[3] == $OldTitle) { $TempArray[$Key][3] = $NewTitle; } } }
361 361
 
362 362
          $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'w');
363
-         foreach($TempArray as $Key => $Settings)
363
+         foreach ($TempArray as $Key => $Settings)
364 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 365
          fclose($Handle);
366 366
         }
@@ -370,16 +370,16 @@  discard block
 block discarded – undo
370 370
    /* Replace the values of the image map contents */
371 371
    function replaceImageMapValues($Title, $Values)
372 372
     {
373
-     if ( $this->ImageMapStorageMode == NULL ) { return(-1); }
373
+     if ($this->ImageMapStorageMode == NULL) { return(-1); }
374 374
 
375 375
      $Values = $this->removeVOIDFromArray($Title, $Values);
376 376
      $ID = 0; 
377
-     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
377
+     if ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION)
378 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++; } }
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 381
       }
382
-     elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE )
382
+     elseif ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE)
383 383
       {
384 384
        $TempArray = "";
385 385
        $Handle    = @fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", "r");
@@ -387,15 +387,15 @@  discard block
 block discarded – undo
387 387
         {
388 388
          while (($Buffer = fgets($Handle, 4096)) !== false)
389 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]);
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 392
           }
393 393
          fclose($Handle);
394 394
 
395
-         foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $Title ) { if ( isset($Values[$ID]) ) { $TempArray[$Key][4] = $Values[$ID]; } $ID++; } }
395
+         foreach ($TempArray as $Key => $Settings) { if ($Settings[3] == $Title) { if (isset($Values[$ID])) { $TempArray[$Key][4] = $Values[$ID]; } $ID++; } }
396 396
 
397 397
          $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'w');
398
-         foreach($TempArray as $Key => $Settings)
398
+         foreach ($TempArray as $Key => $Settings)
399 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 400
          fclose($Handle);
401 401
         }
@@ -403,21 +403,21 @@  discard block
 block discarded – undo
403 403
     }
404 404
 
405 405
    /* Dump the image map */
406
-   function dumpImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp")
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 )
411
+     if ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION)
412 412
       {
413
-       if(!isset($_SESSION)) { session_start(); }
414
-       if ( $_SESSION[$Name] != NULL )
413
+       if (!isset($_SESSION)) { session_start(); }
414
+       if ($_SESSION[$Name] != NULL)
415 415
         {
416
-         foreach($_SESSION[$Name] as $Key => $Params)
416
+         foreach ($_SESSION[$Name] as $Key => $Params)
417 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 419
       }
420
-     elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE )
420
+     elseif ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE)
421 421
       {
422 422
        if (file_exists($StorageFolder."/".$UniqueID.".map"))
423 423
         {
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
          if ($Handle) { while (($Buffer = fgets($Handle, 4096)) !== false) { echo $Buffer; } }
426 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
 
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
     }
435 435
 
436 436
    /* Return the HTML converted color from the RGB composite values */
437
-   function toHTMLColor($R,$G,$B)
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;
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 442
      return($Color);
443 443
     }
444 444
 
@@ -446,27 +446,27 @@  discard block
 block discarded – undo
446 446
    function reversePlots($Plots)
447 447
     {
448 448
      $Result = "";
449
-     for($i=count($Plots)-2;$i>=0;$i=$i-2) { $Result[] = $Plots[$i]; $Result[] = $Plots[$i+1]; }
449
+     for ($i = count($Plots) - 2; $i >= 0; $i = $i - 2) { $Result[] = $Plots[$i]; $Result[] = $Plots[$i + 1]; }
450 450
      return($Result);
451 451
     }
452 452
 
453 453
    /* Mirror Effect */
454
-   function drawAreaMirror($X,$Y,$Width,$Height,$Format="")
454
+   function drawAreaMirror($X, $Y, $Width, $Height, $Format = "")
455 455
     {
456
-     $StartAlpha	= isset($Format["StartAlpha"]) ? $Format["StartAlpha"] : 80;
456
+     $StartAlpha = isset($Format["StartAlpha"]) ? $Format["StartAlpha"] : 80;
457 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++)
464
+     for ($i = 1; $i <= $Height; $i++)
465 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); }
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 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.
Braces   +46 added lines, -98 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
  */
15 15
 
16 16
  /* The GD extension is mandatory */
17
- if (!extension_loaded('gd') && !extension_loaded('gd2'))
18
-  {
17
+ if (!extension_loaded('gd') && !extension_loaded('gd2')) {
19 18
    echo "GD extension must be loaded. \r\n";
20 19
    exit();
21 20
   }
@@ -31,8 +30,7 @@  discard block
 block discarded – undo
31 30
  /* ImageMap string delimiter */
32 31
  define("IMAGE_MAP_DELIMITER"		, chr(1));
33 32
 
34
- class pImage extends pDraw
35
-  {
33
+ class pImage extends pDraw {
36 34
    /* Image settings, size, quality, .. */
37 35
    var $XSize		= NULL;				// Width of the picture
38 36
    var $YSize		= NULL;				// Height of the picture
@@ -82,8 +80,7 @@  discard block
 block discarded – undo
82 80
    var $LastChartLayout	= CHART_LAST_LAYOUT_REGULAR;	// Last layout : regular or stacked
83 81
 
84 82
    /* Class constructor */
85
-   function pImage($XSize,$YSize,$DataSet=NULL,$TransparentBackground=FALSE)
86
-    {
83
+   function pImage($XSize,$YSize,$DataSet=NULL,$TransparentBackground=FALSE) {
87 84
      $this->TransparentBackground = $TransparentBackground;
88 85
 
89 86
      if ( $DataSet != NULL ) { $this->DataSet = $DataSet; }
@@ -92,23 +89,19 @@  discard block
 block discarded – undo
92 89
      $this->YSize   = $YSize;
93 90
      $this->Picture = imagecreatetruecolor($XSize,$YSize);
94 91
 
95
-     if ( $this->TransparentBackground )
96
-      {
92
+     if ( $this->TransparentBackground ) {
97 93
        imagealphablending($this->Picture,FALSE);
98 94
        imagefilledrectangle($this->Picture, 0,0,$XSize, $YSize, imagecolorallocatealpha($this->Picture, 255, 255, 255, 127));
99 95
        imagealphablending($this->Picture,TRUE);
100 96
        imagesavealpha($this->Picture,true); 
101
-      }
102
-     else
103
-      {
97
+      } else {
104 98
        $C_White = $this->AllocateColor($this->Picture,255,255,255);
105 99
        imagefilledrectangle($this->Picture,0,0,$XSize,$YSize,$C_White);
106 100
       }
107 101
     }
108 102
 
109 103
    /* Enable / Disable and set shadow properties */
110
-   function setShadow($Enabled=TRUE,$Format="")
111
-    {
104
+   function setShadow($Enabled=TRUE,$Format="") {
112 105
      $X	    = isset($Format["X"]) ? $Format["X"] : 2;
113 106
      $Y	    = isset($Format["Y"]) ? $Format["Y"] : 2;
114 107
      $R	    = isset($Format["R"]) ? $Format["R"] : 0;
@@ -126,8 +119,7 @@  discard block
 block discarded – undo
126 119
     }
127 120
 
128 121
    /* Set the graph area position */
129
-   function setGraphArea($X1,$Y1,$X2,$Y2)
130
-    {
122
+   function setGraphArea($X1,$Y1,$X2,$Y2) {
131 123
      if ( $X2 < $X1 || $X1 == $X2 || $Y2 < $Y1 || $Y1 == $Y2 ) { return(-1); }
132 124
 
133 125
      $this->GraphAreaX1 = $X1; $this->DataSet->Data["GraphArea"]["X1"] = $X1;
@@ -145,19 +137,16 @@  discard block
 block discarded – undo
145 137
     { return($this->YSize); }
146 138
 
147 139
    /* Render the picture to a file */
148
-   function render($FileName)
149
-    {
140
+   function render($FileName) {
150 141
      if ( $this->TransparentBackground ) { imagealphablending($this->Picture,false); imagesavealpha($this->Picture,true); }
151 142
      imagepng($this->Picture,$FileName);
152 143
     }
153 144
 
154 145
    /* Render the picture to a web browser stream */
155
-   function stroke($BrowserExpire=FALSE)
156
-    {
146
+   function stroke($BrowserExpire=FALSE) {
157 147
      if ( $this->TransparentBackground ) { imagealphablending($this->Picture,false); imagesavealpha($this->Picture,true); }
158 148
 
159
-     if ( $BrowserExpire )
160
-      {
149
+     if ( $BrowserExpire ) {
161 150
        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
162 151
        header("Cache-Control: no-cache");
163 152
        header("Pragma: no-cache");
@@ -168,8 +157,7 @@  discard block
 block discarded – undo
168 157
     }
169 158
 
170 159
    /* Automatic output method based on the calling interface */
171
-   function autoOutput($FileName="output.png")
172
-    {
160
+   function autoOutput($FileName="output.png") {
173 161
      if (php_sapi_name() == "cli")
174 162
       $this->Render($FileName);
175 163
      else
@@ -181,15 +169,13 @@  discard block
 block discarded – undo
181 169
     { return(sqrt(pow(max($X1,$X2)-min($X1,$X2),2)+pow(max($Y1,$Y2)-min($Y1,$Y2),2))); }
182 170
 
183 171
    /* Return the orientation of a line */
184
-   function getAngle($X1,$Y1,$X2,$Y2)
185
-    {
172
+   function getAngle($X1,$Y1,$X2,$Y2) {
186 173
      $Opposite = $Y2 - $Y1; $Adjacent = $X2 - $X1;$Angle = rad2deg(atan2($Opposite,$Adjacent));
187 174
      if ($Angle > 0) { return($Angle); } else { return(360-abs($Angle)); }
188 175
     }
189 176
 
190 177
    /* Return the surrounding box of text area */
191
-   function getTextBox_deprecated($X,$Y,$FontName,$FontSize,$Angle,$Text)
192
-    {
178
+   function getTextBox_deprecated($X,$Y,$FontName,$FontSize,$Angle,$Text) {
193 179
      $Size    = imagettfbbox($FontSize,$Angle,$FontName,$Text);
194 180
      $Width   = $this->getLength($Size[0],$Size[1],$Size[2],$Size[3])+1;
195 181
      $Height  = $this->getLength($Size[2],$Size[3],$Size[4],$Size[5])+1;
@@ -206,13 +192,11 @@  discard block
 block discarded – undo
206 192
     }
207 193
 
208 194
    /* Return the surrounding box of text area */
209
-   function getTextBox($X,$Y,$FontName,$FontSize,$Angle,$Text)
210
-    {
195
+   function getTextBox($X,$Y,$FontName,$FontSize,$Angle,$Text) {
211 196
      $coords = imagettfbbox($FontSize, 0, $FontName, $Text);
212 197
 
213 198
      $a = deg2rad($Angle); $ca = cos($a); $sa = sin($a); $RealPos = array();
214
-     for($i = 0; $i < 7; $i += 2)
215
-      {
199
+     for($i = 0; $i < 7; $i += 2) {
216 200
        $RealPos[$i/2]["X"] = $X + round($coords[$i] * $ca + $coords[$i+1] * $sa);
217 201
        $RealPos[$i/2]["Y"] = $Y + round($coords[$i+1] * $ca - $coords[$i] * $sa);
218 202
       }
@@ -231,8 +215,7 @@  discard block
 block discarded – undo
231 215
     }
232 216
 
233 217
    /* Set current font properties */
234
-   function setFontProperties($Format="")
235
-    {
218
+   function setFontProperties($Format="") {
236 219
      $R		= isset($Format["R"]) ? $Format["R"] : -1;
237 220
      $G		= isset($Format["G"]) ? $Format["G"] : -1;
238 221
      $B		= isset($Format["B"]) ? $Format["B"] : -1;
@@ -253,8 +236,7 @@  discard block
 block discarded – undo
253 236
     }
254 237
 
255 238
    /* Returns the 1st decimal values (used to correct AA bugs) */
256
-   function getFirstDecimal($Value)
257
-    {
239
+   function getFirstDecimal($Value) {
258 240
      $Values = preg_split("/\./",$Value);
259 241
      if ( isset($Values[1]) ) { return(substr($Values[1],0,1)); } else { return(0); }
260 242
     }
@@ -268,18 +250,14 @@  discard block
 block discarded – undo
268 250
     { print_r($this->DataSet); }
269 251
 
270 252
    /* Initialise the image map methods */
271
-   function initialiseImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp")
272
-    {
253
+   function initialiseImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp") {
273 254
      $this->ImageMapIndex 		= $Name;
274 255
      $this->ImageMapStorageMode		= $StorageMode;
275 256
 
276
-     if ($StorageMode == IMAGE_MAP_STORAGE_SESSION)
277
-      {
257
+     if ($StorageMode == IMAGE_MAP_STORAGE_SESSION) {
278 258
        if(!isset($_SESSION)) { session_start(); }
279 259
        $_SESSION[$this->ImageMapIndex]    = NULL;
280
-      }
281
-     elseif($StorageMode == IMAGE_MAP_STORAGE_FILE)
282
-      {
260
+      } elseif($StorageMode == IMAGE_MAP_STORAGE_FILE) {
283 261
        $this->ImageMapFileName 		= $UniqueID;
284 262
        $this->ImageMapStorageFolder	= $StorageFolder;
285 263
 
@@ -288,27 +266,22 @@  discard block
 block discarded – undo
288 266
     }
289 267
 
290 268
    /* Add a zone to the image map */
291
-   function addToImageMap($Type,$Plots,$Color=NULL,$Title=NULL,$Message=NULL,$HTMLEncode=FALSE)
292
-    {
269
+   function addToImageMap($Type,$Plots,$Color=NULL,$Title=NULL,$Message=NULL,$HTMLEncode=FALSE) {
293 270
      if ( $this->ImageMapStorageMode == NULL ) { $this->initialiseImageMap(); }
294 271
 
295 272
      /* Encode the characters in the imagemap in HTML standards */
296 273
      $Title   = str_replace("&#8364;","\u20AC",$Title);
297 274
      $Title   = htmlentities($Title,ENT_QUOTES,"ISO-8859-15");
298
-     if ( $HTMLEncode )
299
-      {
275
+     if ( $HTMLEncode ) {
300 276
        $Message = htmlentities($Message,ENT_QUOTES,"ISO-8859-15");
301 277
        $Message = str_replace("&lt;","<",$Message);
302 278
        $Message = str_replace("&gt;",">",$Message);
303 279
       }
304 280
 
305
-     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
306
-      {
281
+     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) {
307 282
        if(!isset($_SESSION)) { $this->initialiseImageMap(); }
308 283
        $_SESSION[$this->ImageMapIndex][] = array($Type,$Plots,$Color,$Title,$Message);
309
-      }
310
-     elseif($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE)
311
-      {
284
+      } elseif($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE) {
312 285
        $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'a');
313 286
        fwrite($Handle, $Type.IMAGE_MAP_DELIMITER.$Plots.IMAGE_MAP_DELIMITER.$Color.IMAGE_MAP_DELIMITER.$Title.IMAGE_MAP_DELIMITER.$Message."\r\n");
314 287
        fclose($Handle);
@@ -316,8 +289,7 @@  discard block
 block discarded – undo
316 289
     }
317 290
 
318 291
    /* Remove VOID values from an imagemap custom values array */
319
-   function removeVOIDFromArray($SerieName, $Values)
320
-    {
292
+   function removeVOIDFromArray($SerieName, $Values) {
321 293
      if ( !isset($this->DataSet->Data["Series"][$SerieName]) ) { return(-1); }
322 294
 
323 295
      $Result = "";
@@ -327,36 +299,28 @@  discard block
 block discarded – undo
327 299
     }
328 300
 
329 301
    /* Replace the title of one image map serie */
330
-   function replaceImageMapTitle($OldTitle, $NewTitle)
331
-    {
302
+   function replaceImageMapTitle($OldTitle, $NewTitle) {
332 303
      if ( $this->ImageMapStorageMode == NULL ) { return(-1); }
333 304
 
334 305
      if ( is_array($NewTitle) ) { $NewTitle = $this->removeVOIDFromArray($OldTitle, $NewTitle); }
335 306
  
336
-     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
337
-      {
307
+     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) {
338 308
        if(!isset($_SESSION)) { return(-1); }
339 309
        if ( is_array($NewTitle) )
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
310
+        { $ID = 0; foreach($_SESSION[$this->ImageMapIndex] as $Key => $Settings) { if ( $Settings[3] == $OldTitle && isset($NewTitle[$ID])) { $_SESSION[$this->ImageMapIndex][$Key][3] = $NewTitle[$ID]; $ID++; } } } else
342 311
         { 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
-      {
312
+      } elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE ) {
346 313
        $TempArray = "";
347 314
        $Handle    = @fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", "r");
348
-       if ($Handle)
349
-        {
350
-         while (($Buffer = fgets($Handle, 4096)) !== false)
351
-          {
315
+       if ($Handle) {
316
+         while (($Buffer = fgets($Handle, 4096)) !== false) {
352 317
            $Fields      = split(IMAGE_MAP_DELIMITER,str_replace(array(chr(10),chr(13)),"",$Buffer));
353 318
            $TempArray[] = array($Fields[0],$Fields[1],$Fields[2],$Fields[3],$Fields[4]);
354 319
           }
355 320
          fclose($Handle);
356 321
 
357 322
          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
323
+          { $ID = 0; foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $OldTitle && isset($NewTitle[$ID]) ) { $TempArray[$Key][3] = $NewTitle[$ID]; $ID++; } } } else
360 324
           { foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $OldTitle ) { $TempArray[$Key][3] = $NewTitle; } } }
361 325
 
362 326
          $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'w');
@@ -368,25 +332,19 @@  discard block
 block discarded – undo
368 332
     }
369 333
 
370 334
    /* Replace the values of the image map contents */
371
-   function replaceImageMapValues($Title, $Values)
372
-    {
335
+   function replaceImageMapValues($Title, $Values) {
373 336
      if ( $this->ImageMapStorageMode == NULL ) { return(-1); }
374 337
 
375 338
      $Values = $this->removeVOIDFromArray($Title, $Values);
376 339
      $ID = 0; 
377
-     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
378
-      {
340
+     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) {
379 341
        if(!isset($_SESSION)) { return(-1); }
380 342
        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
-      {
343
+      } elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE ) {
384 344
        $TempArray = "";
385 345
        $Handle    = @fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", "r");
386
-       if ($Handle)
387
-        {
388
-         while (($Buffer = fgets($Handle, 4096)) !== false)
389
-          {
346
+       if ($Handle) {
347
+         while (($Buffer = fgets($Handle, 4096)) !== false) {
390 348
            $Fields      = split(IMAGE_MAP_DELIMITER,str_replace(array(chr(10),chr(13)),"",$Buffer));
391 349
            $TempArray[] = array($Fields[0],$Fields[1],$Fields[2],$Fields[3],$Fields[4]);
392 350
           }
@@ -403,24 +361,18 @@  discard block
 block discarded – undo
403 361
     }
404 362
 
405 363
    /* Dump the image map */
406
-   function dumpImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp")
407
-    {
364
+   function dumpImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp") {
408 365
      $this->ImageMapIndex 		= $Name;
409 366
      $this->ImageMapStorageMode		= $StorageMode;
410 367
 
411
-     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
412
-      {
368
+     if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) {
413 369
        if(!isset($_SESSION)) { session_start(); }
414
-       if ( $_SESSION[$Name] != NULL )
415
-        {
370
+       if ( $_SESSION[$Name] != NULL ) {
416 371
          foreach($_SESSION[$Name] as $Key => $Params)
417 372
           { 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 373
         }
419
-      }
420
-     elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE )
421
-      {
422
-       if (file_exists($StorageFolder."/".$UniqueID.".map"))
423
-        {
374
+      } elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE ) {
375
+       if (file_exists($StorageFolder."/".$UniqueID.".map")) {
424 376
          $Handle = @fopen($StorageFolder."/".$UniqueID.".map", "r");
425 377
          if ($Handle) { while (($Buffer = fgets($Handle, 4096)) !== false) { echo $Buffer; } }
426 378
          fclose($Handle);
@@ -434,8 +386,7 @@  discard block
 block discarded – undo
434 386
     }
435 387
 
436 388
    /* Return the HTML converted color from the RGB composite values */
437
-   function toHTMLColor($R,$G,$B)
438
-    {
389
+   function toHTMLColor($R,$G,$B) {
439 390
      $R=intval($R); $G=intval($G); $B=intval($B);
440 391
      $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 392
      $Color="#".(strlen($R) < 2?'0':'').$R; $Color.=(strlen($G) < 2?'0':'').$G; $Color.= (strlen($B) < 2?'0':'').$B;
@@ -443,16 +394,14 @@  discard block
 block discarded – undo
443 394
     }
444 395
 
445 396
    /* Reverse an array of points */
446
-   function reversePlots($Plots)
447
-    {
397
+   function reversePlots($Plots) {
448 398
      $Result = "";
449 399
      for($i=count($Plots)-2;$i>=0;$i=$i-2) { $Result[] = $Plots[$i]; $Result[] = $Plots[$i+1]; }
450 400
      return($Result);
451 401
     }
452 402
 
453 403
    /* Mirror Effect */
454
-   function drawAreaMirror($X,$Y,$Width,$Height,$Format="")
455
-    {
404
+   function drawAreaMirror($X,$Y,$Width,$Height,$Format="") {
456 405
      $StartAlpha	= isset($Format["StartAlpha"]) ? $Format["StartAlpha"] : 80;
457 406
      $EndAlpha		= isset($Format["EndAlpha"]) ? $Format["EndAlpha"] : 0;
458 407
 
@@ -461,8 +410,7 @@  discard block
 block discarded – undo
461 410
      $Picture = imagecreatetruecolor($this->XSize,$this->YSize);
462 411
      imagecopy($Picture,$this->Picture,0,0,0,0,$this->XSize,$this->YSize);
463 412
      
464
-     for($i=1;$i<=$Height;$i++)
465
-      {
413
+     for($i=1;$i<=$Height;$i++) {
466 414
        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 415
       }
468 416
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
  class pImage extends pDraw
35 35
   {
36 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
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 41
    var $AntialiasQuality  = 0;				// Quality of the antialiasing implementation (0-1)
42 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
43
+   var $TransparentBackground = false;			// Just to know if we need to flush the alpha channels when rendering
44 44
 
45 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
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 50
 
51 51
    /* Scale settings */
52 52
    var $ScaleMinDivHeight = 20;				// Minimum height for scame divs
@@ -54,39 +54,39 @@  discard block
 block discarded – undo
54 54
    /* Font properties */
55 55
    var $FontName	= "sites/all/libraries/fonts/DejaVuSans.ttf";	// Default font file
56 56
    var $FontSize	= 12;				// Default font size
57
-   var $FontBox		= NULL;				// Return the bounding box of the last written string
57
+   var $FontBox		= null;				// Return the bounding box of the last written string
58 58
    var $FontColorR	= 0;				// Default color settings
59 59
    var $FontColorG	= 0;				// Default color settings
60 60
    var $FontColorB	= 0;				// Default color settings
61 61
    var $FontColorA	= 100;				// Default transparency
62 62
 
63 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
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 71
 
72 72
    /* Image map */
73
-   var $ImageMap	= NULL;				// Aray containing the image map
73
+   var $ImageMap	= null;				// Aray containing the image map
74 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
75
+   var $ImageMapStorageMode = null;			// Save the current imagemap storage mode
76
+   var $ImageMapAutoDelete  = true;			// Automatic deletion of the image map temp files
77 77
 
78 78
    /* Data Set */
79
-   var $DataSet		= NULL;				// Attached dataset
79
+   var $DataSet		= null;				// Attached dataset
80 80
 
81 81
    /* Last generated chart info */
82 82
    var $LastChartLayout	= CHART_LAST_LAYOUT_REGULAR;	// Last layout : regular or stacked
83 83
 
84 84
    /* Class constructor */
85
-   function pImage($XSize,$YSize,$DataSet=NULL,$TransparentBackground=FALSE)
85
+   function pImage($XSize,$YSize,$DataSet=null,$TransparentBackground=false)
86 86
     {
87 87
      $this->TransparentBackground = $TransparentBackground;
88 88
 
89
-     if ( $DataSet != NULL ) { $this->DataSet = $DataSet; }
89
+     if ( $DataSet != null ) { $this->DataSet = $DataSet; }
90 90
 
91 91
      $this->XSize   = $XSize;
92 92
      $this->YSize   = $YSize;
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 
95 95
      if ( $this->TransparentBackground )
96 96
       {
97
-       imagealphablending($this->Picture,FALSE);
97
+       imagealphablending($this->Picture,false);
98 98
        imagefilledrectangle($this->Picture, 0,0,$XSize, $YSize, imagecolorallocatealpha($this->Picture, 255, 255, 255, 127));
99
-       imagealphablending($this->Picture,TRUE);
99
+       imagealphablending($this->Picture,true);
100 100
        imagesavealpha($this->Picture,true); 
101 101
       }
102 102
      else
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     }
108 108
 
109 109
    /* Enable / Disable and set shadow properties */
110
-   function setShadow($Enabled=TRUE,$Format="")
110
+   function setShadow($Enabled=true,$Format="")
111 111
     {
112 112
      $X	    = isset($Format["X"]) ? $Format["X"] : 2;
113 113
      $Y	    = isset($Format["Y"]) ? $Format["Y"] : 2;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     }
153 153
 
154 154
    /* Render the picture to a web browser stream */
155
-   function stroke($BrowserExpire=FALSE)
155
+   function stroke($BrowserExpire=false)
156 156
     {
157 157
      if ( $this->TransparentBackground ) { imagealphablending($this->Picture,false); imagesavealpha($this->Picture,true); }
158 158
 
@@ -237,18 +237,18 @@  discard block
 block discarded – undo
237 237
      $G		= isset($Format["G"]) ? $Format["G"] : -1;
238 238
      $B		= isset($Format["B"]) ? $Format["B"] : -1;
239 239
      $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
240
-     $FontName	= isset($Format["FontName"]) ? $Format["FontName"] : NULL;
241
-     $FontSize	= isset($Format["FontSize"]) ? $Format["FontSize"] : NULL;
240
+     $FontName	= isset($Format["FontName"]) ? $Format["FontName"] : null;
241
+     $FontSize	= isset($Format["FontSize"]) ? $Format["FontSize"] : null;
242 242
 
243 243
      if ( $R != -1)       {  $this->FontColorR = $R; }
244 244
      if ( $G != -1)       {  $this->FontColorG = $G; }
245 245
      if ( $B != -1)       {  $this->FontColorB = $B; }
246
-     if ( $Alpha != NULL) {  $this->FontColorA = $Alpha; }
246
+     if ( $Alpha != null) {  $this->FontColorA = $Alpha; }
247 247
 
248
-     if ( $FontName != NULL  )
248
+     if ( $FontName != null  )
249 249
       $this->FontName = $FontName;
250 250
  
251
-     if ( $FontSize != NULL  )
251
+     if ( $FontSize != null  )
252 252
       $this->FontSize = $FontSize;
253 253
     }
254 254
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
      if ($StorageMode == IMAGE_MAP_STORAGE_SESSION)
277 277
       {
278 278
        if(!isset($_SESSION)) { session_start(); }
279
-       $_SESSION[$this->ImageMapIndex]    = NULL;
279
+       $_SESSION[$this->ImageMapIndex]    = null;
280 280
       }
281 281
      elseif($StorageMode == IMAGE_MAP_STORAGE_FILE)
282 282
       {
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
     }
289 289
 
290 290
    /* Add a zone to the image map */
291
-   function addToImageMap($Type,$Plots,$Color=NULL,$Title=NULL,$Message=NULL,$HTMLEncode=FALSE)
291
+   function addToImageMap($Type,$Plots,$Color=null,$Title=null,$Message=null,$HTMLEncode=false)
292 292
     {
293
-     if ( $this->ImageMapStorageMode == NULL ) { $this->initialiseImageMap(); }
293
+     if ( $this->ImageMapStorageMode == null ) { $this->initialiseImageMap(); }
294 294
 
295 295
      /* Encode the characters in the imagemap in HTML standards */
296 296
      $Title   = str_replace("&#8364;","\u20AC",$Title);
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
    /* Replace the title of one image map serie */
330 330
    function replaceImageMapTitle($OldTitle, $NewTitle)
331 331
     {
332
-     if ( $this->ImageMapStorageMode == NULL ) { return(-1); }
332
+     if ( $this->ImageMapStorageMode == null ) { return(-1); }
333 333
 
334 334
      if ( is_array($NewTitle) ) { $NewTitle = $this->removeVOIDFromArray($OldTitle, $NewTitle); }
335 335
  
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
    /* Replace the values of the image map contents */
371 371
    function replaceImageMapValues($Title, $Values)
372 372
     {
373
-     if ( $this->ImageMapStorageMode == NULL ) { return(-1); }
373
+     if ( $this->ImageMapStorageMode == null ) { return(-1); }
374 374
 
375 375
      $Values = $this->removeVOIDFromArray($Title, $Values);
376 376
      $ID = 0; 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
      if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION )
412 412
       {
413 413
        if(!isset($_SESSION)) { session_start(); }
414
-       if ( $_SESSION[$Name] != NULL )
414
+       if ( $_SESSION[$Name] != null )
415 415
         {
416 416
          foreach($_SESSION[$Name] as $Key => $Params)
417 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"; }
Please login to merge, or discard this patch.
sites/default/boinc/modules/boincstats/includes/pchart/class/pPie.class.php 4 patches
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.
Spacing   +570 added lines, -570 removed lines patch added patch discarded remove patch
@@ -14,29 +14,29 @@  discard block
 block discarded – undo
14 14
  */
15 15
 
16 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);
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);
22
+ define("PIE_LABEL_COLOR_AUTO", 140010);
23 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 31
  /* pPie class definition */
32 32
  class pPie
33 33
   {
34 34
    var $pChartObject;
35 35
    var $pDataObject;
36
-   var $LabelPos = "" ;
36
+   var $LabelPos = "";
37 37
 
38 38
    /* Class creator */
39
-   function pPie($Object,$pDataObject)
39
+   function pPie($Object, $pDataObject)
40 40
     {
41 41
      /* Cache the pChart object reference */
42 42
      $this->pChartObject = $Object;
@@ -46,58 +46,58 @@  discard block
 block discarded – undo
46 46
     }
47 47
 
48 48
    /* Draw a pie chart */
49
-   function draw2DPie($X,$Y,$Format="")
49
+   function draw2DPie($X, $Y, $Format = "")
50 50
     {
51
-     $Radius		= isset($Format["Radius"]) ? $Format["Radius"] : 60;
51
+     $Radius = isset($Format["Radius"]) ? $Format["Radius"] : 60;
52 52
      $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
53
-     $DataGapAngle	= isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 0;
54
-     $DataGapRadius	= isset($Format["DataGapRadius"]) ? $Format["DataGapRadius"] : 0;
53
+     $DataGapAngle = isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 0;
54
+     $DataGapRadius = isset($Format["DataGapRadius"]) ? $Format["DataGapRadius"] : 0;
55 55
      $SecondPass	= isset($Format["SecondPass"]) ? $Format["SecondPass"] : TRUE;
56
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
56
+     $Border = isset($Format["Border"]) ? $Format["Border"] : FALSE;
57 57
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
58 58
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
59 59
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
60
-     $Shadow		= isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
60
+     $Shadow = isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
61 61
      $DrawLabels	= isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : FALSE;
62
-     $LabelStacked	= isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
62
+     $LabelStacked = isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
63 63
      $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
64 64
      $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
65 65
      $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
66 66
      $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
67
-     $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
67
+     $LabelAlpha = isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
68 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;
69
+     $ValuePosition = isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_OUTSIDE;
70
+     $ValuePadding = isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 15;
71 71
      $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
72 72
      $ValueR		= isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
73 73
      $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
74 74
      $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
75
-     $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
76
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
75
+     $ValueAlpha = isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
76
+     $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
77 77
 
78 78
      /* Data Processing */
79 79
      $Data    = $this->pDataObject->getData();
80 80
      $Palette = $this->pDataObject->getPalette();
81 81
 
82 82
      /* Do we have an abscissa serie defined? */
83
-     if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
83
+     if ($Data["Abscissa"] == "") { return(PIE_NO_ABSCISSA); }
84 84
 
85 85
      /* Try to find the data serie */
86 86
      $DataSerie = "";
87 87
      foreach ($Data["Series"] as $SerieName => $SerieData)
88
-      { if ( $SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
88
+      { if ($SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
89 89
 
90 90
      /* Do we have data to compute? */
91
-     if ( $DataSerie == "" ) { return(PIE_NO_DATASERIE); }
91
+     if ($DataSerie == "") { return(PIE_NO_DATASERIE); }
92 92
 
93 93
      /* Remove unused data */
94
-     list($Data,$Palette) = $this->clean0Values($Data,$Palette,$DataSerie,$Data["Abscissa"]);
94
+     list($Data, $Palette) = $this->clean0Values($Data, $Palette, $DataSerie, $Data["Abscissa"]);
95 95
 
96 96
      /* Compute the pie sum */
97 97
      $SerieSum = $this->pDataObject->getSum($DataSerie);
98 98
 
99 99
      /* Do we have data to draw? */
100
-     if ( $SerieSum == 0 ) { return(PIE_SUMISNULL); }
100
+     if ($SerieSum == 0) { return(PIE_SUMISNULL); }
101 101
 
102 102
      /* Dump the real number of data to draw */
103 103
      $Values = "";
@@ -105,190 +105,190 @@  discard block
 block discarded – undo
105 105
       { if ($Value != 0) { $Values[] = $Value; } }
106 106
 
107 107
      /* Compute the wasted angular space between series */
108
-     if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = count($Values) * $DataGapAngle; }
108
+     if (count($Values) == 1) { $WastedAngular = 0; } else { $WastedAngular = count($Values)*$DataGapAngle; }
109 109
 
110 110
      /* Compute the scale */
111
-     $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
111
+     $ScaleFactor = (360 - $WastedAngular)/$SerieSum;
112 112
 
113 113
      $RestoreShadow = $this->pChartObject->Shadow;
114
-     if ( $this->pChartObject->Shadow )
114
+     if ($this->pChartObject->Shadow)
115 115
       {
116 116
        $this->pChartObject->Shadow = FALSE;
117 117
 
118 118
        $ShadowFormat = $Format; $ShadowFormat["Shadow"] = TRUE;
119
-       $this->draw2DPie($X+$this->pChartObject->ShadowX,$Y+$this->pChartObject->ShadowY,$ShadowFormat);
119
+       $this->draw2DPie($X + $this->pChartObject->ShadowX, $Y + $this->pChartObject->ShadowY, $ShadowFormat);
120 120
       }
121 121
 
122 122
      /* Draw the polygon pie elements */
123
-     $Step = 360 / (2 * PI * $Radius);
123
+     $Step = 360/(2*PI*$Radius);
124 124
      $Offset = 0; $ID = 0;
125
-     foreach($Values as $Key => $Value)
125
+     foreach ($Values as $Key => $Value)
126 126
       {
127
-       if ( $Shadow )
128
-        $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
127
+       if ($Shadow)
128
+        $Settings = array("R"=>$this->pChartObject->ShadowR, "G"=>$this->pChartObject->ShadowG, "B"=>$this->pChartObject->ShadowB, "Alpha"=>$this->pChartObject->Shadowa);
129 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 )
137
+         if (!$Border)
138 138
           $Settings["Surrounding"] = 10;
139 139
          else
140 140
           { $Settings["BorderR"] = $BorderR; $Settings["BorderG"] = $BorderG; $Settings["BorderB"] = $BorderB; }
141 141
         }
142 142
 
143 143
        $Plots = "";
144
-       $EndAngle = $Offset+($Value*$ScaleFactor); if ( $EndAngle > 360 ) { $EndAngle = 360; }
144
+       $EndAngle = $Offset + ($Value*$ScaleFactor); if ($EndAngle > 360) { $EndAngle = 360; }
145 145
 
146 146
        $Angle = ($EndAngle - $Offset)/2 + $Offset;
147 147
        if ($DataGapAngle == 0)
148 148
         { $X0 = $X; $Y0 = $Y; }
149 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 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 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"]);}
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 177
          else
178
-          { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
178
+          { $Settings = array("FillR"=>$LabelR, "FillG"=>$LabelG, "FillB"=>$LabelB, "Alpha"=>$LabelAlpha); }
179 179
 
180 180
          $Angle = ($EndAngle - $Offset)/2 + $Offset;
181
-         $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
182
-         $Yc = sin(($Angle-90)*PI/180) * $Radius + $Y;
181
+         $Xc = cos(($Angle - 90)*PI/180)*$Radius + $X;
182
+         $Yc = sin(($Angle - 90)*PI/180)*$Radius + $Y;
183 183
 
184 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);
186
+         if ($LabelStacked)
187
+          $this->writePieLabel($Xc, $Yc, $Label, $Angle, $Settings, TRUE, $X, $Y, $Radius);
188 188
          else
189
-          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
189
+          $this->writePieLabel($Xc, $Yc, $Label, $Angle, $Settings, FALSE);
190 190
         }
191 191
 
192 192
        $Offset = $i + $DataGapAngle; $ID++;
193 193
       }
194 194
 
195 195
      /* Second pass to smooth the angles */
196
-     if ( $SecondPass )
196
+     if ($SecondPass)
197 197
       {
198
-       $Step = 360 / (2 * PI * $Radius);
198
+       $Step = 360/(2*PI*$Radius);
199 199
        $Offset = 0; $ID = 0;
200
-       foreach($Values as $Key => $Value)
200
+       foreach ($Values as $Key => $Value)
201 201
         {
202 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);
203
+         if ($Shadow)
204
+          $Settings = array("R"=>$this->pChartObject->ShadowR, "G"=>$this->pChartObject->ShadowG, "B"=>$this->pChartObject->ShadowB, "Alpha"=>$this->pChartObject->Shadowa);
205 205
          else
206 206
           {
207
-           if ( $Border )
208
-            $Settings = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB);
207
+           if ($Border)
208
+            $Settings = array("R"=>$BorderR, "G"=>$BorderG, "B"=>$BorderB);
209 209
            else
210
-            $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
210
+            $Settings = array("R"=>$Palette[$ID]["R"], "G"=>$Palette[$ID]["G"], "B"=>$Palette[$ID]["B"], "Alpha"=>$Palette[$ID]["Alpha"]);
211 211
           }
212 212
 
213
-         $EndAngle = $Offset+($Value*$ScaleFactor); if ( $EndAngle > 360 ) { $EndAngle = 360; }
213
+         $EndAngle = $Offset + ($Value*$ScaleFactor); if ($EndAngle > 360) { $EndAngle = 360; }
214 214
 
215 215
          if ($DataGapAngle == 0)
216 216
           { $X0 = $X; $Y0 = $Y; }
217 217
          else
218 218
           {
219 219
            $Angle = ($EndAngle - $Offset)/2 + $Offset;
220
-           $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
221
-           $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius + $Y;
220
+           $X0 = cos(($Angle - 90)*PI/180)*$DataGapRadius + $X;
221
+           $Y0 = sin(($Angle - 90)*PI/180)*$DataGapRadius + $Y;
222 222
           }
223 223
          $Plots[] = $X0; $Plots[] = $Y0;
224 224
 
225
-         for($i=$Offset;$i<=$EndAngle;$i=$i+$Step)
225
+         for ($i = $Offset; $i <= $EndAngle; $i = $i + $Step)
226 226
           {
227
-           $Xc = cos(($i-90)*PI/180) * $Radius + $X;
228
-           $Yc = sin(($i-90)*PI/180) * $Radius + $Y;
227
+           $Xc = cos(($i - 90)*PI/180)*$Radius + $X;
228
+           $Yc = sin(($i - 90)*PI/180)*$Radius + $Y;
229 229
 
230
-           if ( $FirstPoint ) { $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); } { $FirstPoint = FALSE; }
230
+           if ($FirstPoint) { $this->pChartObject->drawLine($Xc, $Yc, $X0, $Y0, $Settings); } { $FirstPoint = FALSE; }
231 231
   
232
-           $this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
232
+           $this->pChartObject->drawAntialiasPixel($Xc, $Yc, $Settings);
233 233
           }
234
-         $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings);
234
+         $this->pChartObject->drawLine($Xc, $Yc, $X0, $Y0, $Settings);
235 235
 
236
-         if ( $DrawLabels && !$Shadow )
236
+         if ($DrawLabels && !$Shadow)
237 237
           {
238
-           if ( $LabelColor == PIE_LABEL_COLOR_AUTO )
239
-            { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);}
238
+           if ($LabelColor == PIE_LABEL_COLOR_AUTO)
239
+            { $Settings = array("FillR"=>$Palette[$ID]["R"], "FillG"=>$Palette[$ID]["G"], "FillB"=>$Palette[$ID]["B"], "Alpha"=>$Palette[$ID]["Alpha"]); }
240 240
            else
241
-            { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
241
+            { $Settings = array("FillR"=>$LabelR, "FillG"=>$LabelG, "FillB"=>$LabelB, "Alpha"=>$LabelAlpha); }
242 242
 
243 243
            $Angle = ($EndAngle - $Offset)/2 + $Offset;
244
-           $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
245
-           $Yc = sin(($Angle-90)*PI/180) * $Radius + $Y;
244
+           $Xc = cos(($Angle - 90)*PI/180)*$Radius + $X;
245
+           $Yc = sin(($Angle - 90)*PI/180)*$Radius + $Y;
246 246
 
247 247
            $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
248 248
 
249
-           if ( $LabelStacked )
250
-            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$Radius);
249
+           if ($LabelStacked)
250
+            $this->writePieLabel($Xc, $Yc, $Label, $Angle, $Settings, TRUE, $X, $Y, $Radius);
251 251
            else
252
-            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
252
+            $this->writePieLabel($Xc, $Yc, $Label, $Angle, $Settings, FALSE);
253 253
           }
254 254
   
255 255
          $Offset = $i + $DataGapAngle; $ID++;
256 256
         }
257 257
       }
258 258
 
259
-     if ( $WriteValues != NULL && !$Shadow )
259
+     if ($WriteValues != NULL && !$Shadow)
260 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)
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; }
266
+         $EndAngle = ($Value*$ScaleFactor) + $Offset; if ($EndAngle > 360) { $EndAngle = 0; }
267 267
          $Angle    = ($EndAngle - $Offset)/2 + $Offset;
268 268
 
269
-         if ( $ValuePosition == PIE_VALUE_OUTSIDE )
269
+         if ($ValuePosition == PIE_VALUE_OUTSIDE)
270 270
           {
271
-           $Xc = cos(($Angle-90)*PI/180) * ($Radius+$ValuePadding) + $X;
272
-           $Yc = sin(($Angle-90)*PI/180) * ($Radius+$ValuePadding) + $Y;
271
+           $Xc = cos(($Angle - 90)*PI/180)*($Radius + $ValuePadding) + $X;
272
+           $Yc = sin(($Angle - 90)*PI/180)*($Radius + $ValuePadding) + $Y;
273 273
           }
274 274
          else
275 275
           {
276
-           $Xc = cos(($Angle-90)*PI/180) * ($Radius)/2 + $X;
277
-           $Yc = sin(($Angle-90)*PI/180) * ($Radius)/2 + $Y;
276
+           $Xc = cos(($Angle - 90)*PI/180)*($Radius)/2 + $X;
277
+           $Yc = sin(($Angle - 90)*PI/180)*($Radius)/2 + $Y;
278 278
           }
279 279
 
280
-         if ( $WriteValues == PIE_VALUE_PERCENTAGE )
281
-          $Display = round(( 100 / $SerieSum ) * $Value,$Precision)."%";
282
-         elseif ( $WriteValues == PIE_VALUE_NATURAL )
280
+         if ($WriteValues == PIE_VALUE_PERCENTAGE)
281
+          $Display = round((100/$SerieSum)*$Value, $Precision)."%";
282
+         elseif ($WriteValues == PIE_VALUE_NATURAL)
283 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 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 293
      $this->pChartObject->Shadow = $RestoreShadow;
294 294
 
@@ -296,61 +296,61 @@  discard block
 block discarded – undo
296 296
     }
297 297
 
298 298
    /* Draw a 3D pie chart */
299
-   function draw3DPie($X,$Y,$Format="")
299
+   function draw3DPie($X, $Y, $Format = "")
300 300
     {
301 301
      /* Rendering layout */
302
-     $Radius		= isset($Format["Radius"]) ? $Format["Radius"] : 80;
302
+     $Radius = isset($Format["Radius"]) ? $Format["Radius"] : 80;
303 303
      $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
304 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;
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 308
      $SecondPass	= isset($Format["SecondPass"]) ? $Format["SecondPass"] : TRUE;
309 309
      $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
310 310
      $Shadow		= isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
311 311
      $DrawLabels	= isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : FALSE;
312
-     $LabelStacked	= isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
312
+     $LabelStacked = isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
313 313
      $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
314 314
      $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
315 315
      $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
316 316
      $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
317
-     $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
317
+     $LabelAlpha = isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
318 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;
319
+     $ValuePosition = isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_INSIDE;
320
+     $ValuePadding = isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 15;
321 321
      $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
322 322
      $ValueR		= isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
323 323
      $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
324 324
      $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
325
-     $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
326
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
325
+     $ValueAlpha = isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
326
+     $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
327 327
 
328 328
      /* Error correction for overlaying rounded corners */
329
-     if ( $SkewFactor < .5 ) { $SkewFactor = .5; }
329
+     if ($SkewFactor < .5) { $SkewFactor = .5; }
330 330
 
331 331
      /* Data Processing */
332 332
      $Data    = $this->pDataObject->getData();
333 333
      $Palette = $this->pDataObject->getPalette();
334 334
 
335 335
      /* Do we have an abscissa serie defined? */
336
-     if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
336
+     if ($Data["Abscissa"] == "") { return(PIE_NO_ABSCISSA); }
337 337
 
338 338
      /* Try to find the data serie */
339 339
      $DataSerie = "";
340 340
      foreach ($Data["Series"] as $SerieName => $SerieData)
341
-      { if ( $SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
341
+      { if ($SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
342 342
 
343 343
      /* Do we have data to compute? */
344
-     if ( $DataSerie == "" ) { return(PIE_NO_DATASERIE); }
344
+     if ($DataSerie == "") { return(PIE_NO_DATASERIE); }
345 345
 
346 346
      /* Remove unused data */
347
-     list($Data,$Palette) = $this->clean0Values($Data,$Palette,$DataSerie,$Data["Abscissa"]);
347
+     list($Data, $Palette) = $this->clean0Values($Data, $Palette, $DataSerie, $Data["Abscissa"]);
348 348
 
349 349
      /* Compute the pie sum */
350 350
      $SerieSum = $this->pDataObject->getSum($DataSerie);
351 351
 
352 352
      /* Do we have data to draw? */
353
-     if ( $SerieSum == 0 ) { return(PIE_SUMISNULL); }
353
+     if ($SerieSum == 0) { return(PIE_SUMISNULL); }
354 354
 
355 355
      /* Dump the real number of data to draw */
356 356
      $Values = "";
@@ -358,51 +358,51 @@  discard block
 block discarded – undo
358 358
       { if ($Value != 0) { $Values[] = $Value; } }
359 359
 
360 360
      /* Compute the wasted angular space between series */
361
-     if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = count($Values) * $DataGapAngle; }
361
+     if (count($Values) == 1) { $WastedAngular = 0; } else { $WastedAngular = count($Values)*$DataGapAngle; }
362 362
 
363 363
      /* Compute the scale */
364
-     $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
364
+     $ScaleFactor = (360 - $WastedAngular)/$SerieSum;
365 365
 
366 366
      $RestoreShadow = $this->pChartObject->Shadow;
367
-     if ( $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = FALSE; }
367
+     if ($this->pChartObject->Shadow) { $this->pChartObject->Shadow = FALSE; }
368 368
 
369 369
      /* Draw the polygon pie elements */
370
-     $Step   = 360 / (2 * PI * $Radius);
371
-     $Offset = 360; $ID = count($Values)-1;
370
+     $Step   = 360/(2*PI*$Radius);
371
+     $Offset = 360; $ID = count($Values) - 1;
372 372
      $Values = array_reverse($Values);
373 373
      $Slice  = 0; $Slices = ""; $SliceColors = ""; $Visible = ""; $SliceAngle = "";
374
-     foreach($Values as $Key => $Value)
374
+     foreach ($Values as $Key => $Value)
375 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"]);
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 378
 
379 379
        $SliceColors[$Slice] = $Settings;
380 380
 
381 381
        $StartAngle = $Offset;
382
-       $EndAngle   = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
382
+       $EndAngle   = $Offset - ($Value*$ScaleFactor); if ($EndAngle < 0) { $EndAngle = 0; }
383 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; }
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 386
 
387 387
        if ($DataGapAngle == 0)
388 388
         { $X0 = $X; $Y0 = $Y; }
389 389
        else
390 390
         {
391 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;
392
+         $X0 = cos(($Angle - 90)*PI/180)*$DataGapRadius + $X;
393
+         $Y0 = sin(($Angle - 90)*PI/180)*$DataGapRadius*$SkewFactor + $Y;
394 394
         }
395 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 407
          $Slices[$Slice][] = $Xc; $Slices[$Slice][] = $Yc; $SliceAngle[$Slice][] = $i;
408 408
         }
@@ -411,30 +411,30 @@  discard block
 block discarded – undo
411 411
       }
412 412
 
413 413
      /* Draw the bottom shadow if needed */
414
-     if ( $RestoreShadow && ($this->pChartObject->ShadowX != 0 || $this->pChartObject->ShadowY !=0 ))
414
+     if ($RestoreShadow && ($this->pChartObject->ShadowX != 0 || $this->pChartObject->ShadowY != 0))
415 415
       {
416
-       foreach($Slices as $SliceID => $Plots)
416
+       foreach ($Slices as $SliceID => $Plots)
417 417
         {
418 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; }
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);
426
+       $Step = 360/(2*PI*$Radius);
427 427
        $Offset = 360;
428
-       foreach($Values as $Key => $Value)
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)
432
+         for ($i = $Offset; $i >= $EndAngle; $i = $i - $Step)
433 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;
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);
437
+           $this->pChartObject->drawAntialiasPixel($Xc, $Yc, $Settings);
438 438
           }
439 439
 
440 440
          $Offset = $i - $DataGapAngle; $ID--;
@@ -442,28 +442,28 @@  discard block
 block discarded – undo
442 442
       }
443 443
 
444 444
      /* Draw the bottom pie splice */
445
-     foreach($Slices as $SliceID => $Plots)
445
+     foreach ($Slices as $SliceID => $Plots)
446 446
       {
447
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
448
-       $this->pChartObject->drawPolygon($Plots,$Settings);
447
+       $Settings = $SliceColors[$SliceID]; $Settings["NoBorder"] = TRUE;
448
+       $this->pChartObject->drawPolygon($Plots, $Settings);
449 449
 
450
-       if ( $SecondPass )
450
+       if ($SecondPass)
451 451
         {
452 452
          $Settings = $SliceColors[$SliceID];
453
-         if ( $Border )
454
-          { $Settings["R"]+= 30; $Settings["G"]+= 30; $Settings["B"]+= 30;; }
453
+         if ($Border)
454
+          { $Settings["R"] += 30; $Settings["G"] += 30; $Settings["B"] += 30; ; }
455 455
   
456
-         if ( isset($SliceAngle[$SliceID][1]) ) /* Empty error handling */
456
+         if (isset($SliceAngle[$SliceID][1])) /* Empty error handling */
457 457
           {
458 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);
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 467
           }
468 468
         }
469 469
       }
@@ -471,225 +471,225 @@  discard block
 block discarded – undo
471 471
      /* Draw the two vertical edges */
472 472
      $Slices      = array_reverse($Slices);
473 473
      $SliceColors = array_reverse($SliceColors);
474
-     foreach($Slices as $SliceID => $Plots)
474
+     foreach ($Slices as $SliceID => $Plots)
475 475
       {
476 476
        $Settings = $SliceColors[$SliceID];
477
-       $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
477
+       $Settings["R"] += 10; $Settings["G"] += 10; $Settings["B"] += 10; $Settings["NoBorder"] = TRUE;
478 478
 
479
-       if ( $Visible[$SliceID]["Start"] && isset($Plots[2])) /* Empty error handling */
479
+       if ($Visible[$SliceID]["Start"] && isset($Plots[2])) /* Empty error handling */
480 480
         {
481
-         $this->pChartObject->drawLine($Plots[2],$Plots[3],$Plots[2],$Plots[3]- $SliceHeight,array("R"=>$Settings["R"],"G"=>$Settings["G"],"B"=>$Settings["B"]));
481
+         $this->pChartObject->drawLine($Plots[2], $Plots[3], $Plots[2], $Plots[3] - $SliceHeight, array("R"=>$Settings["R"], "G"=>$Settings["G"], "B"=>$Settings["B"]));
482 482
          $Border = "";
483 483
          $Border[] = $Plots[0]; $Border[] = $Plots[1]; $Border[] = $Plots[0]; $Border[] = $Plots[1] - $SliceHeight;
484 484
          $Border[] = $Plots[2]; $Border[] = $Plots[3] - $SliceHeight; $Border[] = $Plots[2]; $Border[] = $Plots[3]; 
485
-         $this->pChartObject->drawPolygon($Border,$Settings);
485
+         $this->pChartObject->drawPolygon($Border, $Settings);
486 486
         }
487 487
       }
488 488
 
489 489
      $Slices      = array_reverse($Slices);
490 490
      $SliceColors = array_reverse($SliceColors);
491
-     foreach($Slices as $SliceID => $Plots)
491
+     foreach ($Slices as $SliceID => $Plots)
492 492
       {
493 493
        $Settings = $SliceColors[$SliceID];
494
-       $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
495
-       if ( $Visible[$SliceID]["End"] )
494
+       $Settings["R"] += 10; $Settings["G"] += 10; $Settings["B"] += 10; $Settings["NoBorder"] = TRUE;
495
+       if ($Visible[$SliceID]["End"])
496 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"]));
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 498
 
499 499
          $Border = "";
500 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);
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 503
         }
504 504
       }
505 505
 
506 506
      /* Draw the rounded edges */
507
-     foreach($Slices as $SliceID => $Plots)
507
+     foreach ($Slices as $SliceID => $Plots)
508 508
       {
509 509
        $Settings = $SliceColors[$SliceID];
510
-       $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
510
+       $Settings["R"] += 10; $Settings["G"] += 10; $Settings["B"] += 10; $Settings["NoBorder"] = TRUE;
511 511
 
512
-       for ($j=2;$j<count($Plots)-2;$j=$j+2)
512
+       for ($j = 2; $j < count($Plots) - 2; $j = $j + 2)
513 513
         {
514 514
          $Angle = $SliceAngle[$SliceID][$j/2];
515
-         if ( $Angle < 270 && $Angle > 90 )
515
+         if ($Angle < 270 && $Angle > 90)
516 516
           {
517 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);
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 523
           }
524 524
         }
525 525
 
526
-       if ( $SecondPass )
526
+       if ($SecondPass)
527 527
         {
528 528
          $Settings = $SliceColors[$SliceID];
529
-         if ( $Border )
530
-          { $Settings["R"]+= 30; $Settings["G"]+= 30; $Settings["B"]+= 30; }
529
+         if ($Border)
530
+          { $Settings["R"] += 30; $Settings["G"] += 30; $Settings["B"] += 30; }
531 531
   
532
-         if ( isset($SliceAngle[$SliceID][1]) ) /* Empty error handling */
532
+         if (isset($SliceAngle[$SliceID][1])) /* Empty error handling */
533 533
           {
534 534
            $Angle = $SliceAngle[$SliceID][1];
535
-           if ( $Angle < 270 && $Angle > 90 )
535
+           if ($Angle < 270 && $Angle > 90)
536 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);
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 540
             }
541 541
           }
542 542
 
543
-         $Angle = $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1];
544
-         if ( $Angle < 270 && $Angle > 90 )
543
+         $Angle = $SliceAngle[$SliceID][count($SliceAngle[$SliceID]) - 1];
544
+         if ($Angle < 270 && $Angle > 90)
545 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);
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 549
           }
550 550
 
551
-         if ( isset($SliceAngle[$SliceID][1]) && $SliceAngle[$SliceID][1] > 270 && $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1] < 270 )
551
+         if (isset($SliceAngle[$SliceID][1]) && $SliceAngle[$SliceID][1] > 270 && $SliceAngle[$SliceID][count($SliceAngle[$SliceID]) - 1] < 270)
552 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);
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 556
           }
557 557
 
558
-         if ( isset($SliceAngle[$SliceID][1]) && $SliceAngle[$SliceID][1] > 90 && $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1] < 90 )
558
+         if (isset($SliceAngle[$SliceID][1]) && $SliceAngle[$SliceID][1] > 90 && $SliceAngle[$SliceID][count($SliceAngle[$SliceID]) - 1] < 90)
559 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);
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 563
           }
564 564
 
565 565
         }
566 566
       }
567 567
 
568 568
      /* Draw the top splice */
569
-     foreach($Slices as $SliceID => $Plots)
569
+     foreach ($Slices as $SliceID => $Plots)
570 570
       {
571 571
        $Settings = $SliceColors[$SliceID];
572
-       $Settings["R"]+= 20; $Settings["G"]+= 20; $Settings["B"]+= 20;
572
+       $Settings["R"] += 20; $Settings["G"] += 20; $Settings["B"] += 20;
573 573
 
574 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);
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 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]); }
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 579
       }
580 580
 
581 581
 
582 582
      /* Second pass to smooth the angles */
583
-     if ( $SecondPass )
583
+     if ($SecondPass)
584 584
       {
585
-       $Step = 360 / (2 * PI * $Radius);
586
-       $Offset = 360; $ID = count($Values)-1;
587
-       foreach($Values as $Key => $Value)
585
+       $Step = 360/(2*PI*$Radius);
586
+       $Offset = 360; $ID = count($Values) - 1;
587
+       foreach ($Values as $Key => $Value)
588 588
         {
589 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);
590
+         if ($Shadow)
591
+          $Settings = array("R"=>$this->pChartObject->ShadowR, "G"=>$this->pChartObject->ShadowG, "B"=>$this->pChartObject->ShadowB, "Alpha"=>$this->pChartObject->Shadowa);
592 592
          else
593 593
           {
594
-           if ( $Border )
595
-            { $Settings = array("R"=>$Palette[$ID]["R"]+30,"G"=>$Palette[$ID]["G"]+30,"B"=>$Palette[$ID]["B"]+30,"Alpha"=>$Palette[$ID]["Alpha"]); }
594
+           if ($Border)
595
+            { $Settings = array("R"=>$Palette[$ID]["R"] + 30, "G"=>$Palette[$ID]["G"] + 30, "B"=>$Palette[$ID]["B"] + 30, "Alpha"=>$Palette[$ID]["Alpha"]); }
596 596
            else
597
-            $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
597
+            $Settings = array("R"=>$Palette[$ID]["R"], "G"=>$Palette[$ID]["G"], "B"=>$Palette[$ID]["B"], "Alpha"=>$Palette[$ID]["Alpha"]);
598 598
           }
599 599
 
600
-         $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
600
+         $EndAngle = $Offset - ($Value*$ScaleFactor); if ($EndAngle < 0) { $EndAngle = 0; }
601 601
 
602 602
          if ($DataGapAngle == 0)
603
-          { $X0 = $X; $Y0 = $Y- $SliceHeight; }
603
+          { $X0 = $X; $Y0 = $Y - $SliceHeight; }
604 604
          else
605 605
           {
606 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;
607
+           $X0 = cos(($Angle - 90)*PI/180)*$DataGapRadius + $X;
608
+           $Y0 = sin(($Angle - 90)*PI/180)*$DataGapRadius*$SkewFactor + $Y - $SliceHeight;
609 609
           }
610 610
          $Plots[] = $X0; $Plots[] = $Y0;
611 611
 
612
-         for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
612
+         for ($i = $Offset; $i >= $EndAngle; $i = $i - $Step)
613 613
           {
614
-           $Xc = cos(($i-90)*PI/180) * $Radius + $X;
615
-           $Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y - $SliceHeight;
614
+           $Xc = cos(($i - 90)*PI/180)*$Radius + $X;
615
+           $Yc = sin(($i - 90)*PI/180)*$Radius*$SkewFactor + $Y - $SliceHeight;
616 616
 
617
-           if ( $FirstPoint ) { $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); } { $FirstPoint = FALSE; }
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); }
619
+           $this->pChartObject->drawAntialiasPixel($Xc, $Yc, $Settings);
620
+           if ($i < 270 && $i > 90) { $this->pChartObject->drawAntialiasPixel($Xc, $Yc + $SliceHeight, $Settings); }
621 621
           }
622
-         $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings);
622
+         $this->pChartObject->drawLine($Xc, $Yc, $X0, $Y0, $Settings);
623 623
 
624 624
          $Offset = $i - $DataGapAngle; $ID--;
625 625
         }
626 626
       }
627 627
 
628
-     if ( $WriteValues != NULL )
628
+     if ($WriteValues != NULL)
629 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)
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 634
         {
635
-         $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
635
+         $EndAngle = $Offset - ($Value*$ScaleFactor); if ($EndAngle < 0) { $EndAngle = 0; }
636 636
 
637 637
          $Angle = ($EndAngle - $Offset)/2 + $Offset;
638 638
 
639
-         if ( $ValuePosition == PIE_VALUE_OUTSIDE )
639
+         if ($ValuePosition == PIE_VALUE_OUTSIDE)
640 640
           {
641
-           $Xc = cos(($Angle-90)*PI/180) * ($Radius+$ValuePadding) + $X;
642
-           $Yc = sin(($Angle-90)*PI/180) * (($Radius*$SkewFactor)+$ValuePadding) + $Y - $SliceHeight;
641
+           $Xc = cos(($Angle - 90)*PI/180)*($Radius + $ValuePadding) + $X;
642
+           $Yc = sin(($Angle - 90)*PI/180)*(($Radius*$SkewFactor) + $ValuePadding) + $Y - $SliceHeight;
643 643
           }
644 644
          else
645 645
           {
646
-           $Xc = cos(($Angle-90)*PI/180) * ($Radius)/2 + $X;
647
-           $Yc = sin(($Angle-90)*PI/180) * ($Radius*$SkewFactor)/2 + $Y - $SliceHeight;
646
+           $Xc = cos(($Angle - 90)*PI/180)*($Radius)/2 + $X;
647
+           $Yc = sin(($Angle - 90)*PI/180)*($Radius*$SkewFactor)/2 + $Y - $SliceHeight;
648 648
           }
649 649
 
650
-         if ( $WriteValues == PIE_VALUE_PERCENTAGE )
651
-          $Display = round(( 100 / $SerieSum ) * $Value,$Precision)."%";
652
-         elseif ( $WriteValues == PIE_VALUE_NATURAL )
650
+         if ($WriteValues == PIE_VALUE_PERCENTAGE)
651
+          $Display = round((100/$SerieSum)*$Value, $Precision)."%";
652
+         elseif ($WriteValues == PIE_VALUE_NATURAL)
653 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 657
          $Offset = $EndAngle - $DataGapAngle; $ID--;
658 658
         }
659 659
       }
660 660
 
661
-     if ( $DrawLabels )
661
+     if ($DrawLabels)
662 662
       {
663
-       $Step = 360 / (2 * PI * $Radius);
664
-       $Offset = 360; $ID = count($Values)-1;
665
-       foreach($Values as $Key => $Value)
663
+       $Step = 360/(2*PI*$Radius);
664
+       $Offset = 360; $ID = count($Values) - 1;
665
+       foreach ($Values as $Key => $Value)
666 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"]);}
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 669
          else
670
-          { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
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 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;
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]) )
678
+         if (isset($Data["Series"][$Data["Abscissa"]]["Data"][$ID]))
679 679
           {
680 680
            $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$ID];
681 681
 
682
-           if ( $LabelStacked )
683
-            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$Radius,TRUE);
682
+           if ($LabelStacked)
683
+            $this->writePieLabel($Xc, $Yc, $Label, $Angle, $Settings, TRUE, $X, $Y, $Radius, TRUE);
684 684
            else
685
-            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
685
+            $this->writePieLabel($Xc, $Yc, $Label, $Angle, $Settings, FALSE);
686 686
           }
687 687
 
688 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 694
      $this->pChartObject->Shadow = $RestoreShadow;
695 695
 
@@ -697,29 +697,29 @@  discard block
 block discarded – undo
697 697
     }
698 698
 
699 699
    /* Draw the legend of pie chart */
700
-   function drawPieLegend($X,$Y,$Format="")
700
+   function drawPieLegend($X, $Y, $Format = "")
701 701
     {
702 702
      $FontName		= isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
703 703
      $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
704 704
      $FontR		= isset($Format["FontR"]) ? $Format["FontR"] : $this->pChartObject->FontColorR;
705 705
      $FontG		= isset($Format["FontG"]) ? $Format["FontG"] : $this->pChartObject->FontColorG;
706 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;
707
+     $BoxSize = isset($Format["BoxSize"]) ? $Format["BoxSize"] : 5;
708
+     $Margin = isset($Format["Margin"]) ? $Format["Margin"] : 5;
709 709
      $R			= isset($Format["R"]) ? $Format["R"] : 200;
710 710
      $G			= isset($Format["G"]) ? $Format["G"] : 200;
711 711
      $B			= isset($Format["B"]) ? $Format["B"] : 200;
712
-     $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
712
+     $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
713 713
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
714 714
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
715 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;
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 719
 
720
-     if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
720
+     if ($Surrounding != NULL) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
721 721
 
722
-     $YStep = max($this->pChartObject->FontSize,$BoxSize) + 5;
722
+     $YStep = max($this->pChartObject->FontSize, $BoxSize) + 5;
723 723
      $XStep = $BoxSize + 5;
724 724
 
725 725
      /* Data Processing */
@@ -727,54 +727,54 @@  discard block
 block discarded – undo
727 727
      $Palette = $this->pDataObject->getPalette();
728 728
 
729 729
      /* Do we have an abscissa serie defined? */
730
-     if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
730
+     if ($Data["Abscissa"] == "") { return(PIE_NO_ABSCISSA); }
731 731
 
732 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)
733
+     foreach ($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $Value)
734 734
       {
735
-       $BoxArray = $this->pChartObject->getTextBox($vX+$BoxSize+4,$vY+$BoxSize/2,$FontName,$FontSize,0,$Value);
735
+       $BoxArray = $this->pChartObject->getTextBox($vX + $BoxSize + 4, $vY + $BoxSize/2, $FontName, $FontSize, 0, $Value);
736 736
 
737
-       if ( $Mode == LEGEND_VERTICAL )
737
+       if ($Mode == LEGEND_VERTICAL)
738 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;
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 743
         }
744
-       elseif ( $Mode == LEGEND_HORIZONTAL )
744
+       elseif ($Mode == LEGEND_HORIZONTAL)
745 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;
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 750
         }
751 751
       }
752
-     $vY=$vY-$YStep; $vX=$vX-$XStep;
752
+     $vY = $vY - $YStep; $vX = $vX - $XStep;
753 753
 
754
-     $TopOffset  = $Y - $Boundaries["T"];
755
-     if ( $Boundaries["B"]-($vY+$BoxSize) < $TopOffset ) { $Boundaries["B"] = $vY+$BoxSize+$TopOffset; }
754
+     $TopOffset = $Y - $Boundaries["T"];
755
+     if ($Boundaries["B"] - ($vY + $BoxSize) < $TopOffset) { $Boundaries["B"] = $vY + $BoxSize + $TopOffset; }
756 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));
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 761
 
762 762
      $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE;
763
-     foreach($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $Value)
763
+     foreach ($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $Value)
764 764
       {
765 765
        $R = $Palette[$Key]["R"]; $G = $Palette[$Key]["G"]; $B = $Palette[$Key]["B"];
766 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 )
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 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;
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 773
         }
774
-       elseif ( $Mode == LEGEND_HORIZONTAL )
774
+       elseif ($Mode == LEGEND_HORIZONTAL)
775 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;
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 778
         }
779 779
       }
780 780
 
@@ -782,12 +782,12 @@  discard block
 block discarded – undo
782 782
     }
783 783
 
784 784
    /* Set the color of the specified slice */
785
-   function setSliceColor($SliceID,$Format="")
785
+   function setSliceColor($SliceID, $Format = "")
786 786
     {
787 787
      $R		= isset($Format["R"]) ? $Format["R"] : 0;
788 788
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
789 789
      $B		= isset($Format["B"]) ? $Format["B"] : 0;
790
-     $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
790
+     $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
791 791
 
792 792
      $this->pDataObject->Palette[$SliceID]["R"]     = $R;
793 793
      $this->pDataObject->Palette[$SliceID]["G"]     = $G;
@@ -796,71 +796,71 @@  discard block
 block discarded – undo
796 796
     }
797 797
 
798 798
    /* Internally used compute the label positions */
799
-   function writePieLabel($X,$Y,$Label,$Angle,$Settings,$Stacked,$Xc=0,$Yc=0,$Radius=0,$Reversed=FALSE)
799
+   function writePieLabel($X, $Y, $Label, $Angle, $Settings, $Stacked, $Xc = 0, $Yc = 0, $Radius = 0, $Reversed = FALSE)
800 800
     {
801
-     $LabelOffset	= 30;
801
+     $LabelOffset = 30;
802 802
      $FontName		= $this->pChartObject->FontName;
803 803
      $FontSize		= $this->pChartObject->FontSize;
804 804
 
805
-     if ( !$Stacked )
805
+     if (!$Stacked)
806 806
       {
807
-       $Settings["Angle"]  = 360-$Angle;
807
+       $Settings["Angle"]  = 360 - $Angle;
808 808
        $Settings["Length"] = 25;
809 809
        $Settings["Size"]   = 8;
810 810
 
811
-       $this->pChartObject->drawArrowLabel($X,$Y," ".$Label." ",$Settings);
811
+       $this->pChartObject->drawArrowLabel($X, $Y, " ".$Label." ", $Settings);
812 812
       }
813 813
      else
814 814
       {
815
-       $X2 = cos(deg2rad($Angle-90))*20+$X;
816
-       $Y2 = sin(deg2rad($Angle-90))*20+$Y;
815
+       $X2 = cos(deg2rad($Angle - 90))*20 + $X;
816
+       $Y2 = sin(deg2rad($Angle - 90))*20 + $Y;
817 817
 
818
-       $TxtPos = $this->pChartObject->getTextBox($X,$Y,$FontName,$FontSize,0,$Label);
818
+       $TxtPos = $this->pChartObject->getTextBox($X, $Y, $FontName, $FontSize, 0, $Label);
819 819
        $Height = $TxtPos[0]["Y"] - $TxtPos[2]["Y"];
820 820
        $YTop    = $Y2 - $Height/2 - 2;
821 821
        $YBottom = $Y2 + $Height/2 + 2;
822 822
 
823
-       if ( $this->LabelPos != "" )
823
+       if ($this->LabelPos != "")
824 824
         {
825 825
          $Done = FALSE;
826
-         foreach($this->LabelPos as $Key => $Settings)
826
+         foreach ($this->LabelPos as $Key => $Settings)
827 827
           {
828
-           if ( !$Done )
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; }
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 845
        $this->LabelPos[] = $LabelSettings;
846 846
       }
847 847
     }
848 848
 
849 849
    /* Internally used to shift label positions */
850
-   function shift($StartAngle,$EndAngle,$Offset,$Reversed)
850
+   function shift($StartAngle, $EndAngle, $Offset, $Reversed)
851 851
     {
852
-     if ( $Reversed ) { $Offset = -$Offset; }
853
-     foreach($this->LabelPos as $Key => $Settings)
852
+     if ($Reversed) { $Offset = -$Offset; }
853
+     foreach ($this->LabelPos as $Key => $Settings)
854 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; }
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 856
       }
857 857
     }
858 858
 
859 859
    /* Internally used to write the re-computed labels */
860 860
    function writeShiftedLabels()
861 861
     {
862
-     if ( $this->LabelPos == "" ) { return(0); }
863
-     foreach($this->LabelPos as $Key => $Settings)
862
+     if ($this->LabelPos == "") { return(0); }
863
+     foreach ($this->LabelPos as $Key => $Settings)
864 864
       {
865 865
        $X1 = $Settings["X1"]; $Y1 = $Settings["Y1"];
866 866
        $X2 = $Settings["X2"]; $Y2 = $Settings["Y2"];
@@ -868,72 +868,72 @@  discard block
 block discarded – undo
868 868
        $Angle = $Settings["Angle"];
869 869
        $Label = $Settings["Label"];
870 870
 
871
-       $this->pChartObject->drawArrow($X2,$Y2,$X1,$Y1,array("Size"=>8));
872
-       if ( $Angle <= 180 )
871
+       $this->pChartObject->drawArrow($X2, $Y2, $X1, $Y1, array("Size"=>8));
872
+       if ($Angle <= 180)
873 873
         {
874
-         $this->pChartObject->drawLine($X2,$Y2,$X3,$Y2);
875
-         $this->pChartObject->drawText($X3+2,$Y2,$Label,array("Align"=>TEXT_ALIGN_MIDDLELEFT));
874
+         $this->pChartObject->drawLine($X2, $Y2, $X3, $Y2);
875
+         $this->pChartObject->drawText($X3 + 2, $Y2, $Label, array("Align"=>TEXT_ALIGN_MIDDLELEFT));
876 876
         }
877 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 885
    /* Draw a ring chart */
886
-   function draw2DRing($X,$Y,$Format="")
886
+   function draw2DRing($X, $Y, $Format = "")
887 887
     {
888 888
      $OuterRadius	= isset($Format["Radius"]) ? $Format["Radius"] : 60;
889
-     $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
889
+     $Precision = isset($Format["Precision"]) ? $Format["Precision"] : 0;
890 890
      $InnerRadius	= isset($Format["Radius"]) ? $Format["Radius"] : 30;
891
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
891
+     $Border = isset($Format["Border"]) ? $Format["Border"] : FALSE;
892 892
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
893 893
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
894 894
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
895
-     $BorderAlpha	= isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 100;
896
-     $Shadow		= isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
895
+     $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 100;
896
+     $Shadow = isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
897 897
      $DrawLabels	= isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : FALSE;
898
-     $LabelStacked	= isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
898
+     $LabelStacked = isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
899 899
      $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
900 900
      $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
901 901
      $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
902 902
      $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
903
-     $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
903
+     $LabelAlpha = isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
904 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;
905
+     $ValuePadding = isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 5;
906
+     $ValuePosition = isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_OUTSIDE;
907 907
      $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
908 908
      $ValueR		= isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
909 909
      $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
910 910
      $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
911
-     $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
912
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
911
+     $ValueAlpha = isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
912
+     $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
913 913
 
914 914
      /* Data Processing */
915 915
      $Data    = $this->pDataObject->getData();
916 916
      $Palette = $this->pDataObject->getPalette();
917 917
 
918 918
      /* Do we have an abscissa serie defined? */
919
-     if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
919
+     if ($Data["Abscissa"] == "") { return(PIE_NO_ABSCISSA); }
920 920
 
921 921
      /* Try to find the data serie */
922 922
      $DataSerie = "";
923 923
      foreach ($Data["Series"] as $SerieName => $SerieData)
924
-      { if ( $SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
924
+      { if ($SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
925 925
 
926 926
      /* Do we have data to compute? */
927
-     if ( $DataSerie == "" ) { return(PIE_NO_DATASERIE); }
927
+     if ($DataSerie == "") { return(PIE_NO_DATASERIE); }
928 928
 
929 929
      /* Remove unused data */
930
-     list($Data,$Palette) = $this->clean0Values($Data,$Palette,$DataSerie,$Data["Abscissa"]);
930
+     list($Data, $Palette) = $this->clean0Values($Data, $Palette, $DataSerie, $Data["Abscissa"]);
931 931
 
932 932
      /* Compute the pie sum */
933 933
      $SerieSum = $this->pDataObject->getSum($DataSerie);
934 934
 
935 935
      /* Do we have data to draw? */
936
-     if ( $SerieSum == 0 ) { return(PIE_SUMISNULL); }
936
+     if ($SerieSum == 0) { return(PIE_SUMISNULL); }
937 937
 
938 938
      /* Dump the real number of data to draw */
939 939
      $Values = "";
@@ -941,146 +941,146 @@  discard block
 block discarded – undo
941 941
       { if ($Value != 0) { $Values[] = $Value; } }
942 942
 
943 943
      /* Compute the wasted angular space between series */
944
-     if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = 0; } // count($Values)
944
+     if (count($Values) == 1) { $WastedAngular = 0; } else { $WastedAngular = 0; } // count($Values)
945 945
 
946 946
      /* Compute the scale */
947
-     $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
947
+     $ScaleFactor = (360 - $WastedAngular)/$SerieSum;
948 948
 
949 949
      $RestoreShadow = $this->pChartObject->Shadow;
950
-     if ( $this->pChartObject->Shadow )
950
+     if ($this->pChartObject->Shadow)
951 951
       {
952 952
        $this->pChartObject->Shadow = FALSE;
953 953
 
954 954
        $ShadowFormat = $Format; $ShadowFormat["Shadow"] = TRUE;
955
-       $this->draw2DRing($X+$this->pChartObject->ShadowX,$Y+$this->pChartObject->ShadowY,$ShadowFormat);
955
+       $this->draw2DRing($X + $this->pChartObject->ShadowX, $Y + $this->pChartObject->ShadowY, $ShadowFormat);
956 956
       }
957 957
 
958 958
      /* Draw the polygon pie elements */
959
-     $Step = 360 / (2 * PI * $OuterRadius);
959
+     $Step = 360/(2*PI*$OuterRadius);
960 960
      $Offset = 0; $ID = 0;
961
-     foreach($Values as $Key => $Value)
961
+     foreach ($Values as $Key => $Value)
962 962
       {
963
-       if ( $Shadow )
963
+       if ($Shadow)
964 964
         {
965
-         $Settings    = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
965
+         $Settings    = array("R"=>$this->pChartObject->ShadowR, "G"=>$this->pChartObject->ShadowG, "B"=>$this->pChartObject->ShadowB, "Alpha"=>$this->pChartObject->Shadowa);
966 966
          $BorderColor = $Settings;
967 967
         }
968 968
        else
969 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"]);
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 972
 
973
-         if ( $Border )
974
-          $BorderColor = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
973
+         if ($Border)
974
+          $BorderColor = array("R"=>$BorderR, "G"=>$BorderG, "B"=>$BorderB, "Alpha"=>$BorderAlpha);
975 975
          else
976 976
           $BorderColor = $Settings;
977 977
         }
978 978
 
979 979
        $Plots = ""; $Boundaries = ""; $AAPixels = "";
980
-       $EndAngle = $Offset+($Value*$ScaleFactor); if ( $EndAngle > 360 ) { $EndAngle = 360; }
981
-       for($i=$Offset;$i<=$EndAngle;$i=$i+$Step)
980
+       $EndAngle = $Offset + ($Value*$ScaleFactor); if ($EndAngle > 360) { $EndAngle = 360; }
981
+       for ($i = $Offset; $i <= $EndAngle; $i = $i + $Step)
982 982
         {
983
-         $Xc = cos(($i-90)*PI/180) * $OuterRadius + $X;
984
-         $Yc = sin(($i-90)*PI/180) * $OuterRadius + $Y;
983
+         $Xc = cos(($i - 90)*PI/180)*$OuterRadius + $X;
984
+         $Yc = sin(($i - 90)*PI/180)*$OuterRadius + $Y;
985 985
 
986
-         if ( !isset($Boundaries[0]["X1"]) ) { $Boundaries[0]["X1"] = $Xc; $Boundaries[0]["Y1"] = $Yc; }
987
-         $AAPixels[] = array($Xc,$Yc);
986
+         if (!isset($Boundaries[0]["X1"])) { $Boundaries[0]["X1"] = $Xc; $Boundaries[0]["Y1"] = $Yc; }
987
+         $AAPixels[] = array($Xc, $Yc);
988 988
 
989
-         if ( $i<90 ) { $Yc++; }
990
-         if ( $i>180 && $i<270 ) { $Xc++; }
991
-         if ( $i>=270 ) { $Xc++; $Yc++; }
989
+         if ($i < 90) { $Yc++; }
990
+         if ($i > 180 && $i < 270) { $Xc++; }
991
+         if ($i >= 270) { $Xc++; $Yc++; }
992 992
 
993 993
          $Plots[] = $Xc; $Plots[] = $Yc;
994 994
         }
995 995
        $Boundaries[1]["X1"] = $Xc; $Boundaries[1]["Y1"] = $Yc;
996 996
        $Lasti = $EndAngle;
997 997
 
998
-       for($i=$EndAngle;$i>=$Offset;$i=$i-$Step)
998
+       for ($i = $EndAngle; $i >= $Offset; $i = $i - $Step)
999 999
         {
1000
-         $Xc = cos(($i-90)*PI/180) * ($InnerRadius-1) + $X;
1001
-         $Yc = sin(($i-90)*PI/180) * ($InnerRadius-1) + $Y;
1000
+         $Xc = cos(($i - 90)*PI/180)*($InnerRadius - 1) + $X;
1001
+         $Yc = sin(($i - 90)*PI/180)*($InnerRadius - 1) + $Y;
1002 1002
 
1003
-         if ( !isset($Boundaries[1]["X2"]) ) { $Boundaries[1]["X2"] = $Xc; $Boundaries[1]["Y2"] = $Yc; }
1004
-         $AAPixels[] = array($Xc,$Yc);
1003
+         if (!isset($Boundaries[1]["X2"])) { $Boundaries[1]["X2"] = $Xc; $Boundaries[1]["Y2"] = $Yc; }
1004
+         $AAPixels[] = array($Xc, $Yc);
1005 1005
 
1006
-         $Xc = cos(($i-90)*PI/180) * $InnerRadius + $X;
1007
-         $Yc = sin(($i-90)*PI/180) * $InnerRadius + $Y;
1006
+         $Xc = cos(($i - 90)*PI/180)*$InnerRadius + $X;
1007
+         $Yc = sin(($i - 90)*PI/180)*$InnerRadius + $Y;
1008 1008
 
1009
-         if ( $i<90 ) { $Yc++; }
1010
-         if ( $i>180 && $i<270 ) { $Xc++; }
1011
-         if ( $i>=270 ) { $Xc++; $Yc++; }
1009
+         if ($i < 90) { $Yc++; }
1010
+         if ($i > 180 && $i < 270) { $Xc++; }
1011
+         if ($i >= 270) { $Xc++; $Yc++; }
1012 1012
 
1013 1013
          $Plots[] = $Xc; $Plots[] = $Yc;
1014 1014
         }
1015 1015
        $Boundaries[0]["X2"] = $Xc; $Boundaries[0]["Y2"] = $Yc;
1016 1016
 
1017 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); }
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 1020
 
1021 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);
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);
1025 1025
 
1026
-       if ( $DrawLabels && !$Shadow )
1026
+       if ($DrawLabels && !$Shadow)
1027 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"]);}
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 1030
          else
1031
-          { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
1031
+          { $Settings = array("FillR"=>$LabelR, "FillG"=>$LabelG, "FillB"=>$LabelB, "Alpha"=>$LabelAlpha); }
1032 1032
 
1033 1033
          $Angle = ($EndAngle - $Offset)/2 + $Offset;
1034
-         $Xc = cos(($Angle-90)*PI/180) * $OuterRadius + $X;
1035
-         $Yc = sin(($Angle-90)*PI/180) * $OuterRadius + $Y;
1034
+         $Xc = cos(($Angle - 90)*PI/180)*$OuterRadius + $X;
1035
+         $Yc = sin(($Angle - 90)*PI/180)*$OuterRadius + $Y;
1036 1036
 
1037 1037
          $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
1038 1038
 
1039
-         if ( $LabelStacked )
1040
-          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$OuterRadius);
1039
+         if ($LabelStacked)
1040
+          $this->writePieLabel($Xc, $Yc, $Label, $Angle, $Settings, TRUE, $X, $Y, $OuterRadius);
1041 1041
          else
1042
-          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
1042
+          $this->writePieLabel($Xc, $Yc, $Label, $Angle, $Settings, FALSE);
1043 1043
         }
1044 1044
 
1045 1045
        $Offset = $Lasti; $ID++;
1046 1046
       }
1047 1047
 
1048
-     if ( $DrawLabels && $LabelStacked ) { $this->writeShiftedLabels(); }
1048
+     if ($DrawLabels && $LabelStacked) { $this->writeShiftedLabels(); }
1049 1049
 
1050
-     if ( $WriteValues && !$Shadow )
1050
+     if ($WriteValues && !$Shadow)
1051 1051
       {
1052
-       $Step = 360 / (2 * PI * $OuterRadius);
1052
+       $Step = 360/(2*PI*$OuterRadius);
1053 1053
        $Offset = 0;
1054
-       foreach($Values as $Key => $Value)
1054
+       foreach ($Values as $Key => $Value)
1055 1055
         {
1056
-         $EndAngle = $Offset+($Value*$ScaleFactor);
1057
-         if ( $EndAngle > 360 ) { $EndAngle = 360; }
1056
+         $EndAngle = $Offset + ($Value*$ScaleFactor);
1057
+         if ($EndAngle > 360) { $EndAngle = 360; }
1058 1058
 
1059
-         $Angle = $Offset+($Value*$ScaleFactor)/2;
1060
-         if ( $ValuePosition == PIE_VALUE_OUTSIDE )
1059
+         $Angle = $Offset + ($Value*$ScaleFactor)/2;
1060
+         if ($ValuePosition == PIE_VALUE_OUTSIDE)
1061 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; }
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 1068
           }
1069 1069
          else
1070 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;
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 1073
            $Align = TEXT_ALIGN_MIDDLEMIDDLE;
1074 1074
           }
1075 1075
 
1076
-         if ( $WriteValues == PIE_VALUE_PERCENTAGE )
1077
-          $Display = round(( 100 / $SerieSum ) * $Value,$Precision)."%";
1078
-         elseif ( $WriteValues == PIE_VALUE_NATURAL )
1076
+         if ($WriteValues == PIE_VALUE_PERCENTAGE)
1077
+          $Display = round((100/$SerieSum)*$Value, $Precision)."%";
1078
+         elseif ($WriteValues == PIE_VALUE_NATURAL)
1079 1079
           $Display = $Value.$ValueSuffix;
1080 1080
          else
1081 1081
           $Label = "";
1082 1082
 
1083
-         $this->pChartObject->drawText($Xc,$Yc,$Display,array("Align"=>$Align,"R"=>$ValueR,"G"=>$ValueG,"B"=>$ValueB));
1083
+         $this->pChartObject->drawText($Xc, $Yc, $Display, array("Align"=>$Align, "R"=>$ValueR, "G"=>$ValueG, "B"=>$ValueB));
1084 1084
          $Offset = $EndAngle;
1085 1085
         }
1086 1086
       }
@@ -1091,61 +1091,61 @@  discard block
 block discarded – undo
1091 1091
     }
1092 1092
 
1093 1093
    /* Draw a 3D ring chart */
1094
-   function draw3DRing($X,$Y,$Format="")
1094
+   function draw3DRing($X, $Y, $Format = "")
1095 1095
     {
1096 1096
      $OuterRadius	= isset($Format["OuterRadius"]) ? $Format["OuterRadius"] : 100;
1097 1097
      $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
1098 1098
      $InnerRadius	= isset($Format["InnerRadius"]) ? $Format["InnerRadius"] : 30;
1099 1099
      $SkewFactor	= isset($Format["SkewFactor"]) ? $Format["SkewFactor"] : .6;
1100 1100
      $SliceHeight	= isset($Format["SliceHeight"]) ? $Format["SliceHeight"] : 10;
1101
-     $DataGapAngle	= isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 10;
1102
-     $DataGapRadius	= isset($Format["DataGapRadius"]) ? $Format["DataGapRadius"] : 10;
1101
+     $DataGapAngle = isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 10;
1102
+     $DataGapRadius = isset($Format["DataGapRadius"]) ? $Format["DataGapRadius"] : 10;
1103 1103
      $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
1104 1104
      $Shadow		= isset($Format["Shadow"]) ? $Format["Shadow"] : FALSE;
1105 1105
      $DrawLabels	= isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : FALSE;
1106
-     $LabelStacked	= isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
1106
+     $LabelStacked = isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : FALSE;
1107 1107
      $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
1108 1108
      $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
1109 1109
      $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
1110 1110
      $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
1111
-     $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
1112
-     $Cf		= isset($Format["Cf"]) ? $Format["Cf"] : 20;
1111
+     $LabelAlpha = isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
1112
+     $Cf = isset($Format["Cf"]) ? $Format["Cf"] : 20;
1113 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;
1114
+     $ValuePadding = isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : $SliceHeight + 15;
1115
+     $ValuePosition = isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_OUTSIDE;
1116 1116
      $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
1117 1117
      $ValueR		= isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
1118 1118
      $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
1119 1119
      $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
1120
-     $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
1121
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
1120
+     $ValueAlpha = isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
1121
+     $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
1122 1122
 
1123 1123
      /* Error correction for overlaying rounded corners */
1124
-     if ( $SkewFactor < .5 ) { $SkewFactor = .5; }
1124
+     if ($SkewFactor < .5) { $SkewFactor = .5; }
1125 1125
 
1126 1126
      /* Data Processing */
1127 1127
      $Data    = $this->pDataObject->getData();
1128 1128
      $Palette = $this->pDataObject->getPalette();
1129 1129
 
1130 1130
      /* Do we have an abscissa serie defined? */
1131
-     if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
1131
+     if ($Data["Abscissa"] == "") { return(PIE_NO_ABSCISSA); }
1132 1132
 
1133 1133
      /* Try to find the data serie */
1134 1134
      $DataSerie = "";
1135 1135
      foreach ($Data["Series"] as $SerieName => $SerieData)
1136
-      { if ( $SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
1136
+      { if ($SerieName != $Data["Abscissa"]) { $DataSerie = $SerieName; } }
1137 1137
 
1138 1138
      /* Do we have data to compute? */
1139
-     if ( $DataSerie == "" ) { return(PIE_NO_DATASERIE); }
1139
+     if ($DataSerie == "") { return(PIE_NO_DATASERIE); }
1140 1140
 
1141 1141
      /* Remove unused data */
1142
-     list($Data,$Palette) = $this->clean0Values($Data,$Palette,$DataSerie,$Data["Abscissa"]);
1142
+     list($Data, $Palette) = $this->clean0Values($Data, $Palette, $DataSerie, $Data["Abscissa"]);
1143 1143
 
1144 1144
      /* Compute the pie sum */
1145 1145
      $SerieSum = $this->pDataObject->getSum($DataSerie);
1146 1146
 
1147 1147
      /* Do we have data to draw? */
1148
-     if ( $SerieSum == 0 ) { return(PIE_SUMISNULL); }
1148
+     if ($SerieSum == 0) { return(PIE_SUMISNULL); }
1149 1149
 
1150 1150
      /* Dump the real number of data to draw */
1151 1151
      $Values = "";
@@ -1153,56 +1153,56 @@  discard block
 block discarded – undo
1153 1153
       { if ($Value != 0) { $Values[] = $Value; } }
1154 1154
 
1155 1155
      /* Compute the wasted angular space between series */
1156
-     if (count($Values)==1) { $WastedAngular = 0; } else { $WastedAngular = count($Values) * $DataGapAngle; }
1156
+     if (count($Values) == 1) { $WastedAngular = 0; } else { $WastedAngular = count($Values)*$DataGapAngle; }
1157 1157
 
1158 1158
      /* Compute the scale */
1159
-     $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
1159
+     $ScaleFactor = (360 - $WastedAngular)/$SerieSum;
1160 1160
 
1161 1161
      $RestoreShadow = $this->pChartObject->Shadow;
1162
-     if ( $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = FALSE; }
1162
+     if ($this->pChartObject->Shadow) { $this->pChartObject->Shadow = FALSE; }
1163 1163
 
1164 1164
      /* Draw the polygon ring elements */
1165
-     $Offset = 360; $ID = count($Values)-1;
1165
+     $Offset = 360; $ID = count($Values) - 1;
1166 1166
      $Values = array_reverse($Values);
1167 1167
      $Slice  = 0; $Slices = ""; $SliceColors = ""; $Visible = ""; $SliceAngle = "";
1168
-     foreach($Values as $Key => $Value)
1168
+     foreach ($Values as $Key => $Value)
1169 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"]);
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 1172
 
1173 1173
        $SliceColors[$Slice] = $Settings;
1174 1174
 
1175 1175
        $StartAngle = $Offset;
1176
-       $EndAngle   = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
1176
+       $EndAngle   = $Offset - ($Value*$ScaleFactor); if ($EndAngle < 0) { $EndAngle = 0; }
1177 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; }
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 1180
 
1181
-       $Step   = (360 / (2 * PI * $OuterRadius))/2;
1181
+       $Step = (360/(2*PI*$OuterRadius))/2;
1182 1182
        $OutX1 = VOID; $OutY1 = VOID;
1183
-       for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
1183
+       for ($i = $Offset; $i >= $EndAngle; $i = $i - $Step)
1184 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);
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 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);
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 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);
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 1196
 
1197
-         if ( $OutX1 == VOID ) { $OutX1 = $Xc; $OutY1 = $Yc; }
1197
+         if ($OutX1 == VOID) { $OutX1 = $Xc; $OutY1 = $Yc; }
1198 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++; }
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 1203
 
1204 1204
          $Slices[$Slice]["BottomPoly"][] = floor($Xc); $Slices[$Slice]["BottomPoly"][] = floor($Yc);
1205
-         $Slices[$Slice]["TopPoly"][] = floor($Xc); $Slices[$Slice]["TopPoly"][] = floor($Yc)-$SliceHeight;
1205
+         $Slices[$Slice]["TopPoly"][] = floor($Xc); $Slices[$Slice]["TopPoly"][] = floor($Yc) - $SliceHeight;
1206 1206
          $Slices[$Slice]["Angle"][] = $i;
1207 1207
         }
1208 1208
        $OutX2 = $Xc; $OutY2 = $Yc;
@@ -1210,33 +1210,33 @@  discard block
 block discarded – undo
1210 1210
        $Slices[$Slice]["Angle"][] = VOID;
1211 1211
        $Lasti = $i;
1212 1212
 
1213
-       $Step   = (360 / (2 * PI * $InnerRadius))/2;
1213
+       $Step = (360/(2*PI*$InnerRadius))/2;
1214 1214
        $InX1 = VOID; $InY1 = VOID;
1215
-       for($i=$EndAngle;$i<=$Offset;$i=$i+$Step)
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 1232
          $Slices[$Slice]["BottomPoly"][] = floor($Xc); $Slices[$Slice]["BottomPoly"][] = floor($Yc);
1233
-         $Slices[$Slice]["TopPoly"][] = floor($Xc); $Slices[$Slice]["TopPoly"][] = floor($Yc)-$SliceHeight;
1233
+         $Slices[$Slice]["TopPoly"][] = floor($Xc); $Slices[$Slice]["TopPoly"][] = floor($Yc) - $SliceHeight;
1234 1234
          $Slices[$Slice]["Angle"][] = $i;
1235 1235
         }
1236 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;
1238
+       $Slices[$Slice]["InX1"] = $InX1; $Slices[$Slice]["InY1"] = $InY1;
1239
+       $Slices[$Slice]["InX2"] = $InX2; $Slices[$Slice]["InY2"] = $InY2;
1240 1240
        $Slices[$Slice]["OutX1"] = $OutX1; $Slices[$Slice]["OutY1"] = $OutY1;
1241 1241
        $Slices[$Slice]["OutX2"] = $OutX2; $Slices[$Slice]["OutY2"] = $OutY2;
1242 1242
 
@@ -1244,151 +1244,151 @@  discard block
 block discarded – undo
1244 1244
       }
1245 1245
 
1246 1246
      /* Draw the bottom pie splice */
1247
-     foreach($Slices as $SliceID => $Plots)
1247
+     foreach ($Slices as $SliceID => $Plots)
1248 1248
       {
1249
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1250
-       $this->pChartObject->drawPolygon($Plots["BottomPoly"],$Settings);
1249
+       $Settings = $SliceColors[$SliceID]; $Settings["NoBorder"] = TRUE;
1250
+       $this->pChartObject->drawPolygon($Plots["BottomPoly"], $Settings);
1251 1251
 
1252
-       foreach($Plots["AA"] as $Key => $Pos)
1253
-        $this->pChartObject->drawAntialiasPixel($Pos[0],$Pos[1],$Settings);
1252
+       foreach ($Plots["AA"] as $Key => $Pos)
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);
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 1257
       }
1258 1258
 
1259 1259
      $Slices      = array_reverse($Slices);
1260 1260
      $SliceColors = array_reverse($SliceColors);
1261 1261
 
1262 1262
      /* Draw the vertical edges (semi-visible) */
1263
-     foreach($Slices as $SliceID => $Plots)
1263
+     foreach ($Slices as $SliceID => $Plots)
1264 1264
       {
1265
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1266
-       $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
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 1268
        $StartAngle = $Plots["Angle"][0];
1269
-       foreach($Plots["Angle"] as $Key =>$Angle) { if ($Angle == VOID) { $EndAngle = $Plots["Angle"][$Key-1]; } }
1269
+       foreach ($Plots["Angle"] as $Key =>$Angle) { if ($Angle == VOID) { $EndAngle = $Plots["Angle"][$Key - 1]; } }
1270 1270
 
1271
-       if ( $StartAngle >= 270 || $StartAngle <= 90 )
1272
-        $this->pChartObject->drawLine($Plots["OutX1"],$Plots["OutY1"],$Plots["OutX1"],$Plots["OutY1"]-$SliceHeight,$Settings);
1273
-       if ( $StartAngle >= 270 || $StartAngle <= 90 )
1274
-        $this->pChartObject->drawLine($Plots["OutX2"],$Plots["OutY2"],$Plots["OutX2"],$Plots["OutY2"]-$SliceHeight,$Settings);
1271
+       if ($StartAngle >= 270 || $StartAngle <= 90)
1272
+        $this->pChartObject->drawLine($Plots["OutX1"], $Plots["OutY1"], $Plots["OutX1"], $Plots["OutY1"] - $SliceHeight, $Settings);
1273
+       if ($StartAngle >= 270 || $StartAngle <= 90)
1274
+        $this->pChartObject->drawLine($Plots["OutX2"], $Plots["OutY2"], $Plots["OutX2"], $Plots["OutY2"] - $SliceHeight, $Settings);
1275 1275
 
1276
-        $this->pChartObject->drawLine($Plots["InX1"],$Plots["InY1"],$Plots["InX1"],$Plots["InY1"]-$SliceHeight,$Settings);
1277
-        $this->pChartObject->drawLine($Plots["InX2"],$Plots["InY2"],$Plots["InX2"],$Plots["InY2"]-$SliceHeight,$Settings);
1276
+        $this->pChartObject->drawLine($Plots["InX1"], $Plots["InY1"], $Plots["InX1"], $Plots["InY1"] - $SliceHeight, $Settings);
1277
+        $this->pChartObject->drawLine($Plots["InX2"], $Plots["InY2"], $Plots["InX2"], $Plots["InY2"] - $SliceHeight, $Settings);
1278 1278
       }
1279 1279
 
1280 1280
      /* Draw the inner vertical slices */
1281
-     foreach($Slices as $SliceID => $Plots)
1281
+     foreach ($Slices as $SliceID => $Plots)
1282 1282
       {
1283
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1284
-       $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1283
+       $Settings = $SliceColors[$SliceID]; $Settings["NoBorder"] = TRUE;
1284
+       $Settings["R"] = $Settings["R"] + $Cf; $Settings["G"] = $Settings["G"] + $Cf; $Settings["B"] = $Settings["B"] + $Cf;
1285 1285
 
1286 1286
        $Outer = TRUE; $Inner = FALSE;
1287 1287
        $InnerPlotsA = ""; $InnerPlotsB = "";
1288
-       foreach($Plots["Angle"] as $ID => $Angle)
1288
+       foreach ($Plots["Angle"] as $ID => $Angle)
1289 1289
         {
1290
-         if ( $Angle == VOID )
1290
+         if ($Angle == VOID)
1291 1291
           { $Outer = FALSE; $Inner = TRUE; }
1292
-         elseif( $Inner )
1292
+         elseif ($Inner)
1293 1293
           {
1294
-           if (( $Angle < 90 || $Angle > 270 ) && isset($Plots["BottomPoly"][$ID*2]) )
1294
+           if (($Angle < 90 || $Angle > 270) && isset($Plots["BottomPoly"][$ID*2]))
1295 1295
             {
1296 1296
              $Xo = $Plots["BottomPoly"][$ID*2];
1297
-             $Yo = $Plots["BottomPoly"][$ID*2+1];
1297
+             $Yo = $Plots["BottomPoly"][$ID*2 + 1];
1298 1298
 
1299 1299
              $InnerPlotsA[] = $Xo; $InnerPlotsA[] = $Yo;
1300
-             $InnerPlotsB[] = $Xo; $InnerPlotsB[] = $Yo-$SliceHeight;
1300
+             $InnerPlotsB[] = $Xo; $InnerPlotsB[] = $Yo - $SliceHeight;
1301 1301
             }
1302 1302
           }
1303 1303
         }
1304 1304
 
1305
-       if ( $InnerPlotsA != "" )
1306
-        { $InnerPlots = array_merge($InnerPlotsA,$this->arrayReverse($InnerPlotsB)); $this->pChartObject->drawPolygon($InnerPlots,$Settings); }
1305
+       if ($InnerPlotsA != "")
1306
+        { $InnerPlots = array_merge($InnerPlotsA, $this->arrayReverse($InnerPlotsB)); $this->pChartObject->drawPolygon($InnerPlots, $Settings); }
1307 1307
       }
1308 1308
 
1309 1309
      /* Draw the splice top and left poly */
1310
-     foreach($Slices as $SliceID => $Plots)
1310
+     foreach ($Slices as $SliceID => $Plots)
1311 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;
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 1315
        $StartAngle = $Plots["Angle"][0];
1316
-       foreach($Plots["Angle"] as $Key =>$Angle) { if ($Angle == VOID) { $EndAngle = $Plots["Angle"][$Key-1]; } }
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 1320
          $Points = "";
1321 1321
          $Points[] = $Plots["InX2"];
1322 1322
          $Points[] = $Plots["InY2"];
1323 1323
          $Points[] = $Plots["InX2"];
1324
-         $Points[] = $Plots["InY2"]-$SliceHeight;
1324
+         $Points[] = $Plots["InY2"] - $SliceHeight;
1325 1325
          $Points[] = $Plots["OutX1"];
1326
-         $Points[] = $Plots["OutY1"]-$SliceHeight;
1326
+         $Points[] = $Plots["OutY1"] - $SliceHeight;
1327 1327
          $Points[] = $Plots["OutX1"];
1328 1328
          $Points[] = $Plots["OutY1"];
1329 1329
 
1330
-         $this->pChartObject->drawPolygon($Points,$Settings);
1330
+         $this->pChartObject->drawPolygon($Points, $Settings);
1331 1331
         }
1332 1332
 
1333
-       if ( $EndAngle > 180 )
1333
+       if ($EndAngle > 180)
1334 1334
         {
1335 1335
          $Points = "";
1336 1336
          $Points[] = $Plots["InX1"];
1337 1337
          $Points[] = $Plots["InY1"];
1338 1338
          $Points[] = $Plots["InX1"];
1339
-         $Points[] = $Plots["InY1"]-$SliceHeight;
1339
+         $Points[] = $Plots["InY1"] - $SliceHeight;
1340 1340
          $Points[] = $Plots["OutX2"];
1341
-         $Points[] = $Plots["OutY2"]-$SliceHeight;
1341
+         $Points[] = $Plots["OutY2"] - $SliceHeight;
1342 1342
          $Points[] = $Plots["OutX2"];
1343 1343
          $Points[] = $Plots["OutY2"];
1344 1344
 
1345
-         $this->pChartObject->drawPolygon($Points,$Settings);
1345
+         $this->pChartObject->drawPolygon($Points, $Settings);
1346 1346
         }
1347 1347
       }
1348 1348
 
1349 1349
 
1350 1350
      /* Draw the vertical edges (visible) */
1351
-     foreach($Slices as $SliceID => $Plots)
1351
+     foreach ($Slices as $SliceID => $Plots)
1352 1352
       {
1353
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1354
-       $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
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 1356
        $StartAngle = $Plots["Angle"][0];
1357
-       foreach($Plots["Angle"] as $Key =>$Angle) { if ($Angle == VOID) { $EndAngle = $Plots["Angle"][$Key-1]; } }
1357
+       foreach ($Plots["Angle"] as $Key =>$Angle) { if ($Angle == VOID) { $EndAngle = $Plots["Angle"][$Key - 1]; } }
1358 1358
 
1359
-       if ( $StartAngle <= 270 && $StartAngle >= 90 )
1360
-        $this->pChartObject->drawLine($Plots["OutX1"],$Plots["OutY1"],$Plots["OutX1"],$Plots["OutY1"]-$SliceHeight,$Settings);
1361
-       if ( $EndAngle <= 270 && $EndAngle >= 90 )
1362
-        $this->pChartObject->drawLine($Plots["OutX2"],$Plots["OutY2"],$Plots["OutX2"],$Plots["OutY2"]-$SliceHeight,$Settings);
1359
+       if ($StartAngle <= 270 && $StartAngle >= 90)
1360
+        $this->pChartObject->drawLine($Plots["OutX1"], $Plots["OutY1"], $Plots["OutX1"], $Plots["OutY1"] - $SliceHeight, $Settings);
1361
+       if ($EndAngle <= 270 && $EndAngle >= 90)
1362
+        $this->pChartObject->drawLine($Plots["OutX2"], $Plots["OutY2"], $Plots["OutX2"], $Plots["OutY2"] - $SliceHeight, $Settings);
1363 1363
       }
1364 1364
 
1365 1365
 
1366 1366
      /* Draw the outer vertical slices */
1367
-     foreach($Slices as $SliceID => $Plots)
1367
+     foreach ($Slices as $SliceID => $Plots)
1368 1368
       {
1369
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1370
-       $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
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 1372
        $Outer = TRUE; $Inner = FALSE;
1373 1373
        $OuterPlotsA = ""; $OuterPlotsB = ""; $InnerPlotsA = ""; $InnerPlotsB = "";
1374
-       foreach($Plots["Angle"] as $ID => $Angle)
1374
+       foreach ($Plots["Angle"] as $ID => $Angle)
1375 1375
         {
1376
-         if ( $Angle == VOID )
1376
+         if ($Angle == VOID)
1377 1377
           { $Outer = FALSE; $Inner = TRUE; }
1378
-         elseif( $Outer )
1378
+         elseif ($Outer)
1379 1379
           {
1380
-           if ( ( $Angle > 90 && $Angle < 270 ) && isset($Plots["BottomPoly"][$ID*2]) )
1380
+           if (($Angle > 90 && $Angle < 270) && isset($Plots["BottomPoly"][$ID*2]))
1381 1381
             {
1382 1382
              $Xo = $Plots["BottomPoly"][$ID*2];
1383
-             $Yo = $Plots["BottomPoly"][$ID*2+1];
1383
+             $Yo = $Plots["BottomPoly"][$ID*2 + 1];
1384 1384
 
1385 1385
              $OuterPlotsA[] = $Xo; $OuterPlotsA[] = $Yo;
1386
-             $OuterPlotsB[] = $Xo; $OuterPlotsB[] = $Yo-$SliceHeight;
1386
+             $OuterPlotsB[] = $Xo; $OuterPlotsB[] = $Yo - $SliceHeight;
1387 1387
             }
1388 1388
           }
1389 1389
         }
1390
-       if ( $OuterPlotsA != "" )
1391
-        { $OuterPlots = array_merge($OuterPlotsA,$this->arrayReverse($OuterPlotsB)); $this->pChartObject->drawPolygon($OuterPlots,$Settings); }
1390
+       if ($OuterPlotsA != "")
1391
+        { $OuterPlots = array_merge($OuterPlotsA, $this->arrayReverse($OuterPlotsB)); $this->pChartObject->drawPolygon($OuterPlots, $Settings); }
1392 1392
       }
1393 1393
 
1394 1394
      $Slices      = array_reverse($Slices);
@@ -1396,55 +1396,55 @@  discard block
 block discarded – undo
1396 1396
 
1397 1397
 
1398 1398
      /* Draw the top pie splice */
1399
-     foreach($Slices as $SliceID => $Plots)
1399
+     foreach ($Slices as $SliceID => $Plots)
1400 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;
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)
1409
-        $this->pChartObject->drawAntialiasPixel($Pos[0],$Pos[1]-$SliceHeight,$Settings);
1408
+       foreach ($Plots["AA"] as $Key => $Pos)
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);
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 1413
       }
1414 1414
 
1415
-     if ( $DrawLabels )
1415
+     if ($DrawLabels)
1416 1416
       {
1417 1417
        $Offset = 360;
1418
-       foreach($Values as $Key => $Value)
1418
+       foreach ($Values as $Key => $Value)
1419 1419
         {
1420 1420
          $StartAngle = $Offset;
1421
-         $EndAngle   = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
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"]);}
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 1425
          else
1426
-          { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
1426
+          { $Settings = array("FillR"=>$LabelR, "FillG"=>$LabelG, "FillB"=>$LabelB, "Alpha"=>$LabelAlpha); }
1427 1427
 
1428 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;
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 )
1432
+         if ($WriteValues == PIE_VALUE_PERCENTAGE)
1433
+          $Label = $Display = round((100/$SerieSum)*$Value, $Precision)."%";
1434
+         elseif ($WriteValues == PIE_VALUE_NATURAL)
1435 1435
           $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
1436 1436
          else
1437 1437
           $Label = "";
1438 1438
 
1439
-         if ( $LabelStacked )
1440
-          $this->writePieLabel($Xc,$Yc-$SliceHeight,$Label,$Angle,$Settings,TRUE,$X,$Y,$OuterRadius);
1439
+         if ($LabelStacked)
1440
+          $this->writePieLabel($Xc, $Yc - $SliceHeight, $Label, $Angle, $Settings, TRUE, $X, $Y, $OuterRadius);
1441 1441
          else
1442
-          $this->writePieLabel($Xc,$Yc-$SliceHeight,$Label,$Angle,$Settings,FALSE);
1442
+          $this->writePieLabel($Xc, $Yc - $SliceHeight, $Label, $Angle, $Settings, FALSE);
1443 1443
 
1444 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 1449
      $this->pChartObject->Shadow = $RestoreShadow;
1450 1450
 
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
   function arraySerialize($Data)
1456 1456
    {
1457 1457
     $Result = "";
1458
-    foreach($Data as $Key => $Value)
1458
+    foreach ($Data as $Key => $Value)
1459 1459
      { if ($Result == "") { $Result = floor($Value); } else { $Result = $Result.",".floor($Value); } }
1460 1460
 
1461 1461
     return($Result);
@@ -1466,35 +1466,35 @@  discard block
 block discarded – undo
1466 1466
    {
1467 1467
     $Result = "";
1468 1468
 
1469
-    for($i=count($Plots)-1;$i>=0;$i=$i-2)
1470
-     { $Result[] = $Plots[$i-1]; $Result[] = $Plots[$i]; }
1469
+    for ($i = count($Plots) - 1; $i >= 0; $i = $i - 2)
1470
+     { $Result[] = $Plots[$i - 1]; $Result[] = $Plots[$i]; }
1471 1471
 
1472 1472
     return($Result);
1473 1473
    }
1474 1474
 
1475 1475
   /* Remove unused series & values */
1476
-  function clean0Values($Data,$Palette,$DataSerie,$AbscissaSerie)
1476
+  function clean0Values($Data, $Palette, $DataSerie, $AbscissaSerie)
1477 1477
    {
1478 1478
     $NewPalette = ""; $NewData = ""; $NewAbscissa = "";
1479 1479
 
1480 1480
     /* Remove unused series */
1481
-    foreach($Data["Series"] as $SerieName => $SerieSettings)
1482
-     { if ( $SerieName != $DataSerie && $SerieName != $AbscissaSerie ) { unset($Data["Series"][$SerieName]); } }
1481
+    foreach ($Data["Series"] as $SerieName => $SerieSettings)
1482
+     { if ($SerieName != $DataSerie && $SerieName != $AbscissaSerie) { unset($Data["Series"][$SerieName]); } }
1483 1483
 
1484 1484
     /* Remove NULL values */
1485
-    foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
1485
+    foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
1486 1486
      {
1487
-      if ($Value != 0 )
1487
+      if ($Value != 0)
1488 1488
        {
1489 1489
         $NewData[]     = $Value;
1490 1490
         $NewAbscissa[] = $Data["Series"][$AbscissaSerie]["Data"][$Key];
1491
-        if ( isset($Palette[$Key]) ) { $NewPalette[]  = $Palette[$Key]; }
1491
+        if (isset($Palette[$Key])) { $NewPalette[] = $Palette[$Key]; }
1492 1492
        }
1493 1493
      }
1494 1494
     $Data["Series"][$DataSerie]["Data"]     = $NewData;
1495 1495
     $Data["Series"][$AbscissaSerie]["Data"] = $NewAbscissa;
1496 1496
 
1497
-    return(array($Data,$NewPalette));
1497
+    return(array($Data, $NewPalette));
1498 1498
    }
1499 1499
   }
1500 1500
 ?>
1501 1501
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +124 added lines, -254 removed lines patch added patch discarded remove patch
@@ -29,15 +29,13 @@  discard block
 block discarded – undo
29 29
  define("PIE_VALUE_OUTSIDE"     , 140031);
30 30
 
31 31
  /* pPie class definition */
32
- class pPie
33
-  {
32
+ class pPie {
34 33
    var $pChartObject;
35 34
    var $pDataObject;
36 35
    var $LabelPos = "" ;
37 36
 
38 37
    /* Class creator */
39
-   function pPie($Object,$pDataObject)
40
-    {
38
+   function pPie($Object,$pDataObject) {
41 39
      /* Cache the pChart object reference */
42 40
      $this->pChartObject = $Object;
43 41
 
@@ -46,8 +44,7 @@  discard block
 block discarded – undo
46 44
     }
47 45
 
48 46
    /* Draw a pie chart */
49
-   function draw2DPie($X,$Y,$Format="")
50
-    {
47
+   function draw2DPie($X,$Y,$Format="") {
51 48
      $Radius		= isset($Format["Radius"]) ? $Format["Radius"] : 60;
52 49
      $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
53 50
      $DataGapAngle	= isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 0;
@@ -111,8 +108,7 @@  discard block
 block discarded – undo
111 108
      $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
112 109
 
113 110
      $RestoreShadow = $this->pChartObject->Shadow;
114
-     if ( $this->pChartObject->Shadow )
115
-      {
111
+     if ( $this->pChartObject->Shadow ) {
116 112
        $this->pChartObject->Shadow = FALSE;
117 113
 
118 114
        $ShadowFormat = $Format; $ShadowFormat["Shadow"] = TRUE;
@@ -122,18 +118,15 @@  discard block
 block discarded – undo
122 118
      /* Draw the polygon pie elements */
123 119
      $Step = 360 / (2 * PI * $Radius);
124 120
      $Offset = 0; $ID = 0;
125
-     foreach($Values as $Key => $Value)
126
-      {
121
+     foreach($Values as $Key => $Value) {
127 122
        if ( $Shadow )
128 123
         $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
129
-       else
130
-        {
124
+       else {
131 125
          if ( !isset($Palette[$ID]["R"]) ) { $Color = $this->pChartObject->getRandomColor(); $Palette[$ID] = $Color; $this->pDataObject->savePalette($ID,$Color); }
132 126
          $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
133 127
         }
134 128
 
135
-       if ( !$SecondPass && !$Shadow )
136
-        {
129
+       if ( !$SecondPass && !$Shadow ) {
137 130
          if ( !$Border )
138 131
           $Settings["Surrounding"] = 10;
139 132
          else
@@ -145,9 +138,7 @@  discard block
 block discarded – undo
145 138
 
146 139
        $Angle = ($EndAngle - $Offset)/2 + $Offset;
147 140
        if ($DataGapAngle == 0)
148
-        { $X0 = $X; $Y0 = $Y; }
149
-       else
150
-        {
141
+        { $X0 = $X; $Y0 = $Y; } else {
151 142
          $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
152 143
          $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius + $Y;
153 144
         }
@@ -155,8 +146,7 @@  discard block
 block discarded – undo
155 146
        $Plots[] = $X0; $Plots[] = $Y0;
156 147
 
157 148
 
158
-       for($i=$Offset;$i<=$EndAngle;$i=$i+$Step)
159
-        {
149
+       for($i=$Offset;$i<=$EndAngle;$i=$i+$Step) {
160 150
          $Xc = cos(($i-90)*PI/180) * $Radius + $X;
161 151
          $Yc = sin(($i-90)*PI/180) * $Radius + $Y;
162 152
 
@@ -170,11 +160,9 @@  discard block
 block discarded – undo
170 160
        $this->pChartObject->drawPolygon($Plots,$Settings);
171 161
        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 162
 
173
-       if ( $DrawLabels && !$Shadow && !$SecondPass )
174
-        {
163
+       if ( $DrawLabels && !$Shadow && !$SecondPass ) {
175 164
          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
165
+          { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);} else
178 166
           { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
179 167
 
180 168
          $Angle = ($EndAngle - $Offset)/2 + $Offset;
@@ -193,17 +181,14 @@  discard block
 block discarded – undo
193 181
       }
194 182
 
195 183
      /* Second pass to smooth the angles */
196
-     if ( $SecondPass )
197
-      {
184
+     if ( $SecondPass ) {
198 185
        $Step = 360 / (2 * PI * $Radius);
199 186
        $Offset = 0; $ID = 0;
200
-       foreach($Values as $Key => $Value)
201
-        {
187
+       foreach($Values as $Key => $Value) {
202 188
          $FirstPoint = TRUE;
203 189
          if ( $Shadow )
204 190
           $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
205
-         else
206
-          {
191
+         else {
207 192
            if ( $Border )
208 193
             $Settings = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB);
209 194
            else
@@ -213,17 +198,14 @@  discard block
 block discarded – undo
213 198
          $EndAngle = $Offset+($Value*$ScaleFactor); if ( $EndAngle > 360 ) { $EndAngle = 360; }
214 199
 
215 200
          if ($DataGapAngle == 0)
216
-          { $X0 = $X; $Y0 = $Y; }
217
-         else
218
-          {
201
+          { $X0 = $X; $Y0 = $Y; } else {
219 202
            $Angle = ($EndAngle - $Offset)/2 + $Offset;
220 203
            $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
221 204
            $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius + $Y;
222 205
           }
223 206
          $Plots[] = $X0; $Plots[] = $Y0;
224 207
 
225
-         for($i=$Offset;$i<=$EndAngle;$i=$i+$Step)
226
-          {
208
+         for($i=$Offset;$i<=$EndAngle;$i=$i+$Step) {
227 209
            $Xc = cos(($i-90)*PI/180) * $Radius + $X;
228 210
            $Yc = sin(($i-90)*PI/180) * $Radius + $Y;
229 211
 
@@ -233,11 +215,9 @@  discard block
 block discarded – undo
233 215
           }
234 216
          $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings);
235 217
 
236
-         if ( $DrawLabels && !$Shadow )
237
-          {
218
+         if ( $DrawLabels && !$Shadow ) {
238 219
            if ( $LabelColor == PIE_LABEL_COLOR_AUTO )
239
-            { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);}
240
-           else
220
+            { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);} else
241 221
             { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
242 222
 
243 223
            $Angle = ($EndAngle - $Offset)/2 + $Offset;
@@ -256,23 +236,18 @@  discard block
 block discarded – undo
256 236
         }
257 237
       }
258 238
 
259
-     if ( $WriteValues != NULL && !$Shadow )
260
-      {
239
+     if ( $WriteValues != NULL && !$Shadow ) {
261 240
        $Step = 360 / (2 * PI * $Radius);
262 241
        $Offset = 0; $ID = count($Values)-1;
263 242
        $Settings = array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"R"=>$ValueR,"G"=>$ValueG,"B"=>$ValueB,"Alpha"=>$ValueAlpha);
264
-       foreach($Values as $Key => $Value)
265
-        {
243
+       foreach($Values as $Key => $Value) {
266 244
          $EndAngle = ($Value*$ScaleFactor) + $Offset; if ( $EndAngle > 360 ) { $EndAngle = 0; }
267 245
          $Angle    = ($EndAngle - $Offset)/2 + $Offset;
268 246
 
269
-         if ( $ValuePosition == PIE_VALUE_OUTSIDE )
270
-          {
247
+         if ( $ValuePosition == PIE_VALUE_OUTSIDE ) {
271 248
            $Xc = cos(($Angle-90)*PI/180) * ($Radius+$ValuePadding) + $X;
272 249
            $Yc = sin(($Angle-90)*PI/180) * ($Radius+$ValuePadding) + $Y;
273
-          }
274
-         else
275
-          {
250
+          } else {
276 251
            $Xc = cos(($Angle-90)*PI/180) * ($Radius)/2 + $X;
277 252
            $Yc = sin(($Angle-90)*PI/180) * ($Radius)/2 + $Y;
278 253
           }
@@ -296,8 +271,7 @@  discard block
 block discarded – undo
296 271
     }
297 272
 
298 273
    /* Draw a 3D pie chart */
299
-   function draw3DPie($X,$Y,$Format="")
300
-    {
274
+   function draw3DPie($X,$Y,$Format="") {
301 275
      /* Rendering layout */
302 276
      $Radius		= isset($Format["Radius"]) ? $Format["Radius"] : 80;
303 277
      $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
@@ -371,8 +345,7 @@  discard block
 block discarded – undo
371 345
      $Offset = 360; $ID = count($Values)-1;
372 346
      $Values = array_reverse($Values);
373 347
      $Slice  = 0; $Slices = ""; $SliceColors = ""; $Visible = ""; $SliceAngle = "";
374
-     foreach($Values as $Key => $Value)
375
-      {
348
+     foreach($Values as $Key => $Value) {
376 349
        if ( !isset($Palette[$ID]["R"]) ) { $Color = $this->pChartObject->getRandomColor(); $Palette[$ID] = $Color; $this->pDataObject->savePalette($ID,$Color); }
377 350
        $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
378 351
 
@@ -385,17 +358,14 @@  discard block
 block discarded – undo
385 358
        if ( $EndAngle < 180 )   { $Visible[$Slice]["End"] = FALSE; } else { $Visible[$Slice]["End"] = TRUE; }
386 359
 
387 360
        if ($DataGapAngle == 0)
388
-        { $X0 = $X; $Y0 = $Y; }
389
-       else
390
-        {
361
+        { $X0 = $X; $Y0 = $Y; } else {
391 362
          $Angle = ($EndAngle - $Offset)/2 + $Offset;
392 363
          $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
393 364
          $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius*$SkewFactor + $Y;
394 365
         }
395 366
        $Slices[$Slice][] = $X0; $Slices[$Slice][] = $Y0; $SliceAngle[$Slice][] = 0;
396 367
 
397
-       for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
398
-        {
368
+       for($i=$Offset;$i>=$EndAngle;$i=$i-$Step) {
399 369
          $Xc = cos(($i-90)*PI/180) * $Radius + $X;
400 370
          $Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y;
401 371
 
@@ -411,10 +381,8 @@  discard block
 block discarded – undo
411 381
       }
412 382
 
413 383
      /* 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
-        {
384
+     if ( $RestoreShadow && ($this->pChartObject->ShadowX != 0 || $this->pChartObject->ShadowY !=0 )) {
385
+       foreach($Slices as $SliceID => $Plots) {
418 386
          $ShadowPie = "";
419 387
          for($i=0;$i<count($Plots);$i=$i+2)
420 388
           { $ShadowPie[] = $Plots[$i]+$this->pChartObject->ShadowX; $ShadowPie[] = $Plots[$i+1]+$this->pChartObject->ShadowY; }
@@ -425,12 +393,10 @@  discard block
 block discarded – undo
425 393
 
426 394
        $Step = 360 / (2 * PI * $Radius);
427 395
        $Offset = 360;
428
-       foreach($Values as $Key => $Value)
429
-        {
396
+       foreach($Values as $Key => $Value) {
430 397
          $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
431 398
 
432
-         for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
433
-          {
399
+         for($i=$Offset;$i>=$EndAngle;$i=$i-$Step) {
434 400
            $Xc = cos(($i-90)*PI/180) * $Radius + $X + $this->pChartObject->ShadowX;
435 401
            $Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y + $this->pChartObject->ShadowY;
436 402
 
@@ -442,13 +408,11 @@  discard block
 block discarded – undo
442 408
       }
443 409
 
444 410
      /* Draw the bottom pie splice */
445
-     foreach($Slices as $SliceID => $Plots)
446
-      {
411
+     foreach($Slices as $SliceID => $Plots) {
447 412
        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
448 413
        $this->pChartObject->drawPolygon($Plots,$Settings);
449 414
 
450
-       if ( $SecondPass )
451
-        {
415
+       if ( $SecondPass ) {
452 416
          $Settings = $SliceColors[$SliceID];
453 417
          if ( $Border )
454 418
           { $Settings["R"]+= 30; $Settings["G"]+= 30; $Settings["B"]+= 30;; }
@@ -471,8 +435,7 @@  discard block
 block discarded – undo
471 435
      /* Draw the two vertical edges */
472 436
      $Slices      = array_reverse($Slices);
473 437
      $SliceColors = array_reverse($SliceColors);
474
-     foreach($Slices as $SliceID => $Plots)
475
-      {
438
+     foreach($Slices as $SliceID => $Plots) {
476 439
        $Settings = $SliceColors[$SliceID];
477 440
        $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
478 441
 
@@ -488,12 +451,10 @@  discard block
 block discarded – undo
488 451
 
489 452
      $Slices      = array_reverse($Slices);
490 453
      $SliceColors = array_reverse($SliceColors);
491
-     foreach($Slices as $SliceID => $Plots)
492
-      {
454
+     foreach($Slices as $SliceID => $Plots) {
493 455
        $Settings = $SliceColors[$SliceID];
494 456
        $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
495
-       if ( $Visible[$SliceID]["End"] )
496
-        {
457
+       if ( $Visible[$SliceID]["End"] ) {
497 458
          $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 459
 
499 460
          $Border = "";
@@ -504,16 +465,13 @@  discard block
 block discarded – undo
504 465
       }
505 466
 
506 467
      /* Draw the rounded edges */
507
-     foreach($Slices as $SliceID => $Plots)
508
-      {
468
+     foreach($Slices as $SliceID => $Plots) {
509 469
        $Settings = $SliceColors[$SliceID];
510 470
        $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
511 471
 
512
-       for ($j=2;$j<count($Plots)-2;$j=$j+2)
513
-        {
472
+       for ($j=2;$j<count($Plots)-2;$j=$j+2) {
514 473
          $Angle = $SliceAngle[$SliceID][$j/2];
515
-         if ( $Angle < 270 && $Angle > 90 )
516
-          {
474
+         if ( $Angle < 270 && $Angle > 90 ) {
517 475
            $Border = "";
518 476
            $Border[] = $Plots[$j];   $Border[] = $Plots[$j+1];
519 477
            $Border[] = $Plots[$j+2]; $Border[] = $Plots[$j+3];
@@ -523,8 +481,7 @@  discard block
 block discarded – undo
523 481
           }
524 482
         }
525 483
 
526
-       if ( $SecondPass )
527
-        {
484
+       if ( $SecondPass ) {
528 485
          $Settings = $SliceColors[$SliceID];
529 486
          if ( $Border )
530 487
           { $Settings["R"]+= 30; $Settings["G"]+= 30; $Settings["B"]+= 30; }
@@ -532,8 +489,7 @@  discard block
 block discarded – undo
532 489
          if ( isset($SliceAngle[$SliceID][1]) ) /* Empty error handling */
533 490
           {
534 491
            $Angle = $SliceAngle[$SliceID][1];
535
-           if ( $Angle < 270 && $Angle > 90 )
536
-            {
492
+           if ( $Angle < 270 && $Angle > 90 ) {
537 493
              $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
538 494
              $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y;
539 495
              $this->pChartObject->drawLine($Xc,$Yc,$Xc,$Yc-$SliceHeight,$Settings);
@@ -541,22 +497,19 @@  discard block
 block discarded – undo
541 497
           }
542 498
 
543 499
          $Angle = $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1];
544
-         if ( $Angle < 270 && $Angle > 90 )
545
-          {
500
+         if ( $Angle < 270 && $Angle > 90 ) {
546 501
            $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
547 502
            $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y;
548 503
            $this->pChartObject->drawLine($Xc,$Yc,$Xc,$Yc-$SliceHeight,$Settings);
549 504
           }
550 505
 
551
-         if ( isset($SliceAngle[$SliceID][1]) && $SliceAngle[$SliceID][1] > 270 && $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1] < 270 )
552
-          {
506
+         if ( isset($SliceAngle[$SliceID][1]) && $SliceAngle[$SliceID][1] > 270 && $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1] < 270 ) {
553 507
            $Xc = cos((270-90)*PI/180) * $Radius + $X;
554 508
            $Yc = sin((270-90)*PI/180) * $Radius*$SkewFactor + $Y;
555 509
            $this->pChartObject->drawLine($Xc,$Yc,$Xc,$Yc-$SliceHeight,$Settings);
556 510
           }
557 511
 
558
-         if ( isset($SliceAngle[$SliceID][1]) && $SliceAngle[$SliceID][1] > 90 && $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1] < 90 )
559
-          {
512
+         if ( isset($SliceAngle[$SliceID][1]) && $SliceAngle[$SliceID][1] > 90 && $SliceAngle[$SliceID][count($SliceAngle[$SliceID])-1] < 90 ) {
560 513
            $Xc = cos((0)*PI/180) * $Radius + $X;
561 514
            $Yc = sin((0)*PI/180) * $Radius*$SkewFactor + $Y;
562 515
            $this->pChartObject->drawLine($Xc,$Yc,$Xc,$Yc-$SliceHeight,$Settings);
@@ -566,8 +519,7 @@  discard block
 block discarded – undo
566 519
       }
567 520
 
568 521
      /* Draw the top splice */
569
-     foreach($Slices as $SliceID => $Plots)
570
-      {
522
+     foreach($Slices as $SliceID => $Plots) {
571 523
        $Settings = $SliceColors[$SliceID];
572 524
        $Settings["R"]+= 20; $Settings["G"]+= 20; $Settings["B"]+= 20;
573 525
 
@@ -580,37 +532,30 @@  discard block
 block discarded – undo
580 532
 
581 533
 
582 534
      /* Second pass to smooth the angles */
583
-     if ( $SecondPass )
584
-      {
535
+     if ( $SecondPass ) {
585 536
        $Step = 360 / (2 * PI * $Radius);
586 537
        $Offset = 360; $ID = count($Values)-1;
587
-       foreach($Values as $Key => $Value)
588
-        {
538
+       foreach($Values as $Key => $Value) {
589 539
          $FirstPoint = TRUE;
590 540
          if ( $Shadow )
591 541
           $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
592
-         else
593
-          {
542
+         else {
594 543
            if ( $Border )
595
-            { $Settings = array("R"=>$Palette[$ID]["R"]+30,"G"=>$Palette[$ID]["G"]+30,"B"=>$Palette[$ID]["B"]+30,"Alpha"=>$Palette[$ID]["Alpha"]); }
596
-           else
544
+            { $Settings = array("R"=>$Palette[$ID]["R"]+30,"G"=>$Palette[$ID]["G"]+30,"B"=>$Palette[$ID]["B"]+30,"Alpha"=>$Palette[$ID]["Alpha"]); } else
597 545
             $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
598 546
           }
599 547
 
600 548
          $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
601 549
 
602 550
          if ($DataGapAngle == 0)
603
-          { $X0 = $X; $Y0 = $Y- $SliceHeight; }
604
-         else
605
-          {
551
+          { $X0 = $X; $Y0 = $Y- $SliceHeight; } else {
606 552
            $Angle = ($EndAngle - $Offset)/2 + $Offset;
607 553
            $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
608 554
            $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius*$SkewFactor + $Y - $SliceHeight;
609 555
           }
610 556
          $Plots[] = $X0; $Plots[] = $Y0;
611 557
 
612
-         for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
613
-          {
558
+         for($i=$Offset;$i>=$EndAngle;$i=$i-$Step) {
614 559
            $Xc = cos(($i-90)*PI/180) * $Radius + $X;
615 560
            $Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y - $SliceHeight;
616 561
 
@@ -625,24 +570,19 @@  discard block
 block discarded – undo
625 570
         }
626 571
       }
627 572
 
628
-     if ( $WriteValues != NULL )
629
-      {
573
+     if ( $WriteValues != NULL ) {
630 574
        $Step = 360 / (2 * PI * $Radius);
631 575
        $Offset = 360; $ID = count($Values)-1;
632 576
        $Settings = array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"R"=>$ValueR,"G"=>$ValueG,"B"=>$ValueB,"Alpha"=>$ValueAlpha);
633
-       foreach($Values as $Key => $Value)
634
-        {
577
+       foreach($Values as $Key => $Value) {
635 578
          $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
636 579
 
637 580
          $Angle = ($EndAngle - $Offset)/2 + $Offset;
638 581
 
639
-         if ( $ValuePosition == PIE_VALUE_OUTSIDE )
640
-          {
582
+         if ( $ValuePosition == PIE_VALUE_OUTSIDE ) {
641 583
            $Xc = cos(($Angle-90)*PI/180) * ($Radius+$ValuePadding) + $X;
642 584
            $Yc = sin(($Angle-90)*PI/180) * (($Radius*$SkewFactor)+$ValuePadding) + $Y - $SliceHeight;
643
-          }
644
-         else
645
-          {
585
+          } else {
646 586
            $Xc = cos(($Angle-90)*PI/180) * ($Radius)/2 + $X;
647 587
            $Yc = sin(($Angle-90)*PI/180) * ($Radius*$SkewFactor)/2 + $Y - $SliceHeight;
648 588
           }
@@ -658,15 +598,12 @@  discard block
 block discarded – undo
658 598
         }
659 599
       }
660 600
 
661
-     if ( $DrawLabels )
662
-      {
601
+     if ( $DrawLabels ) {
663 602
        $Step = 360 / (2 * PI * $Radius);
664 603
        $Offset = 360; $ID = count($Values)-1;
665
-       foreach($Values as $Key => $Value)
666
-        {
604
+       foreach($Values as $Key => $Value) {
667 605
          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
606
+          { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);} else
670 607
           { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
671 608
 
672 609
          $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
@@ -675,8 +612,7 @@  discard block
 block discarded – undo
675 612
          $Xc = cos(($Angle-90)*PI/180) * $Radius + $X;
676 613
          $Yc = sin(($Angle-90)*PI/180) * $Radius*$SkewFactor + $Y - $SliceHeight;
677 614
 
678
-         if ( isset($Data["Series"][$Data["Abscissa"]]["Data"][$ID]) )
679
-          {
615
+         if ( isset($Data["Series"][$Data["Abscissa"]]["Data"][$ID]) ) {
680 616
            $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$ID];
681 617
 
682 618
            if ( $LabelStacked )
@@ -697,8 +633,7 @@  discard block
 block discarded – undo
697 633
     }
698 634
 
699 635
    /* Draw the legend of pie chart */
700
-   function drawPieLegend($X,$Y,$Format="")
701
-    {
636
+   function drawPieLegend($X,$Y,$Format="") {
702 637
      $FontName		= isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
703 638
      $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
704 639
      $FontR		= isset($Format["FontR"]) ? $Format["FontR"] : $this->pChartObject->FontColorR;
@@ -730,19 +665,15 @@  discard block
 block discarded – undo
730 665
      if ( $Data["Abscissa"] == "" ) { return(PIE_NO_ABSCISSA); }
731 666
 
732 667
      $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
-      {
668
+     foreach($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $Value) {
735 669
        $BoxArray = $this->pChartObject->getTextBox($vX+$BoxSize+4,$vY+$BoxSize/2,$FontName,$FontSize,0,$Value);
736 670
 
737
-       if ( $Mode == LEGEND_VERTICAL )
738
-        {
671
+       if ( $Mode == LEGEND_VERTICAL ) {
739 672
          if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$BoxSize/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$BoxSize/2; }
740 673
          if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
741 674
          if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$BoxSize/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$BoxSize/2; }
742 675
          $vY=$vY+$YStep;
743
-        }
744
-       elseif ( $Mode == LEGEND_HORIZONTAL )
745
-        {
676
+        } elseif ( $Mode == LEGEND_HORIZONTAL ) {
746 677
          if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$BoxSize/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$BoxSize/2; }
747 678
          if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
748 679
          if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$BoxSize/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$BoxSize/2; }
@@ -760,19 +691,15 @@  discard block
 block discarded – undo
760 691
       $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 692
 
762 693
      $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE;
763
-     foreach($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $Value)
764
-      {
694
+     foreach($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $Value) {
765 695
        $R = $Palette[$Key]["R"]; $G = $Palette[$Key]["G"]; $B = $Palette[$Key]["B"];
766 696
 
767 697
        $this->pChartObject->drawFilledRectangle($X+1,$Y+1,$X+$BoxSize+1,$Y+$BoxSize+1,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
768 698
        $this->pChartObject->drawFilledRectangle($X,$Y,$X+$BoxSize,$Y+$BoxSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
769
-       if ( $Mode == LEGEND_VERTICAL )
770
-        {
699
+       if ( $Mode == LEGEND_VERTICAL ) {
771 700
          $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 701
          $Y=$Y+$YStep;
773
-        }
774
-       elseif ( $Mode == LEGEND_HORIZONTAL )
775
-        {
702
+        } elseif ( $Mode == LEGEND_HORIZONTAL ) {
776 703
          $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 704
          $X=$BoxArray[1]["X"]+2+$XStep;
778 705
         }
@@ -782,8 +709,7 @@  discard block
 block discarded – undo
782 709
     }
783 710
 
784 711
    /* Set the color of the specified slice */
785
-   function setSliceColor($SliceID,$Format="")
786
-    {
712
+   function setSliceColor($SliceID,$Format="") {
787 713
      $R		= isset($Format["R"]) ? $Format["R"] : 0;
788 714
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
789 715
      $B		= isset($Format["B"]) ? $Format["B"] : 0;
@@ -796,22 +722,18 @@  discard block
 block discarded – undo
796 722
     }
797 723
 
798 724
    /* Internally used compute the label positions */
799
-   function writePieLabel($X,$Y,$Label,$Angle,$Settings,$Stacked,$Xc=0,$Yc=0,$Radius=0,$Reversed=FALSE)
800
-    {
725
+   function writePieLabel($X,$Y,$Label,$Angle,$Settings,$Stacked,$Xc=0,$Yc=0,$Radius=0,$Reversed=FALSE) {
801 726
      $LabelOffset	= 30;
802 727
      $FontName		= $this->pChartObject->FontName;
803 728
      $FontSize		= $this->pChartObject->FontSize;
804 729
 
805
-     if ( !$Stacked )
806
-      {
730
+     if ( !$Stacked ) {
807 731
        $Settings["Angle"]  = 360-$Angle;
808 732
        $Settings["Length"] = 25;
809 733
        $Settings["Size"]   = 8;
810 734
 
811 735
        $this->pChartObject->drawArrowLabel($X,$Y," ".$Label." ",$Settings);
812
-      }
813
-     else
814
-      {
736
+      } else {
815 737
        $X2 = cos(deg2rad($Angle-90))*20+$X;
816 738
        $Y2 = sin(deg2rad($Angle-90))*20+$Y;
817 739
 
@@ -820,13 +742,10 @@  discard block
 block discarded – undo
820 742
        $YTop    = $Y2 - $Height/2 - 2;
821 743
        $YBottom = $Y2 + $Height/2 + 2;
822 744
 
823
-       if ( $this->LabelPos != "" )
824
-        {
745
+       if ( $this->LabelPos != "" ) {
825 746
          $Done = FALSE;
826
-         foreach($this->LabelPos as $Key => $Settings)
827
-          {
828
-           if ( !$Done )
829
-            {
747
+         foreach($this->LabelPos as $Key => $Settings) {
748
+           if ( !$Done ) {
830 749
              if ( $Angle <= 90 && (($YTop >= $Settings["YTop"] && $YTop <= $Settings["YBottom"]) || ($YBottom >= $Settings["YTop"] && $YBottom <= $Settings["YBottom"])))
831 750
               { $this->shift(0,180,-($Height+2),$Reversed); $Done = TRUE; }
832 751
              if ( $Angle > 90 && $Angle <= 180 && (($YTop >= $Settings["YTop"] && $YTop <= $Settings["YBottom"]) || ($YBottom >= $Settings["YTop"] && $YBottom <= $Settings["YBottom"])))
@@ -847,21 +766,17 @@  discard block
 block discarded – undo
847 766
     }
848 767
 
849 768
    /* Internally used to shift label positions */
850
-   function shift($StartAngle,$EndAngle,$Offset,$Reversed)
851
-    {
769
+   function shift($StartAngle,$EndAngle,$Offset,$Reversed) {
852 770
      if ( $Reversed ) { $Offset = -$Offset; }
853
-     foreach($this->LabelPos as $Key => $Settings)
854
-      {
771
+     foreach($this->LabelPos as $Key => $Settings) {
855 772
        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 773
       }
857 774
     }
858 775
 
859 776
    /* Internally used to write the re-computed labels */
860
-   function writeShiftedLabels()
861
-    {
777
+   function writeShiftedLabels() {
862 778
      if ( $this->LabelPos == "" ) { return(0); }
863
-     foreach($this->LabelPos as $Key => $Settings)
864
-      {
779
+     foreach($this->LabelPos as $Key => $Settings) {
865 780
        $X1 = $Settings["X1"]; $Y1 = $Settings["Y1"];
866 781
        $X2 = $Settings["X2"]; $Y2 = $Settings["Y2"];
867 782
        $X3 = $Settings["X3"];
@@ -869,13 +784,10 @@  discard block
 block discarded – undo
869 784
        $Label = $Settings["Label"];
870 785
 
871 786
        $this->pChartObject->drawArrow($X2,$Y2,$X1,$Y1,array("Size"=>8));
872
-       if ( $Angle <= 180 )
873
-        {
787
+       if ( $Angle <= 180 ) {
874 788
          $this->pChartObject->drawLine($X2,$Y2,$X3,$Y2);
875 789
          $this->pChartObject->drawText($X3+2,$Y2,$Label,array("Align"=>TEXT_ALIGN_MIDDLELEFT));
876
-        }
877
-       else
878
-        {
790
+        } else {
879 791
          $this->pChartObject->drawLine($X2,$Y2,$X3,$Y2);
880 792
          $this->pChartObject->drawText($X3-2,$Y2,$Label,array("Align"=>TEXT_ALIGN_MIDDLERIGHT));
881 793
         }
@@ -883,8 +795,7 @@  discard block
 block discarded – undo
883 795
     }
884 796
 
885 797
    /* Draw a ring chart */
886
-   function draw2DRing($X,$Y,$Format="")
887
-    {
798
+   function draw2DRing($X,$Y,$Format="") {
888 799
      $OuterRadius	= isset($Format["Radius"]) ? $Format["Radius"] : 60;
889 800
      $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
890 801
      $InnerRadius	= isset($Format["Radius"]) ? $Format["Radius"] : 30;
@@ -947,8 +858,7 @@  discard block
 block discarded – undo
947 858
      $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
948 859
 
949 860
      $RestoreShadow = $this->pChartObject->Shadow;
950
-     if ( $this->pChartObject->Shadow )
951
-      {
861
+     if ( $this->pChartObject->Shadow ) {
952 862
        $this->pChartObject->Shadow = FALSE;
953 863
 
954 864
        $ShadowFormat = $Format; $ShadowFormat["Shadow"] = TRUE;
@@ -958,15 +868,11 @@  discard block
 block discarded – undo
958 868
      /* Draw the polygon pie elements */
959 869
      $Step = 360 / (2 * PI * $OuterRadius);
960 870
      $Offset = 0; $ID = 0;
961
-     foreach($Values as $Key => $Value)
962
-      {
963
-       if ( $Shadow )
964
-        {
871
+     foreach($Values as $Key => $Value) {
872
+       if ( $Shadow ) {
965 873
          $Settings    = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
966 874
          $BorderColor = $Settings;
967
-        }
968
-       else
969
-        {
875
+        } else {
970 876
          if ( !isset($Palette[$ID]["R"]) ) { $Color = $this->pChartObject->getRandomColor(); $Palette[$ID] = $Color; $this->pDataObject->savePalette($ID,$Color); }
971 877
          $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
972 878
 
@@ -978,8 +884,7 @@  discard block
 block discarded – undo
978 884
 
979 885
        $Plots = ""; $Boundaries = ""; $AAPixels = "";
980 886
        $EndAngle = $Offset+($Value*$ScaleFactor); if ( $EndAngle > 360 ) { $EndAngle = 360; }
981
-       for($i=$Offset;$i<=$EndAngle;$i=$i+$Step)
982
-        {
887
+       for($i=$Offset;$i<=$EndAngle;$i=$i+$Step) {
983 888
          $Xc = cos(($i-90)*PI/180) * $OuterRadius + $X;
984 889
          $Yc = sin(($i-90)*PI/180) * $OuterRadius + $Y;
985 890
 
@@ -995,8 +900,7 @@  discard block
 block discarded – undo
995 900
        $Boundaries[1]["X1"] = $Xc; $Boundaries[1]["Y1"] = $Yc;
996 901
        $Lasti = $EndAngle;
997 902
 
998
-       for($i=$EndAngle;$i>=$Offset;$i=$i-$Step)
999
-        {
903
+       for($i=$EndAngle;$i>=$Offset;$i=$i-$Step) {
1000 904
          $Xc = cos(($i-90)*PI/180) * ($InnerRadius-1) + $X;
1001 905
          $Yc = sin(($i-90)*PI/180) * ($InnerRadius-1) + $Y;
1002 906
 
@@ -1023,11 +927,9 @@  discard block
 block discarded – undo
1023 927
        $this->pChartObject->drawLine($Boundaries[0]["X1"],$Boundaries[0]["Y1"],$Boundaries[0]["X2"],$Boundaries[0]["Y2"],$BorderColor);
1024 928
        $this->pChartObject->drawLine($Boundaries[1]["X1"],$Boundaries[1]["Y1"],$Boundaries[1]["X2"],$Boundaries[1]["Y2"],$BorderColor);
1025 929
 
1026
-       if ( $DrawLabels && !$Shadow )
1027
-        {
930
+       if ( $DrawLabels && !$Shadow ) {
1028 931
          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
932
+          { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);} else
1031 933
           { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
1032 934
 
1033 935
          $Angle = ($EndAngle - $Offset)/2 + $Offset;
@@ -1047,27 +949,22 @@  discard block
 block discarded – undo
1047 949
 
1048 950
      if ( $DrawLabels && $LabelStacked ) { $this->writeShiftedLabels(); }
1049 951
 
1050
-     if ( $WriteValues && !$Shadow )
1051
-      {
952
+     if ( $WriteValues && !$Shadow ) {
1052 953
        $Step = 360 / (2 * PI * $OuterRadius);
1053 954
        $Offset = 0;
1054
-       foreach($Values as $Key => $Value)
1055
-        {
955
+       foreach($Values as $Key => $Value) {
1056 956
          $EndAngle = $Offset+($Value*$ScaleFactor);
1057 957
          if ( $EndAngle > 360 ) { $EndAngle = 360; }
1058 958
 
1059 959
          $Angle = $Offset+($Value*$ScaleFactor)/2;
1060
-         if ( $ValuePosition == PIE_VALUE_OUTSIDE )
1061
-          {
960
+         if ( $ValuePosition == PIE_VALUE_OUTSIDE ) {
1062 961
            $Xc = cos(($Angle-90)*PI/180) * ($OuterRadius+$ValuePadding) + $X;
1063 962
            $Yc = sin(($Angle-90)*PI/180) * ($OuterRadius+$ValuePadding) + $Y;
1064 963
            if ( $Angle >=0 && $Angle <= 90 ) { $Align = TEXT_ALIGN_BOTTOMLEFT; }
1065 964
            if ( $Angle > 90 && $Angle <= 180 ) { $Align = TEXT_ALIGN_TOPLEFT; }
1066 965
            if ( $Angle > 180 && $Angle <= 270 ) { $Align = TEXT_ALIGN_TOPRIGHT; }
1067 966
            if ( $Angle > 270 ) { $Align = TEXT_ALIGN_BOTTOMRIGHT; }
1068
-          }
1069
-         else
1070
-          {
967
+          } else {
1071 968
            $Xc = cos(($Angle-90)*PI/180) * (($OuterRadius-$InnerRadius)/2+$InnerRadius) + $X;
1072 969
            $Yc = sin(($Angle-90)*PI/180) * (($OuterRadius-$InnerRadius)/2+$InnerRadius) + $Y;
1073 970
            $Align = TEXT_ALIGN_MIDDLEMIDDLE;
@@ -1091,8 +988,7 @@  discard block
 block discarded – undo
1091 988
     }
1092 989
 
1093 990
    /* Draw a 3D ring chart */
1094
-   function draw3DRing($X,$Y,$Format="")
1095
-    {
991
+   function draw3DRing($X,$Y,$Format="") {
1096 992
      $OuterRadius	= isset($Format["OuterRadius"]) ? $Format["OuterRadius"] : 100;
1097 993
      $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
1098 994
      $InnerRadius	= isset($Format["InnerRadius"]) ? $Format["InnerRadius"] : 30;
@@ -1165,8 +1061,7 @@  discard block
 block discarded – undo
1165 1061
      $Offset = 360; $ID = count($Values)-1;
1166 1062
      $Values = array_reverse($Values);
1167 1063
      $Slice  = 0; $Slices = ""; $SliceColors = ""; $Visible = ""; $SliceAngle = "";
1168
-     foreach($Values as $Key => $Value)
1169
-      {
1064
+     foreach($Values as $Key => $Value) {
1170 1065
        if ( !isset($Palette[$ID]["R"]) ) { $Color = $this->pChartObject->getRandomColor(); $Palette[$ID] = $Color; $this->pDataObject->savePalette($ID,$Color); }
1171 1066
        $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
1172 1067
 
@@ -1180,8 +1075,7 @@  discard block
 block discarded – undo
1180 1075
 
1181 1076
        $Step   = (360 / (2 * PI * $OuterRadius))/2;
1182 1077
        $OutX1 = VOID; $OutY1 = VOID;
1183
-       for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
1184
-        {
1078
+       for($i=$Offset;$i>=$EndAngle;$i=$i-$Step) {
1185 1079
          $Xc = cos(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius-2) + $X;
1186 1080
          $Yc = sin(($i-90)*PI/180) * ($OuterRadius+$DataGapRadius-2)*$SkewFactor + $Y;
1187 1081
          $Slices[$Slice]["AA"][] = array($Xc,$Yc);
@@ -1212,8 +1106,7 @@  discard block
 block discarded – undo
1212 1106
 
1213 1107
        $Step   = (360 / (2 * PI * $InnerRadius))/2;
1214 1108
        $InX1 = VOID; $InY1 = VOID;
1215
-       for($i=$EndAngle;$i<=$Offset;$i=$i+$Step)
1216
-        {
1109
+       for($i=$EndAngle;$i<=$Offset;$i=$i+$Step) {
1217 1110
          $Xc = cos(($i-90)*PI/180) * ($InnerRadius+$DataGapRadius-1) + $X;
1218 1111
          $Yc = sin(($i-90)*PI/180) * ($InnerRadius+$DataGapRadius-1)*$SkewFactor + $Y;
1219 1112
          $Slices[$Slice]["AA"][] = array($Xc,$Yc);
@@ -1244,13 +1137,13 @@  discard block
 block discarded – undo
1244 1137
       }
1245 1138
 
1246 1139
      /* Draw the bottom pie splice */
1247
-     foreach($Slices as $SliceID => $Plots)
1248
-      {
1140
+     foreach($Slices as $SliceID => $Plots) {
1249 1141
        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1250 1142
        $this->pChartObject->drawPolygon($Plots["BottomPoly"],$Settings);
1251 1143
 
1252
-       foreach($Plots["AA"] as $Key => $Pos)
1253
-        $this->pChartObject->drawAntialiasPixel($Pos[0],$Pos[1],$Settings);
1144
+       foreach($Plots["AA"] as $Key => $Pos) {
1145
+               $this->pChartObject->drawAntialiasPixel($Pos[0],$Pos[1],$Settings);
1146
+       }
1254 1147
 
1255 1148
        $this->pChartObject->drawLine($Plots["InX1"],$Plots["InY1"],$Plots["OutX2"],$Plots["OutY2"],$Settings);
1256 1149
        $this->pChartObject->drawLine($Plots["InX2"],$Plots["InY2"],$Plots["OutX1"],$Plots["OutY1"],$Settings);
@@ -1260,8 +1153,7 @@  discard block
 block discarded – undo
1260 1153
      $SliceColors = array_reverse($SliceColors);
1261 1154
 
1262 1155
      /* Draw the vertical edges (semi-visible) */
1263
-     foreach($Slices as $SliceID => $Plots)
1264
-      {
1156
+     foreach($Slices as $SliceID => $Plots) {
1265 1157
        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1266 1158
        $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1267 1159
 
@@ -1278,21 +1170,16 @@  discard block
 block discarded – undo
1278 1170
       }
1279 1171
 
1280 1172
      /* Draw the inner vertical slices */
1281
-     foreach($Slices as $SliceID => $Plots)
1282
-      {
1173
+     foreach($Slices as $SliceID => $Plots) {
1283 1174
        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1284 1175
        $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1285 1176
 
1286 1177
        $Outer = TRUE; $Inner = FALSE;
1287 1178
        $InnerPlotsA = ""; $InnerPlotsB = "";
1288
-       foreach($Plots["Angle"] as $ID => $Angle)
1289
-        {
1179
+       foreach($Plots["Angle"] as $ID => $Angle) {
1290 1180
          if ( $Angle == VOID )
1291
-          { $Outer = FALSE; $Inner = TRUE; }
1292
-         elseif( $Inner )
1293
-          {
1294
-           if (( $Angle < 90 || $Angle > 270 ) && isset($Plots["BottomPoly"][$ID*2]) )
1295
-            {
1181
+          { $Outer = FALSE; $Inner = TRUE; } elseif( $Inner ) {
1182
+           if (( $Angle < 90 || $Angle > 270 ) && isset($Plots["BottomPoly"][$ID*2]) ) {
1296 1183
              $Xo = $Plots["BottomPoly"][$ID*2];
1297 1184
              $Yo = $Plots["BottomPoly"][$ID*2+1];
1298 1185
 
@@ -1307,16 +1194,14 @@  discard block
 block discarded – undo
1307 1194
       }
1308 1195
 
1309 1196
      /* Draw the splice top and left poly */
1310
-     foreach($Slices as $SliceID => $Plots)
1311
-      {
1197
+     foreach($Slices as $SliceID => $Plots) {
1312 1198
        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1313 1199
        $Settings["R"] = $Settings["R"]+$Cf*1.5; $Settings["G"] = $Settings["G"]+$Cf*1.5; $Settings["B"] = $Settings["B"]+$Cf*1.5;
1314 1200
 
1315 1201
        $StartAngle = $Plots["Angle"][0];
1316 1202
        foreach($Plots["Angle"] as $Key =>$Angle) { if ($Angle == VOID) { $EndAngle = $Plots["Angle"][$Key-1]; } }
1317 1203
 
1318
-       if ( $StartAngle < 180 )
1319
-        {
1204
+       if ( $StartAngle < 180 ) {
1320 1205
          $Points = "";
1321 1206
          $Points[] = $Plots["InX2"];
1322 1207
          $Points[] = $Plots["InY2"];
@@ -1330,8 +1215,7 @@  discard block
 block discarded – undo
1330 1215
          $this->pChartObject->drawPolygon($Points,$Settings);
1331 1216
         }
1332 1217
 
1333
-       if ( $EndAngle > 180 )
1334
-        {
1218
+       if ( $EndAngle > 180 ) {
1335 1219
          $Points = "";
1336 1220
          $Points[] = $Plots["InX1"];
1337 1221
          $Points[] = $Plots["InY1"];
@@ -1348,8 +1232,7 @@  discard block
 block discarded – undo
1348 1232
 
1349 1233
 
1350 1234
      /* Draw the vertical edges (visible) */
1351
-     foreach($Slices as $SliceID => $Plots)
1352
-      {
1235
+     foreach($Slices as $SliceID => $Plots) {
1353 1236
        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1354 1237
        $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1355 1238
 
@@ -1364,21 +1247,16 @@  discard block
 block discarded – undo
1364 1247
 
1365 1248
 
1366 1249
      /* Draw the outer vertical slices */
1367
-     foreach($Slices as $SliceID => $Plots)
1368
-      {
1250
+     foreach($Slices as $SliceID => $Plots) {
1369 1251
        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1370 1252
        $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1371 1253
 
1372 1254
        $Outer = TRUE; $Inner = FALSE;
1373 1255
        $OuterPlotsA = ""; $OuterPlotsB = ""; $InnerPlotsA = ""; $InnerPlotsB = "";
1374
-       foreach($Plots["Angle"] as $ID => $Angle)
1375
-        {
1256
+       foreach($Plots["Angle"] as $ID => $Angle) {
1376 1257
          if ( $Angle == VOID )
1377
-          { $Outer = FALSE; $Inner = TRUE; }
1378
-         elseif( $Outer )
1379
-          {
1380
-           if ( ( $Angle > 90 && $Angle < 270 ) && isset($Plots["BottomPoly"][$ID*2]) )
1381
-            {
1258
+          { $Outer = FALSE; $Inner = TRUE; } elseif( $Outer ) {
1259
+           if ( ( $Angle > 90 && $Angle < 270 ) && isset($Plots["BottomPoly"][$ID*2]) ) {
1382 1260
              $Xo = $Plots["BottomPoly"][$ID*2];
1383 1261
              $Yo = $Plots["BottomPoly"][$ID*2+1];
1384 1262
 
@@ -1396,8 +1274,7 @@  discard block
 block discarded – undo
1396 1274
 
1397 1275
 
1398 1276
      /* Draw the top pie splice */
1399
-     foreach($Slices as $SliceID => $Plots)
1400
-      {
1277
+     foreach($Slices as $SliceID => $Plots) {
1401 1278
        $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1402 1279
        $Settings["R"] = $Settings["R"]+$Cf*2; $Settings["G"] = $Settings["G"]+$Cf*2; $Settings["B"] = $Settings["B"]+$Cf*2;
1403 1280
  
@@ -1405,24 +1282,22 @@  discard block
 block discarded – undo
1405 1282
 
1406 1283
        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 1284
 
1408
-       foreach($Plots["AA"] as $Key => $Pos)
1409
-        $this->pChartObject->drawAntialiasPixel($Pos[0],$Pos[1]-$SliceHeight,$Settings);
1285
+       foreach($Plots["AA"] as $Key => $Pos) {
1286
+               $this->pChartObject->drawAntialiasPixel($Pos[0],$Pos[1]-$SliceHeight,$Settings);
1287
+       }
1410 1288
 
1411 1289
        $this->pChartObject->drawLine($Plots["InX1"],$Plots["InY1"]-$SliceHeight,$Plots["OutX2"],$Plots["OutY2"]-$SliceHeight,$Settings);
1412 1290
        $this->pChartObject->drawLine($Plots["InX2"],$Plots["InY2"]-$SliceHeight,$Plots["OutX1"],$Plots["OutY1"]-$SliceHeight,$Settings);
1413 1291
       }
1414 1292
 
1415
-     if ( $DrawLabels )
1416
-      {
1293
+     if ( $DrawLabels ) {
1417 1294
        $Offset = 360;
1418
-       foreach($Values as $Key => $Value)
1419
-        {
1295
+       foreach($Values as $Key => $Value) {
1420 1296
          $StartAngle = $Offset;
1421 1297
          $EndAngle   = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
1422 1298
 
1423 1299
          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
1300
+          { $Settings = array("FillR"=>$Palette[$ID]["R"],"FillG"=>$Palette[$ID]["G"],"FillB"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);} else
1426 1301
           { $Settings = array("FillR"=>$LabelR,"FillG"=>$LabelG,"FillB"=>$LabelB,"Alpha"=>$LabelAlpha); }
1427 1302
 
1428 1303
          $Angle = ($EndAngle - $Offset)/2 + $Offset;
@@ -1452,8 +1327,7 @@  discard block
 block discarded – undo
1452 1327
     }
1453 1328
 
1454 1329
   /* Serialize an array */
1455
-  function arraySerialize($Data)
1456
-   {
1330
+  function arraySerialize($Data) {
1457 1331
     $Result = "";
1458 1332
     foreach($Data as $Key => $Value)
1459 1333
      { if ($Result == "") { $Result = floor($Value); } else { $Result = $Result.",".floor($Value); } }
@@ -1462,8 +1336,7 @@  discard block
 block discarded – undo
1462 1336
    }
1463 1337
 
1464 1338
   /* Reverse an array */
1465
-  function arrayReverse($Plots)
1466
-   {
1339
+  function arrayReverse($Plots) {
1467 1340
     $Result = "";
1468 1341
 
1469 1342
     for($i=count($Plots)-1;$i>=0;$i=$i-2)
@@ -1473,8 +1346,7 @@  discard block
 block discarded – undo
1473 1346
    }
1474 1347
 
1475 1348
   /* Remove unused series & values */
1476
-  function clean0Values($Data,$Palette,$DataSerie,$AbscissaSerie)
1477
-   {
1349
+  function clean0Values($Data,$Palette,$DataSerie,$AbscissaSerie) {
1478 1350
     $NewPalette = ""; $NewData = ""; $NewAbscissa = "";
1479 1351
 
1480 1352
     /* Remove unused series */
@@ -1482,10 +1354,8 @@  discard block
 block discarded – undo
1482 1354
      { if ( $SerieName != $DataSerie && $SerieName != $AbscissaSerie ) { unset($Data["Series"][$SerieName]); } }
1483 1355
 
1484 1356
     /* Remove NULL values */
1485
-    foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
1486
-     {
1487
-      if ($Value != 0 )
1488
-       {
1357
+    foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value) {
1358
+      if ($Value != 0 ) {
1489 1359
         $NewData[]     = $Value;
1490 1360
         $NewAbscissa[] = $Data["Series"][$AbscissaSerie]["Data"][$Key];
1491 1361
         if ( isset($Palette[$Key]) ) { $NewPalette[]  = $Palette[$Key]; }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -52,20 +52,20 @@  discard block
 block discarded – undo
52 52
      $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
53 53
      $DataGapAngle	= isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 0;
54 54
      $DataGapRadius	= isset($Format["DataGapRadius"]) ? $Format["DataGapRadius"] : 0;
55
-     $SecondPass	= isset($Format["SecondPass"]) ? $Format["SecondPass"] : TRUE;
56
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
55
+     $SecondPass	= isset($Format["SecondPass"]) ? $Format["SecondPass"] : true;
56
+     $Border		= isset($Format["Border"]) ? $Format["Border"] : false;
57 57
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
58 58
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
59 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;
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 63
      $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
64 64
      $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
65 65
      $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
66 66
      $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
67 67
      $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
68
-     $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : NULL;
68
+     $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : null;
69 69
      $ValuePosition	= isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_OUTSIDE;
70 70
      $ValuePadding	= isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 15;
71 71
      $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
74 74
      $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
75 75
      $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
76
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
76
+     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
77 77
 
78 78
      /* Data Processing */
79 79
      $Data    = $this->pDataObject->getData();
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
      $RestoreShadow = $this->pChartObject->Shadow;
114 114
      if ( $this->pChartObject->Shadow )
115 115
       {
116
-       $this->pChartObject->Shadow = FALSE;
116
+       $this->pChartObject->Shadow = false;
117 117
 
118
-       $ShadowFormat = $Format; $ShadowFormat["Shadow"] = TRUE;
118
+       $ShadowFormat = $Format; $ShadowFormat["Shadow"] = true;
119 119
        $this->draw2DPie($X+$this->pChartObject->ShadowX,$Y+$this->pChartObject->ShadowY,$ShadowFormat);
120 120
       }
121 121
 
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
          $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
185 185
 
186 186
          if ( $LabelStacked )
187
-          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$Radius);
187
+          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,true,$X,$Y,$Radius);
188 188
          else
189
-          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
189
+          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,false);
190 190
         }
191 191
 
192 192
        $Offset = $i + $DataGapAngle; $ID++;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
        $Offset = 0; $ID = 0;
200 200
        foreach($Values as $Key => $Value)
201 201
         {
202
-         $FirstPoint = TRUE;
202
+         $FirstPoint = true;
203 203
          if ( $Shadow )
204 204
           $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
205 205
          else
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
            $Xc = cos(($i-90)*PI/180) * $Radius + $X;
228 228
            $Yc = sin(($i-90)*PI/180) * $Radius + $Y;
229 229
 
230
-           if ( $FirstPoint ) { $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); } { $FirstPoint = FALSE; }
230
+           if ( $FirstPoint ) { $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); } { $FirstPoint = false; }
231 231
   
232 232
            $this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
233 233
           }
@@ -247,16 +247,16 @@  discard block
 block discarded – undo
247 247
            $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
248 248
 
249 249
            if ( $LabelStacked )
250
-            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$Radius);
250
+            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,true,$X,$Y,$Radius);
251 251
            else
252
-            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
252
+            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,false);
253 253
           }
254 254
   
255 255
          $Offset = $i + $DataGapAngle; $ID++;
256 256
         }
257 257
       }
258 258
 
259
-     if ( $WriteValues != NULL && !$Shadow )
259
+     if ( $WriteValues != null && !$Shadow )
260 260
       {
261 261
        $Step = 360 / (2 * PI * $Radius);
262 262
        $Offset = 0; $ID = count($Values)-1;
@@ -305,17 +305,17 @@  discard block
 block discarded – undo
305 305
      $SliceHeight	= isset($Format["SliceHeight"]) ? $Format["SliceHeight"] : 20;
306 306
      $DataGapAngle	= isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 0;
307 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;
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 313
      $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
314 314
      $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
315 315
      $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
316 316
      $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
317 317
      $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
318
-     $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : NULL; //PIE_VALUE_PERCENTAGE
318
+     $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : null; //PIE_VALUE_PERCENTAGE
319 319
      $ValuePosition	= isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_INSIDE;
320 320
      $ValuePadding	= isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 15;
321 321
      $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
324 324
      $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
325 325
      $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
326
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
326
+     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
327 327
 
328 328
      /* Error correction for overlaying rounded corners */
329 329
      if ( $SkewFactor < .5 ) { $SkewFactor = .5; }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
      $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
365 365
 
366 366
      $RestoreShadow = $this->pChartObject->Shadow;
367
-     if ( $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = FALSE; }
367
+     if ( $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = false; }
368 368
 
369 369
      /* Draw the polygon pie elements */
370 370
      $Step   = 360 / (2 * PI * $Radius);
@@ -381,8 +381,8 @@  discard block
 block discarded – undo
381 381
        $StartAngle = $Offset;
382 382
        $EndAngle   = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
383 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; }
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 386
 
387 387
        if ($DataGapAngle == 0)
388 388
         { $X0 = $X; $Y0 = $Y; }
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
          for($i=0;$i<count($Plots);$i=$i+2)
420 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);
422
+         $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa,"NoBorder"=>true);
423 423
          $this->pChartObject->drawPolygon($ShadowPie,$Settings);
424 424
         }
425 425
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
      /* Draw the bottom pie splice */
445 445
      foreach($Slices as $SliceID => $Plots)
446 446
       {
447
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
447
+       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = true;
448 448
        $this->pChartObject->drawPolygon($Plots,$Settings);
449 449
 
450 450
        if ( $SecondPass )
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
      foreach($Slices as $SliceID => $Plots)
475 475
       {
476 476
        $Settings = $SliceColors[$SliceID];
477
-       $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
477
+       $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = true;
478 478
 
479 479
        if ( $Visible[$SliceID]["Start"] && isset($Plots[2])) /* Empty error handling */
480 480
         {
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
      foreach($Slices as $SliceID => $Plots)
492 492
       {
493 493
        $Settings = $SliceColors[$SliceID];
494
-       $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
494
+       $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = true;
495 495
        if ( $Visible[$SliceID]["End"] )
496 496
         {
497 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"]));
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
      foreach($Slices as $SliceID => $Plots)
508 508
       {
509 509
        $Settings = $SliceColors[$SliceID];
510
-       $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = TRUE;
510
+       $Settings["R"]+= 10; $Settings["G"]+= 10; $Settings["B"]+= 10; $Settings["NoBorder"] = true;
511 511
 
512 512
        for ($j=2;$j<count($Plots)-2;$j=$j+2)
513 513
         {
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
        $Offset = 360; $ID = count($Values)-1;
587 587
        foreach($Values as $Key => $Value)
588 588
         {
589
-         $FirstPoint = TRUE;
589
+         $FirstPoint = true;
590 590
          if ( $Shadow )
591 591
           $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
592 592
          else
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
            $Xc = cos(($i-90)*PI/180) * $Radius + $X;
615 615
            $Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y - $SliceHeight;
616 616
 
617
-           if ( $FirstPoint ) { $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); } { $FirstPoint = FALSE; }
617
+           if ( $FirstPoint ) { $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); } { $FirstPoint = false; }
618 618
   
619 619
            $this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
620 620
            if ($i < 270 && $i > 90 ) { $this->pChartObject->drawAntialiasPixel($Xc,$Yc+$SliceHeight,$Settings); }
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
         }
626 626
       }
627 627
 
628
-     if ( $WriteValues != NULL )
628
+     if ( $WriteValues != null )
629 629
       {
630 630
        $Step = 360 / (2 * PI * $Radius);
631 631
        $Offset = 360; $ID = count($Values)-1;
@@ -680,9 +680,9 @@  discard block
 block discarded – undo
680 680
            $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$ID];
681 681
 
682 682
            if ( $LabelStacked )
683
-            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$Radius,TRUE);
683
+            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,true,$X,$Y,$Radius,true);
684 684
            else
685
-            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
685
+            $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,false);
686 686
           }
687 687
 
688 688
          $Offset = $EndAngle - $DataGapAngle; $ID--;
@@ -713,11 +713,11 @@  discard block
 block discarded – undo
713 713
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
714 714
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
715 715
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
716
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
716
+     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : null;
717 717
      $Style		= isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND;
718 718
      $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
719 719
 
720
-     if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
720
+     if ( $Surrounding != null ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
721 721
 
722 722
      $YStep = max($this->pChartObject->FontSize,$BoxSize) + 5;
723 723
      $XStep = $BoxSize + 5;
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
      elseif ( $Style == LEGEND_BOX )
760 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 761
 
762
-     $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE;
762
+     $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = false;
763 763
      foreach($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $Value)
764 764
       {
765 765
        $R = $Palette[$Key]["R"]; $G = $Palette[$Key]["G"]; $B = $Palette[$Key]["B"];
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
     }
797 797
 
798 798
    /* Internally used compute the label positions */
799
-   function writePieLabel($X,$Y,$Label,$Angle,$Settings,$Stacked,$Xc=0,$Yc=0,$Radius=0,$Reversed=FALSE)
799
+   function writePieLabel($X,$Y,$Label,$Angle,$Settings,$Stacked,$Xc=0,$Yc=0,$Radius=0,$Reversed=false)
800 800
     {
801 801
      $LabelOffset	= 30;
802 802
      $FontName		= $this->pChartObject->FontName;
@@ -822,19 +822,19 @@  discard block
 block discarded – undo
822 822
 
823 823
        if ( $this->LabelPos != "" )
824 824
         {
825
-         $Done = FALSE;
825
+         $Done = false;
826 826
          foreach($this->LabelPos as $Key => $Settings)
827 827
           {
828 828
            if ( !$Done )
829 829
             {
830 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; }
831
+              { $this->shift(0,180,-($Height+2),$Reversed); $Done = true; }
832 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; }
833
+              { $this->shift(0,180,-($Height+2),$Reversed); $Done = true; }
834 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; }
835
+              { $this->shift(180,360,($Height+2),$Reversed); $Done = true; }
836 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; }
837
+              { $this->shift(180,360,($Height+2),$Reversed); $Done = true; }
838 838
             }
839 839
           }
840 840
         }
@@ -888,20 +888,20 @@  discard block
 block discarded – undo
888 888
      $OuterRadius	= isset($Format["Radius"]) ? $Format["Radius"] : 60;
889 889
      $Precision		= isset($Format["Precision"]) ? $Format["Precision"] : 0;
890 890
      $InnerRadius	= isset($Format["Radius"]) ? $Format["Radius"] : 30;
891
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
891
+     $Border		= isset($Format["Border"]) ? $Format["Border"] : false;
892 892
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 255;
893 893
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 255;
894 894
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 255;
895 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;
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 899
      $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
900 900
      $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
901 901
      $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
902 902
      $LabelB		= isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
903 903
      $LabelAlpha	= isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
904
-     $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : NULL; //PIE_VALUE_PERCENTAGE
904
+     $WriteValues	= isset($Format["WriteValues"]) ? $Format["WriteValues"] : null; //PIE_VALUE_PERCENTAGE
905 905
      $ValuePadding	= isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 5;
906 906
      $ValuePosition	= isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_OUTSIDE;
907 907
      $ValueSuffix	= isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
      $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
910 910
      $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
911 911
      $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
912
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
912
+     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
913 913
 
914 914
      /* Data Processing */
915 915
      $Data    = $this->pDataObject->getData();
@@ -949,9 +949,9 @@  discard block
 block discarded – undo
949 949
      $RestoreShadow = $this->pChartObject->Shadow;
950 950
      if ( $this->pChartObject->Shadow )
951 951
       {
952
-       $this->pChartObject->Shadow = FALSE;
952
+       $this->pChartObject->Shadow = false;
953 953
 
954
-       $ShadowFormat = $Format; $ShadowFormat["Shadow"] = TRUE;
954
+       $ShadowFormat = $Format; $ShadowFormat["Shadow"] = true;
955 955
        $this->draw2DRing($X+$this->pChartObject->ShadowX,$Y+$this->pChartObject->ShadowY,$ShadowFormat);
956 956
       }
957 957
 
@@ -1037,9 +1037,9 @@  discard block
 block discarded – undo
1037 1037
          $Label = $Data["Series"][$Data["Abscissa"]]["Data"][$Key];
1038 1038
 
1039 1039
          if ( $LabelStacked )
1040
-          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,TRUE,$X,$Y,$OuterRadius);
1040
+          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,true,$X,$Y,$OuterRadius);
1041 1041
          else
1042
-          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,FALSE);
1042
+          $this->writePieLabel($Xc,$Yc,$Label,$Angle,$Settings,false);
1043 1043
         }
1044 1044
 
1045 1045
        $Offset = $Lasti; $ID++;
@@ -1100,10 +1100,10 @@  discard block
 block discarded – undo
1100 1100
      $SliceHeight	= isset($Format["SliceHeight"]) ? $Format["SliceHeight"] : 10;
1101 1101
      $DataGapAngle	= isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 10;
1102 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;
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 1107
      $LabelColor	= isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
1108 1108
      $LabelR		= isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
1109 1109
      $LabelG		= isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
      $ValueG		= isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
1119 1119
      $ValueB		= isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
1120 1120
      $ValueAlpha	= isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
1121
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
1121
+     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
1122 1122
 
1123 1123
      /* Error correction for overlaying rounded corners */
1124 1124
      if ( $SkewFactor < .5 ) { $SkewFactor = .5; }
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
      $ScaleFactor = (360 - $WastedAngular) / $SerieSum;
1160 1160
 
1161 1161
      $RestoreShadow = $this->pChartObject->Shadow;
1162
-     if ( $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = FALSE; }
1162
+     if ( $this->pChartObject->Shadow ) { $this->pChartObject->Shadow = false; }
1163 1163
 
1164 1164
      /* Draw the polygon ring elements */
1165 1165
      $Offset = 360; $ID = count($Values)-1;
@@ -1175,8 +1175,8 @@  discard block
 block discarded – undo
1175 1175
        $StartAngle = $Offset;
1176 1176
        $EndAngle   = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
1177 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; }
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 1180
 
1181 1181
        $Step   = (360 / (2 * PI * $OuterRadius))/2;
1182 1182
        $OutX1 = VOID; $OutY1 = VOID;
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
      /* Draw the bottom pie splice */
1247 1247
      foreach($Slices as $SliceID => $Plots)
1248 1248
       {
1249
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1249
+       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = true;
1250 1250
        $this->pChartObject->drawPolygon($Plots["BottomPoly"],$Settings);
1251 1251
 
1252 1252
        foreach($Plots["AA"] as $Key => $Pos)
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
      /* Draw the vertical edges (semi-visible) */
1263 1263
      foreach($Slices as $SliceID => $Plots)
1264 1264
       {
1265
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1265
+       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = true;
1266 1266
        $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1267 1267
 
1268 1268
        $StartAngle = $Plots["Angle"][0];
@@ -1280,15 +1280,15 @@  discard block
 block discarded – undo
1280 1280
      /* Draw the inner vertical slices */
1281 1281
      foreach($Slices as $SliceID => $Plots)
1282 1282
       {
1283
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1283
+       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = true;
1284 1284
        $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1285 1285
 
1286
-       $Outer = TRUE; $Inner = FALSE;
1286
+       $Outer = true; $Inner = false;
1287 1287
        $InnerPlotsA = ""; $InnerPlotsB = "";
1288 1288
        foreach($Plots["Angle"] as $ID => $Angle)
1289 1289
         {
1290 1290
          if ( $Angle == VOID )
1291
-          { $Outer = FALSE; $Inner = TRUE; }
1291
+          { $Outer = false; $Inner = true; }
1292 1292
          elseif( $Inner )
1293 1293
           {
1294 1294
            if (( $Angle < 90 || $Angle > 270 ) && isset($Plots["BottomPoly"][$ID*2]) )
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
      /* Draw the splice top and left poly */
1310 1310
      foreach($Slices as $SliceID => $Plots)
1311 1311
       {
1312
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1312
+       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = true;
1313 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 1315
        $StartAngle = $Plots["Angle"][0];
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
      /* Draw the vertical edges (visible) */
1351 1351
      foreach($Slices as $SliceID => $Plots)
1352 1352
       {
1353
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1353
+       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = true;
1354 1354
        $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1355 1355
 
1356 1356
        $StartAngle = $Plots["Angle"][0];
@@ -1366,15 +1366,15 @@  discard block
 block discarded – undo
1366 1366
      /* Draw the outer vertical slices */
1367 1367
      foreach($Slices as $SliceID => $Plots)
1368 1368
       {
1369
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1369
+       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = true;
1370 1370
        $Settings["R"] = $Settings["R"]+$Cf; $Settings["G"] = $Settings["G"]+$Cf; $Settings["B"] = $Settings["B"]+$Cf;
1371 1371
 
1372
-       $Outer = TRUE; $Inner = FALSE;
1372
+       $Outer = true; $Inner = false;
1373 1373
        $OuterPlotsA = ""; $OuterPlotsB = ""; $InnerPlotsA = ""; $InnerPlotsB = "";
1374 1374
        foreach($Plots["Angle"] as $ID => $Angle)
1375 1375
         {
1376 1376
          if ( $Angle == VOID )
1377
-          { $Outer = FALSE; $Inner = TRUE; }
1377
+          { $Outer = false; $Inner = true; }
1378 1378
          elseif( $Outer )
1379 1379
           {
1380 1380
            if ( ( $Angle > 90 && $Angle < 270 ) && isset($Plots["BottomPoly"][$ID*2]) )
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
      /* Draw the top pie splice */
1399 1399
      foreach($Slices as $SliceID => $Plots)
1400 1400
       {
1401
-       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = TRUE;
1401
+       $Settings = $SliceColors[$SliceID];  $Settings["NoBorder"] = true;
1402 1402
        $Settings["R"] = $Settings["R"]+$Cf*2; $Settings["G"] = $Settings["G"]+$Cf*2; $Settings["B"] = $Settings["B"]+$Cf*2;
1403 1403
  
1404 1404
        $this->pChartObject->drawPolygon($Plots["TopPoly"],$Settings);
@@ -1437,9 +1437,9 @@  discard block
 block discarded – undo
1437 1437
           $Label = "";
1438 1438
 
1439 1439
          if ( $LabelStacked )
1440
-          $this->writePieLabel($Xc,$Yc-$SliceHeight,$Label,$Angle,$Settings,TRUE,$X,$Y,$OuterRadius);
1440
+          $this->writePieLabel($Xc,$Yc-$SliceHeight,$Label,$Angle,$Settings,true,$X,$Y,$OuterRadius);
1441 1441
          else
1442
-          $this->writePieLabel($Xc,$Yc-$SliceHeight,$Label,$Angle,$Settings,FALSE);
1442
+          $this->writePieLabel($Xc,$Yc-$SliceHeight,$Label,$Angle,$Settings,false);
1443 1443
 
1444 1444
          $Offset = $EndAngle - $DataGapAngle; $ID--; $Slice++;
1445 1445
         }
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pStock.class.php 4 patches
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.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  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 18
  /* pStock class definition */
19 19
  class pStock
@@ -22,82 +22,82 @@  discard block
 block discarded – undo
22 22
    var $pDataObject;
23 23
 
24 24
    /* Class creator */
25
-   function pStock($pChartObject,$pDataObject)
25
+   function pStock($pChartObject, $pDataObject)
26 26
     {
27 27
      $this->pChartObject = $pChartObject;
28 28
      $this->pDataObject  = $pDataObject;
29 29
     }
30 30
 
31 31
    /* Draw a stock chart */
32
-   function drawStockChart($Format="")
32
+   function drawStockChart($Format = "")
33 33
     {
34 34
      $SerieOpen		= isset($Format["SerieOpen"]) ? $Format["SerieOpen"] : "Open";
35 35
      $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36 36
      $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
37 37
      $SerieMax		= isset($Format["SerieMax"]) ? $Format["SerieMax"] : "Max";
38
-     $SerieMedian	= isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : NULL;
39
-     $LineWidth		= isset($Format["LineWidth"]) ? $Format["LineWidth"] : 1;
38
+     $SerieMedian = isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : NULL;
39
+     $LineWidth = isset($Format["LineWidth"]) ? $Format["LineWidth"] : 1;
40 40
      $LineR		= isset($Format["LineR"]) ? $Format["LineR"] : 0;
41 41
      $LineG		= isset($Format["LineG"]) ? $Format["LineG"] : 0;
42 42
      $LineB		= isset($Format["LineB"]) ? $Format["LineB"] : 0;
43 43
      $LineAlpha		= isset($Format["LineAlpha"]) ? $Format["LineAlpha"] : 100;
44
-     $ExtremityWidth	= isset($Format["ExtremityWidth"]) ? $Format["ExtremityWidth"] : 1;
45
-     $ExtremityLength	= isset($Format["ExtremityLength"]) ? $Format["ExtremityLength"] : 3;
44
+     $ExtremityWidth = isset($Format["ExtremityWidth"]) ? $Format["ExtremityWidth"] : 1;
45
+     $ExtremityLength = isset($Format["ExtremityLength"]) ? $Format["ExtremityLength"] : 3;
46 46
      $ExtremityR	= isset($Format["ExtremityR"]) ? $Format["ExtremityR"] : 0;
47 47
      $ExtremityG	= isset($Format["ExtremityG"]) ? $Format["ExtremityG"] : 0;
48 48
      $ExtremityB	= isset($Format["ExtremityB"]) ? $Format["ExtremityB"] : 0;
49
-     $ExtremityAlpha	= isset($Format["ExtremityAlpha"]) ? $Format["ExtremityAlpha"] : 100;
50
-     $BoxWidth		= isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 8;
49
+     $ExtremityAlpha = isset($Format["ExtremityAlpha"]) ? $Format["ExtremityAlpha"] : 100;
50
+     $BoxWidth = isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 8;
51 51
      $BoxUpR		= isset($Format["BoxUpR"]) ? $Format["BoxUpR"] : 188;
52 52
      $BoxUpG		= isset($Format["BoxUpG"]) ? $Format["BoxUpG"] : 224;
53 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;
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 60
      $BoxDownR		= isset($Format["BoxDownR"]) ? $Format["BoxDownR"] : 224;
61 61
      $BoxDownG		= isset($Format["BoxDownG"]) ? $Format["BoxDownG"] : 100;
62 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;
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 69
      $ShadowOnBoxesOnly	= isset($Format["ShadowOnBoxesOnly"]) ? $Format["ShadowOnBoxesOnly"] : TRUE;
70 70
      $MedianR		= isset($Format["MedianR"]) ? $Format["MedianR"] : 255;
71 71
      $MedianG		= isset($Format["MedianG"]) ? $Format["MedianG"] : 0;
72 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";
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 76
 
77 77
 
78 78
      /* Data Processing */
79 79
      $Data    = $this->pDataObject->getData();
80 80
      $Palette = $this->pDataObject->getPalette();
81 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; }
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 84
 
85
-     if ( $LineWidth != 1 ) { $LineOffset = $LineWidth / 2; }
86
-     $BoxOffset = $BoxWidth / 2;
85
+     if ($LineWidth != 1) { $LineOffset = $LineWidth/2; }
86
+     $BoxOffset = $BoxWidth/2;
87 87
 
88 88
      $Data = $this->pChartObject->DataSet->getData();
89
-     list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
89
+     list($XMargin, $XDivs) = $this->pChartObject->scaleGetXSettings();
90 90
 
91
-     if ( !isset($Data["Series"][$SerieOpen]) || !isset($Data["Series"][$SerieClose]) || !isset($Data["Series"][$SerieMin]) || !isset($Data["Series"][$SerieMax]) )
91
+     if (!isset($Data["Series"][$SerieOpen]) || !isset($Data["Series"][$SerieClose]) || !isset($Data["Series"][$SerieMin]) || !isset($Data["Series"][$SerieMax]))
92 92
       return(STOCK_MISSING_SERIE);
93 93
 
94 94
      $Plots = "";
95
-     foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
95
+     foreach ($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
96 96
       {
97 97
        $Point = "";
98
-       if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) )
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]) )
98
+       if (isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]))
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]))
101 101
         $Point[] = $Data["Series"][$SerieMedian]["Data"][$Key];
102 102
 
103 103
        $Plots[] = $Point;
@@ -108,105 +108,105 @@  discard block
 block discarded – undo
108 108
      $Format	= $Data["Axis"][$AxisID]["Format"];
109 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 114
      $X = $this->pChartObject->GraphAreaX1 + $XMargin;
115 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)
123
+     foreach ($Plots as $Key =>$Points)
124 124
       {
125
-       $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
125
+       $PosArray = $this->pChartObject->scaleComputeY($Points, array("AxisID"=>$AxisID));
126 126
 
127 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); } 
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);
140
+         if ($LineWidth == 1)
141
+          $this->pChartObject->drawLine($X, $PosArray[2], $X, $PosArray[3], $LineSettings);
142 142
          else
143
-          $this->pChartObject->drawFilledRectangle($X-$LineOffset,$PosArray[2],$X+$LineOffset,$PosArray[3],$LineSettings);
143
+          $this->pChartObject->drawFilledRectangle($X - $LineOffset, $PosArray[2], $X + $LineOffset, $PosArray[3], $LineSettings);
144 144
 
145
-         if ( $ExtremityWidth == 1 )
145
+         if ($ExtremityWidth == 1)
146 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);
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); }
150
+           if ($RecordImageMap) { $this->pChartObject->addToImageMap("RECT", floor($X - $ExtremityLength).",".floor($PosArray[2]).",".floor($X + $ExtremityLength).",".floor($PosArray[3]), $ImageMapColor, $ImageMapTitle, $Values); }
151 151
           }
152 152
          else
153 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);
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); }
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 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);
162
+         if ($PosArray[0] > $PosArray[1])
163
+          $this->pChartObject->drawFilledRectangle($X - $BoxOffset, $PosArray[0], $X + $BoxOffset, $PosArray[1], $BoxUpSettings);
164 164
          else
165
-          $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxDownSettings);
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 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);
179
+         if ($LineWidth == 1)
180
+          $this->pChartObject->drawLine($PosArray[2], $Y, $PosArray[3], $Y, $LineSettings);
181 181
          else
182
-          $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$LineOffset,$PosArray[3],$Y+$LineOffset,$LineSettings);
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 )
186
+         if ($ExtremityWidth == 1)
187 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);
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); }
191
+           if ($RecordImageMap) { $this->pChartObject->addToImageMap("RECT", floor($PosArray[2]).",".floor($Y - $ExtremityLength).",".floor($PosArray[3]).",".floor($Y + $ExtremityLength), $ImageMapColor, $ImageMapTitle, $Values); }
192 192
           }
193 193
          else
194 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);
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); }
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 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);
203
+         if ($PosArray[0] < $PosArray[1])
204
+          $this->pChartObject->drawFilledRectangle($PosArray[0], $Y - $BoxOffset, $PosArray[1], $Y + $BoxOffset, $BoxUpSettings);
205 205
          else
206
-          $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxDownSettings);
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 211
          $Y = $Y + $XStep;
212 212
         }
Please login to merge, or discard this patch.
Braces   +11 added lines, -25 removed lines patch added patch discarded remove patch
@@ -16,21 +16,18 @@  discard block
 block discarded – undo
16 16
  define("STOCK_MISSING_SERIE"	, 180001);
17 17
 
18 18
  /* pStock class definition */
19
- class pStock
20
-  {
19
+ class pStock {
21 20
    var $pChartObject;
22 21
    var $pDataObject;
23 22
 
24 23
    /* Class creator */
25
-   function pStock($pChartObject,$pDataObject)
26
-    {
24
+   function pStock($pChartObject,$pDataObject) {
27 25
      $this->pChartObject = $pChartObject;
28 26
      $this->pDataObject  = $pDataObject;
29 27
     }
30 28
 
31 29
    /* Draw a stock chart */
32
-   function drawStockChart($Format="")
33
-    {
30
+   function drawStockChart($Format="") {
34 31
      $SerieOpen		= isset($Format["SerieOpen"]) ? $Format["SerieOpen"] : "Open";
35 32
      $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36 33
      $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
@@ -92,8 +89,7 @@  discard block
 block discarded – undo
92 89
       return(STOCK_MISSING_SERIE);
93 90
 
94 91
      $Plots = "";
95
-     foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
96
-      {
92
+     foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value) {
97 93
        $Point = "";
98 94
        if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) )
99 95
         $Point = array($Value,$Data["Series"][$SerieClose]["Data"][$Key],$Data["Series"][$SerieMin]["Data"][$Key],$Data["Series"][$SerieMax]["Data"][$Key]);
@@ -120,16 +116,14 @@  discard block
 block discarded – undo
120 116
      $BoxDownSettings	= array("R"=>$BoxDownR,"G"=>$BoxDownG,"B"=>$BoxDownB,"Alpha"=>$BoxDownAlpha,"BorderR"=>$BoxDownBorderR,"BorderG"=>$BoxDownBorderG,"BorderB"=>$BoxDownBorderB,"BorderAlpha"=>$BoxDownBorderAlpha);
121 117
      $MedianSettings	= array("R"=>$MedianR,"G"=>$MedianG,"B"=>$MedianB,"Alpha"=>$MedianAlpha);
122 118
 
123
-     foreach($Plots as $Key =>$Points)
124
-      {
119
+     foreach($Plots as $Key =>$Points) {
125 120
        $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
126 121
 
127 122
        $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 123
        if ( $SerieMedian != NULL ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129 124
        if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } 
130 125
 
131
-       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
132
-        {
126
+       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
133 127
          if ( $YZero > $this->pChartObject->GraphAreaY2-1 ) { $YZero = $this->pChartObject->GraphAreaY2-1; }
134 128
          if ( $YZero < $this->pChartObject->GraphAreaY1+1 ) { $YZero = $this->pChartObject->GraphAreaY1+1; }
135 129
 
@@ -142,15 +136,12 @@  discard block
 block discarded – undo
142 136
          else
143 137
           $this->pChartObject->drawFilledRectangle($X-$LineOffset,$PosArray[2],$X+$LineOffset,$PosArray[3],$LineSettings);
144 138
 
145
-         if ( $ExtremityWidth == 1 )
146
-          {
139
+         if ( $ExtremityWidth == 1 ) {
147 140
            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2],$ExtremitySettings);
148 141
            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3],$ExtremitySettings);
149 142
 
150 143
            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
-          {
144
+          } else {
154 145
            $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2]-$ExtremityWidth,$ExtremitySettings);
155 146
            $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3]+$ExtremityWidth,$ExtremitySettings);
156 147
 
@@ -168,9 +159,7 @@  discard block
 block discarded – undo
168 159
           $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[4],$X+$ExtremityLength,$PosArray[4],$MedianSettings);
169 160
 
170 161
          $X = $X + $XStep;
171
-        }
172
-       elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
173
-        {
162
+        } elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) {
174 163
          if ( $YZero > $this->pChartObject->GraphAreaX2-1 ) { $YZero = $this->pChartObject->GraphAreaX2-1; }
175 164
          if ( $YZero < $this->pChartObject->GraphAreaX1+1 ) { $YZero = $this->pChartObject->GraphAreaX1+1; }
176 165
 
@@ -183,15 +172,12 @@  discard block
 block discarded – undo
183 172
 
184 173
          if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
185 174
 
186
-         if ( $ExtremityWidth == 1 )
187
-          {
175
+         if ( $ExtremityWidth == 1 ) {
188 176
            $this->pChartObject->drawLine($PosArray[2],$Y-$ExtremityLength,$PosArray[2],$Y+$ExtremityLength,$ExtremitySettings);
189 177
            $this->pChartObject->drawLine($PosArray[3],$Y-$ExtremityLength,$PosArray[3],$Y+$ExtremityLength,$ExtremitySettings);
190 178
 
191 179
            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
-          {
180
+          } else {
195 181
            $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$ExtremityLength,$PosArray[2]-$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
196 182
            $this->pChartObject->drawFilledRectangle($PosArray[3],$Y-$ExtremityLength,$PosArray[3]+$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
197 183
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36 36
      $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
37 37
      $SerieMax		= isset($Format["SerieMax"]) ? $Format["SerieMax"] : "Max";
38
-     $SerieMedian	= isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : NULL;
38
+     $SerieMedian	= isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : null;
39 39
      $LineWidth		= isset($Format["LineWidth"]) ? $Format["LineWidth"] : 1;
40 40
      $LineR		= isset($Format["LineR"]) ? $Format["LineR"] : 0;
41 41
      $LineG		= isset($Format["LineG"]) ? $Format["LineG"] : 0;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      $BoxUpG		= isset($Format["BoxUpG"]) ? $Format["BoxUpG"] : 224;
53 53
      $BoxUpB		= isset($Format["BoxUpB"]) ? $Format["BoxUpB"] : 46;
54 54
      $BoxUpAlpha	= isset($Format["BoxUpAlpha"]) ? $Format["BoxUpAlpha"] : 100;
55
-     $BoxUpSurrounding	= isset($Format["BoxUpSurrounding"]) ? $Format["BoxUpSurrounding"] : NULL;
55
+     $BoxUpSurrounding	= isset($Format["BoxUpSurrounding"]) ? $Format["BoxUpSurrounding"] : null;
56 56
      $BoxUpBorderR	= isset($Format["BoxUpBorderR"]) ? $Format["BoxUpBorderR"] : $BoxUpR-20;
57 57
      $BoxUpBorderG	= isset($Format["BoxUpBorderG"]) ? $Format["BoxUpBorderG"] : $BoxUpG-20;
58 58
      $BoxUpBorderB	= isset($Format["BoxUpBorderB"]) ? $Format["BoxUpBorderB"] : $BoxUpB-20;
@@ -61,17 +61,17 @@  discard block
 block discarded – undo
61 61
      $BoxDownG		= isset($Format["BoxDownG"]) ? $Format["BoxDownG"] : 100;
62 62
      $BoxDownB		= isset($Format["BoxDownB"]) ? $Format["BoxDownB"] : 46;
63 63
      $BoxDownAlpha	= isset($Format["BoxDownAlpha"]) ? $Format["BoxDownAlpha"] : 100;
64
-     $BoxDownSurrounding= isset($Format["BoxDownSurrounding"]) ? $Format["BoxDownSurrounding"] : NULL;
64
+     $BoxDownSurrounding= isset($Format["BoxDownSurrounding"]) ? $Format["BoxDownSurrounding"] : null;
65 65
      $BoxDownBorderR	= isset($Format["BoxDownBorderR"]) ? $Format["BoxDownBorderR"] : $BoxDownR-20;
66 66
      $BoxDownBorderG	= isset($Format["BoxDownBorderG"]) ? $Format["BoxDownBorderG"] : $BoxDownG-20;
67 67
      $BoxDownBorderB	= isset($Format["BoxDownBorderB"]) ? $Format["BoxDownBorderB"] : $BoxDownB-20;
68 68
      $BoxDownBorderAlpha= isset($Format["BoxDownBorderAlpha"]) ? $Format["BoxDownBorderAlpha"] : 100;
69
-     $ShadowOnBoxesOnly	= isset($Format["ShadowOnBoxesOnly"]) ? $Format["ShadowOnBoxesOnly"] : TRUE;
69
+     $ShadowOnBoxesOnly	= isset($Format["ShadowOnBoxesOnly"]) ? $Format["ShadowOnBoxesOnly"] : true;
70 70
      $MedianR		= isset($Format["MedianR"]) ? $Format["MedianR"] : 255;
71 71
      $MedianG		= isset($Format["MedianG"]) ? $Format["MedianG"] : 0;
72 72
      $MedianB		= isset($Format["MedianB"]) ? $Format["MedianB"] : 0;
73 73
      $MedianAlpha	= isset($Format["MedianAlpha"]) ? $Format["MedianAlpha"] : 100;
74
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
74
+     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
75 75
      $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : "Stock Chart";
76 76
 
77 77
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
      $Data    = $this->pDataObject->getData();
80 80
      $Palette = $this->pDataObject->getPalette();
81 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; }
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 84
 
85 85
      if ( $LineWidth != 1 ) { $LineOffset = $LineWidth / 2; }
86 86
      $BoxOffset = $BoxWidth / 2;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
        $Point = "";
98 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 103
        $Plots[] = $Point;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
        $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
126 126
 
127 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>"; }
128
+       if ( $SerieMedian != null ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129 129
        if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } 
130 130
 
131 131
        if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 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 140
          if ( $LineWidth == 1 )
141 141
           $this->pChartObject->drawLine($X,$PosArray[2],$X,$PosArray[3],$LineSettings);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
          else
182 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 186
          if ( $ExtremityWidth == 1 )
187 187
           {
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pCache.class.php 4 patches
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.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -21,58 +21,58 @@  discard block
 block discarded – undo
21 21
    var $CacheDB;
22 22
 
23 23
    /* Class creator */
24
-   function pCache($Settings="")
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 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); }
35
+     if (!file_exists($this->CacheFolder."/".$this->CacheDB)) { touch($this->CacheFolder."/".$this->CacheDB); }
36 36
     }
37 37
 
38 38
    /* Flush the cache contents */
39 39
    function flush()
40 40
     {
41 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); }
42
+     if (file_exists($this->CacheFolder."/".$this->CacheDB)) { unlink($this->CacheFolder."/".$this->CacheDB); touch($this->CacheFolder."/".$this->CacheDB); }
43 43
     }
44 44
 
45 45
    /* Return the MD5 of the data array to clearly identify the chart */
46
-   function getHash($Data,$Marker="")
46
+   function getHash($Data, $Marker = "")
47 47
     { return(md5($Marker.serialize($Data->Data))); }
48 48
 
49 49
    /* Write the generated picture to the cache */
50
-   function writeToCache($ID,$pChartObject)
50
+   function writeToCache($ID, $pChartObject)
51 51
     {
52 52
      /* Compute the paths */
53
-     $TemporaryFile = $this->CacheFolder."/tmp_".rand(0,1000).".png";
53
+     $TemporaryFile = $this->CacheFolder."/tmp_".rand(0, 1000).".png";
54 54
      $Database      = $this->CacheFolder."/".$this->CacheDB;
55 55
      $Index         = $this->CacheFolder."/".$this->CacheIndex;
56 56
 
57 57
      /* Flush the picture to a temporary file */
58
-     imagepng($pChartObject->Picture ,$TemporaryFile);
58
+     imagepng($pChartObject->Picture, $TemporaryFile);
59 59
 
60 60
      /* Retrieve the files size */
61 61
      $PictureSize = filesize($TemporaryFile);
62 62
      $DBSize      = filesize($Database);
63 63
 
64 64
      /* Save the index */
65
-     $Handle = fopen($Index,"a");
65
+     $Handle = fopen($Index, "a");
66 66
      fwrite($Handle, $ID.",".$DBSize.",".$PictureSize.",".time().",0      \r\n");
67 67
      fclose($Handle);
68 68
 
69 69
      /* Get the picture raw contents */
70
-     $Handle = fopen($TemporaryFile,"r");
71
-     $Raw    = fread($Handle,$PictureSize);
70
+     $Handle = fopen($TemporaryFile, "r");
71
+     $Raw    = fread($Handle, $PictureSize);
72 72
      fclose($Handle);
73 73
 
74 74
      /* Save the picture in the solid database file */
75
-     $Handle = fopen($Database,"a");
75
+     $Handle = fopen($Database, "a");
76 76
      fwrite($Handle, $Raw);
77 77
      fclose($Handle);
78 78
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     {
94 94
      $ID     = isset($Settings["Name"]) ? $Settings["Name"] : NULL;
95 95
      $Expiry = isset($Settings["Expiry"]) ? $Settings["Expiry"] : -(24*60*60);
96
-     $TS     = time()-$Expiry;
96
+     $TS     = time() - $Expiry;
97 97
 
98 98
      /* Compute the paths */
99 99
      $Database     = $this->CacheFolder."/".$this->CacheDB;
@@ -102,18 +102,18 @@  discard block
 block discarded – undo
102 102
      $IndexTemp    = $this->CacheFolder."/".$this->CacheIndex.".tmp";
103 103
 
104 104
      /* Single file removal */
105
-     if ( $ID != NULL )
105
+     if ($ID != NULL)
106 106
       {
107 107
        /* Retrieve object informations */
108
-       $Object = $this->isInCache($ID,TRUE);
108
+       $Object = $this->isInCache($ID, TRUE);
109 109
 
110 110
        /* If it's not in the cache DB, go away */
111
-       if ( !$Object ) { return(0); }
111
+       if (!$Object) { return(0); }
112 112
       }
113 113
 
114 114
      /* Create the temporary files */
115 115
      if (!file_exists($DatabaseTemp)) { touch($DatabaseTemp); }
116
-     if (!file_exists($IndexTemp))    { touch($IndexTemp); }
116
+     if (!file_exists($IndexTemp)) { touch($IndexTemp); }
117 117
 
118 118
      /* Open the file handles */
119 119
      $IndexHandle     = @fopen($Index, "r");
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
      while (!feof($IndexHandle))
126 126
       {
127 127
        $Entry    = fgets($IndexHandle, 4096);
128
-       $Entry    = str_replace("\r","",$Entry);
129
-       $Entry    = str_replace("\n","",$Entry);
130
-       $Settings = preg_split("/,/",$Entry);
128
+       $Entry    = str_replace("\r", "", $Entry);
129
+       $Entry    = str_replace("\n", "", $Entry);
130
+       $Settings = preg_split("/,/", $Entry);
131 131
 
132
-       if ( $Entry != "" )
132
+       if ($Entry != "")
133 133
         {
134 134
          $PicID       = $Settings[0];
135 135
          $DBPos       = $Settings[1];
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
          $GeneratedTS = $Settings[3];
138 138
          $Hits        = $Settings[4];
139 139
 
140
-         if ( $Settings[0] != $ID && $GeneratedTS > $TS)
140
+         if ($Settings[0] != $ID && $GeneratedTS > $TS)
141 141
           {
142
-           $CurrentPos  = ftell($DBTempHandle);
142
+           $CurrentPos = ftell($DBTempHandle);
143 143
            fwrite($IndexTempHandle, $PicID.",".$CurrentPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
144 144
 
145
-           fseek($DBHandle,$DBPos);
146
-           $Picture = fread($DBHandle,$PicSize);
147
-           fwrite($DBTempHandle,$Picture);
145
+           fseek($DBHandle, $DBPos);
146
+           $Picture = fread($DBHandle, $PicSize);
147
+           fwrite($DBTempHandle, $Picture);
148 148
           }
149 149
         }
150 150
       }
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
      unlink($Index);
161 161
 
162 162
      /* Swap the temp & prod DB */
163
-     rename($DatabaseTemp,$Database);
164
-     rename($IndexTemp,$Index);
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 169
      /* Compute the paths */
170 170
      $Index = $this->CacheFolder."/".$this->CacheIndex;
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
       {
176 176
        $IndexPos = ftell($Handle);
177 177
        $Entry = fgets($Handle, 4096);
178
-       if ( $Entry != "" )
178
+       if ($Entry != "")
179 179
         {
180
-         $Settings = preg_split("/,/",$Entry);
180
+         $Settings = preg_split("/,/", $Entry);
181 181
          $PicID    = $Settings[0];
182
-         if ( $PicID == $ID )
182
+         if ($PicID == $ID)
183 183
           {
184 184
            fclose($Handle);
185 185
 
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
            $GeneratedTS = $Settings[3];
189 189
            $Hits        = intval($Settings[4]);
190 190
 
191
-           if ( $UpdateHitsCount )
191
+           if ($UpdateHitsCount)
192 192
             {
193 193
              $Hits++;
194
-             if ( strlen($Hits) < 7 ) { $Hits = $Hits.str_repeat(" ",7-strlen($Hits)); }
194
+             if (strlen($Hits) < 7) { $Hits = $Hits.str_repeat(" ", 7 - strlen($Hits)); }
195 195
 
196 196
              $Handle = @fopen($Index, "r+");
197
-             fseek($Handle,$IndexPos);
197
+             fseek($Handle, $IndexPos);
198 198
              fwrite($Handle, $PicID.",".$DBPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
199 199
              fclose($Handle);
200 200
             }
201 201
 
202 202
            if ($Verbose)
203
-            { return(array("DBPos"=>$DBPos,"PicSize"=>$PicSize,"GeneratedTS"=>$GeneratedTS,"Hits"=>$Hits)); }
203
+            { return(array("DBPos"=>$DBPos, "PicSize"=>$PicSize, "GeneratedTS"=>$GeneratedTS, "Hits"=>$Hits)); }
204 204
            else
205 205
             { return(TRUE); }
206 206
           }
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
     }
214 214
 
215 215
    /* Automatic output method based on the calling interface */
216
-   function autoOutput($ID,$Destination="output.png")
216
+   function autoOutput($ID, $Destination = "output.png")
217 217
     {
218 218
      if (php_sapi_name() == "cli")
219
-      $this->saveFromCache($ID,$Destination);
219
+      $this->saveFromCache($ID, $Destination);
220 220
      else
221 221
       $this->strokeFromCache($ID);
222 222
     }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      $Picture = $this->getFromCache($ID);
228 228
 
229 229
      /* Do we have a hit? */
230
-     if ( $Picture == NULL ) { return(FALSE); }
230
+     if ($Picture == NULL) { return(FALSE); }
231 231
 
232 232
      header('Content-type: image/png');
233 233
      echo $Picture;
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
      return(TRUE);
236 236
     }
237 237
 
238
-   function saveFromCache($ID,$Destination)
238
+   function saveFromCache($ID, $Destination)
239 239
     {
240 240
      /* Get the raw picture from the cache */
241 241
      $Picture = $this->getFromCache($ID);
242 242
 
243 243
      /* Do we have a hit? */
244
-     if ( $Picture == NULL ) { return(FALSE); }
244
+     if ($Picture == NULL) { return(FALSE); }
245 245
 
246 246
      /* Flush the picture to a file */
247
-     $Handle = fopen($Destination,"w");
248
-     fwrite($Handle,$Picture);
247
+     $Handle = fopen($Destination, "w");
248
+     fwrite($Handle, $Picture);
249 249
      fclose($Handle);
250 250
 
251 251
      /* All went fine */
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      $Database = $this->CacheFolder."/".$this->CacheDB;
259 259
 
260 260
      /* Lookup for the picture in the cache */
261
-     $CacheInfo = $this->isInCache($ID,TRUE,TRUE);
261
+     $CacheInfo = $this->isInCache($ID, TRUE, TRUE);
262 262
 
263 263
      /* Not in the cache */
264 264
      if (!$CacheInfo) { return(NULL); }
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 
270 270
      /* Extract the picture from the solid cache file */
271 271
      $Handle = @fopen($Database, "r");
272
-     fseek($Handle,$DBPos);
273
-     $Picture = fread($Handle,$PicSize);
272
+     fseek($Handle, $DBPos);
273
+     $Picture = fread($Handle, $PicSize);
274 274
      fclose($Handle);
275 275
 
276 276
      /* Return back the raw picture data */
Please login to merge, or discard this patch.
Braces   +19 added lines, -38 removed lines patch added patch discarded remove patch
@@ -14,15 +14,13 @@  discard block
 block discarded – undo
14 14
  */
15 15
 
16 16
  /* pData class definition */
17
- class pCache
18
-  {
17
+ class pCache {
19 18
    var $CacheFolder;
20 19
    var $CacheIndex;
21 20
    var $CacheDB;
22 21
 
23 22
    /* Class creator */
24
-   function pCache($Settings="")
25
-    {
23
+   function pCache($Settings="") {
26 24
      $CacheFolder	= isset($Settings["CacheFolder"]) ? $Settings["CacheFolder"] : "cache";
27 25
      $CacheIndex	= isset($Settings["CacheIndex"]) ? $Settings["CacheIndex"] : "index.db";
28 26
      $CacheDB		= isset($Settings["CacheDB"]) ? $Settings["CacheDB"] : "cache.db";
@@ -36,8 +34,7 @@  discard block
 block discarded – undo
36 34
     }
37 35
 
38 36
    /* Flush the cache contents */
39
-   function flush()
40
-    {
37
+   function flush() {
41 38
      if (file_exists($this->CacheFolder."/".$this->CacheIndex)) { unlink($this->CacheFolder."/".$this->CacheIndex); touch($this->CacheFolder."/".$this->CacheIndex); }
42 39
      if (file_exists($this->CacheFolder."/".$this->CacheDB))    { unlink($this->CacheFolder."/".$this->CacheDB); touch($this->CacheFolder."/".$this->CacheDB); }
43 40
     }
@@ -47,8 +44,7 @@  discard block
 block discarded – undo
47 44
     { return(md5($Marker.serialize($Data->Data))); }
48 45
 
49 46
    /* Write the generated picture to the cache */
50
-   function writeToCache($ID,$pChartObject)
51
-    {
47
+   function writeToCache($ID,$pChartObject) {
52 48
      /* Compute the paths */
53 49
      $TemporaryFile = $this->CacheFolder."/tmp_".rand(0,1000).".png";
54 50
      $Database      = $this->CacheFolder."/".$this->CacheDB;
@@ -89,8 +85,7 @@  discard block
 block discarded – undo
89 85
     { $this->dbRemoval(array("Name"=>$ID)); }
90 86
 
91 87
    /* Remove with specified criterias */
92
-   function dbRemoval($Settings)
93
-    {
88
+   function dbRemoval($Settings) {
94 89
      $ID     = isset($Settings["Name"]) ? $Settings["Name"] : NULL;
95 90
      $Expiry = isset($Settings["Expiry"]) ? $Settings["Expiry"] : -(24*60*60);
96 91
      $TS     = time()-$Expiry;
@@ -102,8 +97,7 @@  discard block
 block discarded – undo
102 97
      $IndexTemp    = $this->CacheFolder."/".$this->CacheIndex.".tmp";
103 98
 
104 99
      /* Single file removal */
105
-     if ( $ID != NULL )
106
-      {
100
+     if ( $ID != NULL ) {
107 101
        /* Retrieve object informations */
108 102
        $Object = $this->isInCache($ID,TRUE);
109 103
 
@@ -122,23 +116,20 @@  discard block
 block discarded – undo
122 116
      $DBTempHandle    = @fopen($DatabaseTemp, "w");
123 117
 
124 118
      /* Remove the selected ID from the database */
125
-     while (!feof($IndexHandle))
126
-      {
119
+     while (!feof($IndexHandle)) {
127 120
        $Entry    = fgets($IndexHandle, 4096);
128 121
        $Entry    = str_replace("\r","",$Entry);
129 122
        $Entry    = str_replace("\n","",$Entry);
130 123
        $Settings = preg_split("/,/",$Entry);
131 124
 
132
-       if ( $Entry != "" )
133
-        {
125
+       if ( $Entry != "" ) {
134 126
          $PicID       = $Settings[0];
135 127
          $DBPos       = $Settings[1];
136 128
          $PicSize     = $Settings[2];
137 129
          $GeneratedTS = $Settings[3];
138 130
          $Hits        = $Settings[4];
139 131
 
140
-         if ( $Settings[0] != $ID && $GeneratedTS > $TS)
141
-          {
132
+         if ( $Settings[0] != $ID && $GeneratedTS > $TS) {
142 133
            $CurrentPos  = ftell($DBTempHandle);
143 134
            fwrite($IndexTempHandle, $PicID.",".$CurrentPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
144 135
 
@@ -164,23 +155,19 @@  discard block
 block discarded – undo
164 155
      rename($IndexTemp,$Index);
165 156
     }
166 157
 
167
-   function isInCache($ID,$Verbose=FALSE,$UpdateHitsCount=FALSE)
168
-    {
158
+   function isInCache($ID,$Verbose=FALSE,$UpdateHitsCount=FALSE) {
169 159
      /* Compute the paths */
170 160
      $Index = $this->CacheFolder."/".$this->CacheIndex;
171 161
 
172 162
      /* Search the picture in the index file */
173 163
      $Handle = @fopen($Index, "r");
174
-     while (!feof($Handle))
175
-      {
164
+     while (!feof($Handle)) {
176 165
        $IndexPos = ftell($Handle);
177 166
        $Entry = fgets($Handle, 4096);
178
-       if ( $Entry != "" )
179
-        {
167
+       if ( $Entry != "" ) {
180 168
          $Settings = preg_split("/,/",$Entry);
181 169
          $PicID    = $Settings[0];
182
-         if ( $PicID == $ID )
183
-          {
170
+         if ( $PicID == $ID ) {
184 171
            fclose($Handle);
185 172
 
186 173
            $DBPos       = $Settings[1];
@@ -188,8 +175,7 @@  discard block
 block discarded – undo
188 175
            $GeneratedTS = $Settings[3];
189 176
            $Hits        = intval($Settings[4]);
190 177
 
191
-           if ( $UpdateHitsCount )
192
-            {
178
+           if ( $UpdateHitsCount ) {
193 179
              $Hits++;
194 180
              if ( strlen($Hits) < 7 ) { $Hits = $Hits.str_repeat(" ",7-strlen($Hits)); }
195 181
 
@@ -200,8 +186,7 @@  discard block
 block discarded – undo
200 186
             }
201 187
 
202 188
            if ($Verbose)
203
-            { return(array("DBPos"=>$DBPos,"PicSize"=>$PicSize,"GeneratedTS"=>$GeneratedTS,"Hits"=>$Hits)); }
204
-           else
189
+            { return(array("DBPos"=>$DBPos,"PicSize"=>$PicSize,"GeneratedTS"=>$GeneratedTS,"Hits"=>$Hits)); } else
205 190
             { return(TRUE); }
206 191
           }
207 192
         }
@@ -213,16 +198,14 @@  discard block
 block discarded – undo
213 198
     }
214 199
 
215 200
    /* Automatic output method based on the calling interface */
216
-   function autoOutput($ID,$Destination="output.png")
217
-    {
201
+   function autoOutput($ID,$Destination="output.png") {
218 202
      if (php_sapi_name() == "cli")
219 203
       $this->saveFromCache($ID,$Destination);
220 204
      else
221 205
       $this->strokeFromCache($ID);
222 206
     }
223 207
 
224
-   function strokeFromCache($ID)
225
-    {
208
+   function strokeFromCache($ID) {
226 209
      /* Get the raw picture from the cache */
227 210
      $Picture = $this->getFromCache($ID);
228 211
 
@@ -235,8 +218,7 @@  discard block
 block discarded – undo
235 218
      return(TRUE);
236 219
     }
237 220
 
238
-   function saveFromCache($ID,$Destination)
239
-    {
221
+   function saveFromCache($ID,$Destination) {
240 222
      /* Get the raw picture from the cache */
241 223
      $Picture = $this->getFromCache($ID);
242 224
 
@@ -252,8 +234,7 @@  discard block
 block discarded – undo
252 234
      return(TRUE);
253 235
     }
254 236
 
255
-   function getFromCache($ID)
256
-    {
237
+   function getFromCache($ID) {
257 238
      /* Compute the path */
258 239
      $Database = $this->CacheFolder."/".$this->CacheDB;
259 240
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
    /* Remove with specified criterias */
92 92
    function dbRemoval($Settings)
93 93
     {
94
-     $ID     = isset($Settings["Name"]) ? $Settings["Name"] : NULL;
94
+     $ID     = isset($Settings["Name"]) ? $Settings["Name"] : null;
95 95
      $Expiry = isset($Settings["Expiry"]) ? $Settings["Expiry"] : -(24*60*60);
96 96
      $TS     = time()-$Expiry;
97 97
 
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
      $IndexTemp    = $this->CacheFolder."/".$this->CacheIndex.".tmp";
103 103
 
104 104
      /* Single file removal */
105
-     if ( $ID != NULL )
105
+     if ( $ID != null )
106 106
       {
107 107
        /* Retrieve object informations */
108
-       $Object = $this->isInCache($ID,TRUE);
108
+       $Object = $this->isInCache($ID,true);
109 109
 
110 110
        /* If it's not in the cache DB, go away */
111 111
        if ( !$Object ) { return(0); }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 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 169
      /* Compute the paths */
170 170
      $Index = $this->CacheFolder."/".$this->CacheIndex;
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
            if ($Verbose)
203 203
             { return(array("DBPos"=>$DBPos,"PicSize"=>$PicSize,"GeneratedTS"=>$GeneratedTS,"Hits"=>$Hits)); }
204 204
            else
205
-            { return(TRUE); }
205
+            { return(true); }
206 206
           }
207 207
         }
208 208
       }
209 209
      fclose($Handle);
210 210
 
211 211
      /* Picture isn't in the cache */
212
-     return(FALSE);
212
+     return(false);
213 213
     }
214 214
 
215 215
    /* Automatic output method based on the calling interface */
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
      $Picture = $this->getFromCache($ID);
228 228
 
229 229
      /* Do we have a hit? */
230
-     if ( $Picture == NULL ) { return(FALSE); }
230
+     if ( $Picture == null ) { return(false); }
231 231
 
232 232
      header('Content-type: image/png');
233 233
      echo $Picture;
234 234
 
235
-     return(TRUE);
235
+     return(true);
236 236
     }
237 237
 
238 238
    function saveFromCache($ID,$Destination)
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      $Picture = $this->getFromCache($ID);
242 242
 
243 243
      /* Do we have a hit? */
244
-     if ( $Picture == NULL ) { return(FALSE); }
244
+     if ( $Picture == null ) { return(false); }
245 245
 
246 246
      /* Flush the picture to a file */
247 247
      $Handle = fopen($Destination,"w");
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      fclose($Handle);
250 250
 
251 251
      /* All went fine */
252
-     return(TRUE);
252
+     return(true);
253 253
     }
254 254
 
255 255
    function getFromCache($ID)
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
      $Database = $this->CacheFolder."/".$this->CacheDB;
259 259
 
260 260
      /* Lookup for the picture in the cache */
261
-     $CacheInfo = $this->isInCache($ID,TRUE,TRUE);
261
+     $CacheInfo = $this->isInCache($ID,true,true);
262 262
 
263 263
      /* Not in the cache */
264
-     if (!$CacheInfo) { return(NULL); }
264
+     if (!$CacheInfo) { return(null); }
265 265
 
266 266
      /* Get the database extended information */     
267 267
      $DBPos   = $CacheInfo["DBPos"];
Please login to merge, or discard this patch.