Completed
Pull Request — master (#2571)
by Christian
11:55
created
default/boinc/modules/boincstats/includes/pchart/class/pDraw.class.php 1 patch
Braces   +636 added lines, -1325 removed lines patch added patch discarded remove patch
@@ -100,11 +100,9 @@  discard block
 block discarded – undo
100 100
  define("AUTO"		, 690000);
101 101
  define("OUT_OF_SIGHT"	, -10000000000000);
102 102
 
103
- class pDraw
104
-  {
103
+ class pDraw {
105 104
    /* Returns the number of drawable series */
106
-   function countDrawableSeries()
107
-    {
105
+   function countDrawableSeries() {
108 106
      $Results = 0;
109 107
      $Data = $this->DataSet->getData();
110 108
 
@@ -115,8 +113,7 @@  discard block
 block discarded – undo
115 113
     }
116 114
 
117 115
    /* Fix box coordinates */
118
-   function fixBoxCoordinates($Xa,$Ya,$Xb,$Yb)
119
-    {
116
+   function fixBoxCoordinates($Xa,$Ya,$Xb,$Yb) {
120 117
      $X1 = min($Xa,$Xb); $Y1 = min($Ya,$Yb);
121 118
      $X2 = max($Xa,$Xb); $Y2 = max($Ya,$Yb);
122 119
 
@@ -124,8 +121,7 @@  discard block
 block discarded – undo
124 121
     }
125 122
 
126 123
    /* Draw a polygon */
127
-   function drawPolygon($Points,$Format="")
128
-    {
124
+   function drawPolygon($Points,$Format="") {
129 125
      $R			= isset($Format["R"]) ? $Format["R"] : 0;
130 126
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
131 127
      $B			= isset($Format["B"]) ? $Format["B"] : 0;
@@ -149,10 +145,8 @@  discard block
 block discarded – undo
149 145
      if ( $SkipY != OUT_OF_SIGHT ) { $SkipY = floor($SkipY); }
150 146
 
151 147
      $RestoreShadow = $this->Shadow;
152
-     if ( !$NoFill )
153
-      {
154
-       if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
155
-        {
148
+     if ( !$NoFill ) {
149
+       if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) {
156 150
          $this->Shadow = FALSE;
157 151
          for($i=0;$i<=count($Points)-1;$i=$i+2)
158 152
           { $Shadow[] = $Points[$i] + $this->ShadowX; $Shadow[] = $Points[$i+1] + $this->ShadowY; }
@@ -165,8 +159,7 @@  discard block
 block discarded – undo
165 159
         { ImageFilledPolygon($this->Picture,$Points,count($Points)/2,$FillColor); }
166 160
       }
167 161
 
168
-     if ( !$NoBorder )
169
-      {
162
+     if ( !$NoBorder ) {
170 163
        $Points = $Backup;
171 164
 
172 165
        if ( $NoFill )
@@ -174,15 +167,11 @@  discard block
 block discarded – undo
174 167
        else
175 168
         $BorderSettings = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha);
176 169
 
177
-       for($i=0;$i<=count($Points)-1;$i=$i+2)
178
-        {
179
-         if ( isset($Points[$i+2]) )
180
-          {
170
+       for($i=0;$i<=count($Points)-1;$i=$i+2) {
171
+         if ( isset($Points[$i+2]) ) {
181 172
            if ( !($Points[$i] == $Points[$i+2] && $Points[$i] == $SkipX ) && !($Points[$i+1] == $Points[$i+3] && $Points[$i+1] == $SkipY ) )
182 173
             $this->drawLine($Points[$i],$Points[$i+1],$Points[$i+2],$Points[$i+3],$BorderSettings);
183
-          }
184
-         else
185
-          {
174
+          } else {
186 175
            if ( !($Points[$i] == $Points[0] && $Points[$i] == $SkipX ) && !($Points[$i+1] == $Points[1] && $Points[$i+1] == $SkipY ) )
187 176
             $this->drawLine($Points[$i],$Points[$i+1],$Points[0],$Points[1],$BorderSettings);
188 177
           }
@@ -193,8 +182,7 @@  discard block
 block discarded – undo
193 182
     }
194 183
 
195 184
    /* Apply AALias correction to the rounded box boundaries */
196
-   function offsetCorrection($Value,$Mode)
197
-    {
185
+   function offsetCorrection($Value,$Mode) {
198 186
      $Value = round($Value,1);
199 187
 
200 188
      if ( $Value == 0 && $Mode == 1 ) { return(.9); }
@@ -214,8 +202,7 @@  discard block
 block discarded – undo
214 202
     }
215 203
 
216 204
    /* Draw a rectangle with rounded corners */
217
-   function drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$Format="")
218
-    {
205
+   function drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$Format="") {
219 206
      $R	    = isset($Format["R"]) ? $Format["R"] : 0;
220 207
      $G	    = isset($Format["G"]) ? $Format["G"] : 0;
221 208
      $B	    = isset($Format["B"]) ? $Format["B"] : 0;
@@ -230,15 +217,12 @@  discard block
 block discarded – undo
230 217
 
231 218
      if ( $Radius <= 0 ) { $this->drawRectangle($X1,$Y1,$X2,$Y2,$Color); return(0); }
232 219
 
233
-     if ( $this->Antialias )
234
-      {
220
+     if ( $this->Antialias ) {
235 221
        $this->drawLine($X1+$Radius,$Y1,$X2-$Radius,$Y1,$Color);
236 222
        $this->drawLine($X2,$Y1+$Radius,$X2,$Y2-$Radius,$Color);
237 223
        $this->drawLine($X2-$Radius,$Y2,$X1+$Radius,$Y2,$Color);
238 224
        $this->drawLine($X1,$Y1+$Radius,$X1,$Y2-$Radius,$Color);
239
-      }
240
-     else
241
-      {
225
+      } else {
242 226
        $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
243 227
        imageline($this->Picture,$X1+$Radius,$Y1,$X2-$Radius,$Y1,$Color);
244 228
        imageline($this->Picture,$X2,$Y1+$Radius,$X2,$Y2-$Radius,$Color);
@@ -247,8 +231,7 @@  discard block
 block discarded – undo
247 231
       }
248 232
 
249 233
      $Step = 360 / (2 * PI * $Radius);
250
-     for($i=0;$i<=90;$i=$i+$Step)
251
-      {
234
+     for($i=0;$i<=90;$i=$i+$Step) {
252 235
        $X = cos(($i+180)*PI/180) * $Radius + $X1 + $Radius;
253 236
        $Y = sin(($i+180)*PI/180) * $Radius + $Y1 + $Radius;
254 237
        $this->drawAntialiasPixel($X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
@@ -268,8 +251,7 @@  discard block
 block discarded – undo
268 251
     }
269 252
 
270 253
    /* Draw a rectangle with rounded corners */
271
-   function drawRoundedFilledRectangle($X1,$Y1,$X2,$Y2,$Radius,$Format="")
272
-    {
254
+   function drawRoundedFilledRectangle($X1,$Y1,$X2,$Y2,$Radius,$Format="") {
273 255
      $R			= isset($Format["R"]) ? $Format["R"] : 0;
274 256
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
275 257
      $B			= isset($Format["B"]) ? $Format["B"] : 0;
@@ -291,8 +273,7 @@  discard block
 block discarded – undo
291 273
      if ( $Y2 - $Y1 < $Radius*2 ) { $Radius = floor((($Y2-$Y1))/4); }
292 274
 
293 275
      $RestoreShadow = $this->Shadow;
294
-     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
295
-      {
276
+     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) {
296 277
        $this->Shadow = FALSE;
297 278
        $this->drawRoundedFilledRectangle($X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,$Radius,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa));
298 279
       }
@@ -306,8 +287,7 @@  discard block
 block discarded – undo
306 287
 
307 288
      $Step = 360 / (2 * PI * $Radius);
308 289
      $Positions = ""; $Radius--; $MinY = ""; $MaxY = "";
309
-     for($i=0;$i<=90;$i=$i+$Step)
310
-      {
290
+     for($i=0;$i<=90;$i=$i+$Step) {
311 291
        $Xp1 = cos(($i+180)*PI/180) * $Radius + $X1 + $Radius;
312 292
        $Xp2 = cos(((90-$i)+270)*PI/180) * $Radius + $X2 - $Radius;
313 293
        $Yp  = floor(sin(($i+180)*PI/180) * $Radius + $YTop);
@@ -318,8 +298,7 @@  discard block
 block discarded – undo
318 298
        $Xp1++;
319 299
 
320 300
        if ( !isset($Positions[$Yp]) )
321
-        { $Positions[$Yp]["X1"] = $Xp1; $Positions[$Yp]["X2"] = $Xp2; }
322
-       else
301
+        { $Positions[$Yp]["X1"] = $Xp1; $Positions[$Yp]["X2"] = $Xp2; } else
323 302
         { $Positions[$Yp]["X1"] = ($Positions[$Yp]["X1"]+$Xp1)/2; $Positions[$Yp]["X2"] = ($Positions[$Yp]["X2"]+$Xp2)/2; }
324 303
 
325 304
        $Xp1 = cos(($i+90)*PI/180) * $Radius + $X1 + $Radius;
@@ -332,14 +311,12 @@  discard block
 block discarded – undo
332 311
        $Xp1++;
333 312
 
334 313
        if ( !isset($Positions[$Yp]) )
335
-        { $Positions[$Yp]["X1"] = $Xp1; $Positions[$Yp]["X2"] = $Xp2; }
336
-       else
314
+        { $Positions[$Yp]["X1"] = $Xp1; $Positions[$Yp]["X2"] = $Xp2; } else
337 315
         { $Positions[$Yp]["X1"] = ($Positions[$Yp]["X1"]+$Xp1)/2; $Positions[$Yp]["X2"] = ($Positions[$Yp]["X2"]+$Xp2)/2; }
338 316
       }
339 317
 
340 318
      $ManualColor  = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
341
-     foreach($Positions as $Yp => $Bounds)
342
-      {
319
+     foreach($Positions as $Yp => $Bounds) {
343 320
        $X1 = $Bounds["X1"]; $X1Dec = $this->getFirstDecimal($X1); if ( $X1Dec != 0 ) { $X1 = floor($X1)+1; }
344 321
        $X2 = $Bounds["X2"]; $X2Dec = $this->getFirstDecimal($X2); if ( $X2Dec != 0 ) { $X2 = floor($X2)-1; }
345 322
        imageline($this->Picture,$X1,$Yp,$X2,$Yp,$ManualColor);
@@ -353,8 +330,7 @@  discard block
 block discarded – undo
353 330
     }
354 331
 
355 332
    /* Draw a rectangle with rounded corners */
356
-   function drawRoundedFilledRectangle_deprecated($X1,$Y1,$X2,$Y2,$Radius,$Format="")
357
-    {
333
+   function drawRoundedFilledRectangle_deprecated($X1,$Y1,$X2,$Y2,$Radius,$Format="") {
358 334
      $R			= isset($Format["R"]) ? $Format["R"] : 0;
359 335
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
360 336
      $B			= isset($Format["B"]) ? $Format["B"] : 0;
@@ -373,8 +349,7 @@  discard block
 block discarded – undo
373 349
      if ( $Y2 - $Y1 < $Radius ) { $Radius = floor((($Y2-$Y1)+2)/2); }
374 350
 
375 351
      $RestoreShadow = $this->Shadow;
376
-     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
377
-      {
352
+     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) {
378 353
        $this->Shadow = FALSE;
379 354
        $this->drawRoundedFilledRectangle($X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,$Radius,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa));
380 355
       }
@@ -397,8 +372,7 @@  discard block
 block discarded – undo
397 372
      if ( $Alpha < 100 )  { $Drawn[$YTop] = FALSE; }
398 373
      if ( $Alpha < 100 )  { $Drawn[$YBottom] = TRUE; }
399 374
      
400
-     for($i=0;$i<=90;$i=$i+$Step)
401
-      {
375
+     for($i=0;$i<=90;$i=$i+$Step) {
402 376
        $Xp1 = cos(($i+180)*PI/180) * $Radius + $X1 + $Radius;
403 377
        $Xp2 = cos(((90-$i)+270)*PI/180) * $Radius + $X2 - $Radius;
404 378
        $Yp  = sin(($i+180)*PI/180) * $Radius + $YTop;
@@ -432,8 +406,7 @@  discard block
 block discarded – undo
432 406
     }
433 407
 
434 408
    /* Draw a rectangle */
435
-   function drawRectangle($X1,$Y1,$X2,$Y2,$Format="")
436
-    {
409
+   function drawRectangle($X1,$Y1,$X2,$Y2,$Format="") {
437 410
      $R		= isset($Format["R"]) ? $Format["R"] : 0;
438 411
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
439 412
      $B		= isset($Format["B"]) ? $Format["B"] : 0;
@@ -444,33 +417,26 @@  discard block
 block discarded – undo
444 417
      if ($X1 > $X2) { list($X1, $X2) = array($X2, $X1); }
445 418
      if ($Y1 > $Y2) { list($Y1, $Y2) = array($Y2, $Y1); }
446 419
 
447
-     if ( $this->Antialias )
448
-      {
449
-       if ( $NoAngle )
450
-        {
420
+     if ( $this->Antialias ) {
421
+       if ( $NoAngle ) {
451 422
          $this->drawLine($X1+1,$Y1,$X2-1,$Y1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
452 423
          $this->drawLine($X2,$Y1+1,$X2,$Y2-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
453 424
          $this->drawLine($X2-1,$Y2,$X1+1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
454 425
          $this->drawLine($X1,$Y1+1,$X1,$Y2-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
455
-        }
456
-       else
457
-        {
426
+        } else {
458 427
          $this->drawLine($X1+1,$Y1,$X2-1,$Y1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
459 428
          $this->drawLine($X2,$Y1,$X2,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
460 429
          $this->drawLine($X2-1,$Y2,$X1+1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
461 430
          $this->drawLine($X1,$Y1,$X1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
462 431
         }
463
-      }
464
-     else
465
-      {
432
+      } else {
466 433
        $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
467 434
        imagerectangle($this->Picture,$X1,$Y1,$X2,$Y2,$Color);
468 435
       }
469 436
     }
470 437
 
471 438
    /* Draw a filled rectangle */
472
-   function drawFilledRectangle($X1,$Y1,$X2,$Y2,$Format="")
473
-    {
439
+   function drawFilledRectangle($X1,$Y1,$X2,$Y2,$Format="") {
474 440
      $R			= isset($Format["R"]) ? $Format["R"] : 0;
475 441
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
476 442
      $B			= isset($Format["B"]) ? $Format["B"] : 0;
@@ -495,30 +461,25 @@  discard block
 block discarded – undo
495 461
      if ($Y1 > $Y2) { list($Y1, $Y2) = array($Y2, $Y1); }
496 462
 
497 463
      $RestoreShadow = $this->Shadow;
498
-     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
499
-      {
464
+     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) {
500 465
        $this->Shadow = FALSE;
501 466
        $this->drawFilledRectangle($X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa,"Ticks"=>$Ticks,"NoAngle"=>$NoAngle));
502 467
       }
503 468
 
504 469
      $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
505
-     if ( $NoAngle )
506
-      {
470
+     if ( $NoAngle ) {
507 471
        imagefilledrectangle($this->Picture,ceil($X1)+1,ceil($Y1),floor($X2)-1,floor($Y2),$Color);
508 472
        imageline($this->Picture,ceil($X1),ceil($Y1)+1,ceil($X1),floor($Y2)-1,$Color);
509 473
        imageline($this->Picture,floor($X2),ceil($Y1)+1,floor($X2),floor($Y2)-1,$Color);
510
-      }
511
-     else
474
+      } else
512 475
       imagefilledrectangle($this->Picture,ceil($X1),ceil($Y1),floor($X2),floor($Y2),$Color);
513 476
 
514
-     if ( $Dash )
515
-      {
477
+     if ( $Dash ) {
516 478
        if ( $BorderR != -1 ) { $iX1=$X1+1; $iY1=$Y1+1; $iX2=$X2-1; $iY2=$Y2-1; } else { $iX1=$X1; $iY1=$Y1; $iX2=$X2; $iY2=$Y2; }
517 479
 
518 480
        $Color = $this->allocateColor($this->Picture,$DashR,$DashG,$DashB,$Alpha);
519 481
        $Y=$iY1-$DashStep;
520
-       for($X=$iX1; $X<=$iX2+($iY2-$iY1); $X=$X+$DashStep)
521
-        {
482
+       for($X=$iX1; $X<=$iX2+($iY2-$iY1); $X=$X+$DashStep) {
522 483
          $Y=$Y+$DashStep;
523 484
          if ( $X > $iX2 ) { $Xa = $X-($X-$iX2); $Ya = $iY1+($X-$iX2); } else { $Xa = $X; $Ya = $iY1; }
524 485
          if ( $Y > $iY2 ) { $Xb = $iX1+($Y-$iY2); $Yb = $Y-($Y-$iY2); } else { $Xb = $iX1; $Yb = $Y; }
@@ -526,31 +487,26 @@  discard block
 block discarded – undo
526 487
         }
527 488
       }
528 489
 
529
-     if ( $this->Antialias && !$NoBorder )
530
-      {
531
-       if ( $X1 < ceil($X1) )
532
-        {
490
+     if ( $this->Antialias && !$NoBorder ) {
491
+       if ( $X1 < ceil($X1) ) {
533 492
          $AlphaA = $Alpha * (ceil($X1) - $X1);
534 493
          $Color = $this->allocateColor($this->Picture,$R,$G,$B,$AlphaA);
535 494
          imageline($this->Picture,ceil($X1)-1,ceil($Y1),ceil($X1)-1,floor($Y2),$Color);
536 495
         }
537 496
 
538
-       if ( $Y1 < ceil($Y1) )
539
-        {
497
+       if ( $Y1 < ceil($Y1) ) {
540 498
          $AlphaA = $Alpha * (ceil($Y1) - $Y1);
541 499
          $Color = $this->allocateColor($this->Picture,$R,$G,$B,$AlphaA);
542 500
          imageline($this->Picture,ceil($X1),ceil($Y1)-1,floor($X2),ceil($Y1)-1,$Color);
543 501
         }
544 502
 
545
-       if ( $X2 > floor($X2) )
546
-        {
503
+       if ( $X2 > floor($X2) ) {
547 504
          $AlphaA = $Alpha * (.5-($X2 - floor($X2)));
548 505
          $Color = $this->allocateColor($this->Picture,$R,$G,$B,$AlphaA);
549 506
          imageline($this->Picture,floor($X2)+1,ceil($Y1),floor($X2)+1,floor($Y2),$Color);
550 507
         } 
551 508
 
552
-       if ( $Y2 > floor($Y2) )
553
-        {
509
+       if ( $Y2 > floor($Y2) ) {
554 510
          $AlphaA = $Alpha * (.5-($Y2 - floor($Y2)));
555 511
          $Color = $this->allocateColor($this->Picture,$R,$G,$B,$AlphaA);
556 512
          imageline($this->Picture,ceil($X1),floor($Y2)+1,floor($X2),floor($Y2)+1,$Color);
@@ -564,8 +520,7 @@  discard block
 block discarded – undo
564 520
     }
565 521
 
566 522
    /* Draw a rectangular marker of the specified size */
567
-   function drawRectangleMarker($X,$Y,$Format="")
568
-    {
523
+   function drawRectangleMarker($X,$Y,$Format="") {
569 524
      $Size = isset($Format["Size"]) ? $Format["Size"] : 4;
570 525
 
571 526
      $HalfSize = floor($Size/2);
@@ -573,8 +528,7 @@  discard block
 block discarded – undo
573 528
     }
574 529
 
575 530
    /* Drawn a spline based on the bezier function */
576
-   function drawSpline($Coordinates,$Format="")
577
-    {
531
+   function drawSpline($Coordinates,$Format="") {
578 532
      $R		= isset($Format["R"]) ? $Format["R"] : 0;
579 533
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
580 534
      $B		= isset($Format["B"]) ? $Format["B"] : 0;
@@ -587,8 +541,7 @@  discard block
 block discarded – undo
587 541
      $Weight	= isset($Format["Weight"]) ? $Format["Weight"] : NULL;
588 542
 
589 543
      $Cpt = NULL; $Mode = NULL; $Result = "";
590
-     for($i=1;$i<=count($Coordinates)-1;$i++)
591
-      {
544
+     for($i=1;$i<=count($Coordinates)-1;$i++) {
592 545
        $X1 = $Coordinates[$i-1][0]; $Y1 = $Coordinates[$i-1][1];
593 546
        $X2 = $Coordinates[$i][0];   $Y2 = $Coordinates[$i][1];
594 547
 
@@ -596,9 +549,7 @@  discard block
 block discarded – undo
596 549
 
597 550
        /* First segment */
598 551
        if ( $i == 1 )
599
-        { $Xv1 = $X1; $Yv1 = $Y1; }
600
-       else
601
-        {
552
+        { $Xv1 = $X1; $Yv1 = $Y1; } else {
602 553
          $Angle1 = $this->getAngle($XLast,$YLast,$X1,$Y1);
603 554
          $Angle2 = $this->getAngle($X1,$Y1,$X2,$Y2);
604 555
          $XOff = cos($Angle2 * PI / 180) * $Force + $X1;
@@ -610,9 +561,7 @@  discard block
 block discarded – undo
610 561
 
611 562
        /* Last segment */
612 563
        if ( $i == count($Coordinates)-1 )
613
-        { $Xv2 = $X2; $Yv2 = $Y2; }
614
-       else
615
-        {
564
+        { $Xv2 = $X2; $Yv2 = $Y2; } else {
616 565
          $Angle1 = $this->getAngle($X2,$Y2,$Coordinates[$i+1][0],$Coordinates[$i+1][1]);
617 566
          $Angle2 = $this->getAngle($X1,$Y1,$X2,$Y2);
618 567
          $XOff = cos(($Angle2+180) * PI / 180) * $Force + $X2;
@@ -632,8 +581,7 @@  discard block
 block discarded – undo
632 581
     }
633 582
 
634 583
    /* Draw a bezier curve with two controls points */
635
-   function drawBezier($X1,$Y1,$X2,$Y2,$Xv1,$Yv1,$Xv2,$Yv2,$Format="")
636
-    {
584
+   function drawBezier($X1,$Y1,$X2,$Y2,$Xv1,$Yv1,$Xv2,$Yv2,$Format="") {
637 585
      $R		= isset($Format["R"]) ? $Format["R"] : 0;
638 586
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
639 587
      $B		= isset($Format["B"]) ? $Format["B"] : 0;
@@ -649,12 +597,10 @@  discard block
 block discarded – undo
649 597
      $ArrowRatio	= isset($Format["ArrowRatio"]) ? $Format["ArrowRatio"] : .5;
650 598
      $ArrowTwoHeads	= isset($Format["ArrowTwoHeads"]) ? $Format["ArrowTwoHeads"] : FALSE;
651 599
 
652
-     if ( $Segments == NULL )
653
-      {
600
+     if ( $Segments == NULL ) {
654 601
        $Length    = $this->getLength($X1,$Y1,$X2,$Y2);
655 602
        $Precision = ($Length*125)/1000;
656
-      }
657
-     else
603
+      } else
658 604
       $Precision = $Segments;
659 605
 
660 606
      $P[0]["X"] = $X1;  $P[0]["Y"] = $Y1;
@@ -664,8 +610,7 @@  discard block
 block discarded – undo
664 610
 
665 611
      /* Compute the bezier points */
666 612
      $Q = ""; $ID = 0; $Path = "";
667
-     for($i=0;$i<=$Precision;$i=$i+1)
668
-      {
613
+     for($i=0;$i<=$Precision;$i=$i+1) {
669 614
        $u = $i / $Precision;
670 615
 
671 616
        $C    = "";
@@ -674,8 +619,7 @@  discard block
 block discarded – undo
674 619
        $C[2] = 3 * $u * $u * (1 - $u);
675 620
        $C[3] = $u * $u * $u;
676 621
 
677
-       for($j=0;$j<=3;$j++)
678
-        {
622
+       for($j=0;$j<=3;$j++) {
679 623
          if ( !isset($Q[$ID]) ) { $Q[$ID] = ""; }
680 624
          if ( !isset($Q[$ID]["X"]) ) { $Q[$ID]["X"] = 0; }
681 625
          if ( !isset($Q[$ID]["Y"]) ) { $Q[$ID]["Y"] = 0; }
@@ -687,11 +631,9 @@  discard block
 block discarded – undo
687 631
       }        
688 632
      $Q[$ID]["X"] = $X2; $Q[$ID]["Y"] = $Y2;
689 633
 
690
-     if ( !$NoDraw )
691
-      {
634
+     if ( !$NoDraw ) {
692 635
        /* Display the control points */
693
-       if ( $ShowC && !$PathOnly )
694
-        {
636
+       if ( $ShowC && !$PathOnly ) {
695 637
          $Xv1 = floor($Xv1); $Yv1 = floor($Yv1); $Xv2 = floor($Xv2); $Yv2 = floor($Yv2);
696 638
 
697 639
          $this->drawLine($X1,$Y1,$X2,$Y2,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>30));
@@ -706,8 +648,7 @@  discard block
 block discarded – undo
706 648
 
707 649
        /* Draw the bezier */
708 650
        $LastX = NULL; $LastY = NULL; $Cpt = NULL; $Mode = NULL; $ArrowS = NULL;
709
-       foreach ($Q as $Key => $Point)
710
-        {
651
+       foreach ($Q as $Key => $Point) {
711 652
          $X = $Point["X"]; $Y = $Point["Y"];
712 653
 
713 654
          /* Get the first segment */
@@ -723,8 +664,7 @@  discard block
 block discarded – undo
723 664
          $LastX = $X; $LastY = $Y;
724 665
         }
725 666
 
726
-       if ( $DrawArrow && !$PathOnly )
727
-        {
667
+       if ( $DrawArrow && !$PathOnly ) {
728 668
          $ArrowSettings = array("FillR"=>$R,"FillG"=>$G,"FillB"=>$B,"Alpha"=>$Alpha,"Size"=>$ArrowSize,"Ratio"=>$ArrowRatio);
729 669
          if ( $ArrowTwoHeads )
730 670
           $this->drawArrow($ArrowS["X1"],$ArrowS["Y1"],$ArrowS["X2"],$ArrowS["Y2"],$ArrowSettings);
@@ -736,8 +676,7 @@  discard block
 block discarded – undo
736 676
     }
737 677
 
738 678
    /* Draw a line between two points */
739
-   function drawLine($X1,$Y1,$X2,$Y2,$Format="")
740
-    {
679
+   function drawLine($X1,$Y1,$X2,$Y2,$Format="") {
741 680
      $R		= isset($Format["R"]) ? $Format["R"] : 0;
742 681
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
743 682
      $B		= isset($Format["B"]) ? $Format["B"] : 0;
@@ -748,10 +687,8 @@  discard block
 block discarded – undo
748 687
      $Weight	= isset($Format["Weight"]) ? $Format["Weight"] : NULL;
749 688
      $Threshold	= isset($Format["Threshold"]) ? $Format["Threshold"] : NULL;
750 689
 
751
-     if ( $this->Antialias == FALSE && $Ticks == NULL )
752
-      {
753
-       if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
754
-        {
690
+     if ( $this->Antialias == FALSE && $Ticks == NULL ) {
691
+       if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) {
755 692
          $ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$this->Shadowa);
756 693
          imageline($this->Picture,$X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,$ShadowColor);
757 694
         }
@@ -765,13 +702,11 @@  discard block
 block discarded – undo
765 702
      if ( $Distance == 0 ) { return(-1); }
766 703
 
767 704
      /* Derivative algorithm for overweighted lines, re-route to polygons primitives */
768
-     if ( $Weight != NULL )
769
-      {
705
+     if ( $Weight != NULL ) {
770 706
        $Angle        = $this->getAngle($X1,$Y1,$X2,$Y2);
771 707
        $PolySettings = array ("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"BorderAlpha"=>$Alpha);
772 708
 
773
-       if ( $Ticks == NULL )
774
-        {
709
+       if ( $Ticks == NULL ) {
775 710
          $Points   = ""; 
776 711
          $Points[] = cos(deg2rad($Angle-90)) * $Weight + $X1; $Points[] = sin(deg2rad($Angle-90)) * $Weight + $Y1;
777 712
          $Points[] = cos(deg2rad($Angle+90)) * $Weight + $X1; $Points[] = sin(deg2rad($Angle+90)) * $Weight + $Y1;
@@ -779,11 +714,8 @@  discard block
 block discarded – undo
779 714
          $Points[] = cos(deg2rad($Angle-90)) * $Weight + $X2; $Points[] = sin(deg2rad($Angle-90)) * $Weight + $Y2;
780 715
 
781 716
          $this->drawPolygon($Points,$PolySettings);
782
-        }
783
-       else
784
-        {
785
-         for($i=0;$i<=$Distance;$i=$i+$Ticks*2)
786
-          {
717
+        } else {
718
+         for($i=0;$i<=$Distance;$i=$i+$Ticks*2) {
787 719
            $Xa = (($X2-$X1)/$Distance) * $i + $X1; $Ya = (($Y2-$Y1)/$Distance) * $i + $Y1;
788 720
            $Xb = (($X2-$X1)/$Distance) * ($i+$Ticks) + $X1; $Yb = (($Y2-$Y1)/$Distance) * ($i+$Ticks) + $Y1;
789 721
 
@@ -803,19 +735,15 @@  discard block
 block discarded – undo
803 735
      $XStep = ($X2-$X1) / $Distance;
804 736
      $YStep = ($Y2-$Y1) / $Distance;
805 737
 
806
-     for($i=0;$i<=$Distance;$i++)
807
-      {
738
+     for($i=0;$i<=$Distance;$i++) {
808 739
        $X = $i * $XStep + $X1;
809 740
        $Y = $i * $YStep + $Y1;
810 741
 
811 742
        $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
812 743
 
813
-       if ( $Threshold != NULL )
814
-        {
815
-         foreach($Threshold as $Key => $Parameters)
816
-          {
817
-           if ( $Y <= $Parameters["MinX"] && $Y >= $Parameters["MaxX"])
818
-            {
744
+       if ( $Threshold != NULL ) {
745
+         foreach($Threshold as $Key => $Parameters) {
746
+           if ( $Y <= $Parameters["MinX"] && $Y >= $Parameters["MaxX"]) {
819 747
              if ( isset($Parameters["R"]) ) { $RT = $Parameters["R"]; } else { $RT = 0; }
820 748
              if ( isset($Parameters["G"]) ) { $GT = $Parameters["G"]; } else { $GT = 0; }
821 749
              if ( isset($Parameters["B"]) ) { $BT = $Parameters["B"]; } else { $BT = 0; }
@@ -825,8 +753,7 @@  discard block
 block discarded – undo
825 753
           }
826 754
         }
827 755
 
828
-       if ( $Ticks != NULL )
829
-        {
756
+       if ( $Ticks != NULL ) {
830 757
          if ( $Cpt % $Ticks == 0 )
831 758
           { $Cpt = 0; if ( $Mode == 1 ) { $Mode = 0; } else { $Mode = 1; } }
832 759
 
@@ -834,8 +761,7 @@  discard block
 block discarded – undo
834 761
           $this->drawAntialiasPixel($X,$Y,$Color);
835 762
 
836 763
          $Cpt++;
837
-        }
838
-       else
764
+        } else
839 765
         $this->drawAntialiasPixel($X,$Y,$Color);
840 766
       }
841 767
 
@@ -843,8 +769,7 @@  discard block
 block discarded – undo
843 769
     }
844 770
 
845 771
    /* Draw a circle */
846
-   function drawCircle($Xc,$Yc,$Height,$Width,$Format="")
847
-    {
772
+   function drawCircle($Xc,$Yc,$Height,$Width,$Format="") {
848 773
      $R	    = isset($Format["R"]) ? $Format["R"] : 0;
849 774
      $G	    = isset($Format["G"]) ? $Format["G"] : 0;
850 775
      $B	    = isset($Format["B"]) ? $Format["B"] : 0;
@@ -859,8 +784,7 @@  discard block
 block discarded – undo
859 784
      $Xc = floor($Xc); $Yc = floor($Yc);
860 785
 
861 786
      $RestoreShadow = $this->Shadow;
862
-     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
863
-      {
787
+     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) {
864 788
        $this->Shadow = FALSE;
865 789
        $this->drawCircle($Xc+$this->ShadowX,$Yc+$this->ShadowY,$Height,$Width,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa,"Ticks"=>$Ticks));
866 790
       }
@@ -872,13 +796,11 @@  discard block
 block discarded – undo
872 796
 
873 797
      $Step = 360 / (2 * PI * max($Width,$Height));
874 798
      $Mode = 1; $Cpt = 1;
875
-     for($i=0;$i<=360;$i=$i+$Step)
876
-      {
799
+     for($i=0;$i<=360;$i=$i+$Step) {
877 800
        $X = cos($i*PI/180) * $Height + $Xc;
878 801
        $Y = sin($i*PI/180) * $Width + $Yc;
879 802
 
880
-       if ( $Ticks != NULL )
881
-        {
803
+       if ( $Ticks != NULL ) {
882 804
          if ( $Cpt % $Ticks == 0 )
883 805
           { $Cpt = 0; if ( $Mode == 1 ) { $Mode = 0; } else { $Mode = 1; } }
884 806
 
@@ -886,8 +808,7 @@  discard block
 block discarded – undo
886 808
           $this->drawAntialiasPixel($X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
887 809
 
888 810
          $Cpt++;
889
-        }
890
-       else
811
+        } else
891 812
         $this->drawAntialiasPixel($X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
892 813
 
893 814
       }
@@ -895,8 +816,7 @@  discard block
 block discarded – undo
895 816
     }
896 817
 
897 818
    /* Draw a filled circle */
898
-   function drawFilledCircle($X,$Y,$Radius,$Format="")
899
-    {
819
+   function drawFilledCircle($X,$Y,$Radius,$Format="") {
900 820
      $R			= isset($Format["R"]) ? $Format["R"] : 0;
901 821
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
902 822
      $B			= isset($Format["B"]) ? $Format["B"] : 0;
@@ -915,16 +835,14 @@  discard block
 block discarded – undo
915 835
      $Radius = abs($Radius);
916 836
 
917 837
      $RestoreShadow = $this->Shadow;
918
-     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
919
-      {
838
+     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) {
920 839
        $this->Shadow = FALSE;
921 840
        $this->drawFilledCircle($X+$this->ShadowX,$Y+$this->ShadowY,$Radius,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa,"Ticks"=>$Ticks));
922 841
       }
923 842
 
924 843
      $this->Mask  = "";
925 844
      $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha);
926
-     for ($i=0; $i<=$Radius*2; $i++)
927
-      {
845
+     for ($i=0; $i<=$Radius*2; $i++) {
928 846
        $Slice  = sqrt($Radius * $Radius - ($Radius - $i) * ($Radius - $i));
929 847
        $XPos   = floor($Slice);
930 848
        $YPos   = $Y + $i - $Radius;
@@ -946,8 +864,7 @@  discard block
 block discarded – undo
946 864
     }
947 865
 
948 866
    /* Write text */
949
-   function drawText($X,$Y,$Text,$Format="")
950
-    {
867
+   function drawText($X,$Y,$Text,$Format="") {
951 868
      $R			= isset($Format["R"]) ? $Format["R"] : $this->FontColorR;
952 869
      $G			= isset($Format["G"]) ? $Format["G"] : $this->FontColorG;
953 870
      $B			= isset($Format["B"]) ? $Format["B"] : $this->FontColorB;
@@ -979,16 +896,14 @@  discard block
 block discarded – undo
979 896
 
980 897
      if ( $BoxSurrounding != "" ) { $BoxBorderR = $BoxR - $BoxSurrounding; $BoxBorderG = $BoxG - $BoxSurrounding; $BoxBorderB = $BoxB - $BoxSurrounding; $BoxBorderAlpha = $BoxAlpha; }
981 898
 
982
-     if ( $ShowOrigine )
983
-      {
899
+     if ( $ShowOrigine ) {
984 900
        $MyMarkerSettings = array("R"=>255,"G"=>0,"B"=>0,"BorderR"=>255,"BorderB"=>255,"BorderG"=>255,"Size"=>4);
985 901
        $this->drawRectangleMarker($X,$Y,$MyMarkerSettings);
986 902
       }
987 903
 
988 904
      $TxtPos = $this->getTextBox($X,$Y,$FontName,$FontSize,$Angle,$Text);
989 905
 
990
-     if ( $DrawBox && ($Angle == 0 || $Angle == 90 || $Angle == 180 || $Angle == 270))
991
-      {
906
+     if ( $DrawBox && ($Angle == 0 || $Angle == 90 || $Angle == 180 || $Angle == 270)) {
992 907
        $T[0]["X"]=0;$T[0]["Y"]=0;$T[1]["X"]=0;$T[1]["Y"]=0;$T[2]["X"]=0;$T[2]["Y"]=0;$T[3]["X"]=0;$T[3]["Y"]=0;
993 908
        if ( $Angle == 0 ) { $T[0]["X"]=-$TOffset;$T[0]["Y"]=$TOffset;$T[1]["X"]=$TOffset;$T[1]["Y"]=$TOffset;$T[2]["X"]=$TOffset;$T[2]["Y"]=-$TOffset;$T[3]["X"]=-$TOffset;$T[3]["Y"]=-$TOffset; }
994 909
 
@@ -1005,16 +920,14 @@  discard block
 block discarded – undo
1005 920
        $Settings = array("R"=>$BoxR,"G"=>$BoxG,"B"=>$BoxB,"Alpha"=>$BoxAlpha,"BorderR"=>$BoxBorderR,"BorderG"=>$BoxBorderG,"BorderB"=>$BoxBorderB,"BorderAlpha"=>$BoxBorderAlpha);
1006 921
 
1007 922
        if ( $BoxRounded )
1008
-        { $this->drawRoundedFilledRectangle($X1,$Y1,$X2,$Y2,$RoundedRadius,$Settings); }
1009
-       else
923
+        { $this->drawRoundedFilledRectangle($X1,$Y1,$X2,$Y2,$RoundedRadius,$Settings); } else
1010 924
         { $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Settings); }
1011 925
       }
1012 926
 
1013 927
      $X = $X - $TxtPos[$Align]["X"] + $X;
1014 928
      $Y = $Y - $TxtPos[$Align]["Y"] + $Y;
1015 929
 
1016
-     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
1017
-      {
930
+     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) {
1018 931
        $C_ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$this->Shadowa);
1019 932
        imagettftext($this->Picture,$FontSize,$Angle,$X+$this->ShadowX,$Y+$this->ShadowY,$C_ShadowColor,$FontName,$Text);
1020 933
       }
@@ -1028,8 +941,7 @@  discard block
 block discarded – undo
1028 941
     }
1029 942
 
1030 943
    /* Draw a gradient within a defined area */
1031
-   function drawGradientArea($X1,$Y1,$X2,$Y2,$Direction,$Format="")
1032
-    {
944
+   function drawGradientArea($X1,$Y1,$X2,$Y2,$Direction,$Format="") {
1033 945
      $StartR	= isset($Format["StartR"]) ? $Format["StartR"] : 90;
1034 946
      $StartG	= isset($Format["StartG"]) ? $Format["StartG"] : 90;
1035 947
      $StartB	= isset($Format["StartB"]) ? $Format["StartB"] : 90;
@@ -1042,8 +954,7 @@  discard block
 block discarded – undo
1042 954
      $Shadow = $this->Shadow;
1043 955
      $this->Shadow = FALSE;
1044 956
 
1045
-     if ( $StartR == $EndR && $StartG == $EndG && $StartB == $EndB )
1046
-      {
957
+     if ( $StartR == $EndR && $StartG == $EndG && $StartB == $EndB ) {
1047 958
        $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,array("R"=>$StartR,"G"=>$StartG,"B"=>$StartB,"Alpha"=>$Alpha));
1048 959
        return(0);
1049 960
       }
@@ -1064,17 +975,14 @@  discard block
 block discarded – undo
1064 975
      $BStep    = ($EndB-$StartB)/$Step;
1065 976
 
1066 977
      $R=$StartR;$G=$StartG;$B=$StartB;
1067
-     switch($Direction)
1068
-      {
978
+     switch($Direction) {
1069 979
        case DIRECTION_VERTICAL:
1070 980
         $StartY = $Y1; $EndY = floor($Y2)+1; $LastY2 = $StartY;
1071
-        for($i=0;$i<=$Step;$i++)
1072
-         {
981
+        for($i=0;$i<=$Step;$i++) {
1073 982
           $Y2 = floor($StartY + ($i * $StepSize));
1074 983
 
1075 984
           if ($Y2 > $EndY) { $Y2 = $EndY; }
1076
-          if (($Y1 != $Y2 && $Y1 < $Y2) || $Y2 == $EndY)
1077
-           {
985
+          if (($Y1 != $Y2 && $Y1 < $Y2) || $Y2 == $EndY) {
1078 986
             $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
1079 987
             $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Color);
1080 988
             $LastY2 = max($LastY2,$Y2);
@@ -1087,13 +995,11 @@  discard block
 block discarded – undo
1087 995
 
1088 996
        case DIRECTION_HORIZONTAL:
1089 997
         $StartX = $X1; $EndX = $X2;
1090
-        for($i=0;$i<=$Step;$i++)
1091
-         {
998
+        for($i=0;$i<=$Step;$i++) {
1092 999
           $X2 = floor($StartX + ($i * $StepSize));
1093 1000
 
1094 1001
           if ($X2 > $EndX) { $X2 = $EndX; }
1095
-          if (($X1 != $X2 && $X1 < $X2) || $X2 == $EndX)
1096
-           {
1002
+          if (($X1 != $X2 && $X1 < $X2) || $X2 == $EndX) {
1097 1003
             $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
1098 1004
             $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Color);
1099 1005
             $X1 = $X2+1;
@@ -1109,8 +1015,7 @@  discard block
 block discarded – undo
1109 1015
     }
1110 1016
 
1111 1017
    /* Draw an aliased pixel */
1112
-   function drawAntialiasPixel($X,$Y,$Format="")
1113
-    {
1018
+   function drawAntialiasPixel($X,$Y,$Format="") {
1114 1019
      $R     = isset($Format["R"]) ? $Format["R"] : 0;
1115 1020
      $G     = isset($Format["G"]) ? $Format["G"] : 0;
1116 1021
      $B     = isset($Format["B"]) ? $Format["B"] : 0;
@@ -1123,10 +1028,8 @@  discard block
 block discarded – undo
1123 1028
      if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
1124 1029
      if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
1125 1030
 
1126
-     if ( !$this->Antialias )
1127
-      {
1128
-       if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
1129
-        {
1031
+     if ( !$this->Antialias ) {
1032
+       if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) {
1130 1033
          $ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$this->Shadowa);
1131 1034
          imagesetpixel($this->Picture,$X+$this->ShadowX,$Y+$this->ShadowY,$ShadowColor);
1132 1035
         }
@@ -1141,15 +1044,12 @@  discard block
 block discarded – undo
1141 1044
      $Xi   = floor($X);
1142 1045
      $Yi   = floor($Y);
1143 1046
 
1144
-     if ( $Xi == $X && $Yi == $Y)
1145
-      {
1047
+     if ( $Xi == $X && $Yi == $Y) {
1146 1048
        if ( $Alpha == 100 )
1147 1049
         $this->drawAlphaPixel($X,$Y,100,$R,$G,$B);
1148 1050
        else
1149 1051
         $this->drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B);
1150
-      }
1151
-     else
1152
-      {
1052
+      } else {
1153 1053
        $Alpha1 = (((1 - ($X - floor($X))) * (1 - ($Y - floor($Y))) * 100) / 100) * $Alpha;
1154 1054
        if ( $Alpha1 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi,$Yi,$Alpha1,$R,$G,$B); }
1155 1055
 
@@ -1165,8 +1065,7 @@  discard block
 block discarded – undo
1165 1065
     }
1166 1066
 
1167 1067
    /* Draw a semi-transparent pixel */
1168
-   function drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B)
1169
-    {
1068
+   function drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B) {
1170 1069
      if ( isset($this->Mask[$X])) { if ( isset($this->Mask[$X][$Y]) ) { return(0); } }
1171 1070
 
1172 1071
      if ( $X < 0 || $Y < 0 || $X >= $this->XSize || $Y >= $this->YSize )
@@ -1176,8 +1075,7 @@  discard block
 block discarded – undo
1176 1075
      if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
1177 1076
      if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
1178 1077
 
1179
-     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
1180
-      {
1078
+     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) {
1181 1079
        $AlphaFactor = floor(($Alpha / 100) * $this->Shadowa);
1182 1080
        $ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$AlphaFactor);
1183 1081
        imagesetpixel($this->Picture,$X+$this->ShadowX,$Y+$this->ShadowY,$ShadowColor);
@@ -1192,8 +1090,7 @@  discard block
 block discarded – undo
1192 1090
     { return((127/100)*(100-$AlphaValue)); }
1193 1091
 
1194 1092
    /* Allocate a color with transparency */
1195
-   function allocateColor($Picture,$R,$G,$B,$Alpha=100)
1196
-    {
1093
+   function allocateColor($Picture,$R,$G,$B,$Alpha=100) {
1197 1094
      if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
1198 1095
      if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
1199 1096
      if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
@@ -1216,8 +1113,7 @@  discard block
 block discarded – undo
1216 1113
    function drawFromJPG($X,$Y,$FileName)
1217 1114
     { $this->drawFromPicture(3,$FileName,$X,$Y); }
1218 1115
 
1219
-   function getPicInfo($FileName)
1220
-    {
1116
+   function getPicInfo($FileName) {
1221 1117
      $Infos  = getimagesize($FileName);
1222 1118
      $Width  = $Infos[0];
1223 1119
      $Height = $Infos[1];
@@ -1231,39 +1127,29 @@  discard block
 block discarded – undo
1231 1127
     }
1232 1128
 
1233 1129
    /* Generic loader function for external pictures */
1234
-   function drawFromPicture($PicType,$FileName,$X,$Y)
1235
-    {
1236
-     if ( file_exists($FileName))
1237
-      {
1130
+   function drawFromPicture($PicType,$FileName,$X,$Y) {
1131
+     if ( file_exists($FileName)) {
1238 1132
        list($Width,$Height) = $this->getPicInfo($FileName);
1239 1133
 
1240 1134
        if ( $PicType == 1 )
1241
-        { $Raster = imagecreatefrompng($FileName); }
1242
-       elseif ( $PicType == 2 )
1243
-        { $Raster = imagecreatefromgif($FileName); }
1244
-       elseif ( $PicType == 3 )
1245
-        { $Raster = imagecreatefromjpeg($FileName); }
1246
-       else
1135
+        { $Raster = imagecreatefrompng($FileName); } elseif ( $PicType == 2 )
1136
+        { $Raster = imagecreatefromgif($FileName); } elseif ( $PicType == 3 )
1137
+        { $Raster = imagecreatefromjpeg($FileName); } else
1247 1138
         { return(0); }
1248 1139
 
1249 1140
 
1250 1141
        $RestoreShadow = $this->Shadow;
1251
-       if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
1252
-        {
1142
+       if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) {
1253 1143
          $this->Shadow = FALSE;
1254 1144
          if ( $PicType == 3 )
1255 1145
           $this->drawFilledRectangle($X+$this->ShadowX,$Y+$this->ShadowY,$X+$Width+$this->ShadowX,$Y+$Height+$this->ShadowY,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa));
1256
-         else
1257
-          {
1146
+         else {
1258 1147
            $TranparentID = imagecolortransparent($Raster);
1259
-           for ($Xc=0;$Xc<=$Width-1;$Xc++)
1260
-            {
1261
-             for ($Yc=0;$Yc<=$Height-1;$Yc++)
1262
-              {
1148
+           for ($Xc=0;$Xc<=$Width-1;$Xc++) {
1149
+             for ($Yc=0;$Yc<=$Height-1;$Yc++) {
1263 1150
                $RGBa   = imagecolorat($Raster,$Xc,$Yc);
1264 1151
                $Values = imagecolorsforindex($Raster,$RGBa);
1265
-               if ( $Values["alpha"] < 120 )
1266
-                {
1152
+               if ( $Values["alpha"] < 120 ) {
1267 1153
                  $AlphaFactor = floor(($this->Shadowa / 100) * ((100 / 127) * (127-$Values["alpha"])));
1268 1154
                  $this->drawAlphaPixel($X+$Xc+$this->ShadowX,$Y+$Yc+$this->ShadowY,$AlphaFactor,$this->ShadowR,$this->ShadowG,$this->ShadowB);
1269 1155
                 }
@@ -1279,8 +1165,7 @@  discard block
 block discarded – undo
1279 1165
     }
1280 1166
 
1281 1167
    /* Draw an arrow */
1282
-   function drawArrow($X1,$Y1,$X2,$Y2,$Format="")
1283
-    {
1168
+   function drawArrow($X1,$Y1,$X2,$Y2,$Format="") {
1284 1169
      $FillR	= isset($Format["FillR"]) ? $Format["FillR"] : 0;
1285 1170
      $FillG	= isset($Format["FillG"]) ? $Format["FillG"] : 0;
1286 1171
      $FillB	= isset($Format["FillB"]) ? $Format["FillB"] : 0;
@@ -1298,8 +1183,7 @@  discard block
 block discarded – undo
1298 1183
 
1299 1184
      /* Override Shadow support, this will be managed internally */
1300 1185
      $RestoreShadow = $this->Shadow;
1301
-     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 )
1302
-      {
1186
+     if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) {
1303 1187
        $this->Shadow = FALSE;
1304 1188
        $this->drawArrow($X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,array("FillR"=>$this->ShadowR,"FillG"=>$this->ShadowG,"FillB"=>$this->ShadowB,"Alpha"=>$this->Shadowa,"Size"=>$Size,"Ratio"=>$Ratio,"TwoHeads"=>$TwoHeads,"Ticks"=>$Ticks));
1305 1189
       }
@@ -1326,8 +1210,7 @@  discard block
 block discarded – undo
1326 1210
      $this->drawLine($Points[0],$Points[1],$Points[4],$Points[5],array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha));
1327 1211
 
1328 1212
      /* Draw the second head */
1329
-     if ( $TwoHeads )
1330
-      {
1213
+     if ( $TwoHeads ) {
1331 1214
        $Angle = $this->getAngle($X2,$Y2,$X1,$Y1);
1332 1215
 
1333 1216
        $TailX2 = cos(($Angle-180)*PI/180)*$Size+$X1;
@@ -1351,8 +1234,7 @@  discard block
 block discarded – undo
1351 1234
        $this->drawLine($Points[0],$Points[1],$Points[4],$Points[5],array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha));
1352 1235
 
1353 1236
        $this->drawLine($TailX,$TailY,$TailX2,$TailY2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
1354
-      }
1355
-     else
1237
+      } else
1356 1238
       $this->drawLine($X1,$Y1,$TailX,$TailY,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
1357 1239
 
1358 1240
      /* Re-enable shadows */
@@ -1360,8 +1242,7 @@  discard block
 block discarded – undo
1360 1242
     }
1361 1243
 
1362 1244
    /* Draw a label with associated arrow */
1363
-   function drawArrowLabel($X1,$Y1,$Text,$Format="")
1364
-    {
1245
+   function drawArrowLabel($X1,$Y1,$Text,$Format="") {
1365 1246
      $FillR    = isset($Format["FillR"]) ? $Format["FillR"] : 0;
1366 1247
      $FillG    = isset($Format["FillG"]) ? $Format["FillG"] : 0;
1367 1248
      $FillB    = isset($Format["FillB"]) ? $Format["FillB"] : 0;
@@ -1392,16 +1273,13 @@  discard block
 block discarded – undo
1392 1273
      $TxtWidth	= max(abs($Size[2]-$Size[0]),abs($Size[0]-$Size[6]));
1393 1274
      $TxtHeight	= max(abs($Size[1]-$Size[7]),abs($Size[3]-$Size[1]));
1394 1275
 
1395
-     if ( $Angle > 0 && $Angle < 180 )
1396
-      {
1276
+     if ( $Angle > 0 && $Angle < 180 ) {
1397 1277
        $this->drawLine($X2,$Y2,$X2-$TxtWidth,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
1398 1278
        if ( $Position == POSITION_TOP )
1399 1279
         $this->drawText($X2,$Y2-2,$Text,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha,"Align"=>TEXT_ALIGN_BOTTOMRIGHT));
1400 1280
        else
1401 1281
         $this->drawText($X2,$Y2+4,$Text,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha,"Align"=>TEXT_ALIGN_TOPRIGHT));
1402
-      }
1403
-     else
1404
-      {
1282
+      } else {
1405 1283
        $this->drawLine($X2,$Y2,$X2+$TxtWidth,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
1406 1284
        if ( $Position == POSITION_TOP )
1407 1285
         $this->drawText($X2,$Y2-2,$Text,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha));
@@ -1411,8 +1289,7 @@  discard block
 block discarded – undo
1411 1289
     }
1412 1290
 
1413 1291
    /* Draw a progress bar filled with specified % */
1414
-   function drawProgress($X,$Y,$Percent,$Format="")
1415
-    {
1292
+   function drawProgress($X,$Y,$Percent,$Format="") {
1416 1293
      if ( $Percent > 100 ) { $Percent = 100; }
1417 1294
      if ( $Percent < 0 ) { $Percent = 0; }
1418 1295
 
@@ -1442,8 +1319,7 @@  discard block
 block discarded – undo
1442 1319
      $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : NULL;
1443 1320
      $NoAngle	= isset($Format["NoAngle"]) ? $Format["NoAngle"] : FALSE;
1444 1321
 
1445
-     if ( $RFade != -1 && $GFade != -1 && $BFade != -1 )
1446
-      {
1322
+     if ( $RFade != -1 && $GFade != -1 && $BFade != -1 ) {
1447 1323
        $RFade = (($RFade-$R)/100)*$Percent+$R;
1448 1324
        $GFade = (($GFade-$G)/100)*$Percent+$G;
1449 1325
        $BFade = (($BFade-$B)/100)*$Percent+$B;
@@ -1452,21 +1328,18 @@  discard block
 block discarded – undo
1452 1328
      if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
1453 1329
      if ( $BoxSurrounding != NULL ) { $BoxBorderR = $BoxBackR + $Surrounding; $BoxBorderG = $BoxBackG + $Surrounding; $BoxBorderB = $BoxBackB + $Surrounding; }
1454 1330
 
1455
-     if ( $Orientation == ORIENTATION_VERTICAL )
1456
-      {
1331
+     if ( $Orientation == ORIENTATION_VERTICAL ) {
1457 1332
        $InnerHeight = (($Height-2)/100)*$Percent;
1458 1333
        $this->drawFilledRectangle($X,$Y,$X+$Width,$Y-$Height,array("R"=>$BoxBackR,"G"=>$BoxBackG,"B"=>$BoxBackB,"BorderR"=>$BoxBorderR,"BorderG"=>$BoxBorderG,"BorderB"=>$BoxBorderB,"NoAngle"=>$NoAngle));
1459 1334
 
1460 1335
        $RestoreShadow = $this->Shadow; $this->Shadow  = FALSE;
1461
-       if ( $RFade != -1 && $GFade != -1 && $BFade != -1 )
1462
-        {
1336
+       if ( $RFade != -1 && $GFade != -1 && $BFade != -1 ) {
1463 1337
          $GradientOptions = array("StartR"=>$RFade,"StartG"=>$GFade,"StartB"=>$BFade,"EndR"=>$R,"EndG"=>$G,"EndB"=>$B);
1464 1338
          $this->drawGradientArea($X+1,$Y-1,$X+$Width-1,$Y-$InnerHeight,DIRECTION_VERTICAL,$GradientOptions);
1465 1339
 
1466 1340
          if ( $Surrounding )
1467 1341
           $this->drawRectangle($X+1,$Y-1,$X+$Width-1,$Y-$InnerHeight,array("R"=>255,"G"=>255,"B"=>255,"Alpha"=>$Surrounding));
1468
-        }
1469
-       else
1342
+        } else
1470 1343
         $this->drawFilledRectangle($X+1,$Y-1,$X+$Width-1,$Y-$InnerHeight,array("R"=>$R,"G"=>$G,"B"=>$B,"BorderR"=>$BorderR,"BorderG"=>$BorderG,"BorderB"=>$BorderB));
1471 1344
 
1472 1345
        $this->Shadow = $RestoreShadow;
@@ -1475,9 +1348,7 @@  discard block
 block discarded – undo
1475 1348
        if ( $ShowLabel && $LabelPos == LABEL_POS_TOP )		{ $this->drawText($X+($Width/2),$Y-$Height-$Margin,$Percent."%",array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); }
1476 1349
        if ( $ShowLabel && $LabelPos == LABEL_POS_INSIDE )	{ $this->drawText($X+($Width/2),$Y-$InnerHeight-$Margin,$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLELEFT,"Angle"=>90)); }
1477 1350
        if ( $ShowLabel && $LabelPos == LABEL_POS_CENTER )	{ $this->drawText($X+($Width/2),$Y-($Height/2),$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"Angle"=>90)); }
1478
-      }
1479
-     else
1480
-      {
1351
+      } else {
1481 1352
        if ( $Percent == 100 )
1482 1353
         $InnerWidth = $Width-1;
1483 1354
        else
@@ -1486,15 +1357,13 @@  discard block
 block discarded – undo
1486 1357
        $this->drawFilledRectangle($X,$Y,$X+$Width,$Y+$Height,array("R"=>$BoxBackR,"G"=>$BoxBackG,"B"=>$BoxBackB,"BorderR"=>$BoxBorderR,"BorderG"=>$BoxBorderG,"BorderB"=>$BoxBorderB,"NoAngle"=>$NoAngle));
1487 1358
 
1488 1359
        $RestoreShadow = $this->Shadow; $this->Shadow  = FALSE;
1489
-       if ( $RFade != -1 && $GFade != -1 && $BFade != -1 )
1490
-        {
1360
+       if ( $RFade != -1 && $GFade != -1 && $BFade != -1 ) {
1491 1361
          $GradientOptions = array("StartR"=>$R,"StartG"=>$G,"StartB"=>$B,"EndR"=>$RFade,"EndG"=>$GFade,"EndB"=>$BFade);
1492 1362
          $this->drawGradientArea($X+1,$Y+1,$X+$InnerWidth,$Y+$Height-1,DIRECTION_HORIZONTAL,$GradientOptions);
1493 1363
 
1494 1364
          if ( $Surrounding )
1495 1365
           $this->drawRectangle($X+1,$Y+1,$X+$InnerWidth,$Y+$Height-1,array("R"=>255,"G"=>255,"B"=>255,"Alpha"=>$Surrounding));
1496
-        }
1497
-       else
1366
+        } else
1498 1367
         $this->drawFilledRectangle($X+1,$Y+1,$X+$InnerWidth,$Y+$Height-1,array("R"=>$R,"G"=>$G,"B"=>$B,"BorderR"=>$BorderR,"BorderG"=>$BorderG,"BorderB"=>$BorderB));
1499 1368
  
1500 1369
        $this->Shadow = $RestoreShadow;
@@ -1507,8 +1376,7 @@  discard block
 block discarded – undo
1507 1376
     }
1508 1377
 
1509 1378
    /* Get the legend box size */
1510
-   function getLegendSize($Format="")
1511
-    {
1379
+   function getLegendSize($Format="") {
1512 1380
      $FontName		= isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName;
1513 1381
      $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize;
1514 1382
      $BoxSize		= isset($Format["BoxSize"]) ? $Format["BoxSize"] : 5;
@@ -1523,10 +1391,8 @@  discard block
 block discarded – undo
1523 1391
 
1524 1392
      $Data = $this->DataSet->getData();
1525 1393
 
1526
-     foreach($Data["Series"] as $SerieName => $Serie)
1527
-      {
1528
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] && isset($Serie["Picture"]))
1529
-        {
1394
+     foreach($Data["Series"] as $SerieName => $Serie) {
1395
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] && isset($Serie["Picture"])) {
1530 1396
          list($PicWidth,$PicHeight) = $this->getPicInfo($Serie["Picture"]);
1531 1397
          if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; }
1532 1398
          if ( $IconAreaHeight < $PicHeight ) { $IconAreaHeight = $PicHeight; }
@@ -1540,12 +1406,9 @@  discard block
 block discarded – undo
1540 1406
      $X=100; $Y=100;
1541 1407
 
1542 1408
      $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
1543
-     foreach($Data["Series"] as $SerieName => $Serie)
1544
-      {
1545
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
1546
-        {
1547
-         if ( $Mode == LEGEND_VERTICAL )
1548
-          {
1409
+     foreach($Data["Series"] as $SerieName => $Serie) {
1410
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
1411
+         if ( $Mode == LEGEND_VERTICAL ) {
1549 1412
            $BoxArray = $this->getTextBox($vX+$IconAreaWidth+4,$vY+$IconAreaHeight/2,$FontName,$FontSize,0,$Serie["Description"]);
1550 1413
 
1551 1414
            if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
@@ -1554,13 +1417,10 @@  discard block
 block discarded – undo
1554 1417
 
1555 1418
            $Lines = preg_split("/\n/",$Serie["Description"]);
1556 1419
            $vY = $vY + max($this->FontSize*count($Lines),$IconAreaHeight) + 5;
1557
-          }
1558
-         elseif ( $Mode == LEGEND_HORIZONTAL )
1559
-          {
1420
+          } elseif ( $Mode == LEGEND_HORIZONTAL ) {
1560 1421
            $Lines = preg_split("/\n/",$Serie["Description"]);
1561 1422
            $Width = "";
1562
-           foreach($Lines as $Key => $Value)
1563
-            {
1423
+           foreach($Lines as $Key => $Value) {
1564 1424
              $BoxArray = $this->getTextBox($vX+$IconAreaWidth+6,$Y+$IconAreaHeight/2+(($this->FontSize+3)*$Key),$FontName,$FontSize,0,$Value);
1565 1425
 
1566 1426
              if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
@@ -1586,8 +1446,7 @@  discard block
 block discarded – undo
1586 1446
     }
1587 1447
 
1588 1448
    /* Draw the legend of the active series */
1589
-   function drawLegend($X,$Y,$Format="")
1590
-    {
1449
+   function drawLegend($X,$Y,$Format="") {
1591 1450
      $Family	= isset($Format["Family"]) ? $Format["Family"] : LEGEND_FAMILY_BOX;
1592 1451
      $FontName	= isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName;
1593 1452
      $FontSize	= isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize;
@@ -1615,10 +1474,8 @@  discard block
 block discarded – undo
1615 1474
 
1616 1475
      $Data = $this->DataSet->getData();
1617 1476
 
1618
-     foreach($Data["Series"] as $SerieName => $Serie)
1619
-      {
1620
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] && isset($Serie["Picture"]))
1621
-        {
1477
+     foreach($Data["Series"] as $SerieName => $Serie) {
1478
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] && isset($Serie["Picture"])) {
1622 1479
          list($PicWidth,$PicHeight) = $this->getPicInfo($Serie["Picture"]);
1623 1480
          if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; }
1624 1481
          if ( $IconAreaHeight < $PicHeight ) { $IconAreaHeight = $PicHeight; }
@@ -1630,12 +1487,9 @@  discard block
 block discarded – undo
1630 1487
      $XStep = $XSpacing;
1631 1488
 
1632 1489
      $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
1633
-     foreach($Data["Series"] as $SerieName => $Serie)
1634
-      {
1635
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
1636
-        {
1637
-         if ( $Mode == LEGEND_VERTICAL )
1638
-          {
1490
+     foreach($Data["Series"] as $SerieName => $Serie) {
1491
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
1492
+         if ( $Mode == LEGEND_VERTICAL ) {
1639 1493
            $BoxArray = $this->getTextBox($vX+$IconAreaWidth+4,$vY+$IconAreaHeight/2,$FontName,$FontSize,0,$Serie["Description"]);
1640 1494
 
1641 1495
            if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
@@ -1644,13 +1498,10 @@  discard block
 block discarded – undo
1644 1498
 
1645 1499
            $Lines = preg_split("/\n/",$Serie["Description"]);
1646 1500
            $vY = $vY + max($this->FontSize*count($Lines),$IconAreaHeight) + 5;
1647
-          }
1648
-         elseif ( $Mode == LEGEND_HORIZONTAL )
1649
-          {
1501
+          } elseif ( $Mode == LEGEND_HORIZONTAL ) {
1650 1502
            $Lines = preg_split("/\n/",$Serie["Description"]);
1651 1503
            $Width = "";
1652
-           foreach($Lines as $Key => $Value)
1653
-            {
1504
+           foreach($Lines as $Key => $Value) {
1654 1505
              $BoxArray = $this->getTextBox($vX+$IconAreaWidth+6,$Y+$IconAreaHeight/2+(($this->FontSize+3)*$Key),$FontName,$FontSize,0,$Value);
1655 1506
 
1656 1507
              if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; }
@@ -1675,57 +1526,44 @@  discard block
 block discarded – undo
1675 1526
       $this->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));
1676 1527
 
1677 1528
      $RestoreShadow = $this->Shadow; $this->Shadow = FALSE;
1678
-     foreach($Data["Series"] as $SerieName => $Serie)
1679
-      {
1680
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
1681
-        {
1529
+     foreach($Data["Series"] as $SerieName => $Serie) {
1530
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
1682 1531
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"];
1683 1532
          $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"];
1684 1533
 
1685
-         if ( isset($Serie["Picture"]) )
1686
-          {
1534
+         if ( isset($Serie["Picture"]) ) {
1687 1535
            $Picture = $Serie["Picture"];
1688 1536
            list($PicWidth,$PicHeight) = $this->getPicInfo($Picture);
1689 1537
            $PicX = $X+$IconAreaWidth/2; $PicY = $Y+$IconAreaHeight/2; 
1690 1538
 
1691 1539
            $this->drawFromPNG($PicX-$PicWidth/2,$PicY-$PicHeight/2,$Picture);
1692
-          }
1693
-         else
1694
-          {
1695
-           if ( $Family == LEGEND_FAMILY_BOX )
1696
-            {
1540
+          } else {
1541
+           if ( $Family == LEGEND_FAMILY_BOX ) {
1697 1542
              if ( $BoxWidth != $IconAreaWidth ) { $XOffset = floor(($IconAreaWidth-$BoxWidth)/2); } else { $XOffset = 0; }
1698 1543
              if ( $BoxHeight != $IconAreaHeight ) { $YOffset = floor(($IconAreaHeight-$BoxHeight)/2); } else { $YOffset = 0; }
1699 1544
 
1700 1545
              $this->drawFilledRectangle($X+1+$XOffset,$Y+1+$YOffset,$X+$BoxWidth+$XOffset+1,$Y+$BoxHeight+1+$YOffset,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
1701 1546
              $this->drawFilledRectangle($X+$XOffset,$Y+$YOffset,$X+$BoxWidth+$XOffset,$Y+$BoxHeight+$YOffset,array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
1702
-            }
1703
-           elseif ( $Family == LEGEND_FAMILY_CIRCLE )
1704
-            {
1547
+            } elseif ( $Family == LEGEND_FAMILY_CIRCLE ) {
1705 1548
              $this->drawFilledCircle($X+1+$IconAreaWidth/2,$Y+1+$IconAreaHeight/2,min($IconAreaHeight/2,$IconAreaWidth/2),array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
1706 1549
              $this->drawFilledCircle($X+$IconAreaWidth/2,$Y+$IconAreaHeight/2,min($IconAreaHeight/2,$IconAreaWidth/2),array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20));
1707
-            }
1708
-           elseif ( $Family == LEGEND_FAMILY_LINE )
1709
-            {
1550
+            } elseif ( $Family == LEGEND_FAMILY_LINE ) {
1710 1551
              $this->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));
1711 1552
              $this->drawLine($X,$Y+$IconAreaHeight/2,$X+$IconAreaWidth,$Y+$IconAreaHeight/2,array("R"=>$R,"G"=>$G,"B"=>$B,"Ticks"=>$Ticks,"Weight"=>$Weight));
1712 1553
             }
1713 1554
           }
1714 1555
 
1715
-         if ( $Mode == LEGEND_VERTICAL )
1716
-          {
1556
+         if ( $Mode == LEGEND_VERTICAL ) {
1717 1557
            $Lines = preg_split("/\n/",$Serie["Description"]);
1718
-           foreach($Lines as $Key => $Value)
1719
-            $this->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT,"FontSize"=>$FontSize,"FontName"=>$FontName));
1558
+           foreach($Lines as $Key => $Value) {
1559
+                       $this->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT,"FontSize"=>$FontSize,"FontName"=>$FontName));
1560
+           }
1720 1561
 
1721 1562
            $Y=$Y+max($this->FontSize*count($Lines),$IconAreaHeight) + 5;
1722
-          }
1723
-         elseif ( $Mode == LEGEND_HORIZONTAL )
1724
-          {
1563
+          } elseif ( $Mode == LEGEND_HORIZONTAL ) {
1725 1564
            $Lines = preg_split("/\n/",$Serie["Description"]);
1726 1565
            $Width = "";
1727
-           foreach($Lines as $Key => $Value)
1728
-            {
1566
+           foreach($Lines as $Key => $Value) {
1729 1567
              $BoxArray = $this->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT,"FontSize"=>$FontSize,"FontName"=>$FontName));
1730 1568
              $Width[] = $BoxArray[1]["X"];
1731 1569
             }
@@ -1738,8 +1576,7 @@  discard block
 block discarded – undo
1738 1576
      $this->Shadow = $RestoreShadow;
1739 1577
     }
1740 1578
 
1741
-   function drawScale($Format="")
1742
-    {
1579
+   function drawScale($Format="") {
1743 1580
      $Pos		= isset($Format["Pos"]) ? $Format["Pos"] : SCALE_POS_LEFTRIGHT;
1744 1581
      $Floating		= isset($Format["Floating"]) ? $Format["Floating"] : FALSE;
1745 1582
      $Mode		= isset($Format["Mode"]) ? $Format["Mode"] : SCALE_MODE_FLOATING;
@@ -1816,34 +1653,26 @@  discard block
 block discarded – undo
1816 1653
      if ( isset($Data["Abscissa"]) ) { $Abscissa = $Data["Abscissa"]; } else { $Abscissa = NULL; }
1817 1654
 
1818 1655
      /* Unset the abscissa axis, needed if we display multiple charts on the same picture */
1819
-     if ( $Abscissa != NULL )
1820
-      {
1656
+     if ( $Abscissa != NULL ) {
1821 1657
        foreach($Data["Axis"] as $AxisID => $Parameters)
1822 1658
         { if ($Parameters["Identity"] == AXIS_X) { unset($Data["Axis"][$AxisID]); } }
1823 1659
       }
1824 1660
 
1825 1661
      /* Build the scale settings */
1826 1662
      $GotXAxis = FALSE;
1827
-     foreach($Data["Axis"] as $AxisID => $AxisParameter)
1828
-      {
1663
+     foreach($Data["Axis"] as $AxisID => $AxisParameter) {
1829 1664
        if ( $AxisParameter["Identity"] == AXIS_X ) { $GotXAxis = TRUE; }
1830 1665
 
1831 1666
        if ( $Pos == SCALE_POS_LEFTRIGHT && $AxisParameter["Identity"] == AXIS_Y)
1832
-        { $Height = $this->GraphAreaY2-$this->GraphAreaY1 - $YMargin*2; }
1833
-       elseif ( $Pos == SCALE_POS_LEFTRIGHT && $AxisParameter["Identity"] == AXIS_X)
1834
-        { $Height = $this->GraphAreaX2-$this->GraphAreaX1; }
1835
-       elseif ( $Pos == SCALE_POS_TOPBOTTOM && $AxisParameter["Identity"] == AXIS_Y)
1836
-        { $Height = $this->GraphAreaX2-$this->GraphAreaX1 - $YMargin*2;; }
1837
-       else
1667
+        { $Height = $this->GraphAreaY2-$this->GraphAreaY1 - $YMargin*2; } elseif ( $Pos == SCALE_POS_LEFTRIGHT && $AxisParameter["Identity"] == AXIS_X)
1668
+        { $Height = $this->GraphAreaX2-$this->GraphAreaX1; } elseif ( $Pos == SCALE_POS_TOPBOTTOM && $AxisParameter["Identity"] == AXIS_Y)
1669
+        { $Height = $this->GraphAreaX2-$this->GraphAreaX1 - $YMargin*2;; } else
1838 1670
         { $Height = $this->GraphAreaY2-$this->GraphAreaY1; }
1839 1671
 
1840 1672
        $AxisMin = ABSOLUTE_MAX; $AxisMax = OUT_OF_SIGHT;
1841
-       if ( $Mode == SCALE_MODE_FLOATING || $Mode == SCALE_MODE_START0 )
1842
-        {
1843
-         foreach($Data["Series"] as $SerieID => $SerieParameter)
1844
-          {
1845
-           if ( $SerieParameter["Axis"] == $AxisID && $Data["Series"][$SerieID]["isDrawable"] && $Data["Abscissa"] != $SerieID)
1846
-            {
1673
+       if ( $Mode == SCALE_MODE_FLOATING || $Mode == SCALE_MODE_START0 ) {
1674
+         foreach($Data["Series"] as $SerieID => $SerieParameter) {
1675
+           if ( $SerieParameter["Axis"] == $AxisID && $Data["Series"][$SerieID]["isDrawable"] && $Data["Abscissa"] != $SerieID) {
1847 1676
              $AxisMax = max($AxisMax,$Data["Series"][$SerieID]["Max"]);
1848 1677
              $AxisMin = min($AxisMin,$Data["Series"][$SerieID]["Min"]);
1849 1678
             }
@@ -1852,30 +1681,21 @@  discard block
 block discarded – undo
1852 1681
 
1853 1682
          $Data["Axis"][$AxisID]["Min"] = $AxisMin-$AutoMargin; $Data["Axis"][$AxisID]["Max"] = $AxisMax+$AutoMargin;
1854 1683
          if ( $Mode == SCALE_MODE_START0 ) { $Data["Axis"][$AxisID]["Min"] = 0; }
1855
-        }
1856
-       elseif ( $Mode == SCALE_MODE_MANUAL )
1857
-        {
1858
-         if ( isset($ManualScale[$AxisID]["Min"]) && isset($ManualScale[$AxisID]["Max"]) )
1859
-          {
1684
+        } elseif ( $Mode == SCALE_MODE_MANUAL ) {
1685
+         if ( isset($ManualScale[$AxisID]["Min"]) && isset($ManualScale[$AxisID]["Max"]) ) {
1860 1686
            $Data["Axis"][$AxisID]["Min"] = $ManualScale[$AxisID]["Min"];
1861 1687
            $Data["Axis"][$AxisID]["Max"] = $ManualScale[$AxisID]["Max"];
1862
-          }
1863
-         else
1688
+          } else
1864 1689
           { echo "Manual scale boundaries not set."; exit(); }
1865
-        }
1866
-       elseif ( $Mode == SCALE_MODE_ADDALL || $Mode == SCALE_MODE_ADDALL_START0 )
1867
-        {
1690
+        } elseif ( $Mode == SCALE_MODE_ADDALL || $Mode == SCALE_MODE_ADDALL_START0 ) {
1868 1691
          $Series = "";
1869 1692
          foreach($Data["Series"] as $SerieID => $SerieParameter)
1870 1693
           { if ( $SerieParameter["Axis"] == $AxisID && $SerieParameter["isDrawable"] && $Data["Abscissa"] != $SerieID ) { $Series[$SerieID] = count($Data["Series"][$SerieID]["Data"]); } }
1871 1694
 
1872
-         for ($ID=0;$ID<=max($Series)-1;$ID++)
1873
-          {
1695
+         for ($ID=0;$ID<=max($Series)-1;$ID++) {
1874 1696
            $PointMin = 0; $PointMax = 0;
1875
-           foreach($Series as $SerieID => $ValuesCount )
1876
-            {
1877
-             if (isset($Data["Series"][$SerieID]["Data"][$ID]) && $Data["Series"][$SerieID]["Data"][$ID] != NULL )
1878
-              {
1697
+           foreach($Series as $SerieID => $ValuesCount ) {
1698
+             if (isset($Data["Series"][$SerieID]["Data"][$ID]) && $Data["Series"][$SerieID]["Data"][$ID] != NULL ) {
1879 1699
                $Value = $Data["Series"][$SerieID]["Data"][$ID];
1880 1700
                if ( $Value > 0 ) { $PointMax = $PointMax + $Value; } else { $PointMin = $PointMin + $Value; }
1881 1701
               }
@@ -1906,18 +1726,14 @@  discard block
 block discarded – undo
1906 1726
       }
1907 1727
 
1908 1728
      /* Still no X axis */
1909
-     if ( $GotXAxis == FALSE )
1910
-      {
1911
-       if ( $Abscissa != NULL )
1912
-        {
1729
+     if ( $GotXAxis == FALSE ) {
1730
+       if ( $Abscissa != NULL ) {
1913 1731
          $Points = count($Data["Series"][$Abscissa]["Data"]);
1914 1732
          if ( $AutoAxisLabels )
1915 1733
           $AxisName = isset($Data["Series"][$Abscissa]["Description"]) ? $Data["Series"][$Abscissa]["Description"] : NULL;
1916 1734
          else
1917 1735
           $AxisName = NULL;
1918
-        }
1919
-       else
1920
-        {
1736
+        } else {
1921 1737
          $Points = 0;
1922 1738
          $AxisName = isset($Data["XAxisName"]) ? $Data["XAxisName"] : NULL;
1923 1739
          foreach($Data["Series"] as $SerieID => $SerieParameter)
@@ -1928,19 +1744,16 @@  discard block
 block discarded – undo
1928 1744
        $Data["Axis"][$AxisID]["Identity"] = AXIS_X;
1929 1745
        if ( $Pos == SCALE_POS_LEFTRIGHT ) { $Data["Axis"][$AxisID]["Position"] = AXIS_POSITION_BOTTOM; } else { $Data["Axis"][$AxisID]["Position"] = AXIS_POSITION_LEFT; }
1930 1746
        if ( isset($Data["AbscissaName"]) ) { $Data["Axis"][$AxisID]["Name"] = $Data["AbscissaName"]; }
1931
-       if ( $XMargin == AUTO )
1932
-        {
1747
+       if ( $XMargin == AUTO ) {
1933 1748
          if ( $Pos == SCALE_POS_LEFTRIGHT )
1934
-          { $Height = $this->GraphAreaX2-$this->GraphAreaX1; }
1935
-         else
1749
+          { $Height = $this->GraphAreaX2-$this->GraphAreaX1; } else
1936 1750
           { $Height = $this->GraphAreaY2-$this->GraphAreaY1; }
1937 1751
 
1938 1752
          if ( $Points == 1 )
1939 1753
           $Data["Axis"][$AxisID]["Margin"] = $Height / 2;
1940 1754
          else
1941 1755
           $Data["Axis"][$AxisID]["Margin"] = ($Height/$Points) / 2;
1942
-        }
1943
-       else
1756
+        } else
1944 1757
         { $Data["Axis"][$AxisID]["Margin"] = $XMargin; }
1945 1758
        $Data["Axis"][$AxisID]["Rows"] = $Points-1;
1946 1759
        if ( !isset($Data["Axis"][$AxisID]["Display"]) ) { $Data["Axis"][$AxisID]["Display"] = NULL; }
@@ -1949,11 +1762,9 @@  discard block
 block discarded – undo
1949 1762
       }
1950 1763
 
1951 1764
      /* Do we need to reverse the abscissa position? */
1952
-     if ( $Pos != SCALE_POS_LEFTRIGHT )
1953
-      {
1765
+     if ( $Pos != SCALE_POS_LEFTRIGHT ) {
1954 1766
        if ( $Data["AbsicssaPosition"] == AXIS_POSITION_BOTTOM )
1955
-        { $Data["AbsicssaPosition"] = AXIS_POSITION_LEFT; }
1956
-       else
1767
+        { $Data["AbsicssaPosition"] = AXIS_POSITION_LEFT; } else
1957 1768
         { $Data["AbsicssaPosition"] = AXIS_POSITION_RIGHT; }
1958 1769
       }
1959 1770
      $Data["Axis"][$AxisID]["Position"] = $Data["AbsicssaPosition"];
@@ -1965,38 +1776,29 @@  discard block
 block discarded – undo
1965 1776
      $FontColorRo = $this->FontColorR; $FontColorGo = $this->FontColorG; $FontColorBo = $this->FontColorB;
1966 1777
 
1967 1778
      $AxisPos["L"] = $this->GraphAreaX1; $AxisPos["R"] = $this->GraphAreaX2; $AxisPos["T"] = $this->GraphAreaY1; $AxisPos["B"] = $this->GraphAreaY2;
1968
-     foreach($Data["Axis"] as $AxisID => $Parameters)
1969
-      {
1970
-       if ( isset($Parameters["Color"]) )
1971
-        {
1779
+     foreach($Data["Axis"] as $AxisID => $Parameters) {
1780
+       if ( isset($Parameters["Color"]) ) {
1972 1781
          $AxisR = $Parameters["Color"]["R"]; $AxisG = $Parameters["Color"]["G"]; $AxisB = $Parameters["Color"]["B"];
1973 1782
          $TickR = $Parameters["Color"]["R"]; $TickG = $Parameters["Color"]["G"]; $TickB = $Parameters["Color"]["B"];
1974 1783
          $this->setFontProperties(array("R"=>$Parameters["Color"]["R"],"G"=>$Parameters["Color"]["G"],"B"=>$Parameters["Color"]["B"]));
1975
-        }
1976
-       else
1977
-        {
1784
+        } else {
1978 1785
          $AxisR = $AxisRo; $AxisG = $AxisGo; $AxisB = $AxisBo;
1979 1786
          $TickR = $TickRo; $TickG = $TickGo; $TickB = $TickBo;
1980 1787
          $this->setFontProperties(array("R"=>$FontColorRo,"G"=>$FontColorGo,"B"=>$FontColorBo));
1981 1788
         }
1982 1789
 
1983 1790
        $LastValue = "w00t"; $ID = 1;
1984
-       if ( $Parameters["Identity"] == AXIS_X )
1985
-        {
1986
-         if ( $Pos == SCALE_POS_LEFTRIGHT )
1987
-          {
1988
-           if ( $Parameters["Position"] == AXIS_POSITION_BOTTOM )
1989
-            {
1791
+       if ( $Parameters["Identity"] == AXIS_X ) {
1792
+         if ( $Pos == SCALE_POS_LEFTRIGHT ) {
1793
+           if ( $Parameters["Position"] == AXIS_POSITION_BOTTOM ) {
1990 1794
              if ( $LabelRotation == 0 )					{ $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $YLabelOffset = 2; }
1991 1795
              if ( $LabelRotation > 0 && $LabelRotation < 190 )		{ $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $YLabelOffset = 5; }
1992 1796
              if ( $LabelRotation == 180 )				{ $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $YLabelOffset = 5; }
1993 1797
              if ( $LabelRotation > 180 && $LabelRotation < 360 )	{ $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $YLabelOffset = 2; }
1994 1798
 
1995
-             if ( !$RemoveXAxis )
1996
-              {
1799
+             if ( !$RemoveXAxis ) {
1997 1800
                if ( $Floating )
1998
-                { $FloatingOffset = $YMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
1999
-               else
1801
+                { $FloatingOffset = $YMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else
2000 1802
                 { $FloatingOffset = 0; $this->drawLine($this->GraphAreaX1,$AxisPos["B"],$this->GraphAreaX2,$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2001 1803
 
2002 1804
                if ( $DrawArrows ) { $this->drawArrow($this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2+($ArrowSize*2),$AxisPos["B"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
@@ -2007,15 +1809,12 @@  discard block
 block discarded – undo
2007 1809
              if ($Parameters["Rows"] == 0 ) { $Step  = $Width; } else { $Step  = $Width / ($Parameters["Rows"]); }
2008 1810
              
2009 1811
              $MaxBottom = $AxisPos["B"];
2010
-             for($i=0;$i<=$Parameters["Rows"];$i++)
2011
-              {
1812
+             for($i=0;$i<=$Parameters["Rows"];$i++) {
2012 1813
                $XPos  = $this->GraphAreaX1 + $Parameters["Margin"] + $Step*$i;
2013 1814
                $YPos  = $AxisPos["B"];
2014 1815
 
2015 1816
                if ( $Abscissa != NULL )
2016
-                { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } }
2017
-               else
2018
-                {
1817
+                { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } } else {
2019 1818
                  if ( isset($Parameters["ScaleMin"]) && isset ($Parameters["RowHeight"]) )
2020 1819
                   $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]);
2021 1820
                  else
@@ -2023,8 +1822,7 @@  discard block
 block discarded – undo
2023 1822
                 }
2024 1823
 
2025 1824
                $ID++; $Skipped = TRUE;
2026
-               if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis)
2027
-                {
1825
+               if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis) {
2028 1826
                  $Bounds    = $this->drawText($XPos,$YPos+$OuterTickWidth+$YLabelOffset,$Value,array("Angle"=>$LabelRotation,"Align"=>$LabelAlign));
2029 1827
                  $TxtBottom = $YPos+$OuterTickWidth+2+($Bounds[0]["Y"]-$Bounds[2]["Y"]);
2030 1828
                  $MaxBottom = max($MaxBottom,$TxtBottom);
@@ -2034,20 +1832,16 @@  discard block
 block discarded – undo
2034 1832
 
2035 1833
                if ( $RemoveXAxis ) { $Skipped   = FALSE; }
2036 1834
 
2037
-               if ( $Skipped )
2038
-                {
1835
+               if ( $Skipped ) {
2039 1836
                  if ( $DrawXLines ) { $this->drawLine($XPos,$this->GraphAreaY1+$FloatingOffset,$XPos,$this->GraphAreaY2-$FloatingOffset,$SkippedAxisColor); }
2040 1837
                  if ( ($SkippedInnerTickWidth !=0 || $SkippedOuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos,$YPos-$SkippedInnerTickWidth,$XPos,$YPos+$SkippedOuterTickWidth,$SkippedTickColor); }
2041
-                }
2042
-               else
2043
-                {
1838
+                } else {
2044 1839
                  if ( $DrawXLines && ($XPos != $this->GraphAreaX1 && $XPos != $this->GraphAreaX2) ) { $this->drawLine($XPos,$this->GraphAreaY1+$FloatingOffset,$XPos,$this->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
2045 1840
                  if ( ($InnerTickWidth !=0 || $OuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos,$YPos-$InnerTickWidth,$XPos,$YPos+$OuterTickWidth,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha)); }
2046 1841
                 }
2047 1842
               }
2048 1843
 
2049
-             if ( isset($Parameters["Name"]) && !$RemoveXAxis)
2050
-              {
1844
+             if ( isset($Parameters["Name"]) && !$RemoveXAxis) {
2051 1845
                $YPos   = $MaxBottom+2;
2052 1846
                $XPos   = $this->GraphAreaX1+($this->GraphAreaX2-$this->GraphAreaX1)/2;
2053 1847
                $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_TOPMIDDLE));
@@ -2057,19 +1851,15 @@  discard block
 block discarded – undo
2057 1851
               }
2058 1852
 
2059 1853
              $AxisPos["B"] = $MaxBottom + $ScaleSpacing;
2060
-            }
2061
-           elseif ( $Parameters["Position"] == AXIS_POSITION_TOP )
2062
-            {
1854
+            } elseif ( $Parameters["Position"] == AXIS_POSITION_TOP ) {
2063 1855
              if ( $LabelRotation == 0 )					{ $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $YLabelOffset = 2; }
2064 1856
              if ( $LabelRotation > 0 && $LabelRotation < 190 )		{ $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $YLabelOffset = 2; }
2065 1857
              if ( $LabelRotation == 180 )				{ $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $YLabelOffset = 5; }
2066 1858
              if ( $LabelRotation > 180 && $LabelRotation < 360 )	{ $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $YLabelOffset = 5; }
2067 1859
 
2068
-             if ( !$RemoveXAxis )
2069
-              {
1860
+             if ( !$RemoveXAxis ) {
2070 1861
                if ( $Floating )
2071
-                { $FloatingOffset = $YMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2072
-               else
1862
+                { $FloatingOffset = $YMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else
2073 1863
                 { $FloatingOffset = 0; $this->drawLine($this->GraphAreaX1,$AxisPos["T"],$this->GraphAreaX2,$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2074 1864
 
2075 1865
                if ( $DrawArrows ) { $this->drawArrow($this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2+($ArrowSize*2),$AxisPos["T"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
@@ -2080,15 +1870,12 @@  discard block
 block discarded – undo
2080 1870
              if ($Parameters["Rows"] == 0 ) { $Step  = $Width; } else { $Step  = $Width / $Parameters["Rows"]; }
2081 1871
              
2082 1872
              $MinTop = $AxisPos["T"];
2083
-             for($i=0;$i<=$Parameters["Rows"];$i++)
2084
-              {
1873
+             for($i=0;$i<=$Parameters["Rows"];$i++) {
2085 1874
                $XPos  = $this->GraphAreaX1 + $Parameters["Margin"] + $Step*$i;
2086 1875
                $YPos  = $AxisPos["T"];
2087 1876
 
2088 1877
                if ( $Abscissa != NULL )
2089
-                { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } }
2090
-               else
2091
-                {
1878
+                { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } } else {
2092 1879
                  if ( isset($Parameters["ScaleMin"]) && isset ($Parameters["RowHeight"]) )
2093 1880
                   $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]);
2094 1881
                  else
@@ -2096,8 +1883,7 @@  discard block
 block discarded – undo
2096 1883
                 }
2097 1884
 
2098 1885
                $ID++; $Skipped = TRUE;
2099
-               if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis)
2100
-                {
1886
+               if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis) {
2101 1887
                  $Bounds = $this->drawText($XPos,$YPos-$OuterTickWidth-$YLabelOffset,$Value,array("Angle"=>$LabelRotation,"Align"=>$LabelAlign));
2102 1888
                  $TxtBox = $YPos-$OuterTickWidth-2-($Bounds[0]["Y"]-$Bounds[2]["Y"]);
2103 1889
                  $MinTop = min($MinTop,$TxtBox);
@@ -2107,21 +1893,17 @@  discard block
 block discarded – undo
2107 1893
 
2108 1894
                if ( $RemoveXAxis ) { $Skipped   = FALSE; }
2109 1895
 
2110
-               if ( $Skipped )
2111
-                {
1896
+               if ( $Skipped ) {
2112 1897
                  if ( $DrawXLines ) { $this->drawLine($XPos,$this->GraphAreaY1+$FloatingOffset,$XPos,$this->GraphAreaY2-$FloatingOffset,$SkippedAxisColor); }
2113 1898
                  if ( ($SkippedInnerTickWidth !=0 || $SkippedOuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos,$YPos+$SkippedInnerTickWidth,$XPos,$YPos-$SkippedOuterTickWidth,$SkippedTickColor); }
2114
-                }
2115
-               else
2116
-                {
1899
+                } else {
2117 1900
                  if ( $DrawXLines ) { $this->drawLine($XPos,$this->GraphAreaY1+$FloatingOffset,$XPos,$this->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
2118 1901
                  if ( ($InnerTickWidth !=0 || $OuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos,$YPos+$InnerTickWidth,$XPos,$YPos-$OuterTickWidth,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha)); }
2119 1902
                 }
2120 1903
 
2121 1904
               }
2122 1905
 
2123
-             if ( isset($Parameters["Name"]) && !$RemoveXAxis )
2124
-              {
1906
+             if ( isset($Parameters["Name"]) && !$RemoveXAxis ) {
2125 1907
                $YPos   = $MinTop-2;
2126 1908
                $XPos   = $this->GraphAreaX1+($this->GraphAreaX2-$this->GraphAreaX1)/2;
2127 1909
                $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
@@ -2132,21 +1914,16 @@  discard block
 block discarded – undo
2132 1914
 
2133 1915
              $AxisPos["T"] = $MinTop - $ScaleSpacing;
2134 1916
             }
2135
-          }
2136
-         elseif ( $Pos == SCALE_POS_TOPBOTTOM )
2137
-          {
2138
-           if ( $Parameters["Position"] == AXIS_POSITION_LEFT )
2139
-            {
1917
+          } elseif ( $Pos == SCALE_POS_TOPBOTTOM ) {
1918
+           if ( $Parameters["Position"] == AXIS_POSITION_LEFT ) {
2140 1919
              if ( $LabelRotation == 0 )					{ $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = -2; }
2141 1920
              if ( $LabelRotation > 0 && $LabelRotation < 190 )		{ $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = -6; }
2142 1921
              if ( $LabelRotation == 180 )				{ $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = -2; }
2143 1922
              if ( $LabelRotation > 180 && $LabelRotation < 360 )	{ $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = -5; }
2144 1923
 
2145
-             if ( !$RemoveXAxis )
2146
-              {
1924
+             if ( !$RemoveXAxis ) {
2147 1925
                if ( $Floating )
2148
-                { $FloatingOffset = $YMargin; $this->drawLine($AxisPos["L"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2149
-               else
1926
+                { $FloatingOffset = $YMargin; $this->drawLine($AxisPos["L"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else
2150 1927
                 { $FloatingOffset = 0; $this->drawLine($AxisPos["L"],$this->GraphAreaY1,$AxisPos["L"],$this->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2151 1928
 
2152 1929
                if ( $DrawArrows ) { $this->drawArrow($AxisPos["L"],$this->GraphAreaY2-$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY2+($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
@@ -2157,15 +1934,12 @@  discard block
 block discarded – undo
2157 1934
              if ($Parameters["Rows"] == 0 ) { $Step  = $Height; } else { $Step   = $Height / $Parameters["Rows"]; }
2158 1935
 
2159 1936
              $MinLeft = $AxisPos["L"];
2160
-             for($i=0;$i<=$Parameters["Rows"];$i++)
2161
-              {
1937
+             for($i=0;$i<=$Parameters["Rows"];$i++) {
2162 1938
                $YPos  = $this->GraphAreaY1 + $Parameters["Margin"] + $Step*$i;
2163 1939
                $XPos  = $AxisPos["L"];
2164 1940
 
2165 1941
                if ( $Abscissa != NULL )
2166
-                { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } }
2167
-               else
2168
-                {
1942
+                { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } } else {
2169 1943
                  if ( isset($Parameters["ScaleMin"]) && isset ($Parameters["RowHeight"]) )
2170 1944
                   $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]);
2171 1945
                  else
@@ -2173,8 +1947,7 @@  discard block
 block discarded – undo
2173 1947
                 }
2174 1948
 
2175 1949
                $ID++; $Skipped = TRUE;
2176
-               if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis)
2177
-                {
1950
+               if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis) {
2178 1951
                  $Bounds  = $this->drawText($XPos-$OuterTickWidth+$XLabelOffset,$YPos,$Value,array("Angle"=>$LabelRotation,"Align"=>$LabelAlign));
2179 1952
                  $TxtBox  = $XPos-$OuterTickWidth-2-($Bounds[1]["X"]-$Bounds[0]["X"]);
2180 1953
                  $MinLeft = min($MinLeft,$TxtBox);
@@ -2184,20 +1957,16 @@  discard block
 block discarded – undo
2184 1957
 
2185 1958
                if ( $RemoveXAxis ) { $Skipped   = FALSE; }
2186 1959
 
2187
-               if ( $Skipped )
2188
-                {
1960
+               if ( $Skipped ) {
2189 1961
                  if ( $DrawXLines ) { $this->drawLine($this->GraphAreaX1+$FloatingOffset,$YPos,$this->GraphAreaX2-$FloatingOffset,$YPos,$SkippedAxisColor); }
2190 1962
                  if ( ($SkippedInnerTickWidth !=0 || $SkippedOuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos-$SkippedOuterTickWidth,$YPos,$XPos+$SkippedInnerTickWidth,$YPos,$SkippedTickColor); }
2191
-                }
2192
-               else
2193
-                {
1963
+                } else {
2194 1964
                  if ( $DrawXLines && ($YPos != $this->GraphAreaY1 && $YPos != $this->GraphAreaY2) ) { $this->drawLine($this->GraphAreaX1+$FloatingOffset,$YPos,$this->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
2195 1965
                  if ( ($InnerTickWidth !=0 || $OuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos-$OuterTickWidth,$YPos,$XPos+$InnerTickWidth,$YPos,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha)); }
2196 1966
                 }
2197 1967
 
2198 1968
               }
2199
-             if ( isset($Parameters["Name"]) && !$RemoveXAxis )
2200
-              {
1969
+             if ( isset($Parameters["Name"]) && !$RemoveXAxis ) {
2201 1970
                $XPos   = $MinLeft-2;
2202 1971
                $YPos   = $this->GraphAreaY1+($this->GraphAreaY2-$this->GraphAreaY1)/2;
2203 1972
                $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>90));
@@ -2207,19 +1976,15 @@  discard block
 block discarded – undo
2207 1976
               }
2208 1977
 
2209 1978
              $AxisPos["L"] = $MinLeft - $ScaleSpacing;
2210
-            }
2211
-           elseif ( $Parameters["Position"] == AXIS_POSITION_RIGHT )
2212
-            {
1979
+            } elseif ( $Parameters["Position"] == AXIS_POSITION_RIGHT ) {
2213 1980
              if ( $LabelRotation == 0 )					{ $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = 2; }
2214 1981
              if ( $LabelRotation > 0 && $LabelRotation < 190 )		{ $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = 6; }
2215 1982
              if ( $LabelRotation == 180 )				{ $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = 5; }
2216 1983
              if ( $LabelRotation > 180 && $LabelRotation < 360 )	{ $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = 7; }
2217 1984
 
2218
-             if ( !$RemoveXAxis )
2219
-              {
1985
+             if ( !$RemoveXAxis ) {
2220 1986
                if ( $Floating )
2221
-                { $FloatingOffset = $YMargin; $this->drawLine($AxisPos["R"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2222
-               else
1987
+                { $FloatingOffset = $YMargin; $this->drawLine($AxisPos["R"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else
2223 1988
                 { $FloatingOffset = 0; $this->drawLine($AxisPos["R"],$this->GraphAreaY1,$AxisPos["R"],$this->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2224 1989
 
2225 1990
                if ( $DrawArrows ) { $this->drawArrow($AxisPos["R"],$this->GraphAreaY2-$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY2+($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
@@ -2230,15 +1995,12 @@  discard block
 block discarded – undo
2230 1995
              if ($Parameters["Rows"] == 0 ) { $Step  = $Height; } else { $Step   = $Height / $Parameters["Rows"]; }
2231 1996
              
2232 1997
              $MaxRight = $AxisPos["R"];
2233
-             for($i=0;$i<=$Parameters["Rows"];$i++)
2234
-              {
1998
+             for($i=0;$i<=$Parameters["Rows"];$i++) {
2235 1999
                $YPos  = $this->GraphAreaY1 + $Parameters["Margin"] + $Step*$i;
2236 2000
                $XPos  = $AxisPos["R"];
2237 2001
 
2238 2002
                if ( $Abscissa != NULL )
2239
-                { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } }
2240
-               else
2241
-                {
2003
+                { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } } else {
2242 2004
                  if ( isset($Parameters["ScaleMin"]) && isset ($Parameters["RowHeight"]) )
2243 2005
                   $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]);
2244 2006
                  else
@@ -2246,8 +2008,7 @@  discard block
 block discarded – undo
2246 2008
                 }
2247 2009
 
2248 2010
                $ID++; $Skipped = TRUE;
2249
-               if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis)
2250
-                {
2011
+               if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis) {
2251 2012
                  $Bounds   = $this->drawText($XPos+$OuterTickWidth+$XLabelOffset,$YPos,$Value,array("Angle"=>$LabelRotation,"Align"=>$LabelAlign));
2252 2013
                  $TxtBox   = $XPos+$OuterTickWidth+2+($Bounds[1]["X"]-$Bounds[0]["X"]);
2253 2014
                  $MaxRight = max($MaxRight,$TxtBox);
@@ -2257,21 +2018,17 @@  discard block
 block discarded – undo
2257 2018
 
2258 2019
                if ( $RemoveXAxis ) { $Skipped   = FALSE; }
2259 2020
 
2260
-               if ( $Skipped )
2261
-                {
2021
+               if ( $Skipped ) {
2262 2022
                  if ( $DrawXLines ) { $this->drawLine($this->GraphAreaX1+$FloatingOffset,$YPos,$this->GraphAreaX2-$FloatingOffset,$YPos,$SkippedAxisColor); }
2263 2023
                  if ( ($SkippedInnerTickWidth != 0 || $SkippedOuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos+$SkippedOuterTickWidth,$YPos,$XPos-$SkippedInnerTickWidth,$YPos,$SkippedTickColor); }
2264
-                }
2265
-               else
2266
-                {
2024
+                } else {
2267 2025
                  if ( $DrawXLines ) { $this->drawLine($this->GraphAreaX1+$FloatingOffset,$YPos,$this->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); }
2268 2026
                  if ( ($InnerTickWidth != 0 || $OuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos+$OuterTickWidth,$YPos,$XPos-$InnerTickWidth,$YPos,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha)); }
2269 2027
                 }
2270 2028
 
2271 2029
               }
2272 2030
 
2273
-             if ( isset($Parameters["Name"]) && !$RemoveXAxis)
2274
-              {
2031
+             if ( isset($Parameters["Name"]) && !$RemoveXAxis) {
2275 2032
                $XPos   = $MaxRight+4;
2276 2033
                $YPos   = $this->GraphAreaY1+($this->GraphAreaY2-$this->GraphAreaY1)/2;
2277 2034
                $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>270));
@@ -2287,16 +2044,12 @@  discard block
 block discarded – undo
2287 2044
 
2288 2045
 
2289 2046
 
2290
-       if ( $Parameters["Identity"] == AXIS_Y )
2291
-        {
2292
-         if ( $Pos == SCALE_POS_LEFTRIGHT )
2293
-          {
2294
-           if ( $Parameters["Position"] == AXIS_POSITION_LEFT )
2295
-            {
2047
+       if ( $Parameters["Identity"] == AXIS_Y ) {
2048
+         if ( $Pos == SCALE_POS_LEFTRIGHT ) {
2049
+           if ( $Parameters["Position"] == AXIS_POSITION_LEFT ) {
2296 2050
 
2297 2051
              if ( $Floating )
2298
-              { $FloatingOffset = $XMargin; $this->drawLine($AxisPos["L"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2299
-             else
2052
+              { $FloatingOffset = $XMargin; $this->drawLine($AxisPos["L"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else
2300 2053
               { $FloatingOffset = 0; $this->drawLine($AxisPos["L"],$this->GraphAreaY1,$AxisPos["L"],$this->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2301 2054
 
2302 2055
              if ( $DrawArrows ) { $this->drawArrow($AxisPos["L"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY1-($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
@@ -2304,8 +2057,7 @@  discard block
 block discarded – undo
2304 2057
              $Height = ($this->GraphAreaY2 - $this->GraphAreaY1) - $Parameters["Margin"]*2;
2305 2058
              $Step   = $Height / $Parameters["Rows"]; $SubTicksSize = $Step /2; $MinLeft = $AxisPos["L"];
2306 2059
              $LastY  = NULL;
2307
-             for($i=0;$i<=$Parameters["Rows"];$i++)
2308
-              {
2060
+             for($i=0;$i<=$Parameters["Rows"];$i++) {
2309 2061
                $YPos  = $this->GraphAreaY2 - $Parameters["Margin"] - $Step*$i;
2310 2062
                $XPos  = $AxisPos["L"];
2311 2063
                $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Parameters["Display"],$Parameters["Format"],$Parameters["Unit"]);
@@ -2326,8 +2078,7 @@  discard block
 block discarded – undo
2326 2078
                $LastY = $YPos;
2327 2079
               }
2328 2080
 
2329
-             if ( isset($Parameters["Name"]) )
2330
-              {
2081
+             if ( isset($Parameters["Name"]) ) {
2331 2082
                $XPos    = $MinLeft-2;
2332 2083
                $YPos    = $this->GraphAreaY1+($this->GraphAreaY2-$this->GraphAreaY1)/2;
2333 2084
                $Bounds  = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>90));
@@ -2337,12 +2088,9 @@  discard block
 block discarded – undo
2337 2088
               }
2338 2089
 
2339 2090
              $AxisPos["L"] = $MinLeft - $ScaleSpacing;
2340
-            }
2341
-           elseif ( $Parameters["Position"] == AXIS_POSITION_RIGHT )
2342
-            {
2091
+            } elseif ( $Parameters["Position"] == AXIS_POSITION_RIGHT ) {
2343 2092
              if ( $Floating )
2344
-              { $FloatingOffset = $XMargin; $this->drawLine($AxisPos["R"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2345
-             else
2093
+              { $FloatingOffset = $XMargin; $this->drawLine($AxisPos["R"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else
2346 2094
               { $FloatingOffset = 0; $this->drawLine($AxisPos["R"],$this->GraphAreaY1,$AxisPos["R"],$this->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2347 2095
 
2348 2096
              if ( $DrawArrows ) { $this->drawArrow($AxisPos["R"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY1-($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
@@ -2350,8 +2098,7 @@  discard block
 block discarded – undo
2350 2098
              $Height = ($this->GraphAreaY2 - $this->GraphAreaY1) - $Parameters["Margin"]*2;
2351 2099
              $Step   = $Height / $Parameters["Rows"]; $SubTicksSize = $Step /2; $MaxLeft = $AxisPos["R"];
2352 2100
              $LastY  = NULL;
2353
-             for($i=0;$i<=$Parameters["Rows"];$i++)
2354
-              {
2101
+             for($i=0;$i<=$Parameters["Rows"];$i++) {
2355 2102
                $YPos  = $this->GraphAreaY2 - $Parameters["Margin"] - $Step*$i;
2356 2103
                $XPos  = $AxisPos["R"];
2357 2104
                $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Parameters["Display"],$Parameters["Format"],$Parameters["Unit"]);
@@ -2372,8 +2119,7 @@  discard block
 block discarded – undo
2372 2119
                $LastY = $YPos;
2373 2120
               }
2374 2121
 
2375
-             if ( isset($Parameters["Name"]) )
2376
-              {
2122
+             if ( isset($Parameters["Name"]) ) {
2377 2123
                $XPos    = $MaxLeft+6;
2378 2124
                $YPos    = $this->GraphAreaY1+($this->GraphAreaY2-$this->GraphAreaY1)/2;
2379 2125
                $Bounds  = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>270));
@@ -2383,14 +2129,10 @@  discard block
 block discarded – undo
2383 2129
               }
2384 2130
              $AxisPos["R"] = $MaxLeft + $ScaleSpacing;
2385 2131
             }
2386
-          }
2387
-         elseif ( $Pos == SCALE_POS_TOPBOTTOM )
2388
-          {
2389
-           if ( $Parameters["Position"] == AXIS_POSITION_TOP )
2390
-            {
2132
+          } elseif ( $Pos == SCALE_POS_TOPBOTTOM ) {
2133
+           if ( $Parameters["Position"] == AXIS_POSITION_TOP ) {
2391 2134
              if ( $Floating )
2392
-              { $FloatingOffset = $XMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2393
-             else
2135
+              { $FloatingOffset = $XMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else
2394 2136
               { $FloatingOffset = 0; $this->drawLine($this->GraphAreaX1,$AxisPos["T"],$this->GraphAreaX2,$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2395 2137
 
2396 2138
              if ( $DrawArrows ) { $this->drawArrow($this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2+($ArrowSize*2),$AxisPos["T"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
@@ -2398,8 +2140,7 @@  discard block
 block discarded – undo
2398 2140
              $Width = ($this->GraphAreaX2 - $this->GraphAreaX1) - $Parameters["Margin"]*2;
2399 2141
              $Step   = $Width / $Parameters["Rows"]; $SubTicksSize = $Step /2; $MinTop = $AxisPos["T"];
2400 2142
              $LastX  = NULL;
2401
-             for($i=0;$i<=$Parameters["Rows"];$i++)
2402
-              {
2143
+             for($i=0;$i<=$Parameters["Rows"];$i++) {
2403 2144
                $XPos  = $this->GraphAreaX1 + $Parameters["Margin"] + $Step*$i;
2404 2145
                $YPos  = $AxisPos["T"];
2405 2146
                $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Parameters["Display"],$Parameters["Format"],$Parameters["Unit"]);
@@ -2420,8 +2161,7 @@  discard block
 block discarded – undo
2420 2161
                $LastX = $XPos;
2421 2162
               }
2422 2163
 
2423
-             if ( isset($Parameters["Name"]) )
2424
-              {
2164
+             if ( isset($Parameters["Name"]) ) {
2425 2165
                $YPos   = $MinTop-2;
2426 2166
                $XPos   = $this->GraphAreaX1+($this->GraphAreaX2-$this->GraphAreaX1)/2;
2427 2167
                $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
@@ -2431,12 +2171,9 @@  discard block
 block discarded – undo
2431 2171
               }
2432 2172
 
2433 2173
              $AxisPos["T"] = $MinTop - $ScaleSpacing;
2434
-            }
2435
-           elseif ( $Parameters["Position"] == AXIS_POSITION_BOTTOM )
2436
-            {
2174
+            } elseif ( $Parameters["Position"] == AXIS_POSITION_BOTTOM ) {
2437 2175
              if ( $Floating )
2438
-              { $FloatingOffset = $XMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2439
-             else
2176
+              { $FloatingOffset = $XMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else
2440 2177
               { $FloatingOffset = 0; $this->drawLine($this->GraphAreaX1,$AxisPos["B"],$this->GraphAreaX2,$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); }
2441 2178
 
2442 2179
              if ( $DrawArrows ) { $this->drawArrow($this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2+($ArrowSize*2),$AxisPos["B"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
@@ -2444,8 +2181,7 @@  discard block
 block discarded – undo
2444 2181
              $Width = ($this->GraphAreaX2 - $this->GraphAreaX1) - $Parameters["Margin"]*2;
2445 2182
              $Step   = $Width / $Parameters["Rows"]; $SubTicksSize = $Step /2; $MaxBottom = $AxisPos["B"];
2446 2183
              $LastX  = NULL;
2447
-             for($i=0;$i<=$Parameters["Rows"];$i++)
2448
-              {
2184
+             for($i=0;$i<=$Parameters["Rows"];$i++) {
2449 2185
                $XPos  = $this->GraphAreaX1 + $Parameters["Margin"] + $Step*$i;
2450 2186
                $YPos  = $AxisPos["B"];
2451 2187
                $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Parameters["Display"],$Parameters["Format"],$Parameters["Unit"]);
@@ -2466,8 +2202,7 @@  discard block
 block discarded – undo
2466 2202
                $LastX = $XPos;
2467 2203
               }
2468 2204
 
2469
-             if ( isset($Parameters["Name"]) )
2470
-              {
2205
+             if ( isset($Parameters["Name"]) ) {
2471 2206
                $YPos   = $MaxBottom+2;
2472 2207
                $XPos   = $this->GraphAreaX1+($this->GraphAreaX2-$this->GraphAreaX1)/2;
2473 2208
                $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_TOPMIDDLE));
@@ -2483,8 +2218,7 @@  discard block
 block discarded – undo
2483 2218
       }
2484 2219
     }
2485 2220
 
2486
-   function isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip)
2487
-    {
2221
+   function isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) {
2488 2222
      if ( $LabelingMethod == LABELING_DIFFERENT && $Value != $LastValue ) { return(TRUE); }
2489 2223
      if ( $LabelingMethod == LABELING_DIFFERENT && $Value == $LastValue ) { return(FALSE); }
2490 2224
      if ( $LabelingMethod == LABELING_ALL && $LabelSkip == 0 ) { return(TRUE); }
@@ -2494,17 +2228,16 @@  discard block
 block discarded – undo
2494 2228
     }
2495 2229
 
2496 2230
    /* Compute the scale, check for the best visual factors */
2497
-   function computeScale($XMin,$XMax,$MaxDivs,$Factors,$AxisID=0)
2498
-    {
2231
+   function computeScale($XMin,$XMax,$MaxDivs,$Factors,$AxisID=0) {
2499 2232
      /* Compute each factors */
2500 2233
      $Results = "";
2501
-     foreach ($Factors as $Key => $Factor)
2502
-      $Results[$Factor] = $this->processScale($XMin,$XMax,$MaxDivs,array($Factor),$AxisID);
2234
+     foreach ($Factors as $Key => $Factor) {
2235
+           $Results[$Factor] = $this->processScale($XMin,$XMax,$MaxDivs,array($Factor),$AxisID);
2236
+     }
2503 2237
 
2504 2238
      /* Remove scales that are creating to much decimals */
2505 2239
      $GoodScaleFactors = "";
2506
-     foreach ($Results as $Key => $Result)
2507
-      {
2240
+     foreach ($Results as $Key => $Result) {
2508 2241
        $Decimals = preg_split("/\./",$Result["RowHeight"]);
2509 2242
        if ( (!isset($Decimals[1])) || (strlen($Decimals[1]) < 6) ) { $GoodScaleFactors[] = $Key; }
2510 2243
       }
@@ -2522,8 +2255,7 @@  discard block
 block discarded – undo
2522 2255
     }
2523 2256
 
2524 2257
    /* Compute the best matching scale based on size & factors */
2525
-   function processScale($XMin,$XMax,$MaxDivs,$Factors,$AxisID)
2526
-    {
2258
+   function processScale($XMin,$XMax,$MaxDivs,$Factors,$AxisID) {
2527 2259
      $ScaleHeight = abs(ceil($XMax)-floor($XMin));
2528 2260
 
2529 2261
      if ( isset($this->DataSet->Data["Axis"][$AxisID]["Format"]) )
@@ -2537,15 +2269,11 @@  discard block
 block discarded – undo
2537 2269
       $Mode = AXIS_FORMAT_DEFAULT;
2538 2270
 
2539 2271
      $Scale = "";
2540
-     if ( $XMin != $XMax )
2541
-      {
2272
+     if ( $XMin != $XMax ) {
2542 2273
        $Found = FALSE; $Rescaled = FALSE; $Scaled10Factor = .0001; $Result = 0;
2543
-       while(!$Found)
2544
-        {
2545
-         foreach($Factors as $Key => $Factor)
2546
-          {
2547
-           if ( !$Found )
2548
-            {
2274
+       while(!$Found) {
2275
+         foreach($Factors as $Key => $Factor) {
2276
+           if ( !$Found ) {
2549 2277
              if ( !($this->modulo($XMin,$Factor*$Scaled10Factor) == 0) || ($XMin != floor($XMin))) { $XMinRescaled = floor($XMin/($Factor*$Scaled10Factor))*$Factor*$Scaled10Factor; } else { $XMinRescaled = $XMin; }
2550 2278
              if ( !($this->modulo($XMax,$Factor*$Scaled10Factor) == 0) || ($XMax != floor($XMax))) { $XMaxRescaled = floor($XMax/($Factor*$Scaled10Factor))*$Factor*$Scaled10Factor+($Factor*$Scaled10Factor); } else { $XMaxRescaled = $XMax; }
2551 2279
              $ScaleHeightRescaled = abs($XMaxRescaled-$XMinRescaled);
@@ -2567,16 +2295,12 @@  discard block
 block discarded – undo
2567 2295
        $Scale["Rows"] = $Rows; $Scale["RowHeight"] = $RowHeight; $Scale["XMin"] = $XMin;  $Scale["XMax"] = $XMax;
2568 2296
 
2569 2297
        /* Compute the needed decimals for the metric view to avoid repetition of the same X Axis labels */
2570
-       if ( $Mode == AXIS_FORMAT_METRIC && $Format == NULL )
2571
-        {
2298
+       if ( $Mode == AXIS_FORMAT_METRIC && $Format == NULL ) {
2572 2299
          $Done = FALSE; $GoodDecimals = 0;
2573
-         for($Decimals=0;$Decimals<=10;$Decimals++)
2574
-          {
2575
-           if ( !$Done )
2576
-            {
2300
+         for($Decimals=0;$Decimals<=10;$Decimals++) {
2301
+           if ( !$Done ) {
2577 2302
              $LastLabel = "zob"; $ScaleOK = TRUE;
2578
-             for($i=0;$i<=$Rows;$i++)
2579
-              {
2303
+             for($i=0;$i<=$Rows;$i++) {
2580 2304
                $Value = $XMin + $i*$RowHeight;
2581 2305
                $Label = $this->scaleFormat($Value,AXIS_FORMAT_METRIC,$Decimals);
2582 2306
 
@@ -2589,9 +2313,7 @@  discard block
 block discarded – undo
2589 2313
 
2590 2314
          $Scale["Format"] = $GoodDecimals;
2591 2315
         }
2592
-      }
2593
-     else
2594
-      {
2316
+      } else {
2595 2317
        /* If all values are the same we keep a +1/-1 scale */
2596 2318
        $Rows = 2; $XMin = $XMax-1; $XMax = $XMax+1; $RowHeight = 1;
2597 2319
 
@@ -2602,8 +2324,7 @@  discard block
 block discarded – undo
2602 2324
      return($Scale);
2603 2325
     }
2604 2326
 
2605
-   function modulo($Value1,$Value2)
2606
-    {
2327
+   function modulo($Value1,$Value2) {
2607 2328
      if (floor($Value2) == 0) { return(0); }
2608 2329
      if (floor($Value2) != 0) { return($Value1 % $Value2); }
2609 2330
 
@@ -2615,8 +2336,7 @@  discard block
 block discarded – undo
2615 2336
     }
2616 2337
 
2617 2338
    /* Draw an X threshold */
2618
-   function drawXThreshold($Value,$Format="")
2619
-    {
2339
+   function drawXThreshold($Value,$Format="") {
2620 2340
      $R			= isset($Format["R"]) ? $Format["R"] : 255;
2621 2341
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
2622 2342
      $B			= isset($Format["B"]) ? $Format["B"] : 0;
@@ -2655,8 +2375,7 @@  discard block
 block discarded – undo
2655 2375
 
2656 2376
      if ( is_array($Value) ) { foreach ($Value as $Key => $ID) { $this->drawXThreshold($ID,$Format); } return(0); }
2657 2377
 
2658
-     if ( $ValueIsLabel )
2659
-      {
2378
+     if ( $ValueIsLabel ) {
2660 2379
        $Format["ValueIsLabel"] = FALSE;
2661 2380
        foreach($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $SerieValue)
2662 2381
         { if ( $SerieValue == $Value ) { $this->drawXThreshold($Key,$Format); } }
@@ -2669,41 +2388,33 @@  discard block
 block discarded – undo
2669 2388
                               "BoxBorderR"=>$BoxBorderR,"BoxBorderG"=>$BoxBorderG,"BoxBorderB"=>$BoxBorderB,"BoxBorderAlpha"=>$BoxBorderAlpha,
2670 2389
                               "R"=>$CaptionR,"G"=>$CaptionG,"B"=>$CaptionB,"Alpha"=>$CaptionAlpha);
2671 2390
 
2672
-     if ( $Caption == NULL )
2673
-      {
2674
-       if ( isset($Data["Abscissa"]) )
2675
-        {
2391
+     if ( $Caption == NULL ) {
2392
+       if ( isset($Data["Abscissa"]) ) {
2676 2393
          if ( isset($Data["Series"][$Data["Abscissa"]]["Data"][$Value]) )
2677 2394
           $Caption = $Data["Series"][$Data["Abscissa"]]["Data"][$Value];
2678 2395
          else
2679 2396
           $Caption = $Value;
2680
-        }
2681
-       else
2397
+        } else
2682 2398
         $Caption = $Value;
2683 2399
       }
2684 2400
 
2685
-     if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
2686
-      {
2401
+     if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
2687 2402
        $XStep = (($this->GraphAreaX2 - $this->GraphAreaX1) - $XScale[0] *2 ) / $XScale[1];
2688 2403
        $XPos  = $this->GraphAreaX1 + $XScale[0] + $XStep * $Value;
2689 2404
        $YPos1 = $this->GraphAreaY1 + $Data["YMargin"];
2690 2405
        $YPos2 = $this->GraphAreaY2 - $Data["YMargin"];
2691 2406
 
2692
-       if ( $XPos >= $this->GraphAreaX1 + $AbscissaMargin && $XPos <= $this->GraphAreaX2 - $AbscissaMargin )
2693
-        {
2407
+       if ( $XPos >= $this->GraphAreaX1 + $AbscissaMargin && $XPos <= $this->GraphAreaX2 - $AbscissaMargin ) {
2694 2408
          $this->drawLine($XPos,$YPos1,$XPos,$YPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
2695 2409
 
2696
-         if ( $Wide )
2697
-          {
2410
+         if ( $Wide ) {
2698 2411
            $this->drawLine($XPos-1,$YPos1,$XPos-1,$YPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
2699 2412
            $this->drawLine($XPos+1,$YPos1,$XPos+1,$YPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
2700 2413
           }
2701 2414
 
2702
-         if ( $WriteCaption )
2703
-          {
2415
+         if ( $WriteCaption ) {
2704 2416
            if ( $CaptionAlign == CAPTION_LEFT_TOP )
2705
-            { $Y = $YPos1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
2706
-           else 
2417
+            { $Y = $YPos1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; } else 
2707 2418
             { $Y = $YPos2 - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
2708 2419
            
2709 2420
            $this->drawText($XPos,$Y,$Caption,$CaptionSettings);
@@ -2711,29 +2422,23 @@  discard block
 block discarded – undo
2711 2422
 
2712 2423
          return(array("X"=>$XPos));
2713 2424
         }
2714
-      }
2715
-     elseif( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
2716
-      {
2425
+      } elseif( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) {
2717 2426
        $XStep = (($this->GraphAreaY2 - $this->GraphAreaY1) - $XScale[0] *2 ) / $XScale[1];
2718 2427
        $XPos  = $this->GraphAreaY1 + $XScale[0] + $XStep * $Value;
2719 2428
        $YPos1 = $this->GraphAreaX1 + $Data["YMargin"];
2720 2429
        $YPos2 = $this->GraphAreaX2 - $Data["YMargin"];
2721 2430
 
2722
-       if ( $XPos >= $this->GraphAreaY1 + $AbscissaMargin && $XPos <= $this->GraphAreaY2 - $AbscissaMargin )
2723
-        {
2431
+       if ( $XPos >= $this->GraphAreaY1 + $AbscissaMargin && $XPos <= $this->GraphAreaY2 - $AbscissaMargin ) {
2724 2432
          $this->drawLine($YPos1,$XPos,$YPos2,$XPos,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
2725 2433
 
2726
-         if ( $Wide )
2727
-          {
2434
+         if ( $Wide ) {
2728 2435
            $this->drawLine($YPos1,$XPos-1,$YPos2,$XPos-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
2729 2436
            $this->drawLine($YPos1,$XPos+1,$YPos2,$XPos+1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
2730 2437
           }
2731 2438
 
2732
-         if ( $WriteCaption )
2733
-          {
2439
+         if ( $WriteCaption ) {
2734 2440
            if ( $CaptionAlign == CAPTION_LEFT_TOP )
2735
-            { $Y = $YPos1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
2736
-           else 
2441
+            { $Y = $YPos1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; } else 
2737 2442
             { $Y = $YPos2 - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
2738 2443
            
2739 2444
            $this->drawText($Y,$XPos,$Caption,$CaptionSettings);
@@ -2745,8 +2450,7 @@  discard block
 block discarded – undo
2745 2450
     }
2746 2451
 
2747 2452
    /* Draw an X threshold area */
2748
-   function drawXThresholdArea($Value1,$Value2,$Format="")
2749
-    {
2453
+   function drawXThresholdArea($Value1,$Value2,$Format="") {
2750 2454
      $R		= isset($Format["R"]) ? $Format["R"] : 255;
2751 2455
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
2752 2456
      $B		= isset($Format["B"]) ? $Format["B"] : 0;
@@ -2774,8 +2478,7 @@  discard block
 block discarded – undo
2774 2478
      $XScale         = $this->scaleGetXSettings();
2775 2479
      $AbscissaMargin = $this->getAbscissaMargin($Data);
2776 2480
 
2777
-     if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
2778
-      {
2481
+     if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
2779 2482
        $XStep = (($this->GraphAreaX2 - $this->GraphAreaX1) - $XScale[0] *2 ) / $XScale[1];
2780 2483
        $XPos1 = $this->GraphAreaX1 + $XScale[0] + $XStep * $Value1;
2781 2484
        $XPos2 = $this->GraphAreaX1 + $XScale[0] + $XStep * $Value2;
@@ -2789,19 +2492,16 @@  discard block
 block discarded – undo
2789 2492
 
2790 2493
        $this->drawFilledRectangle($XPos1,$YPos1,$XPos2,$YPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
2791 2494
 
2792
-       if ( $Border )
2793
-        {
2495
+       if ( $Border ) {
2794 2496
          $this->drawLine($XPos1,$YPos1,$XPos1,$YPos2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
2795 2497
          $this->drawLine($XPos2,$YPos1,$XPos2,$YPos2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
2796 2498
         }
2797 2499
 
2798
-       if ( $AreaName != NULL )
2799
-        {
2500
+       if ( $AreaName != NULL ) {
2800 2501
          $XPos = ($XPos2-$XPos1)/2 + $XPos1;
2801 2502
          $YPos = ($YPos2-$YPos1)/2 + $YPos1;
2802 2503
 
2803
-         if ( $NameAngle == ZONE_NAME_ANGLE_AUTO )
2804
-          {
2504
+         if ( $NameAngle == ZONE_NAME_ANGLE_AUTO ) {
2805 2505
            $TxtPos   = $this->getTextBox($XPos,$YPos,$this->FontName,$this->FontSize,0,$AreaName);
2806 2506
            $TxtWidth = $TxtPos[1]["X"] - $TxtPos[0]["X"];
2807 2507
            if ( abs($XPos2 - $XPos1) > $TxtWidth ) { $NameAngle = 0; } else { $NameAngle = 90; }
@@ -2813,9 +2513,7 @@  discard block
 block discarded – undo
2813 2513
 
2814 2514
        $this->Shadow = $RestoreShadow;
2815 2515
        return(array("X1"=>$XPos1,"X2"=>$XPos2));
2816
-      }
2817
-     elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
2818
-      {
2516
+      } elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) {
2819 2517
        $XStep = (($this->GraphAreaY2 - $this->GraphAreaY1) - $XScale[0] *2 ) / $XScale[1];
2820 2518
        $XPos1 = $this->GraphAreaY1 + $XScale[0] + $XStep * $Value1;
2821 2519
        $XPos2 = $this->GraphAreaY1 + $XScale[0] + $XStep * $Value2;
@@ -2829,14 +2527,12 @@  discard block
 block discarded – undo
2829 2527
 
2830 2528
        $this->drawFilledRectangle($YPos1,$XPos1,$YPos2,$XPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
2831 2529
 
2832
-       if ( $Border )
2833
-        {
2530
+       if ( $Border ) {
2834 2531
          $this->drawLine($YPos1,$XPos1,$YPos2,$XPos1,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
2835 2532
          $this->drawLine($YPos1,$XPos2,$YPos2,$XPos2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
2836 2533
         }
2837 2534
 
2838
-       if ( $AreaName != NULL )
2839
-        {
2535
+       if ( $AreaName != NULL ) {
2840 2536
          $XPos = ($XPos2-$XPos1)/2 + $XPos1;
2841 2537
          $YPos = ($YPos2-$YPos1)/2 + $YPos1;
2842 2538
 
@@ -2851,8 +2547,7 @@  discard block
 block discarded – undo
2851 2547
     }
2852 2548
 
2853 2549
    /* Draw an Y threshold with the computed scale */
2854
-   function drawThreshold($Value,$Format="")
2855
-    {
2550
+   function drawThreshold($Value,$Format="") {
2856 2551
      $AxisID		= isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
2857 2552
      $R			= isset($Format["R"]) ? $Format["R"] : 255;
2858 2553
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
@@ -2900,27 +2595,22 @@  discard block
 block discarded – undo
2900 2595
      if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); }
2901 2596
      if ( $Caption == NULL ) { $Caption = $Value; }
2902 2597
 
2903
-     if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
2904
-      {
2598
+     if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
2905 2599
        $YPos = $this->scaleComputeY($Value,array("AxisID"=>$AxisID));
2906
-       if ( $YPos >= $this->GraphAreaY1+$Data["Axis"][$AxisID]["Margin"] && $YPos <= $this->GraphAreaY2-$Data["Axis"][$AxisID]["Margin"] )
2907
-        {
2600
+       if ( $YPos >= $this->GraphAreaY1+$Data["Axis"][$AxisID]["Margin"] && $YPos <= $this->GraphAreaY2-$Data["Axis"][$AxisID]["Margin"] ) {
2908 2601
          $X1 = $this->GraphAreaX1 + $AbscissaMargin;
2909 2602
          $X2 = $this->GraphAreaX2 - $AbscissaMargin;
2910 2603
 
2911 2604
          $this->drawLine($X1,$YPos,$X2,$YPos,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
2912 2605
 
2913
-         if ( $Wide )
2914
-          {
2606
+         if ( $Wide ) {
2915 2607
            $this->drawLine($X1,$YPos-1,$X2,$YPos-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
2916 2608
            $this->drawLine($X1,$YPos+1,$X2,$YPos+1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
2917 2609
           }
2918 2610
 
2919
-         if ( $WriteCaption )
2920
-          {
2611
+         if ( $WriteCaption ) {
2921 2612
            if ( $CaptionAlign == CAPTION_LEFT_TOP )
2922
-            { $X = $X1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
2923
-           else 
2613
+            { $X = $X1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; } else 
2924 2614
             { $X = $X2 - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
2925 2615
            
2926 2616
            $this->drawText($X,$YPos,$Caption,$CaptionSettings);
@@ -2930,27 +2620,22 @@  discard block
 block discarded – undo
2930 2620
        return(array("Y"=>$YPos));
2931 2621
       }
2932 2622
 
2933
-     if ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
2934
-      {
2623
+     if ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) {
2935 2624
        $XPos = $this->scaleComputeY($Value,array("AxisID"=>$AxisID));
2936
-       if ( $XPos >= $this->GraphAreaX1+$Data["Axis"][$AxisID]["Margin"] && $XPos <= $this->GraphAreaX2-$Data["Axis"][$AxisID]["Margin"] )
2937
-        {
2625
+       if ( $XPos >= $this->GraphAreaX1+$Data["Axis"][$AxisID]["Margin"] && $XPos <= $this->GraphAreaX2-$Data["Axis"][$AxisID]["Margin"] ) {
2938 2626
          $Y1 = $this->GraphAreaY1 + $AbscissaMargin;
2939 2627
          $Y2 = $this->GraphAreaY2 - $AbscissaMargin;
2940 2628
 
2941 2629
          $this->drawLine($XPos,$Y1,$XPos,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
2942 2630
 
2943
-         if ( $Wide )
2944
-          {
2631
+         if ( $Wide ) {
2945 2632
            $this->drawLine($XPos-1,$Y1,$XPos-1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
2946 2633
            $this->drawLine($XPos+1,$Y1,$XPos+1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks));
2947 2634
           }
2948 2635
 
2949
-         if ( $WriteCaption )
2950
-          {
2636
+         if ( $WriteCaption ) {
2951 2637
            if ( $CaptionAlign == CAPTION_LEFT_TOP )
2952
-            { $Y = $Y1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
2953
-           else 
2638
+            { $Y = $Y1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; } else 
2954 2639
             { $Y = $Y2 - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
2955 2640
 
2956 2641
            $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE;
@@ -2963,8 +2648,7 @@  discard block
 block discarded – undo
2963 2648
     }
2964 2649
 
2965 2650
    /* Draw a threshold with the computed scale */
2966
-   function drawThresholdArea($Value1,$Value2,$Format="")
2967
-    {
2651
+   function drawThresholdArea($Value1,$Value2,$Format="") {
2968 2652
      $AxisID	= isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
2969 2653
      $R		= isset($Format["R"]) ? $Format["R"] : 255;
2970 2654
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
@@ -2998,8 +2682,7 @@  discard block
 block discarded – undo
2998 2682
      if ( $NoMargin ) { $AbscissaMargin = 0; }
2999 2683
      if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); }
3000 2684
 
3001
-     if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
3002
-      {
2685
+     if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
3003 2686
        $XPos1 = $this->GraphAreaX1 + $AbscissaMargin;
3004 2687
        $XPos2 = $this->GraphAreaX2 - $AbscissaMargin;
3005 2688
        $YPos1 = $this->scaleComputeY($Value1,array("AxisID"=>$AxisID));
@@ -3011,14 +2694,12 @@  discard block
 block discarded – undo
3011 2694
        if ( $YPos2 > $this->GraphAreaY2-$Data["Axis"][$AxisID]["Margin"] ) { $YPos2 = $this->GraphAreaY2-$Data["Axis"][$AxisID]["Margin"]; }
3012 2695
 
3013 2696
        $this->drawFilledRectangle($XPos1,$YPos1,$XPos2,$YPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
3014
-       if ( $Border )
3015
-        {
2697
+       if ( $Border ) {
3016 2698
          $this->drawLine($XPos1,$YPos1,$XPos2,$YPos1,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
3017 2699
          $this->drawLine($XPos1,$YPos2,$XPos2,$YPos2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
3018 2700
         }
3019 2701
 
3020
-       if ( $AreaName != NULL )
3021
-        {
2702
+       if ( $AreaName != NULL ) {
3022 2703
          $XPos = ($XPos2-$XPos1)/2 + $XPos1;
3023 2704
          $YPos = ($YPos2-$YPos1)/2 + $YPos1;
3024 2705
          $this->Shadow = $RestoreShadow;
@@ -3028,9 +2709,7 @@  discard block
 block discarded – undo
3028 2709
 
3029 2710
        $this->Shadow = $RestoreShadow;
3030 2711
        return(array("Y1"=>$YPos1,"Y2"=>$YPos2));
3031
-      }
3032
-     elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
3033
-      {
2712
+      } elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) {
3034 2713
        $YPos1 = $this->GraphAreaY1 + $AbscissaMargin;
3035 2714
        $YPos2 = $this->GraphAreaY2 - $AbscissaMargin;
3036 2715
        $XPos1 = $this->scaleComputeY($Value1,array("AxisID"=>$AxisID));
@@ -3042,19 +2721,16 @@  discard block
 block discarded – undo
3042 2721
        if ( $XPos2 > $this->GraphAreaX2-$Data["Axis"][$AxisID]["Margin"] ) { $XPos2 = $this->GraphAreaX2-$Data["Axis"][$AxisID]["Margin"]; }
3043 2722
 
3044 2723
        $this->drawFilledRectangle($XPos1,$YPos1,$XPos2,$YPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
3045
-       if ( $Border )
3046
-        {
2724
+       if ( $Border ) {
3047 2725
          $this->drawLine($XPos1,$YPos1,$XPos1,$YPos2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
3048 2726
          $this->drawLine($XPos2,$YPos1,$XPos2,$YPos2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks));
3049 2727
         }
3050 2728
 
3051
-       if ( $AreaName != NULL )
3052
-        {
2729
+       if ( $AreaName != NULL ) {
3053 2730
          $XPos = ($YPos2-$YPos1)/2 + $YPos1;
3054 2731
          $YPos = ($XPos2-$XPos1)/2 + $XPos1;
3055 2732
 
3056
-         if ( $NameAngle == ZONE_NAME_ANGLE_AUTO )
3057
-          {
2733
+         if ( $NameAngle == ZONE_NAME_ANGLE_AUTO ) {
3058 2734
            $TxtPos   = $this->getTextBox($XPos,$YPos,$this->FontName,$this->FontSize,0,$AreaName);
3059 2735
            $TxtWidth = $TxtPos[1]["X"] - $TxtPos[0]["X"];
3060 2736
            if ( abs($XPos2 - $XPos1) > $TxtWidth ) { $NameAngle = 0; } else { $NameAngle = 90; }
@@ -3069,13 +2745,10 @@  discard block
 block discarded – undo
3069 2745
       }
3070 2746
     }
3071 2747
 
3072
-   function scaleGetXSettings()
3073
-    {
2748
+   function scaleGetXSettings() {
3074 2749
      $Data = $this->DataSet->getData();
3075
-     foreach($Data["Axis"] as $AxisID => $Settings)
3076
-      {
3077
-       if ( $Settings["Identity"] == AXIS_X )
3078
-        {
2750
+     foreach($Data["Axis"] as $AxisID => $Settings) {
2751
+       if ( $Settings["Identity"] == AXIS_X ) {
3079 2752
          $Rows = $Settings["Rows"];
3080 2753
 
3081 2754
          return(array($Settings["Margin"],$Rows));
@@ -3083,8 +2756,7 @@  discard block
 block discarded – undo
3083 2756
       }
3084 2757
     }
3085 2758
 
3086
-   function scaleComputeY($Values,$Option="",$ReturnOnly0Height=FALSE)
3087
-    {
2759
+   function scaleComputeY($Values,$Option="",$ReturnOnly0Height=FALSE) {
3088 2760
      $AxisID	= isset($Option["AxisID"]) ? $Option["AxisID"] : 0;
3089 2761
      $SerieName	= isset($Option["SerieName"]) ? $Option["SerieName"] : NULL;
3090 2762
 
@@ -3095,26 +2767,21 @@  discard block
 block discarded – undo
3095 2767
      if ( !is_array($Values) ) { $tmp = $Values; $Values = ""; $Values[0] = $tmp; }
3096 2768
 
3097 2769
      $Result = "";
3098
-     if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
3099
-      {
2770
+     if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
3100 2771
        $Height      = ($this->GraphAreaY2 - $this->GraphAreaY1) - $Data["Axis"][$AxisID]["Margin"]*2;
3101 2772
        $ScaleHeight = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"];
3102 2773
        $Step        = $Height / $ScaleHeight;
3103 2774
 
3104 2775
        if ( $ReturnOnly0Height )
3105
-        { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $Step * $Value; } } }
3106
-       else
2776
+        { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $Step * $Value; } } } else
3107 2777
         { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $this->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"] - ($Step * ($Value-$Data["Axis"][$AxisID]["ScaleMin"])); } } }
3108
-      }
3109
-     else
3110
-      {
2778
+      } else {
3111 2779
        $Width      = ($this->GraphAreaX2 - $this->GraphAreaX1) - $Data["Axis"][$AxisID]["Margin"]*2;
3112 2780
        $ScaleWidth = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"];
3113 2781
        $Step       = $Width / $ScaleWidth;
3114 2782
 
3115 2783
        if ( $ReturnOnly0Height )
3116
-        { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $Step * $Value; } } }
3117
-       else
2784
+        { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $Step * $Value; } } } else
3118 2785
         { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $this->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"] + ($Step * ($Value-$Data["Axis"][$AxisID]["ScaleMin"])); } } }
3119 2786
       }
3120 2787
 
@@ -3125,8 +2792,7 @@  discard block
 block discarded – undo
3125 2792
     }
3126 2793
 
3127 2794
    /* Format the axis values */
3128
-   function scaleFormat($Value,$Mode=NULL,$Format=NULL,$Unit=NULL)
3129
-    {
2795
+   function scaleFormat($Value,$Mode=NULL,$Format=NULL,$Unit=NULL) {
3130 2796
      if ( $Value == VOID ) { return(""); }
3131 2797
 
3132 2798
      if ( $Mode == AXIS_FORMAT_CUSTOM )
@@ -3141,8 +2807,7 @@  discard block
 block discarded – undo
3141 2807
      if ( $Mode == AXIS_FORMAT_CURRENCY )
3142 2808
       { return($Format.number_format($Value,2)); }
3143 2809
 
3144
-     if ( $Mode == AXIS_FORMAT_METRIC )
3145
-      {
2810
+     if ( $Mode == AXIS_FORMAT_METRIC ) {
3146 2811
        if (abs($Value) > 1000000000)
3147 2812
         return(round($Value/1000000000,$Format)."g".$Unit);
3148 2813
        if (abs($Value) > 1000000)
@@ -3155,8 +2820,7 @@  discard block
 block discarded – undo
3155 2820
     }
3156 2821
 
3157 2822
    /* Write Max value on a chart */
3158
-   function writeBounds($Type=BOUND_BOTH,$Format=NULL)
3159
-    {
2823
+   function writeBounds($Type=BOUND_BOTH,$Format=NULL) {
3160 2824
      $MaxLabelTxt	= isset($Format["MaxLabelTxt"]) ? $Format["MaxLabelTxt"] : "max=";
3161 2825
      $MinLabelTxt	= isset($Format["MinLabelTxt"]) ? $Format["MinLabelTxt"] : "min=";
3162 2826
      $Decimals		= isset($Format["Decimals"]) ? $Format["Decimals"] : 1;
@@ -3193,10 +2857,8 @@  discard block
 block discarded – undo
3193 2857
      list($XMargin,$XDivs) = $this->scaleGetXSettings();
3194 2858
 
3195 2859
      $Data = $this->DataSet->getData();
3196
-     foreach($Data["Series"] as $SerieName => $Serie)
3197
-      {
3198
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] && !isset($ExcludedSeries[$SerieName]))
3199
-        {
2860
+     foreach($Data["Series"] as $SerieName => $Serie) {
2861
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] && !isset($ExcludedSeries[$SerieName])) {
3200 2862
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"];
3201 2863
          if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; }
3202 2864
 
@@ -3204,8 +2866,7 @@  discard block
 block discarded – undo
3204 2866
          $MaxValue = $this->DataSet->getMax($SerieName);
3205 2867
 
3206 2868
          $MinPos = VOID; $MaxPos = VOID;
3207
-         foreach($Serie["Data"] as $Key => $Value)
3208
-          { 
2869
+         foreach($Serie["Data"] as $Key => $Value) {
3209 2870
            if ( $Value == $MinValue && $MinPos == VOID ) { $MinPos = $Key; }
3210 2871
            if ( $Value == $MaxValue ) { $MaxPos = $Key; }
3211 2872
           }
@@ -3217,14 +2878,12 @@  discard block
 block discarded – undo
3217 2878
 
3218 2879
          $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"]));
3219 2880
 
3220
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
3221
-          {
2881
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
3222 2882
            $XStep       = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs;
3223 2883
            $X           = $this->GraphAreaX1 + $XMargin;
3224 2884
            $SerieOffset = isset($Serie["XOffset"]) ? $Serie["XOffset"] : 0;
3225 2885
 
3226
-           if ( $Type == BOUND_MAX || $Type == BOUND_BOTH )
3227
-            {
2886
+           if ( $Type == BOUND_MAX || $Type == BOUND_BOTH ) {
3228 2887
              if ( $MaxLabelPos == BOUND_LABEL_POS_TOP    || ( $MaxLabelPos ==  BOUND_LABEL_POS_AUTO && $MaxValue >= 0) ) { $YPos  = $PosArray[$MaxPos] - $DisplayOffset + 2; $Align = TEXT_ALIGN_BOTTOMMIDDLE; }
3229 2888
              if ( $MaxLabelPos == BOUND_LABEL_POS_BOTTOM || ( $MaxLabelPos ==  BOUND_LABEL_POS_AUTO && $MaxValue < 0) ) { $YPos  = $PosArray[$MaxPos] + $DisplayOffset + 2; $Align = TEXT_ALIGN_TOPMIDDLE; }
3230 2889
 
@@ -3244,8 +2903,7 @@  discard block
 block discarded – undo
3244 2903
              $this->drawText($XPos+$XOffset,$YPos+$YOffset,$Label,$CaptionSettings);
3245 2904
             }
3246 2905
 
3247
-           if ( $Type == BOUND_MIN || $Type == BOUND_BOTH )
3248
-            {
2906
+           if ( $Type == BOUND_MIN || $Type == BOUND_BOTH ) {
3249 2907
              if ( $MinLabelPos == BOUND_LABEL_POS_TOP    || ( $MinLabelPos ==  BOUND_LABEL_POS_AUTO && $MinValue >= 0) ) { $YPos  = $PosArray[$MinPos] - $DisplayOffset + 2; $Align = TEXT_ALIGN_BOTTOMMIDDLE; }
3250 2908
              if ( $MinLabelPos == BOUND_LABEL_POS_BOTTOM || ( $MinLabelPos ==  BOUND_LABEL_POS_AUTO && $MinValue < 0) ) { $YPos  = $PosArray[$MinPos] + $DisplayOffset + 2; $Align = TEXT_ALIGN_TOPMIDDLE; }
3251 2909
 
@@ -3264,15 +2922,12 @@  discard block
 block discarded – undo
3264 2922
 
3265 2923
              $this->drawText($XPos+$XOffset,$YPos-$DisplayOffset+$YOffset,$Label,$CaptionSettings);
3266 2924
             }
3267
-          }
3268
-         else
3269
-          {
2925
+          } else {
3270 2926
            $XStep       = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs;
3271 2927
            $X           = $this->GraphAreaY1 + $XMargin;
3272 2928
            $SerieOffset = isset($Serie["XOffset"]) ? $Serie["XOffset"] : 0;
3273 2929
 
3274
-           if ( $Type == BOUND_MAX || $Type == BOUND_BOTH )
3275
-            {
2930
+           if ( $Type == BOUND_MAX || $Type == BOUND_BOTH ) {
3276 2931
              if ( $MaxLabelPos == BOUND_LABEL_POS_TOP    || ( $MaxLabelPos ==  BOUND_LABEL_POS_AUTO && $MaxValue >= 0) ) { $YPos  = $PosArray[$MaxPos] + $DisplayOffset + 2; $Align = TEXT_ALIGN_MIDDLELEFT; }
3277 2932
              if ( $MaxLabelPos == BOUND_LABEL_POS_BOTTOM || ( $MaxLabelPos ==  BOUND_LABEL_POS_AUTO && $MaxValue < 0) ) { $YPos  = $PosArray[$MaxPos] - $DisplayOffset + 2; $Align = TEXT_ALIGN_MIDDLERIGHT; }
3278 2933
 
@@ -3292,8 +2947,7 @@  discard block
 block discarded – undo
3292 2947
              $this->drawText($YPos+$XOffset,$XPos+$YOffset,$Label,$CaptionSettings);
3293 2948
             }
3294 2949
 
3295
-           if ( $Type == BOUND_MIN || $Type == BOUND_BOTH )
3296
-            {
2950
+           if ( $Type == BOUND_MIN || $Type == BOUND_BOTH ) {
3297 2951
              if ( $MinLabelPos == BOUND_LABEL_POS_TOP    || ( $MinLabelPos ==  BOUND_LABEL_POS_AUTO && $MinValue >= 0) ) { $YPos  = $PosArray[$MinPos] + $DisplayOffset + 2; $Align = TEXT_ALIGN_MIDDLELEFT; }
3298 2952
              if ( $MinLabelPos == BOUND_LABEL_POS_BOTTOM || ( $MinLabelPos ==  BOUND_LABEL_POS_AUTO && $MinValue < 0) ) { $YPos  = $PosArray[$MinPos] - $DisplayOffset + 2; $Align = TEXT_ALIGN_MIDDLERIGHT; }
3299 2953
 
@@ -3318,8 +2972,7 @@  discard block
 block discarded – undo
3318 2972
     }
3319 2973
 
3320 2974
    /* Draw a plot chart */
3321
-   function drawPlotChart($Format=NULL)
3322
-    {
2975
+   function drawPlotChart($Format=NULL) {
3323 2976
      $PlotSize		= isset($Format["PlotSize"]) ? $Format["PlotSize"] : NULL;
3324 2977
      $PlotBorder	= isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : FALSE;
3325 2978
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 50;
@@ -3341,18 +2994,15 @@  discard block
 block discarded – undo
3341 2994
      $Data = $this->DataSet->getData();
3342 2995
      list($XMargin,$XDivs) = $this->scaleGetXSettings();
3343 2996
 
3344
-     foreach($Data["Series"] as $SerieName => $Serie)
3345
-      {
3346
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
3347
-        {
2997
+     foreach($Data["Series"] as $SerieName => $Serie) {
2998
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
3348 2999
          if ( isset($Serie["Weight"]) ) { $SerieWeight = $Serie["Weight"] + 2; } else { $SerieWeight = 2; }
3349 3000
          if ( $PlotSize != NULL ) { $SerieWeight = $PlotSize; }
3350 3001
 
3351 3002
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"];
3352 3003
          if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
3353 3004
          if ( isset($Serie["Picture"]) )
3354
-          { $Picture = $Serie["Picture"]; list($PicWidth,$PicHeight,$PicType) = $this->getPicInfo($Picture); }
3355
-         else { $Picture = NULL; $PicOffset = 0; }
3005
+          { $Picture = $Serie["Picture"]; list($PicWidth,$PicHeight,$PicType) = $this->getPicInfo($Picture); } else { $Picture = NULL; $PicOffset = 0; }
3356 3006
 
3357 3007
          if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; }
3358 3008
 
@@ -3368,49 +3018,40 @@  discard block
 block discarded – undo
3368 3018
 
3369 3019
          $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0;
3370 3020
 
3371
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
3372
-          {
3021
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
3373 3022
            if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; }
3374 3023
            if ( $Picture != NULL ) { $PicOffset = $PicHeight / 2; $SerieWeight = 0; }
3375 3024
            $X = $this->GraphAreaX1 + $XMargin;
3376 3025
 
3377 3026
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
3378
-           foreach($PosArray as $Key => $Y)
3379
-            {
3027
+           foreach($PosArray as $Key => $Y) {
3380 3028
              if ( $DisplayValues ) 
3381 3029
               $this->drawText($X,$Y-$DisplayOffset-$SerieWeight-$BorderSize-$PicOffset,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
3382 3030
 
3383
-             if ( $Y != VOID )
3384
-              {
3031
+             if ( $Y != VOID ) {
3385 3032
                if ( $RecordImageMap ) { $this->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$SerieWeight,$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
3386 3033
 
3387 3034
                if ( $Picture != NULL )
3388
-                { $this->drawFromPicture($PicType,$Picture,$X-$PicWidth/2,$Y-$PicHeight/2); }
3389
-               else
3035
+                { $this->drawFromPicture($PicType,$Picture,$X-$PicWidth/2,$Y-$PicHeight/2); } else
3390 3036
                 { $this->drawShape($X,$Y,$Shape,$SerieWeight,$PlotBorder,$BorderSize,$R,$G,$B,$Alpha,$BorderR,$BorderG,$BorderB,$BorderAlpha); }
3391 3037
               }
3392 3038
              $X = $X + $XStep;
3393 3039
             }
3394
-          }
3395
-         else
3396
-          {
3040
+          } else {
3397 3041
            if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; }
3398 3042
            if ( $Picture != NULL ) { $PicOffset = $PicWidth / 2; $SerieWeight = 0; }
3399 3043
            $Y = $this->GraphAreaY1 + $XMargin;
3400 3044
 
3401 3045
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
3402
-           foreach($PosArray as $Key => $X)
3403
-            {
3046
+           foreach($PosArray as $Key => $X) {
3404 3047
              if ( $DisplayValues ) 
3405 3048
               $this->drawText($X+$DisplayOffset+$SerieWeight+$BorderSize+$PicOffset,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("Angle"=>270,"R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
3406 3049
 
3407
-             if ( $X != VOID )
3408
-              {
3050
+             if ( $X != VOID ) {
3409 3051
                if ( $RecordImageMap ) { $this->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$SerieWeight,$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
3410 3052
 
3411 3053
                if ( $Picture != NULL )
3412
-                { $this->drawFromPicture($PicType,$Picture,$X-$PicWidth/2,$Y-$PicHeight/2); }
3413
-               else
3054
+                { $this->drawFromPicture($PicType,$Picture,$X-$PicWidth/2,$Y-$PicHeight/2); } else
3414 3055
                 { $this->drawShape($X,$Y,$Shape,$SerieWeight,$PlotBorder,$BorderSize,$R,$G,$B,$Alpha,$BorderR,$BorderG,$BorderB,$BorderAlpha); }
3415 3056
               }
3416 3057
              $Y = $Y + $YStep;
@@ -3421,8 +3062,7 @@  discard block
 block discarded – undo
3421 3062
     }
3422 3063
 
3423 3064
    /* Draw a spline chart */
3424
-   function drawSplineChart($Format=NULL)
3425
-    {
3065
+   function drawSplineChart($Format=NULL) {
3426 3066
      $BreakVoid		= isset($Format["BreakVoid"]) ? $Format["BreakVoid"] : TRUE;
3427 3067
      $VoidTicks		= isset($Format["VoidTicks"]) ? $Format["VoidTicks"] : 4;
3428 3068
      $BreakR		= isset($Format["BreakR"]) ? $Format["BreakR"] : NULL; // 234
@@ -3441,10 +3081,8 @@  discard block
 block discarded – undo
3441 3081
 
3442 3082
      $Data = $this->DataSet->getData();
3443 3083
      list($XMargin,$XDivs) = $this->scaleGetXSettings();
3444
-     foreach($Data["Series"] as $SerieName => $Serie)
3445
-      {
3446
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
3447
-        {
3084
+     foreach($Data["Series"] as $SerieName => $Serie) {
3085
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
3448 3086
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"];
3449 3087
 
3450 3088
          if ( $BreakR == NULL )
@@ -3465,16 +3103,14 @@  discard block
 block discarded – undo
3465 3103
 
3466 3104
          $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0;
3467 3105
 
3468
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
3469
-          {
3106
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
3470 3107
            if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; }
3471 3108
            $X     = $this->GraphAreaX1 + $XMargin; $WayPoints = "";
3472 3109
            $Force = $XStep / 5;
3473 3110
 
3474 3111
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
3475 3112
            $LastGoodY = NULL; $LastGoodX = NULL; $LastX = 1; $LastY = 1;
3476
-           foreach($PosArray as $Key => $Y)
3477
-            {
3113
+           foreach($PosArray as $Key => $Y) {
3478 3114
              if ( $DisplayValues ) 
3479 3115
               $this->drawText($X,$Y-$DisplayOffset,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
3480 3116
 	
@@ -3496,17 +3132,14 @@  discard block
 block discarded – undo
3496 3132
              $X = $X + $XStep;
3497 3133
             }
3498 3134
            $this->drawSpline($WayPoints,array("Force"=>$Force,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
3499
-          }
3500
-         else
3501
-          {
3135
+          } else {
3502 3136
            if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; }
3503 3137
            $Y     = $this->GraphAreaY1 + $XMargin; $WayPoints = "";
3504 3138
            $Force = $YStep / 5;
3505 3139
 
3506 3140
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
3507 3141
            $LastGoodY = NULL; $LastGoodX = NULL; $LastX = 1; $LastY = 1;
3508
-           foreach($PosArray as $Key => $X)
3509
-            {
3142
+           foreach($PosArray as $Key => $X) {
3510 3143
              if ( $DisplayValues ) 
3511 3144
               $this->drawText($X+$DisplayOffset,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("Angle"=>270,"R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
3512 3145
 
@@ -3534,8 +3167,7 @@  discard block
 block discarded – undo
3534 3167
     }
3535 3168
 
3536 3169
    /* Draw a filled spline chart */
3537
-   function drawFilledSplineChart($Format=NULL)
3538
-    {
3170
+   function drawFilledSplineChart($Format=NULL) {
3539 3171
      $DisplayValues	= isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE;
3540 3172
      $DisplayOffset	= isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2;
3541 3173
      $DisplayColor	= isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL;
@@ -3549,10 +3181,8 @@  discard block
 block discarded – undo
3549 3181
 
3550 3182
      $Data = $this->DataSet->getData();
3551 3183
      list($XMargin,$XDivs) = $this->scaleGetXSettings();
3552
-     foreach($Data["Series"] as $SerieName => $Serie)
3553
-      {
3554
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
3555
-        {
3184
+     foreach($Data["Series"] as $SerieName => $Serie) {
3185
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
3556 3186
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"];
3557 3187
          if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; }
3558 3188
 
@@ -3564,10 +3194,8 @@  discard block
 block discarded – undo
3564 3194
          $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"]));
3565 3195
          if ( $AroundZero ) { $YZero = $this->scaleComputeY(0,array("AxisID"=>$Serie["Axis"])); }
3566 3196
 
3567
-         if ( $Threshold != NULL )
3568
-          {
3569
-           foreach($Threshold as $Key => $Params)
3570
-            {
3197
+         if ( $Threshold != NULL ) {
3198
+           foreach($Threshold as $Key => $Params) {
3571 3199
              $Threshold[$Key]["MinX"] = $this->scaleComputeY($Params["Min"],array("AxisID"=>$Serie["Axis"]));
3572 3200
              $Threshold[$Key]["MaxX"] = $this->scaleComputeY($Params["Max"],array("AxisID"=>$Serie["Axis"]));
3573 3201
             }
@@ -3575,8 +3203,7 @@  discard block
 block discarded – undo
3575 3203
 
3576 3204
          $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0;
3577 3205
 
3578
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
3579
-          {
3206
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
3580 3207
            if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; }
3581 3208
            $X     = $this->GraphAreaX1 + $XMargin; $WayPoints = "";
3582 3209
            $Force = $XStep / 5;
@@ -3587,22 +3214,17 @@  discard block
 block discarded – undo
3587 3214
 
3588 3215
            $LastX = ""; $LastY = "";
3589 3216
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
3590
-           foreach($PosArray as $Key => $Y)
3591
-            {
3217
+           foreach($PosArray as $Key => $Y) {
3592 3218
              if ( $DisplayValues ) 
3593 3219
               $this->drawText($X,$Y-$DisplayOffset,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
3594 3220
 
3595
-             if ( $Y == VOID )
3596
-              {
3221
+             if ( $Y == VOID ) {
3597 3222
                $Area = $this->drawSpline($WayPoints,array("Force"=>$Force,"PathOnly"=>TRUE));
3598 3223
 
3599
-               if ( $Area != "" )
3600
-                {
3601
-                 foreach ($Area as $key => $Points)
3602
-                  {
3224
+               if ( $Area != "" ) {
3225
+                 foreach ($Area as $key => $Points) {
3603 3226
                    $Corners = ""; $Corners[] = $Area[$key][0]["X"]; $Corners[] = $YZero;
3604
-                   foreach($Points as $subKey => $Point)
3605
-                    {
3227
+                   foreach($Points as $subKey => $Point) {
3606 3228
                      if ( $subKey == count($Points)-1) { $Corners[] = $Point["X"]-1; } else { $Corners[] = $Point["X"]; }
3607 3229
                      $Corners[] = $Point["Y"]+1;
3608 3230
                     }
@@ -3614,21 +3236,17 @@  discard block
 block discarded – undo
3614 3236
                 }
3615 3237
 
3616 3238
                $WayPoints = "";
3617
-              }
3618
-             else
3239
+              } else
3619 3240
               $WayPoints[] = array($X,$Y-.5); /* -.5 for AA visual fix */
3620 3241
 
3621 3242
              $X = $X + $XStep;
3622 3243
             }
3623 3244
            $Area = $this->drawSpline($WayPoints,array("Force"=>$Force,"PathOnly"=>TRUE));
3624 3245
 
3625
-           if ( $Area != "" )
3626
-            {
3627
-             foreach ($Area as $key => $Points)
3628
-              {
3246
+           if ( $Area != "" ) {
3247
+             foreach ($Area as $key => $Points) {
3629 3248
                $Corners = ""; $Corners[] = $Area[$key][0]["X"]; $Corners[] = $YZero;
3630
-               foreach($Points as $subKey => $Point)
3631
-                {
3249
+               foreach($Points as $subKey => $Point) {
3632 3250
                  if ( $subKey == count($Points)-1) { $Corners[] = $Point["X"]-1; } else { $Corners[] = $Point["X"]; }
3633 3251
                  $Corners[] = $Point["Y"]+1;
3634 3252
                 }
@@ -3638,9 +3256,7 @@  discard block
 block discarded – undo
3638 3256
               }
3639 3257
              $this->drawSpline($WayPoints,array("Force"=>$Force,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks));
3640 3258
             }
3641
-          }
3642
-         else
3643
-          {
3259
+          } else {
3644 3260
            if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; }
3645 3261
            $Y     = $this->GraphAreaY1 + $XMargin; $WayPoints = "";
3646 3262
            $Force = $YStep / 5;
@@ -3650,22 +3266,17 @@  discard block
 block discarded – undo
3650 3266
            if ( $YZero < $this->GraphAreaX1+1 ) { $YZero = $this->GraphAreaX1+1; }
3651 3267
 
3652 3268
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
3653
-           foreach($PosArray as $Key => $X)
3654
-            {
3269
+           foreach($PosArray as $Key => $X) {
3655 3270
              if ( $DisplayValues ) 
3656 3271
               $this->drawText($X+$DisplayOffset,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("Angle"=>270,"R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
3657 3272
 
3658
-             if ( $X == VOID )
3659
-              {
3273
+             if ( $X == VOID ) {
3660 3274
                $Area = $this->drawSpline($WayPoints,array("Force"=>$Force,"PathOnly"=>TRUE));
3661 3275
 
3662
-               if ( $Area != "" )
3663
-                {
3664
-                 foreach ($Area as $key => $Points)
3665
-                  {
3276
+               if ( $Area != "" ) {
3277
+                 foreach ($Area as $key => $Points) {
3666 3278
                    $Corners = ""; $Corners[] = $YZero; $Corners[] = $Area[$key][0]["Y"];
3667
-                   foreach($Points as $subKey => $Point)
3668
-                    {
3279
+                   foreach($Points as $subKey => $Point) {
3669 3280
                      if ( $subKey == count($Points)-1) { $Corners[] = $Point["X"]-1; } else { $Corners[] = $Point["X"]; }
3670 3281
                      $Corners[] = $Point["Y"];
3671 3282
                     }
@@ -3677,21 +3288,17 @@  discard block
 block discarded – undo
3677 3288
                 }
3678 3289
 
3679 3290
                $WayPoints = "";
3680
-              }
3681
-             else
3291
+              } else
3682 3292
               $WayPoints[] = array($X,$Y);
3683 3293
 
3684 3294
              $Y = $Y + $YStep;
3685 3295
             }
3686 3296
            $Area = $this->drawSpline($WayPoints,array("Force"=>$Force,"PathOnly"=>TRUE));
3687 3297
 
3688
-           if ( $Area != "" )
3689
-            {
3690
-             foreach ($Area as $key => $Points)
3691
-              {
3298
+           if ( $Area != "" ) {
3299
+             foreach ($Area as $key => $Points) {
3692 3300
                $Corners = ""; $Corners[] = $YZero; $Corners[] = $Area[$key][0]["Y"];
3693
-               foreach($Points as $subKey => $Point)
3694
-                {
3301
+               foreach($Points as $subKey => $Point) {
3695 3302
                  if ( $subKey == count($Points)-1) { $Corners[] = $Point["X"]-1; } else { $Corners[] = $Point["X"]; }
3696 3303
                  $Corners[] = $Point["Y"];
3697 3304
                 }
@@ -3708,8 +3315,7 @@  discard block
 block discarded – undo
3708 3315
     }
3709 3316
 
3710 3317
    /* Draw a line chart */
3711
-   function drawLineChart($Format=NULL)
3712
-    {
3318
+   function drawLineChart($Format=NULL) {
3713 3319
      $BreakVoid		= isset($Format["BreakVoid"]) ? $Format["BreakVoid"] : TRUE;
3714 3320
      $VoidTicks		= isset($Format["VoidTicks"]) ? $Format["VoidTicks"] : 4;
3715 3321
      $BreakR		= isset($Format["BreakR"]) ? $Format["BreakR"] : NULL;
@@ -3733,10 +3339,8 @@  discard block
 block discarded – undo
3733 3339
 
3734 3340
      $Data = $this->DataSet->getData();
3735 3341
      list($XMargin,$XDivs) = $this->scaleGetXSettings();
3736
-     foreach($Data["Series"] as $SerieName => $Serie)
3737
-      {
3738
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
3739
-        {
3342
+     foreach($Data["Series"] as $SerieName => $Serie) {
3343
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
3740 3344
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"];
3741 3345
 
3742 3346
          if ( $ForceColor )
@@ -3760,17 +3364,14 @@  discard block
 block discarded – undo
3760 3364
 
3761 3365
          $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0;
3762 3366
 
3763
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
3764
-          {
3367
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
3765 3368
            if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; }
3766 3369
            $X = $this->GraphAreaX1 + $XMargin; $LastX = NULL; $LastY = NULL;
3767 3370
 
3768 3371
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
3769 3372
            $LastGoodY = NULL; $LastGoodX = NULL;
3770
-           foreach($PosArray as $Key => $Y)
3771
-            {
3772
-             if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) 
3773
-              {
3373
+           foreach($PosArray as $Key => $Y) {
3374
+             if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) {
3774 3375
                if ( $Serie["Data"][$Key] > 0 ) { $Align = TEXT_ALIGN_BOTTOMMIDDLE; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_TOPMIDDLE; $Offset = -$DisplayOffset; }
3775 3376
                $this->drawText($X,$Y-$Offset-$Weight,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align));
3776 3377
               }
@@ -3789,16 +3390,13 @@  discard block
 block discarded – undo
3789 3390
              $LastX = $X; $LastY = $Y;
3790 3391
              $X = $X + $XStep;
3791 3392
             }
3792
-          }
3793
-         else
3794
-          {
3393
+          } else {
3795 3394
            if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; }
3796 3395
            $Y = $this->GraphAreaY1 + $XMargin; $LastX = NULL; $LastY = NULL;
3797 3396
 
3798 3397
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
3799 3398
            $LastGoodY = NULL; $LastGoodX = NULL;
3800
-           foreach($PosArray as $Key => $X)
3801
-            {
3399
+           foreach($PosArray as $Key => $X) {
3802 3400
              if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) 
3803 3401
               { $this->drawText($X+$DisplayOffset+$Weight,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("Angle"=>270,"R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); }
3804 3402
 
@@ -3822,8 +3420,7 @@  discard block
 block discarded – undo
3822 3420
     }
3823 3421
 
3824 3422
    /* Draw a line chart */
3825
-   function drawZoneChart($SerieA,$SerieB,$Format=NULL)
3826
-    {
3423
+   function drawZoneChart($SerieA,$SerieB,$Format=NULL) {
3827 3424
      $AxisID	= isset($Format["AxisID"]) ? $Format["AxisID"] : 0;
3828 3425
      $LineR	= isset($Format["LineR"]) ? $Format["LineR"] : 150;
3829 3426
      $LineG	= isset($Format["LineG"]) ? $Format["LineG"] : 150;
@@ -3852,15 +3449,13 @@  discard block
 block discarded – undo
3852 3449
      $PosArrayB = $this->scaleComputeY($SerieBData,array("AxisID"=>$AxisID));
3853 3450
      if ( count($PosArrayA) != count($PosArrayB) ) { return(0); }
3854 3451
 
3855
-     if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
3856
-      {
3452
+     if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
3857 3453
        if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; }
3858 3454
        $X = $this->GraphAreaX1 + $XMargin; $LastX = NULL; $LastY = NULL;
3859 3455
 
3860 3456
        $LastX = NULL; $LastY1 = NULL; $LastY2 = NULL;
3861 3457
        $BoundsA = ""; $BoundsB = "";
3862
-       foreach($PosArrayA as $Key => $Y1)
3863
-        {
3458
+       foreach($PosArrayA as $Key => $Y1) {
3864 3459
          $Y2 = $PosArrayB[$Key];
3865 3460
 
3866 3461
          $BoundsA[] = $X; $BoundsA[] = $Y1;
@@ -3874,21 +3469,17 @@  discard block
 block discarded – undo
3874 3469
        $Bounds = array_merge($BoundsA,$this->reversePlots($BoundsB));
3875 3470
        $this->drawPolygonChart($Bounds,array("R"=>$AreaR,"G"=>$AreaG,"B"=>$AreaB,"Alpha"=>$AreaAlpha));
3876 3471
 
3877
-       for($i=0;$i<=count($BoundsA)-4;$i=$i+2)
3878
-        {
3472
+       for($i=0;$i<=count($BoundsA)-4;$i=$i+2) {
3879 3473
          $this->drawLine($BoundsA[$i],$BoundsA[$i+1],$BoundsA[$i+2],$BoundsA[$i+3],array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha,"Ticks"=>$LineTicks));
3880 3474
          $this->drawLine($BoundsB[$i],$BoundsB[$i+1],$BoundsB[$i+2],$BoundsB[$i+3],array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha,"Ticks"=>$LineTicks));
3881 3475
         }
3882
-      }
3883
-     else
3884
-      {
3476
+      } else {
3885 3477
        if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; }
3886 3478
        $Y = $this->GraphAreaY1 + $XMargin; $LastX = NULL; $LastY = NULL;
3887 3479
 
3888 3480
        $LastY = NULL; $LastX1 = NULL; $LastX2 = NULL;
3889 3481
        $BoundsA = ""; $BoundsB = "";
3890
-       foreach($PosArrayA as $Key => $X1)
3891
-        {
3482
+       foreach($PosArrayA as $Key => $X1) {
3892 3483
          $X2 = $PosArrayB[$Key];
3893 3484
 
3894 3485
          $BoundsA[] = $X1; $BoundsA[] = $Y;
@@ -3902,8 +3493,7 @@  discard block
 block discarded – undo
3902 3493
        $Bounds = array_merge($BoundsA,$this->reversePlots($BoundsB));
3903 3494
        $this->drawPolygonChart($Bounds,array("R"=>$AreaR,"G"=>$AreaG,"B"=>$AreaB,"Alpha"=>$AreaAlpha));
3904 3495
 
3905
-       for($i=0;$i<=count($BoundsA)-4;$i=$i+2)
3906
-        {
3496
+       for($i=0;$i<=count($BoundsA)-4;$i=$i+2) {
3907 3497
          $this->drawLine($BoundsA[$i],$BoundsA[$i+1],$BoundsA[$i+2],$BoundsA[$i+3],array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha,"Ticks"=>$LineTicks));
3908 3498
          $this->drawLine($BoundsB[$i],$BoundsB[$i+1],$BoundsB[$i+2],$BoundsB[$i+3],array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha,"Ticks"=>$LineTicks));
3909 3499
         }
@@ -3911,8 +3501,7 @@  discard block
 block discarded – undo
3911 3501
     }
3912 3502
 
3913 3503
    /* Draw a step chart */
3914
-   function drawStepChart($Format=NULL)
3915
-    {
3504
+   function drawStepChart($Format=NULL) {
3916 3505
      $BreakVoid		= isset($Format["BreakVoid"]) ? $Format["BreakVoid"] : FALSE;
3917 3506
      $ReCenter		= isset($Format["ReCenter"]) ? $Format["ReCenter"] : TRUE;
3918 3507
      $VoidTicks		= isset($Format["VoidTicks"]) ? $Format["VoidTicks"] : 4;
@@ -3932,10 +3521,8 @@  discard block
 block discarded – undo
3932 3521
 
3933 3522
      $Data = $this->DataSet->getData();
3934 3523
      list($XMargin,$XDivs) = $this->scaleGetXSettings();
3935
-     foreach($Data["Series"] as $SerieName => $Serie)
3936
-      {
3937
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
3938
-        {
3524
+     foreach($Data["Series"] as $SerieName => $Serie) {
3525
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
3939 3526
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"];
3940 3527
 
3941 3528
          if (isset($Serie["Description"])) { $SerieDescription = $Serie["Description"]; } else { $SerieDescription = $SerieName; }
@@ -3957,52 +3544,40 @@  discard block
 block discarded – undo
3957 3544
 
3958 3545
          $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0;
3959 3546
 
3960
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
3961
-          {
3547
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
3962 3548
            if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; }
3963 3549
            $X = $this->GraphAreaX1 + $XMargin; $LastX = NULL; $LastY = NULL;
3964 3550
 
3965 3551
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
3966 3552
            $LastGoodY = NULL; $LastGoodX = NULL; $Init = FALSE;
3967
-           foreach($PosArray as $Key => $Y)
3968
-            {
3969
-             if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) 
3970
-              {
3553
+           foreach($PosArray as $Key => $Y) {
3554
+             if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) {
3971 3555
                if ( $Y <= $LastY ) { $Align = TEXT_ALIGN_BOTTOMMIDDLE; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_TOPMIDDLE; $Offset = -$DisplayOffset; }
3972 3556
                $this->drawText($X,$Y-$Offset-$Weight,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align));
3973 3557
               }
3974 3558
 
3975
-             if ( $Y != VOID && $LastX != NULL && $LastY != NULL )
3976
-              {
3559
+             if ( $Y != VOID && $LastX != NULL && $LastY != NULL ) {
3977 3560
                $this->drawLine($LastX,$LastY,$X,$LastY,$Color);
3978 3561
                $this->drawLine($X,$LastY,$X,$Y,$Color);
3979
-               if ( $ReCenter && $X+$XStep < $this->GraphAreaX2 - $XMargin )
3980
-                {
3562
+               if ( $ReCenter && $X+$XStep < $this->GraphAreaX2 - $XMargin ) {
3981 3563
                  $this->drawLine($X,$Y,$X+$XStep,$Y,$Color);
3982 3564
                  if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($X-$ImageMapPlotSize).",".floor($Y-$ImageMapPlotSize).",".floor($X+$XStep+$ImageMapPlotSize).",".floor($Y+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
3983
-                }
3984
-               else
3565
+                } else
3985 3566
                 { if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastX-$ImageMapPlotSize).",".floor($LastY-$ImageMapPlotSize).",".floor($X+$ImageMapPlotSize).",".floor($LastY+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } }
3986 3567
               }
3987 3568
 
3988
-             if ( $Y != VOID && $LastY == NULL && $LastGoodY != NULL && !$BreakVoid )
3989
-              { 
3990
-               if ( $ReCenter )
3991
-                {
3569
+             if ( $Y != VOID && $LastY == NULL && $LastGoodY != NULL && !$BreakVoid ) {
3570
+               if ( $ReCenter ) {
3992 3571
                  $this->drawLine($LastGoodX+$XStep,$LastGoodY,$X,$LastGoodY,$BreakSettings);
3993 3572
                  if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastGoodX+$XStep-$ImageMapPlotSize).",".floor($LastGoodY-$ImageMapPlotSize).",".floor($X+$ImageMapPlotSize).",".floor($LastGoodY+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
3994
-                }
3995
-               else
3996
-                {
3573
+                } else {
3997 3574
                  $this->drawLine($LastGoodX,$LastGoodY,$X,$LastGoodY,$BreakSettings);
3998 3575
                  if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastGoodX-$ImageMapPlotSize).",".floor($LastGoodY-$ImageMapPlotSize).",".floor($X+$ImageMapPlotSize).",".floor($LastGoodY+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
3999 3576
                 }
4000 3577
 
4001 3578
                $this->drawLine($X,$LastGoodY,$X,$Y,$BreakSettings);
4002 3579
                $LastGoodY = NULL;
4003
-              }
4004
-             elseif( !$BreakVoid && $LastGoodY == NULL && $Y != VOID )
4005
-              {
3580
+              } elseif( !$BreakVoid && $LastGoodY == NULL && $Y != VOID ) {
4006 3581
               $this->drawLine($this->GraphAreaX1 + $XMargin,$Y,$X,$Y,$BreakSettings);
4007 3582
                if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($this->GraphAreaX1+$XMargin-$ImageMapPlotSize).",".floor($Y-$ImageMapPlotSize).",".floor($X+$ImageMapPlotSize).",".floor($Y+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
4008 3583
               }
@@ -4015,37 +3590,30 @@  discard block
 block discarded – undo
4015 3590
              if ( $LastX < $this->GraphAreaX1 + $XMargin ) { $LastX = $this->GraphAreaX1 + $XMargin; }
4016 3591
              $X = $X + $XStep;
4017 3592
             }
4018
-           if ( $ReCenter )
4019
-            {
3593
+           if ( $ReCenter ) {
4020 3594
              $this->drawLine($LastX,$LastY,$this->GraphAreaX2 - $XMargin,$LastY,$Color);
4021 3595
              if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastX-$ImageMapPlotSize).",".floor($LastY-$ImageMapPlotSize).",".floor($this->GraphAreaX2-$XMargin+$ImageMapPlotSize).",".floor($LastY+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
4022 3596
             }
4023
-          }
4024
-         else
4025
-          {
3597
+          } else {
4026 3598
            if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; }
4027 3599
            $Y = $this->GraphAreaY1 + $XMargin; $LastX = NULL; $LastY = NULL;
4028 3600
 
4029 3601
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
4030 3602
            $LastGoodY = NULL; $LastGoodX = NULL; $Init = FALSE;
4031
-           foreach($PosArray as $Key => $X)
4032
-            {
4033
-             if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) 
4034
-              {
3603
+           foreach($PosArray as $Key => $X) {
3604
+             if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) {
4035 3605
                if ( $X >= $LastX ) { $Align = TEXT_ALIGN_MIDDLELEFT; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_MIDDLERIGHT; $Offset = -$DisplayOffset; }
4036 3606
                $this->drawText($X+$Offset+$Weight,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align));
4037 3607
               }
4038 3608
 
4039
-             if ( $X != VOID && $LastX != NULL && $LastY != NULL )
4040
-              {
3609
+             if ( $X != VOID && $LastX != NULL && $LastY != NULL ) {
4041 3610
                $this->drawLine($LastX,$LastY,$LastX,$Y,$Color);
4042 3611
                $this->drawLine($LastX,$Y,$X,$Y,$Color);
4043 3612
 
4044 3613
                if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastX-$ImageMapPlotSize).",".floor($LastY-$ImageMapPlotSize).",".floor($LastX+$XStep+$ImageMapPlotSize).",".floor($Y+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
4045 3614
               }
4046 3615
 
4047
-             if ( $X != VOID && $LastX == NULL && $LastGoodY != NULL && !$BreakVoid )
4048
-              {
3616
+             if ( $X != VOID && $LastX == NULL && $LastGoodY != NULL && !$BreakVoid ) {
4049 3617
                $this->drawLine($LastGoodX,$LastGoodY,$LastGoodX,$LastGoodY+$YStep,$Color);
4050 3618
                if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastGoodX-$ImageMapPlotSize).",".floor($LastGoodY-$ImageMapPlotSize).",".floor($LastGoodX+$ImageMapPlotSize).",".floor($LastGoodY+$YStep+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
4051 3619
 
@@ -4054,9 +3622,7 @@  discard block
 block discarded – undo
4054 3622
 
4055 3623
                $this->drawLine($LastGoodX,$Y,$X,$Y,$BreakSettings);
4056 3624
                $LastGoodY = NULL;
4057
-              }
4058
-             elseif ( $X != VOID && $LastGoodY == NULL && !$BreakVoid )
4059
-              {
3625
+              } elseif ( $X != VOID && $LastGoodY == NULL && !$BreakVoid ) {
4060 3626
                $this->drawLine($X,$this->GraphAreaY1 + $XMargin,$X,$Y,$BreakSettings);
4061 3627
                if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($X-$ImageMapPlotSize).",".floor($this->GraphAreaY1+$XMargin-$ImageMapPlotSize).",".floor($X+$ImageMapPlotSize).",".floor($Y+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
4062 3628
               }
@@ -4069,8 +3635,7 @@  discard block
 block discarded – undo
4069 3635
              if ( $LastY < $this->GraphAreaY1 + $XMargin ) { $LastY = $this->GraphAreaY1 + $XMargin; }
4070 3636
              $Y = $Y + $YStep;
4071 3637
             }
4072
-           if ( $ReCenter )
4073
-            {
3638
+           if ( $ReCenter ) {
4074 3639
              $this->drawLine($LastX,$LastY,$LastX,$this->GraphAreaY2 - $XMargin,$Color);
4075 3640
              if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastX-$ImageMapPlotSize).",".floor($LastY-$ImageMapPlotSize).",".floor($LastX+$ImageMapPlotSize).",".floor($this->GraphAreaY2-$XMargin+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
4076 3641
             }
@@ -4080,8 +3645,7 @@  discard block
 block discarded – undo
4080 3645
     }
4081 3646
 
4082 3647
    /* Draw a step chart */
4083
-   function drawFilledStepChart($Format=NULL)
4084
-    {
3648
+   function drawFilledStepChart($Format=NULL) {
4085 3649
      $ReCenter		= isset($Format["ReCenter"]) ? $Format["ReCenter"] : TRUE;
4086 3650
      $DisplayValues	= isset($Format["DisplayValues"]) ? $Format["DisplayValues"] :FALSE;
4087 3651
      $DisplayOffset	= isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2;
@@ -4096,10 +3660,8 @@  discard block
 block discarded – undo
4096 3660
 
4097 3661
      $Data = $this->DataSet->getData();
4098 3662
      list($XMargin,$XDivs) = $this->scaleGetXSettings();
4099
-     foreach($Data["Series"] as $SerieName => $Serie)
4100
-      {
4101
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
4102
-        {
3663
+     foreach($Data["Series"] as $SerieName => $Serie) {
3664
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
4103 3665
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"];
4104 3666
 
4105 3667
          if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; }
@@ -4117,8 +3679,7 @@  discard block
 block discarded – undo
4117 3679
 
4118 3680
          $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0;
4119 3681
 
4120
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
4121
-          {
3682
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
4122 3683
            if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; }
4123 3684
            if ( $YZero < $this->GraphAreaY1+1 ) { $YZero = $this->GraphAreaY1+1; }
4124 3685
 
@@ -4129,10 +3690,8 @@  discard block
 block discarded – undo
4129 3690
 
4130 3691
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
4131 3692
            $LastGoodY = NULL; $LastGoodX = NULL; $Points = ""; $Init = FALSE;
4132
-           foreach($PosArray as $Key => $Y)
4133
-            {
4134
-             if ( $Y == VOID && $LastX != NULL && $LastY != NULL && $Points !="" )
4135
-              {
3693
+           foreach($PosArray as $Key => $Y) {
3694
+             if ( $Y == VOID && $LastX != NULL && $LastY != NULL && $Points !="" ) {
4136 3695
                $Points[] = $LastX; $Points[] = $LastY;
4137 3696
                $Points[] = $X; $Points[] = $LastY;
4138 3697
                $Points[] = $X; $Points[] = $YZero;
@@ -4140,8 +3699,7 @@  discard block
 block discarded – undo
4140 3699
                $Points = "";
4141 3700
               }
4142 3701
 
4143
-             if ( $Y != VOID && $LastX != NULL && $LastY != NULL )
4144
-              {
3702
+             if ( $Y != VOID && $LastX != NULL && $LastY != NULL ) {
4145 3703
                if ( $Points == "") { $Points[] = $LastX; $Points[] = $YZero; }
4146 3704
                $Points[] = $LastX; $Points[] = $LastY;
4147 3705
                $Points[] = $X; $Points[] = $LastY;
@@ -4157,18 +3715,14 @@  discard block
 block discarded – undo
4157 3715
              $X = $X + $XStep;
4158 3716
             }
4159 3717
 
4160
-           if ( $ReCenter )
4161
-            {
3718
+           if ( $ReCenter ) {
4162 3719
              $Points[] = $LastX+$XStep/2; $Points[] = $LastY;
4163 3720
              $Points[] = $LastX+$XStep/2; $Points[] = $YZero;
4164
-            }
4165
-           else
3721
+            } else
4166 3722
             { $Points[] = $LastX; $Points[] = $YZero; }
4167 3723
 
4168 3724
            $this->drawPolygon($Points,$Color);
4169
-          }
4170
-         else
4171
-          {
3725
+          } else {
4172 3726
            if ( $YZero < $this->GraphAreaX1+1 ) { $YZero = $this->GraphAreaX1+1; }
4173 3727
            if ( $YZero > $this->GraphAreaX2-1 ) { $YZero = $this->GraphAreaX2-1; }
4174 3728
 
@@ -4177,10 +3731,8 @@  discard block
 block discarded – undo
4177 3731
 
4178 3732
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
4179 3733
            $LastGoodY = NULL; $LastGoodX = NULL; $Points = "";
4180
-           foreach($PosArray as $Key => $X)
4181
-            {
4182
-             if ( $X == VOID && $LastX != NULL && $LastY != NULL && $Points !="" )
4183
-              {
3734
+           foreach($PosArray as $Key => $X) {
3735
+             if ( $X == VOID && $LastX != NULL && $LastY != NULL && $Points !="" ) {
4184 3736
                $Points[] = $LastX; $Points[] = $LastY;
4185 3737
                $Points[] = $LastX; $Points[] = $Y;
4186 3738
                $Points[] = $YZero; $Points[] = $Y;
@@ -4188,8 +3740,7 @@  discard block
 block discarded – undo
4188 3740
                $Points = "";
4189 3741
               }
4190 3742
 
4191
-             if ( $X != VOID && $LastX != NULL && $LastY != NULL )
4192
-              {
3743
+             if ( $X != VOID && $LastX != NULL && $LastY != NULL ) {
4193 3744
                if ( $Points == "") { $Points[] = $YZero; $Points[] = $LastY; }
4194 3745
                $Points[] = $LastX; $Points[] = $LastY;
4195 3746
                $Points[] = $LastX; $Points[] = $Y;
@@ -4205,12 +3756,10 @@  discard block
 block discarded – undo
4205 3756
              $Y = $Y + $YStep;
4206 3757
             }
4207 3758
 
4208
-           if ( $ReCenter )
4209
-            {
3759
+           if ( $ReCenter ) {
4210 3760
              $Points[] = $LastX; $Points[] = $LastY+$YStep/2;
4211 3761
              $Points[] = $YZero; $Points[] = $LastY+$YStep/2;
4212
-            }
4213
-           else
3762
+            } else
4214 3763
             { $Points[] = $YZero; $Points[] = $LastY; }
4215 3764
 
4216 3765
            $this->drawPolygon($Points,$Color);
@@ -4220,8 +3769,7 @@  discard block
 block discarded – undo
4220 3769
     }
4221 3770
 
4222 3771
    /* Draw an area chart */
4223
-   function drawAreaChart($Format=NULL)
4224
-    {
3772
+   function drawAreaChart($Format=NULL) {
4225 3773
      $DisplayValues	= isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE;
4226 3774
      $DisplayOffset	= isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2;
4227 3775
      $DisplayColor	= isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL;
@@ -4237,10 +3785,8 @@  discard block
 block discarded – undo
4237 3785
      $Data  = $this->DataSet->getData();
4238 3786
      list($XMargin,$XDivs) = $this->scaleGetXSettings();
4239 3787
 
4240
-     foreach($Data["Series"] as $SerieName => $Serie)
4241
-      {
4242
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
4243
-        {
3788
+     foreach($Data["Series"] as $SerieName => $Serie) {
3789
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
4244 3790
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"];
4245 3791
          if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; }
4246 3792
 
@@ -4252,10 +3798,8 @@  discard block
 block discarded – undo
4252 3798
          $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"]));
4253 3799
          $YZero    = $this->scaleComputeY(0,array("AxisID"=>$Serie["Axis"]));
4254 3800
 
4255
-         if ( $Threshold != NULL )
4256
-          {
4257
-           foreach($Threshold as $Key => $Params)
4258
-            {
3801
+         if ( $Threshold != NULL ) {
3802
+           foreach($Threshold as $Key => $Params) {
4259 3803
              $Threshold[$Key]["MinX"] = $this->scaleComputeY($Params["Min"],array("AxisID"=>$Serie["Axis"]));
4260 3804
              $Threshold[$Key]["MaxX"] = $this->scaleComputeY($Params["Max"],array("AxisID"=>$Serie["Axis"]));
4261 3805
             }
@@ -4263,8 +3807,7 @@  discard block
 block discarded – undo
4263 3807
 
4264 3808
          $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0;
4265 3809
 
4266
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
4267
-          {
3810
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
4268 3811
            if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; }
4269 3812
 
4270 3813
            $Areas = ""; $AreaID = 0; 
@@ -4275,28 +3818,21 @@  discard block
 block discarded – undo
4275 3818
            $X = $this->GraphAreaX1 + $XMargin; $LastX = NULL; $LastY = NULL;
4276 3819
 
4277 3820
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
4278
-           foreach($PosArray as $Key => $Y)
4279
-            {
4280
-             if ( $DisplayValues && $Serie["Data"][$Key] != VOID )
4281
-              {
3821
+           foreach($PosArray as $Key => $Y) {
3822
+             if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) {
4282 3823
                if ( $Serie["Data"][$Key] > 0 ) { $Align = TEXT_ALIGN_BOTTOMMIDDLE; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_TOPMIDDLE; $Offset = -$DisplayOffset; }
4283 3824
                $this->drawText($X,$Y-$Offset,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align));
4284 3825
               }
4285 3826
 
4286
-             if ( $Y == VOID && isset($Areas[$AreaID]) )
4287
-              {
3827
+             if ( $Y == VOID && isset($Areas[$AreaID]) ) {
4288 3828
                if($LastX == NULL)
4289
-                { $Areas[$AreaID][] = $X; }
4290
-               else
3829
+                { $Areas[$AreaID][] = $X; } else
4291 3830
                 { $Areas[$AreaID][] = $LastX; }
4292 3831
 
4293 3832
                if ( $AroundZero ) { $Areas[$AreaID][] = $YZero; } else { $Areas[$AreaID][] = $this->GraphAreaY2-1; }
4294 3833
                $AreaID++;
4295
-              }
4296
-             elseif ($Y != VOID)
4297
-              {
4298
-               if ( !isset($Areas[$AreaID]) )
4299
-                {
3834
+              } elseif ($Y != VOID) {
3835
+               if ( !isset($Areas[$AreaID]) ) {
4300 3836
                  $Areas[$AreaID][] = $X;
4301 3837
                  if ( $AroundZero ) { $Areas[$AreaID][] = $YZero; } else { $Areas[$AreaID][] = $this->GraphAreaY2-1; }
4302 3838
                 }
@@ -4312,33 +3848,29 @@  discard block
 block discarded – undo
4312 3848
            if ( $AroundZero ) { $Areas[$AreaID][] = $YZero; } else { $Areas[$AreaID][] = $this->GraphAreaY2-1; }
4313 3849
 
4314 3850
            /* Handle shadows in the areas */
4315
-           if ( $this->Shadow )
4316
-            {
3851
+           if ( $this->Shadow ) {
4317 3852
              $ShadowArea = "";
4318
-             foreach($Areas as $Key => $Points)
4319
-              {
3853
+             foreach($Areas as $Key => $Points) {
4320 3854
                $ShadowArea[$Key] = "";
4321
-               foreach($Points as $Key2 => $Value)
4322
-                {
3855
+               foreach($Points as $Key2 => $Value) {
4323 3856
                  if ( $Key2 % 2 == 0 )
4324
-                  { $ShadowArea[$Key][] = $Value + $this->ShadowX; }
4325
-                 else
3857
+                  { $ShadowArea[$Key][] = $Value + $this->ShadowX; } else
4326 3858
                   { $ShadowArea[$Key][] = $Value + $this->ShadowY; }
4327 3859
                 }
4328 3860
               }              
4329 3861
 
4330
-             foreach($ShadowArea as $Key => $Points)
4331
-              $this->drawPolygonChart($Points,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa));
3862
+             foreach($ShadowArea as $Key => $Points) {
3863
+                           $this->drawPolygonChart($Points,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa));
3864
+             }
4332 3865
             }
4333 3866
 
4334 3867
            $Alpha = $ForceTransparency != NULL ? $ForceTransparency : $Alpha;
4335 3868
            $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Threshold"=>$Threshold);
4336 3869
 
4337
-           foreach($Areas as $Key => $Points)
4338
-            $this->drawPolygonChart($Points,$Color);
4339
-          }
4340
-         else
4341
-          {
3870
+           foreach($Areas as $Key => $Points) {
3871
+                       $this->drawPolygonChart($Points,$Color);
3872
+           }
3873
+          } else {
4342 3874
            if ( $YZero < $this->GraphAreaX1+1 ) { $YZero = $this->GraphAreaX1+1; }
4343 3875
            if ( $YZero > $this->GraphAreaX2-1 ) { $YZero = $this->GraphAreaX2-1; }
4344 3876
 
@@ -4350,29 +3882,22 @@  discard block
 block discarded – undo
4350 3882
            $Y     = $this->GraphAreaY1 + $XMargin; $LastX = NULL; $LastY = NULL;
4351 3883
 
4352 3884
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
4353
-           foreach($PosArray as $Key => $X)
4354
-            {
4355
-             if ( $DisplayValues && $Serie["Data"][$Key] != VOID )
4356
-              {
3885
+           foreach($PosArray as $Key => $X) {
3886
+             if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) {
4357 3887
                if ( $Serie["Data"][$Key] > 0 ) { $Align = TEXT_ALIGN_BOTTOMMIDDLE; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_TOPMIDDLE; $Offset = -$DisplayOffset; }
4358 3888
                $this->drawText($X+$Offset,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("Angle"=>270,"R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align));
4359 3889
               }
4360 3890
 
4361
-             if ( $X == VOID && isset($Areas[$AreaID]) )
4362
-              {
3891
+             if ( $X == VOID && isset($Areas[$AreaID]) ) {
4363 3892
                if ( $AroundZero ) { $Areas[$AreaID][] = $YZero; } else { $Areas[$AreaID][] = $this->GraphAreaX1+1; }
4364 3893
 
4365 3894
                if($LastY == NULL)
4366
-                { $Areas[$AreaID][] = $Y; }
4367
-               else
3895
+                { $Areas[$AreaID][] = $Y; } else
4368 3896
                 { $Areas[$AreaID][] = $LastY; }
4369 3897
 
4370 3898
                $AreaID++;
4371
-              }
4372
-             elseif ($X != VOID)
4373
-              {
4374
-               if ( !isset($Areas[$AreaID]) )
4375
-                {
3899
+              } elseif ($X != VOID) {
3900
+               if ( !isset($Areas[$AreaID]) ) {
4376 3901
                  if ( $AroundZero ) { $Areas[$AreaID][] = $YZero; } else { $Areas[$AreaID][] = $this->GraphAreaX1+1; }
4377 3902
                  $Areas[$AreaID][] = $Y;
4378 3903
                 }
@@ -4388,30 +3913,28 @@  discard block
 block discarded – undo
4388 3913
            $Areas[$AreaID][] = $LastY;
4389 3914
 
4390 3915
            /* Handle shadows in the areas */
4391
-           if ( $this->Shadow )
4392
-            {
3916
+           if ( $this->Shadow ) {
4393 3917
              $ShadowArea = "";
4394
-             foreach($Areas as $Key => $Points)
4395
-              {
3918
+             foreach($Areas as $Key => $Points) {
4396 3919
                $ShadowArea[$Key] = "";
4397
-               foreach($Points as $Key2 => $Value)
4398
-                {
3920
+               foreach($Points as $Key2 => $Value) {
4399 3921
                  if ( $Key2 % 2 == 0 )
4400
-                  { $ShadowArea[$Key][] = $Value + $this->ShadowX; }
4401
-                 else
3922
+                  { $ShadowArea[$Key][] = $Value + $this->ShadowX; } else
4402 3923
                   { $ShadowArea[$Key][] = $Value + $this->ShadowY; }
4403 3924
                 }
4404 3925
               }              
4405 3926
 
4406
-             foreach($ShadowArea as $Key => $Points)
4407
-              $this->drawPolygonChart($Points,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa));
3927
+             foreach($ShadowArea as $Key => $Points) {
3928
+                           $this->drawPolygonChart($Points,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa));
3929
+             }
4408 3930
             }
4409 3931
 
4410 3932
            $Alpha = $ForceTransparency != NULL ? $ForceTransparency : $Alpha;
4411 3933
            $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Threshold"=>$Threshold);
4412 3934
 
4413
-           foreach($Areas as $Key => $Points)
4414
-            $this->drawPolygonChart($Points,$Color);
3935
+           foreach($Areas as $Key => $Points) {
3936
+                       $this->drawPolygonChart($Points,$Color);
3937
+           }
4415 3938
           }
4416 3939
         }
4417 3940
       }
@@ -4419,8 +3942,7 @@  discard block
 block discarded – undo
4419 3942
 
4420 3943
 
4421 3944
    /* Draw a bar chart */
4422
-   function drawBarChart($Format=NULL)
4423
-    {
3945
+   function drawBarChart($Format=NULL) {
4424 3946
      $Floating0Serie	= isset($Format["Floating0Serie"]) ? $Format["Floating0Serie"] : NULL;
4425 3947
      $Floating0Value	= isset($Format["Floating0Value"]) ? $Format["Floating0Value"] : NULL;
4426 3948
      $Draw0Line		= isset($Format["Draw0Line"]) ? $Format["Draw0Line"] : FALSE;
@@ -4466,8 +3988,7 @@  discard block
 block discarded – undo
4466 3988
      $Data = $this->DataSet->getData();
4467 3989
      list($XMargin,$XDivs) = $this->scaleGetXSettings();
4468 3990
 
4469
-     if ( $OverrideColors != NULL )
4470
-      {
3991
+     if ( $OverrideColors != NULL ) {
4471 3992
        $OverrideColors = $this->validatePalette($OverrideColors,$OverrideSurrounding);
4472 3993
        $this->DataSet->saveExtendedData("Palette",$OverrideColors);
4473 3994
       }
@@ -4476,10 +3997,8 @@  discard block
 block discarded – undo
4476 3997
 
4477 3998
      $SeriesCount  = $this->countDrawableSeries();
4478 3999
      $CurrentSerie = 0;
4479
-     foreach($Data["Series"] as $SerieName => $Serie)
4480
-      {
4481
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
4482
-        {
4000
+     foreach($Data["Series"] as $SerieName => $Serie) {
4001
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
4483 4002
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"];
4484 4003
          if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; }
4485 4004
          if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; }
@@ -4497,12 +4016,10 @@  discard block
 block discarded – undo
4497 4016
          $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"]));
4498 4017
 
4499 4018
          if ( $Floating0Value != NULL )
4500
-          { $YZero = $this->scaleComputeY($Floating0Value,array("AxisID"=>$Serie["Axis"])); }
4501
-         else
4019
+          { $YZero = $this->scaleComputeY($Floating0Value,array("AxisID"=>$Serie["Axis"])); } else
4502 4020
           { $YZero = $this->scaleComputeY(0,array("AxisID"=>$Serie["Axis"])); }
4503 4021
 
4504
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
4505
-          {
4022
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
4506 4023
            if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; }
4507 4024
            if ( $YZero < $this->GraphAreaY1+1 ) { $YZero = $this->GraphAreaY1+1; }
4508 4025
 
@@ -4522,13 +4039,10 @@  discard block
 block discarded – undo
4522 4039
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
4523 4040
 
4524 4041
            $ID = 0;
4525
-           foreach($PosArray as $Key => $Y2)
4526
-            {
4527
-             if ( $Floating0Serie != NULL )
4528
-              {
4042
+           foreach($PosArray as $Key => $Y2) {
4043
+             if ( $Floating0Serie != NULL ) {
4529 4044
                if ( isset($Data["Series"][$Floating0Serie]["Data"][$Key]) )
4530
-                { $Value = $Data["Series"][$Floating0Serie]["Data"][$Key]; }
4531
-               else
4045
+                { $Value = $Data["Series"][$Floating0Serie]["Data"][$Key]; } else
4532 4046
                 { $Value = 0; }
4533 4047
 
4534 4048
                $YZero = $this->scaleComputeY($Value,array("AxisID"=>$Serie["Axis"]));
@@ -4541,42 +4055,33 @@  discard block
 block discarded – undo
4541 4055
              if ( $OverrideColors != NULL )
4542 4056
               { if ( isset($OverrideColors[$ID]) ) { $Color = array("R"=>$OverrideColors[$ID]["R"],"G"=>$OverrideColors[$ID]["G"],"B"=>$OverrideColors[$ID]["B"],"Alpha"=>$OverrideColors[$ID]["Alpha"],"BorderR"=>$OverrideColors[$ID]["BorderR"],"BorderG"=>$OverrideColors[$ID]["BorderG"],"BorderB"=>$OverrideColors[$ID]["BorderB"]); } else { $Color = $this->getRandomColor(); } }
4543 4057
 
4544
-             if ( $Y2 != VOID )
4545
-              {
4058
+             if ( $Y2 != VOID ) {
4546 4059
                $BarHeight = $Y1 - $Y2;
4547 4060
 
4548
-               if ( $Serie["Data"][$Key] == 0 )
4549
-                {
4061
+               if ( $Serie["Data"][$Key] == 0 ) {
4550 4062
                  $this->drawLine($X+$XOffset+$XSpace,$Y1,$X+$XOffset+$XSize-$XSpace,$Y1,$Color);
4551 4063
                  if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($X+$XOffset+$XSpace).",".floor($Y1-1).",".floor($X+$XOffset+$XSize-$XSpace).",".floor($Y1+1),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
4552
-                }
4553
-               else
4554
-                {
4064
+                } else {
4555 4065
                  if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($X+$XOffset+$XSpace).",".floor($Y1).",".floor($X+$XOffset+$XSize-$XSpace).",".floor($Y2),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
4556 4066
 
4557 4067
                  if ( $Rounded )
4558 4068
                   $this->drawRoundedFilledRectangle($X+$XOffset+$XSpace,$Y1,$X+$XOffset+$XSize-$XSpace,$Y2,$RoundRadius,$Color);
4559
-                 else
4560
-                  {
4069
+                 else {
4561 4070
                    $this->drawFilledRectangle($X+$XOffset+$XSpace,$Y1,$X+$XOffset+$XSize-$XSpace,$Y2,$Color);
4562 4071
 
4563 4072
                    if ( $InnerColor != NULL ) { $this->drawRectangle($X+$XOffset+$XSpace+1,min($Y1,$Y2)+1,$X+$XOffset+$XSize-$XSpace-1,max($Y1,$Y2)-1,$InnerColor); }
4564 4073
 
4565
-                   if ( $Gradient )
4566
-                    {
4074
+                   if ( $Gradient ) {
4567 4075
                      $this->Shadow  = FALSE;
4568 4076
 
4569
-                     if ( $GradientMode == GRADIENT_SIMPLE )
4570
-                      {
4077
+                     if ( $GradientMode == GRADIENT_SIMPLE ) {
4571 4078
                        if ( $Serie["Data"][$Key] >= 0 )
4572 4079
                         $GradienColor = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha);
4573 4080
                        else
4574 4081
                         $GradienColor = array("StartR"=>$GradientEndR,"StartG"=>$GradientEndG,"StartB"=>$GradientEndB,"EndR"=>$GradientStartR,"EndG"=>$GradientStartG,"EndB"=>$GradientStartB,"Alpha"=>$GradientAlpha);
4575 4082
 
4576 4083
                        $this->drawGradientArea($X+$XOffset+$XSpace,$Y1,$X+$XOffset+$XSize-$XSpace,$Y2,DIRECTION_VERTICAL,$GradienColor);
4577
-                      }
4578
-                     elseif ( $GradientMode == GRADIENT_EFFECT_CAN )
4579
-                      {
4084
+                      } elseif ( $GradientMode == GRADIENT_EFFECT_CAN ) {
4580 4085
                        $GradienColor1 = array("StartR"=>$GradientEndR,"StartG"=>$GradientEndG,"StartB"=>$GradientEndB,"EndR"=>$GradientStartR,"EndG"=>$GradientStartG,"EndB"=>$GradientStartB,"Alpha"=>$GradientAlpha);
4581 4086
                        $GradienColor2 = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha);
4582 4087
                        $XSpan = floor($XSize / 3);
@@ -4588,8 +4093,7 @@  discard block
 block discarded – undo
4588 4093
                     }
4589 4094
                   }
4590 4095
 
4591
-                 if ( $Draw0Line )
4592
-                  {
4096
+                 if ( $Draw0Line ) {
4593 4097
                    $Line0Color = array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20);
4594 4098
 
4595 4099
                    if ( abs($Y1 - $Y2) > 3 ) { $Line0Width = 3; } else { $Line0Width = 1; }
@@ -4600,23 +4104,19 @@  discard block
 block discarded – undo
4600 4104
                   }
4601 4105
                 }
4602 4106
 
4603
-               if ( $DisplayValues && $Serie["Data"][$Key] != VOID )
4604
-                {
4107
+               if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) {
4605 4108
                  if ( $DisplayShadow ) { $this->Shadow = TRUE; }
4606 4109
 
4607 4110
                  $Caption    = $this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit);
4608 4111
                  $TxtPos     = $this->getTextBox(0,0,$DisplayFont,$DisplaySize,90,$Caption);
4609 4112
                  $TxtHeight  = $TxtPos[0]["Y"] - $TxtPos[1]["Y"] + $TxtMargin;
4610 4113
 
4611
-                 if ( $DisplayPos == LABEL_POS_INSIDE && abs($TxtHeight) < abs($BarHeight) )
4612
-                  {
4114
+                 if ( $DisplayPos == LABEL_POS_INSIDE && abs($TxtHeight) < abs($BarHeight) ) {
4613 4115
                    $CenterX = (($X+$XOffset+$XSize-$XSpace)-($X+$XOffset+$XSpace))/2 + $X+$XOffset+$XSpace;
4614 4116
                    $CenterY = ($Y2-$Y1)/2 + $Y1;
4615 4117
 
4616 4118
                    $this->drawText($CenterX,$CenterY,$Caption,array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontSize"=>$DisplaySize,"Angle"=>90));
4617
-                  }
4618
-                 else
4619
-                  {
4119
+                  } else {
4620 4120
                    if ( $Serie["Data"][$Key] >= 0 ) { $Align = TEXT_ALIGN_BOTTOMMIDDLE; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_TOPMIDDLE; $Offset = -$DisplayOffset; }
4621 4121
                    $this->drawText($X+$XOffset+$XSize/2,$Y2-$Offset,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align,"FontSize"=>$DisplaySize));
4622 4122
                   }
@@ -4628,9 +4128,7 @@  discard block
 block discarded – undo
4628 4128
              $X = $X + $XStep;
4629 4129
              $ID++;
4630 4130
             }
4631
-          }
4632
-         else
4633
-          {
4131
+          } else {
4634 4132
            if ( $YZero < $this->GraphAreaX1+1 ) { $YZero = $this->GraphAreaX1+1; }
4635 4133
            if ( $YZero > $this->GraphAreaX2-1 ) { $YZero = $this->GraphAreaX2-1; }
4636 4134
 
@@ -4651,10 +4149,8 @@  discard block
 block discarded – undo
4651 4149
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
4652 4150
 
4653 4151
            $ID = 0 ;
4654
-           foreach($PosArray as $Key => $X2)
4655
-            {
4656
-             if ( $Floating0Serie != NULL )
4657
-              {
4152
+           foreach($PosArray as $Key => $X2) {
4153
+             if ( $Floating0Serie != NULL ) {
4658 4154
                if ( isset($Data["Series"][$Floating0Serie]["Data"][$Key]) )
4659 4155
                 $Value = $Data["Series"][$Floating0Serie]["Data"][$Key];
4660 4156
                else { $Value = 0; }
@@ -4668,42 +4164,33 @@  discard block
 block discarded – undo
4668 4164
              if ( $OverrideColors != NULL )
4669 4165
               { if ( isset($OverrideColors[$ID]) ) { $Color = array("R"=>$OverrideColors[$ID]["R"],"G"=>$OverrideColors[$ID]["G"],"B"=>$OverrideColors[$ID]["B"],"Alpha"=>$OverrideColors[$ID]["Alpha"],"BorderR"=>$OverrideColors[$ID]["BorderR"],"BorderG"=>$OverrideColors[$ID]["BorderG"],"BorderB"=>$OverrideColors[$ID]["BorderB"]); } else { $Color = $this->getRandomColor(); } }
4670 4166
 
4671
-             if ( $X2 != VOID )
4672
-              {
4167
+             if ( $X2 != VOID ) {
4673 4168
                $BarWidth = $X2 - $X1;
4674 4169
 
4675
-               if ( $Serie["Data"][$Key] == 0 )
4676
-                {
4170
+               if ( $Serie["Data"][$Key] == 0 ) {
4677 4171
                  $this->drawLine($X1,$Y+$YOffset+$YSpace,$X1,$Y+$YOffset+$YSize-$YSpace,$Color);
4678 4172
                  if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($X1-1).",".floor($Y+$YOffset+$YSpace).",".floor($X1+1).",".floor($Y+$YOffset+$YSize-$YSpace),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
4679
-                }
4680
-               else
4681
-                {
4173
+                } else {
4682 4174
                  if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($X1).",".floor($Y+$YOffset+$YSpace).",".floor($X2).",".floor($Y+$YOffset+$YSize-$YSpace),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); }
4683 4175
 
4684 4176
                  if ( $Rounded )
4685 4177
                   $this->drawRoundedFilledRectangle($X1+1,$Y+$YOffset+$YSpace,$X2,$Y+$YOffset+$YSize-$YSpace,$RoundRadius,$Color);
4686
-                 else
4687
-                  {
4178
+                 else {
4688 4179
                    $this->drawFilledRectangle($X1,$Y+$YOffset+$YSpace,$X2,$Y+$YOffset+$YSize-$YSpace,$Color);
4689 4180
 
4690 4181
                    if ( $InnerColor != NULL ) { $this->drawRectangle(min($X1,$X2)+1,$Y+$YOffset+$YSpace+1,max($X1,$X2)-1,$Y+$YOffset+$YSize-$YSpace-1,$InnerColor); }
4691 4182
 
4692
-                   if ( $Gradient )
4693
-                    {
4183
+                   if ( $Gradient ) {
4694 4184
                      $this->Shadow  = FALSE;
4695 4185
 
4696
-                     if ( $GradientMode == GRADIENT_SIMPLE )
4697
-                      {
4186
+                     if ( $GradientMode == GRADIENT_SIMPLE ) {
4698 4187
                        if ( $Serie["Data"][$Key] >= 0 )
4699 4188
                         $GradienColor = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha);
4700 4189
                        else
4701 4190
                         $GradienColor = array("StartR"=>$GradientEndR,"StartG"=>$GradientEndG,"StartB"=>$GradientEndB,"EndR"=>$GradientStartR,"EndG"=>$GradientStartG,"EndB"=>$GradientStartB,"Alpha"=>$GradientAlpha);
4702 4191
 
4703 4192
                        $this->drawGradientArea($X1,$Y+$YOffset+$YSpace,$X2,$Y+$YOffset+$YSize-$YSpace,DIRECTION_HORIZONTAL,$GradienColor);
4704
-                      }
4705
-                     elseif ( $GradientMode == GRADIENT_EFFECT_CAN )
4706
-                      {
4193
+                      } elseif ( $GradientMode == GRADIENT_EFFECT_CAN ) {
4707 4194
                        $GradienColor1 = array("StartR"=>$GradientEndR,"StartG"=>$GradientEndG,"StartB"=>$GradientEndB,"EndR"=>$GradientStartR,"EndG"=>$GradientStartG,"EndB"=>$GradientStartB,"Alpha"=>$GradientAlpha);
4708 4195
                        $GradienColor2 = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha);
4709 4196
                        $YSpan = floor($YSize / 3);
@@ -4715,8 +4202,7 @@  discard block
 block discarded – undo
4715 4202
                     }
4716 4203
                   }
4717 4204
 
4718
-                 if ( $Draw0Line )
4719
-                  {
4205
+                 if ( $Draw0Line ) {
4720 4206
                    $Line0Color = array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20);
4721 4207
 
4722 4208
                    if ( abs($X1 - $X2) > 3 ) { $Line0Width = 3; } else { $Line0Width = 1; }
@@ -4727,23 +4213,19 @@  discard block
 block discarded – undo
4727 4213
                   }
4728 4214
                 }
4729 4215
 
4730
-               if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) 
4731
-                {
4216
+               if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) {
4732 4217
                  if ( $DisplayShadow ) { $this->Shadow = TRUE; }
4733 4218
 
4734 4219
                  $Caption   = $this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit);
4735 4220
                  $TxtPos    = $this->getTextBox(0,0,$DisplayFont,$DisplaySize,0,$Caption);
4736 4221
                  $TxtWidth  = $TxtPos[1]["X"] - $TxtPos[0]["X"] + $TxtMargin;
4737 4222
 
4738
-                 if ( $DisplayPos == LABEL_POS_INSIDE && abs($TxtWidth) < abs($BarWidth) )
4739
-                  {
4223
+                 if ( $DisplayPos == LABEL_POS_INSIDE && abs($TxtWidth) < abs($BarWidth) ) {
4740 4224
                    $CenterX = ($X2-$X1)/2 + $X1;
4741 4225
                    $CenterY = (($Y+$YOffset+$YSize-$YSpace)-($Y+$YOffset+$YSpace))/2 + ($Y+$YOffset+$YSpace);
4742 4226
 
4743 4227
                    $this->drawText($CenterX,$CenterY,$Caption,array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontSize"=>$DisplaySize));
4744
-                  }
4745
-                 else
4746
-                  {
4228
+                  } else {
4747 4229
                    if ( $Serie["Data"][$Key] >= 0 ) { $Align = TEXT_ALIGN_MIDDLELEFT; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_MIDDLERIGHT; $Offset = -$DisplayOffset; }
4748 4230
                    $this->drawText($X2+$Offset,$Y+$YOffset+$YSize/2,$Caption,array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align,"FontSize"=>$DisplaySize));
4749 4231
                   }
@@ -4761,8 +4243,7 @@  discard block
 block discarded – undo
4761 4243
     }
4762 4244
 
4763 4245
    /* Draw a bar chart */
4764
-   function drawStackedBarChart($Format=NULL)
4765
-    {
4246
+   function drawStackedBarChart($Format=NULL) {
4766 4247
      $DisplayValues	= isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE;
4767 4248
      $DisplayOrientation = isset($Format["DisplayOrientation"]) ? $Format["DisplayOrientation"] : ORIENTATION_AUTO;
4768 4249
      $DisplayRound      = isset($Format["DisplayRound"]) ? $Format["DisplayRound"] : 0;
@@ -4803,10 +4284,8 @@  discard block
 block discarded – undo
4803 4284
      $RestoreShadow = $this->Shadow;
4804 4285
 
4805 4286
      $LastX = ""; $LastY = "";
4806
-     foreach($Data["Series"] as $SerieName => $Serie)
4807
-      {
4808
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
4809
-        {
4287
+     foreach($Data["Series"] as $SerieName => $Serie) {
4288
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
4810 4289
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"];
4811 4290
          if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = 255; $DisplayG = 255; $DisplayB = 255; }
4812 4291
          if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; }
@@ -4827,8 +4306,7 @@  discard block
 block discarded – undo
4827 4306
 
4828 4307
          $Color = array("TransCorner"=>TRUE,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"BorderR"=>$BorderR,"BorderG"=>$BorderG,"BorderB"=>$BorderB);
4829 4308
 
4830
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
4831
-          {
4309
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
4832 4310
            if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; }
4833 4311
            if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; }
4834 4312
 
@@ -4839,10 +4317,8 @@  discard block
 block discarded – undo
4839 4317
            $XOffset = -($XSize/2);
4840 4318
 
4841 4319
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
4842
-           foreach($PosArray as $Key => $Height)
4843
-            {
4844
-             if ( $Height != VOID && $Serie["Data"][$Key] != 0 )
4845
-              {
4320
+           foreach($PosArray as $Key => $Height) {
4321
+             if ( $Height != VOID && $Serie["Data"][$Key] != 0 ) {
4846 4322
                if ( $Serie["Data"][$Key] > 0 ) { $Pos = "+"; } else { $Pos = "-"; }
4847 4323
 
4848 4324
                if ( !isset($LastY[$Key] ) ) { $LastY[$Key] = ""; }
@@ -4858,23 +4334,18 @@  discard block
 block discarded – undo
4858 4334
 
4859 4335
                if ( $Rounded )
4860 4336
                 $this->drawRoundedFilledRectangle($X+$XOffset,$Y1-$YSpaceUp+$YSpaceDown,$X+$XOffset+$XSize,$Y2,$RoundRadius,$Color);
4861
-               else
4862
-                {
4337
+               else {
4863 4338
                  $this->drawFilledRectangle($X+$XOffset,$Y1-$YSpaceUp+$YSpaceDown,$X+$XOffset+$XSize,$Y2,$Color);
4864 4339
 
4865 4340
                  if ( $InnerColor != NULL ) { $RestoreShadow = $this->Shadow; $this->Shadow = FALSE; $this->drawRectangle(min($X+$XOffset+1,$X+$XOffset+$XSize),min($Y1-$YSpaceUp+$YSpaceDown,$Y2)+1,max($X+$XOffset+1,$X+$XOffset+$XSize)-1,max($Y1-$YSpaceUp+$YSpaceDown,$Y2)-1,$InnerColor); $this->Shadow = $RestoreShadow;}
4866 4341
 
4867
-                 if ( $Gradient )
4868
-                  {
4342
+                 if ( $Gradient ) {
4869 4343
                    $this->Shadow  = FALSE;
4870 4344
 
4871
-                   if ( $GradientMode == GRADIENT_SIMPLE )
4872
-                    {
4345
+                   if ( $GradientMode == GRADIENT_SIMPLE ) {
4873 4346
                      $GradientColor = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha);
4874 4347
                      $this->drawGradientArea($X+$XOffset,$Y1-1-$YSpaceUp+$YSpaceDown,$X+$XOffset+$XSize,$Y2+1,DIRECTION_VERTICAL,$GradientColor);
4875
-                    }
4876
-                   elseif ( $GradientMode == GRADIENT_EFFECT_CAN )
4877
-                    {
4348
+                    } elseif ( $GradientMode == GRADIENT_EFFECT_CAN ) {
4878 4349
                      $GradientColor1 = array("StartR"=>$GradientEndR,"StartG"=>$GradientEndG,"StartB"=>$GradientEndB,"EndR"=>$GradientStartR,"EndG"=>$GradientStartG,"EndB"=>$GradientStartB,"Alpha"=>$GradientAlpha);
4879 4350
                      $GradientColor2 = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha);
4880 4351
                      $XSpan = floor($XSize / 3);
@@ -4886,8 +4357,7 @@  discard block
 block discarded – undo
4886 4357
                   }
4887 4358
                 }
4888 4359
 
4889
-               if ( $DisplayValues )
4890
-                {
4360
+               if ( $DisplayValues ) {
4891 4361
                  $BarHeight = abs($Y2-$Y1)-2;
4892 4362
                  $BarWidth  = $XSize+($XOffset/2)-$FontFactor;
4893 4363
 
@@ -4900,17 +4370,14 @@  discard block
 block discarded – undo
4900 4370
                  $YCenter = ( ($Y2) - ($Y1-$YSpaceUp+$YSpaceDown) ) / 2 + $Y1-$YSpaceUp+$YSpaceDown;
4901 4371
 
4902 4372
                  $Done = FALSE;
4903
-                 if ( $DisplayOrientation == ORIENTATION_HORIZONTAL || $DisplayOrientation == ORIENTATION_AUTO )
4904
-                  {
4905
-                   if ( $TxtHeight < $BarHeight && $TxtWidth < $BarWidth  )
4906
-                    {
4373
+                 if ( $DisplayOrientation == ORIENTATION_HORIZONTAL || $DisplayOrientation == ORIENTATION_AUTO ) {
4374
+                   if ( $TxtHeight < $BarHeight && $TxtWidth < $BarWidth  ) {
4907 4375
                      $this->drawText($XCenter,$YCenter,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontSize"=>$DisplaySize,"FontName"=>$DisplayFont));
4908 4376
                      $Done = TRUE;
4909 4377
                     }
4910 4378
                   }
4911 4379
 
4912
-                 if ( $DisplayOrientation == ORIENTATION_VERTICAL || ( $DisplayOrientation == ORIENTATION_AUTO && !$Done) )
4913
-                  {
4380
+                 if ( $DisplayOrientation == ORIENTATION_VERTICAL || ( $DisplayOrientation == ORIENTATION_AUTO && !$Done) ) {
4914 4381
                    if ( $TxtHeight < $BarWidth && $TxtWidth < $BarHeight  )
4915 4382
                     $this->drawText($XCenter,$YCenter,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Angle"=>90,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontSize"=>$DisplaySize,"FontName"=>$DisplayFont));
4916 4383
                   }
@@ -4921,9 +4388,7 @@  discard block
 block discarded – undo
4921 4388
 
4922 4389
              $X = $X + $XStep;
4923 4390
             }
4924
-          }
4925
-         else
4926
-          {
4391
+          } else {
4927 4392
            if ( $YZero < $this->GraphAreaX1+1 ) { $YZero = $this->GraphAreaX1+1; }
4928 4393
            if ( $YZero > $this->GraphAreaX2-1 ) { $YZero = $this->GraphAreaX2-1; }
4929 4394
 
@@ -4934,10 +4399,8 @@  discard block
 block discarded – undo
4934 4399
            $YOffset = -($YSize/2);
4935 4400
 
4936 4401
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
4937
-           foreach($PosArray as $Key => $Width)
4938
-            {
4939
-             if ( $Width != VOID && $Serie["Data"][$Key] != 0 )
4940
-              {
4402
+           foreach($PosArray as $Key => $Width) {
4403
+             if ( $Width != VOID && $Serie["Data"][$Key] != 0 ) {
4941 4404
                if ( $Serie["Data"][$Key] > 0 ) { $Pos = "+"; } else { $Pos = "-"; }
4942 4405
 
4943 4406
                if ( !isset($LastX[$Key] ) ) { $LastX[$Key] = ""; }
@@ -4953,23 +4416,18 @@  discard block
 block discarded – undo
4953 4416
 
4954 4417
                if ( $Rounded )
4955 4418
                 $this->drawRoundedFilledRectangle($X1+$XSpaceLeft,$Y+$YOffset,$X2-$XSpaceRight,$Y+$YOffset+$YSize,$RoundRadius,$Color);
4956
-               else
4957
-                {
4419
+               else {
4958 4420
                  $this->drawFilledRectangle($X1+$XSpaceLeft,$Y+$YOffset,$X2-$XSpaceRight,$Y+$YOffset+$YSize,$Color);
4959 4421
 
4960 4422
                  if ( $InnerColor != NULL ) { $RestoreShadow = $this->Shadow; $this->Shadow = FALSE; $this->drawRectangle(min($X1+$XSpaceLeft,$X2-$XSpaceRight)+1,min($Y+$YOffset,$Y+$YOffset+$YSize)+1,max($X1+$XSpaceLeft,$X2-$XSpaceRight)-1,max($Y+$YOffset,$Y+$YOffset+$YSize)-1,$InnerColor); $this->Shadow = $RestoreShadow;}
4961 4423
 
4962
-                 if ( $Gradient )
4963
-                  {
4424
+                 if ( $Gradient ) {
4964 4425
                    $this->Shadow  = FALSE;
4965 4426
 
4966
-                   if ( $GradientMode == GRADIENT_SIMPLE )
4967
-                    {
4427
+                   if ( $GradientMode == GRADIENT_SIMPLE ) {
4968 4428
                      $GradientColor = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha);
4969 4429
                      $this->drawGradientArea($X1+$XSpaceLeft,$Y+$YOffset,$X2-$XSpaceRight,$Y+$YOffset+$YSize,DIRECTION_HORIZONTAL,$GradientColor);
4970
-                    }
4971
-                   elseif ( $GradientMode == GRADIENT_EFFECT_CAN )
4972
-                    {
4430
+                    } elseif ( $GradientMode == GRADIENT_EFFECT_CAN ) {
4973 4431
                      $GradientColor1 = array("StartR"=>$GradientEndR,"StartG"=>$GradientEndG,"StartB"=>$GradientEndB,"EndR"=>$GradientStartR,"EndG"=>$GradientStartG,"EndB"=>$GradientStartB,"Alpha"=>$GradientAlpha);
4974 4432
                      $GradientColor2 = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha);
4975 4433
                      $YSpan = floor($YSize / 3);
@@ -4981,8 +4439,7 @@  discard block
 block discarded – undo
4981 4439
                   }
4982 4440
                 }
4983 4441
 
4984
-               if ( $DisplayValues )
4985
-                {
4442
+               if ( $DisplayValues ) {
4986 4443
                  $BarWidth = abs($X2-$X1)-$FontFactor;
4987 4444
                  $BarHeight = $YSize+($YOffset/2)-$FontFactor/2;
4988 4445
                  $Caption   = $this->scaleFormat(round($Serie["Data"][$Key],$DisplayRound),$Mode,$Format,$Unit);
@@ -4994,17 +4451,14 @@  discard block
 block discarded – undo
4994 4451
                  $YCenter  = ( ($Y+$YOffset+$YSize) - ($Y+$YOffset) ) / 2 + $Y+$YOffset;
4995 4452
 
4996 4453
                  $Done = FALSE;
4997
-                 if ( $DisplayOrientation == ORIENTATION_HORIZONTAL || $DisplayOrientation == ORIENTATION_AUTO )
4998
-                  {
4999
-                   if ( $TxtHeight < $BarHeight && $TxtWidth < $BarWidth  )
5000
-                    {
4454
+                 if ( $DisplayOrientation == ORIENTATION_HORIZONTAL || $DisplayOrientation == ORIENTATION_AUTO ) {
4455
+                   if ( $TxtHeight < $BarHeight && $TxtWidth < $BarWidth  ) {
5001 4456
                      $this->drawText($XCenter,$YCenter,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontSize"=>$DisplaySize,"FontName"=>$DisplayFont));
5002 4457
                      $Done = TRUE;
5003 4458
                     }
5004 4459
                   }
5005 4460
 
5006
-                 if ( $DisplayOrientation == ORIENTATION_VERTICAL || ( $DisplayOrientation == ORIENTATION_AUTO && !$Done) )
5007
-                  {
4461
+                 if ( $DisplayOrientation == ORIENTATION_VERTICAL || ( $DisplayOrientation == ORIENTATION_AUTO && !$Done) ) {
5008 4462
                    if ( $TxtHeight < $BarWidth && $TxtWidth < $BarHeight  )
5009 4463
                     $this->drawText($XCenter,$YCenter,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Angle"=>90,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontSize"=>$DisplaySize,"FontName"=>$DisplayFont));
5010 4464
                   }
@@ -5021,8 +4475,7 @@  discard block
 block discarded – undo
5021 4475
     }
5022 4476
 
5023 4477
    /* Draw a stacked area chart */
5024
-   function drawStackedAreaChart($Format=NULL)
5025
-    {
4478
+   function drawStackedAreaChart($Format=NULL) {
5026 4479
      $DrawLine		= isset($Format["DrawLine"]) ? $Format["DrawLine"] : FALSE;
5027 4480
      $LineSurrounding	= isset($Format["LineSurrounding"]) ? $Format["LineSurrounding"] : NULL;
5028 4481
      $LineR		= isset($Format["LineR"]) ? $Format["LineR"] : VOID;
@@ -5051,21 +4504,17 @@  discard block
 block discarded – undo
5051 4504
      $OffsetData    = "";
5052 4505
      $OverallOffset = "";
5053 4506
      $SerieOrder    = "";
5054
-     foreach($Data["Series"] as $SerieName => $Serie)
5055
-      {
5056
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
5057
-        {
4507
+     foreach($Data["Series"] as $SerieName => $Serie) {
4508
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
5058 4509
          $SerieOrder[] = $SerieName;
5059 4510
 
5060
-         foreach($Serie["Data"] as $Key => $Value)
5061
-          {
4511
+         foreach($Serie["Data"] as $Key => $Value) {
5062 4512
            if ( $Value == VOID ) { $Value = 0; }
5063 4513
            if ($Value >= 0) { $Sign = "+"; } else { $Sign = "-"; }
5064 4514
            if ( !isset($OverallOffset[$Key]) || !isset($OverallOffset[$Key][$Sign]) ) { $OverallOffset[$Key][$Sign] = 0; }
5065 4515
 
5066 4516
            if ( $Sign == "+" )
5067
-            { $Data["Series"][$SerieName]["Data"][$Key] = $Value + $OverallOffset[$Key][$Sign]; }
5068
-           else
4517
+            { $Data["Series"][$SerieName]["Data"][$Key] = $Value + $OverallOffset[$Key][$Sign]; } else
5069 4518
             { $Data["Series"][$SerieName]["Data"][$Key] = $Value - $OverallOffset[$Key][$Sign]; }
5070 4519
 
5071 4520
            $OverallOffset[$Key][$Sign] = $OverallOffset[$Key][$Sign] + abs($Value);
@@ -5075,11 +4524,9 @@  discard block
 block discarded – undo
5075 4524
      $SerieOrder = array_reverse($SerieOrder);
5076 4525
 
5077 4526
      $LastX = ""; $LastY = "";
5078
-     foreach($SerieOrder as $Key => $SerieName)
5079
-      {
4527
+     foreach($SerieOrder as $Key => $SerieName) {
5080 4528
        $Serie = $Data["Series"][$SerieName];
5081
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
5082
-        {
4529
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
5083 4530
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"];
5084 4531
          if ( $ForceTransparency != NULL ) { $Alpha = $ForceTransparency; }
5085 4532
 
@@ -5107,8 +4554,7 @@  discard block
 block discarded – undo
5107 4554
 
5108 4555
          $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0;
5109 4556
 
5110
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
5111
-          {
4557
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
5112 4558
            if ( $YZero < $this->GraphAreaY1+1 ) { $YZero = $this->GraphAreaY1+1; }
5113 4559
            if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; }
5114 4560
 
@@ -5118,8 +4564,7 @@  discard block
 block discarded – undo
5118 4564
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
5119 4565
 
5120 4566
            $Plots = ""; $Plots[] = $X; $Plots[] = $YZero;
5121
-           foreach($PosArray as $Key => $Height)
5122
-            {
4567
+           foreach($PosArray as $Key => $Height) {
5123 4568
              if ( $Height != VOID ) { $Plots[] = $X; $Plots[] = $YZero-$Height; }
5124 4569
              $X = $X + $XStep;
5125 4570
             }
@@ -5129,10 +4574,8 @@  discard block
 block discarded – undo
5129 4574
 
5130 4575
            $this->Shadow = $RestoreShadow;
5131 4576
            if ( $DrawLine ) { for($i=2; $i<=count($Plots)-6; $i=$i+2) { $this->drawLine($Plots[$i],$Plots[$i+1],$Plots[$i+2],$Plots[$i+3],$LineColor); } }
5132
-           if ( $DrawPlot )
5133
-            {
5134
-             for($i=2; $i<=count($Plots)-4; $i=$i+2)
5135
-              {
4577
+           if ( $DrawPlot ) {
4578
+             for($i=2; $i<=count($Plots)-4; $i=$i+2) {
5136 4579
                if ( $PlotBorder != 0 )
5137 4580
                 { $this->drawFilledCircle($Plots[$i],$Plots[$i+1],$PlotRadius+$PlotBorder,$PlotBorderColor); }
5138 4581
 
@@ -5140,9 +4583,7 @@  discard block
 block discarded – undo
5140 4583
               }
5141 4584
             }
5142 4585
            $this->Shadow = FALSE;
5143
-          }
5144
-         elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
5145
-          {
4586
+          } elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) {
5146 4587
            if ( $YZero < $this->GraphAreaX1+1 ) { $YZero = $this->GraphAreaX1+1; }
5147 4588
            if ( $YZero > $this->GraphAreaX2-1 ) { $YZero = $this->GraphAreaX2-1; }
5148 4589
 
@@ -5152,8 +4593,7 @@  discard block
 block discarded – undo
5152 4593
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
5153 4594
 
5154 4595
            $Plots = ""; $Plots[] = $YZero; $Plots[] = $Y;
5155
-           foreach($PosArray as $Key => $Height)
5156
-            {
4596
+           foreach($PosArray as $Key => $Height) {
5157 4597
              if ( $Height != VOID ) { $Plots[] = $YZero+$Height; $Plots[] = $Y; }
5158 4598
              $Y = $Y + $YStep;
5159 4599
             }
@@ -5163,10 +4603,8 @@  discard block
 block discarded – undo
5163 4603
 
5164 4604
            $this->Shadow = $RestoreShadow;
5165 4605
            if ( $DrawLine ) { for($i=2; $i<=count($Plots)-6; $i=$i+2) { $this->drawLine($Plots[$i],$Plots[$i+1],$Plots[$i+2],$Plots[$i+3],$LineColor); } }
5166
-           if ( $DrawPlot )
5167
-            {
5168
-             for($i=2; $i<=count($Plots)-4; $i=$i+2)
5169
-              {
4606
+           if ( $DrawPlot ) {
4607
+             for($i=2; $i<=count($Plots)-4; $i=$i+2) {
5170 4608
                if ( $PlotBorder != 0 )
5171 4609
                 { $this->drawFilledCircle($Plots[$i],$Plots[$i+1],$PlotRadius+$PlotBorder,$PlotBorderColor); }
5172 4610
 
@@ -5185,27 +4623,22 @@  discard block
 block discarded – undo
5185 4623
     { return(array("R"=>rand(0,255),"G"=>rand(0,255),"B"=>rand(0,255),"Alpha"=>$Alpha)); }
5186 4624
  
5187 4625
    /* Validate a palette */
5188
-   function validatePalette($Colors,$Surrounding=NULL)
5189
-    {
4626
+   function validatePalette($Colors,$Surrounding=NULL) {
5190 4627
      $Result = "";
5191 4628
 
5192 4629
      if ( !is_array($Colors) ) { return($this->getRandomColor()); }
5193 4630
 
5194
-     foreach($Colors as $Key => $Values)
5195
-      {
4631
+     foreach($Colors as $Key => $Values) {
5196 4632
        if ( isset($Values["R"]) ) { $Result[$Key]["R"] = $Values["R"]; } else { $Result[$Key]["R"] = rand(0,255); }
5197 4633
        if ( isset($Values["G"]) ) { $Result[$Key]["G"] = $Values["G"]; } else { $Result[$Key]["G"] = rand(0,255); }
5198 4634
        if ( isset($Values["B"]) ) { $Result[$Key]["B"] = $Values["B"]; } else { $Result[$Key]["B"] = rand(0,255); }
5199 4635
        if ( isset($Values["Alpha"]) ) { $Result[$Key]["Alpha"] = $Values["Alpha"]; } else { $Result[$Key]["Alpha"] = 100; }
5200 4636
 
5201
-       if ( $Surrounding != NULL )
5202
-        {
4637
+       if ( $Surrounding != NULL ) {
5203 4638
          $Result[$Key]["BorderR"] = $Result[$Key]["R"] + $Surrounding;
5204 4639
          $Result[$Key]["BorderG"] = $Result[$Key]["G"] + $Surrounding;
5205 4640
          $Result[$Key]["BorderB"] = $Result[$Key]["B"] + $Surrounding;
5206
-        }
5207
-       else
5208
-        {
4641
+        } else {
5209 4642
          if ( isset($Values["BorderR"]) )     { $Result[$Key]["BorderR"] = $Values["BorderR"]; } else { $Result[$Key]["BorderR"] = $Result[$Key]["R"]; }
5210 4643
          if ( isset($Values["BorderG"]) )     { $Result[$Key]["BorderG"] = $Values["BorderG"]; } else { $Result[$Key]["BorderG"] = $Result[$Key]["G"]; }
5211 4644
          if ( isset($Values["BorderB"]) )     { $Result[$Key]["BorderB"] = $Values["BorderB"]; } else { $Result[$Key]["BorderB"] = $Result[$Key]["B"]; }
@@ -5217,8 +4650,7 @@  discard block
 block discarded – undo
5217 4650
     }
5218 4651
 
5219 4652
    /* Draw the derivative chart associated to the data series */
5220
-   function drawDerivative($Format=NULL)
5221
-    {
4653
+   function drawDerivative($Format=NULL) {
5222 4654
      $Offset		= isset($Format["Offset"]) ? $Format["Offset"] : 10;
5223 4655
      $SerieSpacing	= isset($Format["SerieSpacing"]) ? $Format["SerieSpacing"] : 3;
5224 4656
      $DerivativeHeight	= isset($Format["DerivativeHeight"]) ? $Format["DerivativeHeight"] : 4;
@@ -5268,29 +4700,23 @@  discard block
 block discarded – undo
5268 4700
      else
5269 4701
       $XPos = $this->DataSet->Data["GraphArea"]["X2"] + $Offset;
5270 4702
 
5271
-     foreach($Data["Series"] as $SerieName => $Serie)
5272
-      {
5273
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
5274
-        {
4703
+     foreach($Data["Series"] as $SerieName => $Serie) {
4704
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
5275 4705
          $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"];
5276 4706
 
5277 4707
          $AxisID   = $Serie["Axis"];
5278 4708
          $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"]));
5279 4709
 
5280
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
5281
-          {
5282
-           if ( $Caption )
5283
-            {
5284
-             if ( $CaptionLine ) 
5285
-              {
4710
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
4711
+           if ( $Caption ) {
4712
+             if ( $CaptionLine ) {
5286 4713
                $StartX = floor($this->GraphAreaX1-$CaptionWidth+$XMargin-$CaptionMargin);
5287 4714
                $EndX   = floor($this->GraphAreaX1-$CaptionMargin+$XMargin);
5288 4715
 
5289 4716
                $CaptionSettings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight);
5290 4717
                if ( $CaptionBox ) { $this->drawFilledRectangle($StartX,$YPos,$EndX,$YPos+$CaptionHeight,array("R"=>$CaptionFillR,"G"=>$CaptionFillG,"B"=>$CaptionFillB,"BorderR"=>$CaptionBorderR,"BorderG"=>$CaptionBorderG,"BorderB"=>$CaptionBorderB,"Alpha"=>$CaptionFillAlpha)); }
5291 4718
                $this->drawLine($StartX+2,$YPos+($CaptionHeight/2),$EndX-2,$YPos+($CaptionHeight/2),$CaptionSettings);
5292
-              }
5293
-             else
4719
+              } else
5294 4720
               $this->drawFilledRectangle($this->GraphAreaX1-$CaptionWidth+$XMargin-$CaptionMargin,$YPos,$this->GraphAreaX1-$CaptionMargin+$XMargin,$YPos+$CaptionHeight,array("R"=>$R,"G"=>$G,"B"=>$B,"BorderR"=>$CaptionBorderR,"BorderG"=>$CaptionBorderG,"BorderB"=>$CaptionBorderB));
5295 4721
             }
5296 4722
 
@@ -5313,33 +4739,26 @@  discard block
 block discarded – undo
5313 4739
 
5314 4740
            /* Determine the Max slope index */
5315 4741
            $LastX = NULL; $LastY = NULL; $MinSlope = 0; $MaxSlope = 1;
5316
-           foreach($PosArray as $Key => $Y)
5317
-            {
4742
+           foreach($PosArray as $Key => $Y) {
5318 4743
              if ( $Y != VOID && $LastX != NULL )
5319 4744
               { $Slope = ($LastY - $Y); if ( $Slope > $MaxSlope ) { $MaxSlope = $Slope; } if ( $Slope < $MinSlope ) { $MinSlope = $Slope; } }
5320 4745
 
5321 4746
              if ( $Y == VOID )
5322
-              { $LastX = NULL; $LastY = NULL; }
5323
-             else
4747
+              { $LastX = NULL; $LastY = NULL; } else
5324 4748
               { $LastX = $X; $LastY = $Y; }
5325 4749
             }
5326 4750
 
5327 4751
            $LastX = NULL; $LastY = NULL; $LastColor = NULL;
5328
-           foreach($PosArray as $Key => $Y)
5329
-            {
5330
-             if ( $Y != VOID && $LastY != NULL )
5331
-              {
4752
+           foreach($PosArray as $Key => $Y) {
4753
+             if ( $Y != VOID && $LastY != NULL ) {
5332 4754
                $Slope = ($LastY - $Y);
5333 4755
 
5334
-               if ( $Slope >= 0 )
5335
-                {
4756
+               if ( $Slope >= 0 ) {
5336 4757
                  $SlopeIndex = (100 / $MaxSlope) * $Slope;
5337 4758
                  $R = (($PositiveSlopeEndR - $PositiveSlopeStartR)/100)*$SlopeIndex+$PositiveSlopeStartR;
5338 4759
                  $G = (($PositiveSlopeEndG - $PositiveSlopeStartG)/100)*$SlopeIndex+$PositiveSlopeStartG;
5339 4760
                  $B = (($PositiveSlopeEndB - $PositiveSlopeStartB)/100)*$SlopeIndex+$PositiveSlopeStartB;
5340
-                }
5341
-               elseif ( $Slope < 0 )
5342
-                {
4761
+                } elseif ( $Slope < 0 ) {
5343 4762
                  $SlopeIndex = (100 / abs($MinSlope)) * abs($Slope);
5344 4763
                  $R = (($NegativeSlopeEndR - $NegativeSlopeStartR)/100)*$SlopeIndex+$NegativeSlopeStartR;
5345 4764
                  $G = (($NegativeSlopeEndG - $NegativeSlopeStartG)/100)*$SlopeIndex+$NegativeSlopeStartG;
@@ -5352,36 +4771,29 @@  discard block
 block discarded – undo
5352 4771
                 {
5353 4772
                  $GradientSettings = array("StartR"=>$LastColor["R"],"StartG"=>$LastColor["G"],"StartB"=>$LastColor["B"],"EndR"=>$R,"EndG"=>$G,"EndB"=>$B);
5354 4773
                  $this->drawGradientArea($LastX,$TopY,$X,$BottomY,DIRECTION_HORIZONTAL,$GradientSettings);
5355
-                }
5356
-               elseif ( !$ShadedSlopeBox || $LastColor == NULL ) // || $Slope == 0
4774
+                } elseif ( !$ShadedSlopeBox || $LastColor == NULL ) // || $Slope == 0
5357 4775
                 $this->drawFilledRectangle(floor($LastX),$TopY,floor($X),$BottomY,$Color);
5358 4776
 
5359 4777
                $LastColor = $Color;
5360 4778
               }
5361 4779
 
5362 4780
              if ( $Y == VOID )
5363
-              { $LastY = NULL; }
5364
-             else
4781
+              { $LastY = NULL; } else
5365 4782
               { $LastX = $X; $LastY = $Y; }
5366 4783
 
5367 4784
              $X = $X + $XStep;
5368 4785
             }
5369 4786
 
5370 4787
            $YPos = $YPos + $CaptionHeight + $SerieSpacing;
5371
-          }
5372
-         else
5373
-          {
5374
-           if ( $Caption )
5375
-            {
4788
+          } else {
4789
+           if ( $Caption ) {
5376 4790
              $StartY = floor($this->GraphAreaY1-$CaptionWidth+$XMargin-$CaptionMargin);
5377 4791
              $EndY   = floor($this->GraphAreaY1-$CaptionMargin+$XMargin);
5378
-             if ( $CaptionLine ) 
5379
-              {
4792
+             if ( $CaptionLine ) {
5380 4793
                $CaptionSettings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight);
5381 4794
                if ( $CaptionBox ) { $this->drawFilledRectangle($XPos,$StartY,$XPos+$CaptionHeight,$EndY,array("R"=>$CaptionFillR,"G"=>$CaptionFillG,"B"=>$CaptionFillB,"BorderR"=>$CaptionBorderR,"BorderG"=>$CaptionBorderG,"BorderB"=>$CaptionBorderB,"Alpha"=>$CaptionFillAlpha)); }
5382 4795
                $this->drawLine($XPos+($CaptionHeight/2),$StartY+2,$XPos+($CaptionHeight/2),$EndY-2,$CaptionSettings);
5383
-              }
5384
-             else
4796
+              } else
5385 4797
               $this->drawFilledRectangle($XPos,$StartY,$XPos+$CaptionHeight,$EndY,array("R"=>$R,"G"=>$G,"B"=>$B,"BorderR"=>$CaptionBorderR,"BorderG"=>$CaptionBorderG,"BorderB"=>$CaptionBorderB));
5386 4798
             }
5387 4799
 
@@ -5405,33 +4817,26 @@  discard block
 block discarded – undo
5405 4817
 
5406 4818
            /* Determine the Max slope index */
5407 4819
            $LastX = NULL; $LastY = NULL; $MinSlope = 0; $MaxSlope = 1;
5408
-           foreach($PosArray as $Key => $X)
5409
-            {
4820
+           foreach($PosArray as $Key => $X) {
5410 4821
              if ( $X != VOID && $LastX != NULL )
5411 4822
               { $Slope = ($X - $LastX); if ( $Slope > $MaxSlope ) { $MaxSlope = $Slope; } if ( $Slope < $MinSlope ) { $MinSlope = $Slope; } }
5412 4823
 
5413 4824
              if ( $X == VOID )
5414
-              { $LastX = NULL; }
5415
-             else
4825
+              { $LastX = NULL; } else
5416 4826
               { $LastX = $X; }
5417 4827
             }
5418 4828
 
5419 4829
            $LastX = NULL; $LastY = NULL; $LastColor = NULL;
5420
-           foreach($PosArray as $Key => $X)
5421
-            {
5422
-             if ( $X != VOID && $LastX != NULL )
5423
-              {
4830
+           foreach($PosArray as $Key => $X) {
4831
+             if ( $X != VOID && $LastX != NULL ) {
5424 4832
                $Slope = ($X - $LastX);
5425 4833
 
5426
-               if ( $Slope >= 0 )
5427
-                {
4834
+               if ( $Slope >= 0 ) {
5428 4835
                  $SlopeIndex = (100 / $MaxSlope) * $Slope;
5429 4836
                  $R = (($PositiveSlopeEndR - $PositiveSlopeStartR)/100)*$SlopeIndex+$PositiveSlopeStartR;
5430 4837
                  $G = (($PositiveSlopeEndG - $PositiveSlopeStartG)/100)*$SlopeIndex+$PositiveSlopeStartG;
5431 4838
                  $B = (($PositiveSlopeEndB - $PositiveSlopeStartB)/100)*$SlopeIndex+$PositiveSlopeStartB;
5432
-                }
5433
-               elseif ( $Slope < 0 )
5434
-                {
4839
+                } elseif ( $Slope < 0 ) {
5435 4840
                  $SlopeIndex = (100 / abs($MinSlope)) * abs($Slope);
5436 4841
                  $R = (($NegativeSlopeEndR - $NegativeSlopeStartR)/100)*$SlopeIndex+$NegativeSlopeStartR;
5437 4842
                  $G = (($NegativeSlopeEndG - $NegativeSlopeStartG)/100)*$SlopeIndex+$NegativeSlopeStartG;
@@ -5440,21 +4845,18 @@  discard block
 block discarded – undo
5440 4845
 
5441 4846
                $Color = array("R"=>$R,"G"=>$G,"B"=>$B);
5442 4847
 
5443
-               if ( $ShadedSlopeBox && $LastColor != NULL )
5444
-                {
4848
+               if ( $ShadedSlopeBox && $LastColor != NULL ) {
5445 4849
                  $GradientSettings = array("StartR"=>$LastColor["R"],"StartG"=>$LastColor["G"],"StartB"=>$LastColor["B"],"EndR"=>$R,"EndG"=>$G,"EndB"=>$B);
5446 4850
 
5447 4851
                  $this->drawGradientArea($TopX,$LastY,$BottomX,$Y,DIRECTION_VERTICAL,$GradientSettings);
5448
-                }
5449
-               elseif ( !$ShadedSlopeBox || $LastColor == NULL ) 
4852
+                } elseif ( !$ShadedSlopeBox || $LastColor == NULL ) 
5450 4853
                 $this->drawFilledRectangle($TopX,floor($LastY),$BottomX,floor($Y),$Color);
5451 4854
 
5452 4855
                $LastColor = $Color;
5453 4856
               }
5454 4857
 
5455 4858
              if ( $X == VOID )
5456
-              { $LastX = NULL; }
5457
-             else
4859
+              { $LastX = NULL; } else
5458 4860
               { $LastX = $X; $LastY = $Y; }
5459 4861
 
5460 4862
              $Y = $Y + $XStep;
@@ -5469,8 +4871,7 @@  discard block
 block discarded – undo
5469 4871
     }
5470 4872
 
5471 4873
    /* Draw the line of best fit */
5472
-   function drawBestFit($Format="")
5473
-    {
4874
+   function drawBestFit($Format="") {
5474 4875
      $OverrideTicks	= isset($Format["Ticks"]) ? $Format["Ticks"] : NULL;
5475 4876
      $OverrideR		= isset($Format["R"]) ? $Format["R"] : VOID;
5476 4877
      $OverrideG		= isset($Format["G"]) ? $Format["G"] : VOID;
@@ -5480,10 +4881,8 @@  discard block
 block discarded – undo
5480 4881
      $Data = $this->DataSet->getData();
5481 4882
      list($XMargin,$XDivs) = $this->scaleGetXSettings();
5482 4883
 
5483
-     foreach($Data["Series"] as $SerieName => $Serie)
5484
-      {
5485
-       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
5486
-        {
4884
+     foreach($Data["Series"] as $SerieName => $Serie) {
4885
+       if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) {
5487 4886
          if ( $OverrideR != VOID && $OverrideG != VOID && $OverrideB != VOID ) { $R = $OverrideR; $G = $OverrideG; $B = $OverrideB; } else { $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; }
5488 4887
          if ( $OverrideTicks == NULL ) { $Ticks = $Serie["Ticks"]; } else { $Ticks = $OverrideTicks; }
5489 4888
          if ( $OverrideAlpha == VOID ) { $Alpha = $Serie["Color"]["Alpha"]; } else { $Alpha = $OverrideAlpha; }
@@ -5493,17 +4892,14 @@  discard block
 block discarded – undo
5493 4892
          $AxisID   = $Serie["Axis"];
5494 4893
          $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"]));
5495 4894
 
5496
-         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
5497
-          {
4895
+         if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
5498 4896
            if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; }
5499 4897
            $X = $this->GraphAreaX1 + $XMargin;
5500 4898
 
5501 4899
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
5502 4900
            $Sxy = 0; $Sx = 0; $Sy = 0; $Sxx = 0;
5503
-           foreach($PosArray as $Key => $Y)
5504
-            {
5505
-             if ( $Y != VOID )
5506
-              {
4901
+           foreach($PosArray as $Key => $Y) {
4902
+             if ( $Y != VOID ) {
5507 4903
                $Sxy = $Sxy + $X*$Y;
5508 4904
                $Sx  = $Sx + $X;
5509 4905
                $Sy  = $Sy + $Y;
@@ -5527,18 +4923,14 @@  discard block
 block discarded – undo
5527 4923
            if ( $Y2 > $this->GraphAreaY2 ) { $X2 = $X2 - ($Y2-$this->GraphAreaY2); $Y2 = $this->GraphAreaY2; }
5528 4924
 
5529 4925
            $this->drawLine($X1,$Y1,$X2,$Y2,$Color);
5530
-          }
5531
-         else
5532
-          {
4926
+          } else {
5533 4927
            if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; }
5534 4928
            $Y = $this->GraphAreaY1 + $XMargin;
5535 4929
 
5536 4930
            if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; }
5537 4931
            $Sxy = 0; $Sx = 0; $Sy = 0; $Sxx = 0;
5538
-           foreach($PosArray as $Key => $X)
5539
-            {
5540
-             if ( $X != VOID )
5541
-              {
4932
+           foreach($PosArray as $Key => $X) {
4933
+             if ( $X != VOID ) {
5542 4934
                $Sxy = $Sxy + $X*$Y;
5543 4935
                $Sx  = $Sx + $Y;
5544 4936
                $Sy  = $Sy + $X;
@@ -5568,8 +4960,7 @@  discard block
 block discarded – undo
5568 4960
     }
5569 4961
 
5570 4962
    /* Write labels */
5571
-   function writeLabel($SeriesName,$Indexes,$Format="")
5572
-    {
4963
+   function writeLabel($SeriesName,$Indexes,$Format="") {
5573 4964
      $OverrideTitle	= isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL;
5574 4965
      $ForceLabels	= isset($Format["ForceLabels"]) ? $Format["ForceLabels"] : NULL;
5575 4966
      $DrawPoint		= isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
@@ -5587,34 +4978,28 @@  discard block
 block discarded – undo
5587 4978
      if ( !is_array($SeriesName) ) { $SerieName = $SeriesName; $SeriesName = ""; $SeriesName[] = $SerieName; }
5588 4979
      if ( $ForceLabels != NULL && !is_array($ForceLabels) ) { $ForceLabel = $ForceLabels; $ForceLabels = ""; $ForceLabels[] = $ForceLabel; }
5589 4980
 
5590
-     foreach ($Indexes as $Key => $Index)
5591
-      {
4981
+     foreach ($Indexes as $Key => $Index) {
5592 4982
        $Series = "";
5593 4983
 
5594
-       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
5595
-        {
4984
+       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
5596 4985
          if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; }
5597 4986
          $X = $this->GraphAreaX1 + $XMargin + $Index * $XStep;
5598 4987
 
5599 4988
          if ( $DrawVerticalLine ) { $this->drawLine($X,$this->GraphAreaY1+$Data["YMargin"],$X,$this->GraphAreaY2-$Data["YMargin"],array("R"=>$VerticalLineR,"G"=>$VerticalLineG,"B"=>$VerticalLineB,"Alpha"=>$VerticalLineAlpha,"Ticks"=>$VerticalLineTicks)); }
5600 4989
 
5601 4990
          $MinY = $this->GraphAreaY2;
5602
-         foreach ($SeriesName as $iKey => $SerieName)
5603
-          {
5604
-           if ( isset($Data["Series"][$SerieName]["Data"][$Index]) )
5605
-            {
4991
+         foreach ($SeriesName as $iKey => $SerieName) {
4992
+           if ( isset($Data["Series"][$SerieName]["Data"][$Index]) ) {
5606 4993
              $AxisID      = $Data["Series"][$SerieName]["Axis"];
5607 4994
 
5608 4995
              if ( $OverrideTitle != NULL)
5609 4996
               $Description = $OverrideTitle;
5610
-             elseif ( count($SeriesName) == 1 )
5611
-              {
4997
+             elseif ( count($SeriesName) == 1 ) {
5612 4998
                if ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index]) )
5613 4999
                 $Description = $Data["Series"][$SerieName]["Description"]." - ".$Data["Series"][$Data["Abscissa"]]["Data"][$Index];
5614 5000
                else
5615 5001
                 $Description = $Data["Series"][$SerieName]["Description"];
5616
-              }
5617
-             elseif ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index]) )
5002
+              } elseif ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index]) )
5618 5003
               $Description = $Data["Series"][$Data["Abscissa"]]["Data"][$Index];
5619 5004
 
5620 5005
              $AxisMode     = $Data["Axis"][$AxisID]["Display"];
@@ -5640,17 +5025,13 @@  discard block
 block discarded – undo
5640 5025
              else
5641 5026
               $Caption = $this->scaleFormat($Value,$AxisMode,$AxisFormat,$AxisUnit);
5642 5027
 
5643
-             if ( $this->LastChartLayout == CHART_LAST_LAYOUT_STACKED )
5644
-              {
5028
+             if ( $this->LastChartLayout == CHART_LAST_LAYOUT_STACKED ) {
5645 5029
                if ( $Value >=0 ) { $LookFor = "+"; } else { $LookFor = "-"; }
5646 5030
 
5647 5031
                $Value = 0; $Done = FALSE;
5648
-               foreach($Data["Series"] as $Name => $SerieLookup)
5649
-                {
5650
-                 if ( $SerieLookup["isDrawable"] == TRUE && $Name != $Data["Abscissa"] && !$Done )
5651
-                  {
5652
-                   if ( isset($Data["Series"][$Name]["Data"][$Index]) && $Data["Series"][$Name]["Data"][$Index] != VOID )
5653
-                    {
5032
+               foreach($Data["Series"] as $Name => $SerieLookup) {
5033
+                 if ( $SerieLookup["isDrawable"] == TRUE && $Name != $Data["Abscissa"] && !$Done ) {
5034
+                   if ( isset($Data["Series"][$Name]["Data"][$Index]) && $Data["Series"][$Name]["Data"][$Index] != VOID ) {
5654 5035
                      if ($Data["Series"][$Name]["Data"][$Index] >= 0 && $LookFor == "+" ) { $Value = $Value + $Data["Series"][$Name]["Data"][$Index]; }
5655 5036
                      if ($Data["Series"][$Name]["Data"][$Index] < 0 && $LookFor == "-" )  { $Value = $Value - $Data["Series"][$Name]["Data"][$Index]; }
5656 5037
                      if ($Name == $SerieName ) { $Done = TRUE; }
@@ -5674,31 +5055,25 @@  discard block
 block discarded – undo
5674 5055
           }
5675 5056
          $this->drawLabelBox($X,$MinY-3,$Description,$Series,$Format);
5676 5057
 
5677
-        }
5678
-       else
5679
-        {
5058
+        } else {
5680 5059
          if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $XStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; }
5681 5060
          $Y = $this->GraphAreaY1 + $XMargin + $Index * $XStep;
5682 5061
 
5683 5062
          if ( $DrawVerticalLine ) { $this->drawLine($this->GraphAreaX1+$Data["YMargin"],$Y,$this->GraphAreaX2-$Data["YMargin"],$Y,array("R"=>$VerticalLineR,"G"=>$VerticalLineG,"B"=>$VerticalLineB,"Alpha"=>$VerticalLineAlpha,"Ticks"=>$VerticalLineTicks)); }
5684 5063
 
5685 5064
          $MinX = $this->GraphAreaX2;
5686
-         foreach ($SeriesName as $Key => $SerieName)
5687
-          {
5688
-           if ( isset($Data["Series"][$SerieName]["Data"][$Index]) )
5689
-            {
5065
+         foreach ($SeriesName as $Key => $SerieName) {
5066
+           if ( isset($Data["Series"][$SerieName]["Data"][$Index]) ) {
5690 5067
              $AxisID      = $Data["Series"][$SerieName]["Axis"];
5691 5068
 
5692 5069
              if ( $OverrideTitle != NULL)
5693 5070
               $Description = $OverrideTitle;
5694
-             elseif ( count($SeriesName) == 1 )
5695
-              {
5071
+             elseif ( count($SeriesName) == 1 ) {
5696 5072
                if ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index]) )
5697 5073
                 $Description = $Data["Series"][$SerieName]["Description"]." - ".$Data["Series"][$Data["Abscissa"]]["Data"][$Index];
5698 5074
                else
5699 5075
                 $Description = $Data["Series"][$SerieName]["Description"];
5700
-              }
5701
-             elseif ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index]) )
5076
+              } elseif ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index]) )
5702 5077
               $Description = $Data["Series"][$Data["Abscissa"]]["Data"][$Index];
5703 5078
 
5704 5079
              $AxisMode     = $Data["Axis"][$AxisID]["Display"];
@@ -5706,15 +5081,12 @@  discard block
 block discarded – undo
5706 5081
              $AxisUnit     = $Data["Axis"][$AxisID]["Unit"];
5707 5082
 
5708 5083
              $Serie = "";
5709
-             if ( isset($Data["Extended"]["Palette"][$Index] ) )
5710
-              {
5084
+             if ( isset($Data["Extended"]["Palette"][$Index] ) ) {
5711 5085
                $Serie["R"] = $Data["Extended"]["Palette"][$Index]["R"];
5712 5086
                $Serie["G"] = $Data["Extended"]["Palette"][$Index]["G"];
5713 5087
                $Serie["B"] = $Data["Extended"]["Palette"][$Index]["B"];
5714 5088
                $Serie["Alpha"] = $Data["Extended"]["Palette"][$Index]["Alpha"];
5715
-              }
5716
-             else
5717
-              {
5089
+              } else {
5718 5090
                $Serie["R"] = $Data["Series"][$SerieName]["Color"]["R"];
5719 5091
                $Serie["G"] = $Data["Series"][$SerieName]["Color"]["G"];
5720 5092
                $Serie["B"] = $Data["Series"][$SerieName]["Color"]["B"];
@@ -5733,17 +5105,13 @@  discard block
 block discarded – undo
5733 5105
               $Caption = $this->scaleFormat($Value,$AxisMode,$AxisFormat,$AxisUnit);
5734 5106
              if ( $Value == VOID ) { $Value = "NaN"; }
5735 5107
 
5736
-             if ( $this->LastChartLayout == CHART_LAST_LAYOUT_STACKED )
5737
-              {
5108
+             if ( $this->LastChartLayout == CHART_LAST_LAYOUT_STACKED ) {
5738 5109
                if ( $Value >=0 ) { $LookFor = "+"; } else { $LookFor = "-"; }
5739 5110
 
5740 5111
                $Value = 0; $Done = FALSE;
5741
-               foreach($Data["Series"] as $Name => $SerieLookup)
5742
-                {
5743
-                 if ( $SerieLookup["isDrawable"] == TRUE && $Name != $Data["Abscissa"] && !$Done )
5744
-                  {
5745
-                   if ( isset($Data["Series"][$Name]["Data"][$Index]) && $Data["Series"][$Name]["Data"][$Index] != VOID )
5746
-                    {
5112
+               foreach($Data["Series"] as $Name => $SerieLookup) {
5113
+                 if ( $SerieLookup["isDrawable"] == TRUE && $Name != $Data["Abscissa"] && !$Done ) {
5114
+                   if ( isset($Data["Series"][$Name]["Data"][$Index]) && $Data["Series"][$Name]["Data"][$Index] != VOID ) {
5747 5115
                      if ($Data["Series"][$Name]["Data"][$Index] >= 0 && $LookFor == "+" ) { $Value = $Value + $Data["Series"][$Name]["Data"][$Index]; }
5748 5116
                      if ($Data["Series"][$Name]["Data"][$Index] < 0 && $LookFor == "-" )  { $Value = $Value - $Data["Series"][$Name]["Data"][$Index]; }
5749 5117
                      if ($Name == $SerieName ) { $Done = TRUE; }
@@ -5772,8 +5140,7 @@  discard block
 block discarded – undo
5772 5140
     }
5773 5141
 
5774 5142
    /* Draw a label box */
5775
-   function drawLabelBox($X,$Y,$Title,$Captions,$Format="")
5776
-    {
5143
+   function drawLabelBox($X,$Y,$Title,$Captions,$Format="") {
5777 5144
      $NoTitle		= isset($Format["NoTitle"]) ? $Format["NoTitle"] : NULL;
5778 5145
      $BoxWidth		= isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 50;
5779 5146
      $DrawSerieColor	= isset($Format["DrawSerieColor"]) ? $Format["DrawSerieColor"] : TRUE;
@@ -5814,8 +5181,7 @@  discard block
 block discarded – undo
5814 5181
      if ( $NoTitle ) { $TitleWidth = 0; $TitleHeight = 0; }
5815 5182
 
5816 5183
      $CaptionWidth = 0; $CaptionHeight = -$HorizontalMargin;
5817
-     foreach($Captions as $Key =>$Caption)
5818
-      {
5184
+     foreach($Captions as $Key =>$Caption) {
5819 5185
        $TxtPos        = $this->getTextBox($X,$Y,$FontName,$FontSize,0,$Caption["Caption"]);
5820 5186
        $CaptionWidth  = max($CaptionWidth,($TxtPos[1]["X"] - $TxtPos[0]["X"])+$VerticalMargin*2);
5821 5187
        $CaptionHeight = $CaptionHeight + max(($TxtPos[0]["Y"] - $TxtPos[2]["Y"]),($SerieBoxSize+2)) + $HorizontalMargin;
@@ -5831,8 +5197,7 @@  discard block
 block discarded – undo
5831 5197
      $XMax = $X + 5 + floor(($BoxWidth-10) / 2);
5832 5198
 
5833 5199
      $RestoreShadow = $this->Shadow;
5834
-     if ( $this->Shadow == TRUE )
5835
-      {
5200
+     if ( $this->Shadow == TRUE ) {
5836 5201
        $this->Shadow = FALSE;
5837 5202
 
5838 5203
        $Poly = "";
@@ -5840,13 +5205,10 @@  discard block
 block discarded – undo
5840 5205
        $Poly[] = $X+5+$this->ShadowX; $Poly[] = $Y-5+$this->ShadowX;
5841 5206
        $Poly[] = $XMax+$this->ShadowX; $Poly[] = $Y-5+$this->ShadowX;
5842 5207
 
5843
-       if ( $NoTitle )
5844
-        {
5208
+       if ( $NoTitle ) {
5845 5209
          $Poly[] = $XMax+$this->ShadowX; $Poly[] = $Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*2+$this->ShadowX;
5846 5210
          $Poly[] = $XMin+$this->ShadowX; $Poly[] = $Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*2+$this->ShadowX;
5847
-        }
5848
-       else
5849
-        {
5211
+        } else {
5850 5212
          $Poly[] = $XMax+$this->ShadowX; $Poly[] = $Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3+$this->ShadowX;
5851 5213
          $Poly[] = $XMin+$this->ShadowX; $Poly[] = $Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3+$this->ShadowX;
5852 5214
         }
@@ -5871,14 +5233,11 @@  discard block
 block discarded – undo
5871 5233
      imageline($this->Picture,$X,$Y,$X-5,$Y-5,$OuterBorderColor);
5872 5234
      imageline($this->Picture,$X,$Y,$X+5,$Y-5,$OuterBorderColor);
5873 5235
      imageline($this->Picture,$X+5,$Y-5,$XMax,$Y-5,$OuterBorderColor);
5874
-     if ( $NoTitle )
5875
-      {
5236
+     if ( $NoTitle ) {
5876 5237
        imageline($this->Picture,$XMin,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$XMin,$Y-5,$OuterBorderColor);
5877 5238
        imageline($this->Picture,$XMax,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$XMax,$Y-5,$OuterBorderColor);
5878 5239
        imageline($this->Picture,$XMin,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$XMax,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$OuterBorderColor);
5879
-      }
5880
-     else
5881
-      {
5240
+      } else {
5882 5241
        imageline($this->Picture,$XMin,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMin,$Y-5,$OuterBorderColor);
5883 5242
        imageline($this->Picture,$XMax,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMax,$Y-5,$OuterBorderColor);
5884 5243
        imageline($this->Picture,$XMin,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMax,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$OuterBorderColor);
@@ -5890,29 +5249,23 @@  discard block
 block discarded – undo
5890 5249
      imageline($this->Picture,$X,$Y-1,$X-5,$Y-6,$InnerBorderColor);
5891 5250
      imageline($this->Picture,$X,$Y-1,$X+5,$Y-6,$InnerBorderColor);
5892 5251
      imageline($this->Picture,$X+5,$Y-6,$XMax-1,$Y-6,$InnerBorderColor);
5893
-     if ( $NoTitle )
5894
-      {
5252
+     if ( $NoTitle ) {
5895 5253
        imageline($this->Picture,$XMin+1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$XMin+1,$Y-6,$InnerBorderColor);
5896 5254
        imageline($this->Picture,$XMax-1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$XMax-1,$Y-6,$InnerBorderColor);
5897 5255
        imageline($this->Picture,$XMin+1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$XMax-1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$InnerBorderColor);
5898
-      }
5899
-     else
5900
-      {
5256
+      } else {
5901 5257
        imageline($this->Picture,$XMin+1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMin+1,$Y-6,$InnerBorderColor);
5902 5258
        imageline($this->Picture,$XMax-1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMax-1,$Y-6,$InnerBorderColor);
5903 5259
        imageline($this->Picture,$XMin+1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMax-1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$InnerBorderColor);
5904 5260
       }
5905 5261
 
5906 5262
      /* Draw the separator line */
5907
-     if ( $TitleMode == LABEL_TITLE_NOBACKGROUND && !$NoTitle )
5908
-      {
5263
+     if ( $TitleMode == LABEL_TITLE_NOBACKGROUND && !$NoTitle ) {
5909 5264
        $YPos    = $Y-7-$CaptionHeight-$HorizontalMargin-$HorizontalMargin/2;
5910 5265
        $XMargin = $VerticalMargin / 2;
5911 5266
        $this->drawLine($XMin+$XMargin,$YPos+1,$XMax-$XMargin,$YPos+1,array("R"=>$GradientEndR,"G"=>$GradientEndG,"B"=>$GradientEndB));
5912 5267
        $this->drawLine($XMin+$XMargin,$YPos,$XMax-$XMargin,$YPos,array("R"=>$GradientStartR,"G"=>$GradientStartG,"B"=>$GradientStartB));
5913
-      }
5914
-     elseif ( $TitleMode == LABEL_TITLE_BACKGROUND )
5915
-      {
5268
+      } elseif ( $TitleMode == LABEL_TITLE_BACKGROUND ) {
5916 5269
        $this->drawFilledRectangle($XMin,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMax,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin+$HorizontalMargin/2,array("R"=>$TitleBackgroundR,"G"=>$TitleBackgroundG,"B"=>$TitleBackgroundB));
5917 5270
        imageline($this->Picture,$XMin+1,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin+$HorizontalMargin/2+1,$XMax-1,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin+$HorizontalMargin/2+1,$InnerBorderColor);
5918 5271
       }
@@ -5923,15 +5276,13 @@  discard block
 block discarded – undo
5923 5276
 
5924 5277
      /* Write the value */
5925 5278
      $YPos = $Y-5-$HorizontalMargin; $XPos = $XMin+$VerticalMargin+$SerieBoxSize+$SerieBoxSpacing;
5926
-     foreach($Captions as $Key => $Caption)
5927
-      {
5279
+     foreach($Captions as $Key => $Caption) {
5928 5280
        $CaptionTxt    = $Caption["Caption"];
5929 5281
        $TxtPos        = $this->getTextBox($XPos,$YPos,$FontName,$FontSize,0,$CaptionTxt);
5930 5282
        $CaptionHeight = ($TxtPos[0]["Y"] - $TxtPos[2]["Y"]);
5931 5283
 
5932 5284
        /* Write the serie color if needed */
5933
-       if ( $DrawSerieColor )
5934
-        {
5285
+       if ( $DrawSerieColor ) {
5935 5286
          $BoxSettings = array("R"=>$Caption["Format"]["R"],"G"=>$Caption["Format"]["G"],"B"=>$Caption["Format"]["B"],"Alpha"=>$Caption["Format"]["Alpha"],"BorderR"=>0,"BorderG"=>0,"BorderB"=>0);
5936 5287
          $this->drawFilledRectangle($XMin+$VerticalMargin,$YPos-$SerieBoxSize,$XMin+$VerticalMargin+$SerieBoxSize,$YPos,$BoxSettings);
5937 5288
         }
@@ -5945,48 +5296,34 @@  discard block
 block discarded – undo
5945 5296
     }
5946 5297
 
5947 5298
    /* Draw a basic shape */
5948
-   function drawShape($X,$Y,$Shape,$PlotSize,$PlotBorder,$BorderSize,$R,$G,$B,$Alpha,$BorderR,$BorderG,$BorderB,$BorderAlpha)
5949
-    {
5950
-     if ( $Shape == SERIE_SHAPE_FILLEDCIRCLE )
5951
-      {
5299
+   function drawShape($X,$Y,$Shape,$PlotSize,$PlotBorder,$BorderSize,$R,$G,$B,$Alpha,$BorderR,$BorderG,$BorderB,$BorderAlpha) {
5300
+     if ( $Shape == SERIE_SHAPE_FILLEDCIRCLE ) {
5952 5301
        if ( $PlotBorder ) { $this->drawFilledCircle($X,$Y,$PlotSize+$BorderSize,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha)); }
5953 5302
        $this->drawFilledCircle($X,$Y,$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
5954
-      }
5955
-     elseif ( $Shape == SERIE_SHAPE_FILLEDSQUARE )
5956
-      {
5303
+      } elseif ( $Shape == SERIE_SHAPE_FILLEDSQUARE ) {
5957 5304
        if ( $PlotBorder ) { $this->drawFilledRectangle($X-$PlotSize-$BorderSize,$Y-$PlotSize-$BorderSize,$X+$PlotSize+$BorderSize,$Y+$PlotSize+$BorderSize,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha)); }
5958 5305
        $this->drawFilledRectangle($X-$PlotSize,$Y-$PlotSize,$X+$PlotSize,$Y+$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
5959
-      }
5960
-     elseif ( $Shape == SERIE_SHAPE_FILLEDTRIANGLE )
5961
-      {
5962
-       if ( $PlotBorder )
5963
-        {
5306
+      } elseif ( $Shape == SERIE_SHAPE_FILLEDTRIANGLE ) {
5307
+       if ( $PlotBorder ) {
5964 5308
          $Pos = ""; $Pos[]=$X; $Pos[]=$Y-$PlotSize-$BorderSize; $Pos[]=$X-$PlotSize-$BorderSize; $Pos[]=$Y+$PlotSize+$BorderSize; $Pos[]=$X+$PlotSize+$BorderSize; $Pos[]=$Y+$PlotSize+$BorderSize;
5965 5309
          $this->drawPolygon($Pos,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha));
5966 5310
         }
5967 5311
 
5968 5312
        $Pos = ""; $Pos[]=$X; $Pos[]=$Y-$PlotSize; $Pos[]=$X-$PlotSize; $Pos[]=$Y+$PlotSize; $Pos[]=$X+$PlotSize; $Pos[]=$Y+$PlotSize;
5969 5313
        $this->drawPolygon($Pos,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
5970
-      }
5971
-     elseif ( $Shape == SERIE_SHAPE_TRIANGLE )
5972
-      {
5314
+      } elseif ( $Shape == SERIE_SHAPE_TRIANGLE ) {
5973 5315
        $this->drawLine($X,$Y-$PlotSize,$X-$PlotSize,$Y+$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
5974 5316
        $this->drawLine($X-$PlotSize,$Y+$PlotSize,$X+$PlotSize,$Y+$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
5975 5317
        $this->drawLine($X+$PlotSize,$Y+$PlotSize,$X,$Y-$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
5976
-      }
5977
-     elseif ( $Shape == SERIE_SHAPE_SQUARE )
5318
+      } elseif ( $Shape == SERIE_SHAPE_SQUARE )
5978 5319
       $this->drawRectangle($X-$PlotSize,$Y-$PlotSize,$X+$PlotSize,$Y+$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
5979 5320
      elseif ( $Shape == SERIE_SHAPE_CIRCLE )
5980 5321
       $this->drawCircle($X,$Y,$PlotSize,$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
5981
-     elseif ( $Shape == SERIE_SHAPE_DIAMOND )
5982
-      {
5322
+     elseif ( $Shape == SERIE_SHAPE_DIAMOND ) {
5983 5323
        $Pos = ""; $Pos[]=$X-$PlotSize; $Pos[]=$Y; $Pos[]=$X; $Pos[]=$Y-$PlotSize; $Pos[]=$X+$PlotSize; $Pos[]=$Y; $Pos[]=$X; $Pos[]=$Y+$PlotSize;
5984 5324
        $this->drawPolygon($Pos,array("NoFill"=>TRUE,"BorderR"=>$R,"BorderG"=>$G,"BorderB"=>$B,"BorderAlpha"=>$Alpha));
5985
-      }      
5986
-     elseif ( $Shape == SERIE_SHAPE_FILLEDDIAMOND )
5987
-      {
5988
-       if ( $PlotBorder )
5989
-        {
5325
+      } elseif ( $Shape == SERIE_SHAPE_FILLEDDIAMOND ) {
5326
+       if ( $PlotBorder ) {
5990 5327
          $Pos = ""; $Pos[]=$X-$PlotSize-$BorderSize; $Pos[]=$Y; $Pos[]=$X; $Pos[]=$Y-$PlotSize-$BorderSize; $Pos[]=$X+$PlotSize+$BorderSize; $Pos[]=$Y; $Pos[]=$X; $Pos[]=$Y+$PlotSize+$BorderSize;
5991 5328
          $this->drawPolygon($Pos,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha));
5992 5329
         }
@@ -5996,8 +5333,7 @@  discard block
 block discarded – undo
5996 5333
       }      
5997 5334
     }
5998 5335
 
5999
-   function drawPolygonChart($Points,$Format="")
6000
-    {
5336
+   function drawPolygonChart($Points,$Format="") {
6001 5337
      $R			= isset($Format["R"]) ? $Format["R"] : 0;
6002 5338
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
6003 5339
      $B			= isset($Format["B"]) ? $Format["B"] : 0;
@@ -6028,15 +5364,12 @@  discard block
 block discarded – undo
6028 5364
 
6029 5365
      /* Simplify straight lines */
6030 5366
      $Result = ""; $inHorizon = FALSE; $LastX = VOID;
6031
-     foreach($Segments as $Key => $Pos)
6032
-      {
6033
-       if ( $Pos["Y1"] != $Pos["Y2"] )
6034
-        {
5367
+     foreach($Segments as $Key => $Pos) {
5368
+       if ( $Pos["Y1"] != $Pos["Y2"] ) {
6035 5369
          if ( $inHorizon ) { $inHorizon = FALSE; $Result[] = array("X1"=>$LastX,"Y1"=>$Pos["Y1"],"X2"=>$Pos["X1"],"Y2"=>$Pos["Y1"]); }
6036 5370
 
6037 5371
          $Result[] = array("X1"=>$Pos["X1"],"Y1"=>$Pos["Y1"],"X2"=>$Pos["X2"],"Y2"=>$Pos["Y2"]);
6038
-        }
6039
-       else { if ( !$inHorizon ) { $inHorizon = TRUE; $LastX = $Pos["X1"];} }
5372
+        } else { if ( !$inHorizon ) { $inHorizon = TRUE; $LastX = $Pos["X1"];} }
6040 5373
       }
6041 5374
      $Segments = $Result;
6042 5375
 
@@ -6049,8 +5382,7 @@  discard block
 block discarded – undo
6049 5382
 
6050 5383
      /* Find out the min & max Y boundaries */
6051 5384
      $MinY = OUT_OF_SIGHT; $MaxY = OUT_OF_SIGHT;
6052
-     foreach($Segments as $Key => $Coords)
6053
-      {
5385
+     foreach($Segments as $Key => $Coords) {
6054 5386
        if ( $MinY == OUT_OF_SIGHT || $MinY > min($Coords["Y1"],$Coords["Y2"]) ) { $MinY = min($Coords["Y1"],$Coords["Y2"]); }
6055 5387
        if ( $MaxY == OUT_OF_SIGHT || $MaxY < max($Coords["Y1"],$Coords["Y2"]) ) { $MaxY = max($Coords["Y1"],$Coords["Y2"]); }
6056 5388
       }
@@ -6065,44 +5397,32 @@  discard block
 block discarded – undo
6065 5397
 
6066 5398
      $MinY = floor($MinY); $MaxY = floor($MaxY); $YStep = 1; 
6067 5399
 
6068
-     if ( !$NoFill )
6069
-      {
5400
+     if ( !$NoFill ) {
6070 5401
        //if ( $DebugLine ) { $MinY = $DebugLine; $MaxY = $DebugLine; }
6071
-       for($Y=$MinY;$Y<=$MaxY;$Y=$Y+$YStep)
6072
-        {
5402
+       for($Y=$MinY;$Y<=$MaxY;$Y=$Y+$YStep) {
6073 5403
          $Intersections = ""; $LastSlope = NULL; $RestoreLast = "-";
6074
-         foreach($Segments as $Key => $Coords)
6075
-          {
5404
+         foreach($Segments as $Key => $Coords) {
6076 5405
            $X1 = $Coords["X1"]; $X2 = $Coords["X2"]; $Y1 = $Coords["Y1"]; $Y2 = $Coords["Y2"];
6077 5406
 
6078
-           if ( min($Y1,$Y2) <= $Y && max($Y1,$Y2) >= $Y )
6079
-            {
5407
+           if ( min($Y1,$Y2) <= $Y && max($Y1,$Y2) >= $Y ) {
6080 5408
              if ( $Y1 == $Y2 )
6081
-              { $X = $X1; }
6082
-             else
5409
+              { $X = $X1; } else
6083 5410
               { $X = $X1 + ( ($Y-$Y1)*$X2 - ($Y-$Y1)*$X1 ) / ($Y2-$Y1); }
6084 5411
 
6085 5412
              $X = floor($X);
6086 5413
 
6087 5414
              if ( $X2 == $X1 )
6088
-              { $Slope = "!"; }
6089
-             else
6090
-              {
5415
+              { $Slope = "!"; } else {
6091 5416
                $SlopeC = ($Y2 - $Y1) / ($X2 - $X1);
6092 5417
                if( $SlopeC == 0 )
6093
-                { $Slope = "="; }
6094
-               elseif( $SlopeC > 0 )
6095
-                { $Slope = "+"; }
6096
-               elseif ( $SlopeC < 0 )
5418
+                { $Slope = "="; } elseif( $SlopeC > 0 )
5419
+                { $Slope = "+"; } elseif ( $SlopeC < 0 )
6097 5420
                 { $Slope = "-"; }
6098 5421
               }
6099 5422
 
6100 5423
              if ( !is_array($Intersections) )
6101
-              { $Intersections[] = $X; }
6102
-             elseif( !in_array($X,$Intersections) )
6103
-              { $Intersections[] = $X; }
6104
-             elseif( in_array($X,$Intersections) )
6105
-              {
5424
+              { $Intersections[] = $X; } elseif( !in_array($X,$Intersections) )
5425
+              { $Intersections[] = $X; } elseif( in_array($X,$Intersections) ) {
6106 5426
                if ($Y == $DebugLine) { echo $Slope."/".$LastSlope."(".$X.") "; }
6107 5427
 
6108 5428
                if ( $Slope == "=" && $LastSlope == "-"  )                             { $Intersections[] = $X; }
@@ -6117,40 +5437,32 @@  discard block
 block discarded – undo
6117 5437
           }
6118 5438
          if ( $RestoreLast != "-" ) { $Intersections[] = $RestoreLast; echo "@".$Y."\r\n"; }
6119 5439
 
6120
-         if ( is_array($Intersections) )
6121
-          {
5440
+         if ( is_array($Intersections) ) {
6122 5441
            sort($Intersections);
6123 5442
 
6124 5443
            if ($Y == $DebugLine) { print_r($Intersections); }
6125 5444
 
6126 5445
            /* Remove NULL plots */
6127 5446
            $Result = "";
6128
-           for($i=0;$i<=count($Intersections)-1;$i=$i+2)
6129
-            {
5447
+           for($i=0;$i<=count($Intersections)-1;$i=$i+2) {
6130 5448
              if ( isset($Intersections[$i+1]) )
6131 5449
               { if ( $Intersections[$i] != $Intersections[$i+1] ) { $Result[] = $Intersections[$i]; $Result[] = $Intersections[$i+1]; } }
6132 5450
             }
6133 5451
 
6134
-           if ( is_array($Result) )
6135
-            {
5452
+           if ( is_array($Result) ) {
6136 5453
              $Intersections = $Result;
6137 5454
 
6138 5455
              $LastX = OUT_OF_SIGHT;
6139
-             foreach($Intersections as $Key => $X)
6140
-              {
5456
+             foreach($Intersections as $Key => $X) {
6141 5457
                if ( $LastX == OUT_OF_SIGHT )
6142 5458
                 $LastX = $X;
6143
-               elseif ( $LastX != OUT_OF_SIGHT )
6144
-                {
5459
+               elseif ( $LastX != OUT_OF_SIGHT ) {
6145 5460
                  if ( $this->getFirstDecimal($LastX) > 1 ) { $LastX++; }
6146 5461
 
6147 5462
                  $Color = $DefaultColor;
6148
-                 if ( $Threshold != NULL )
6149
-                  {
6150
-                   foreach($Threshold as $Key => $Parameters)
6151
-                    {
6152
-                     if ( $Y <= $Parameters["MinX"] && $Y >= $Parameters["MaxX"])
6153
-                      {
5463
+                 if ( $Threshold != NULL ) {
5464
+                   foreach($Threshold as $Key => $Parameters) {
5465
+                     if ( $Y <= $Parameters["MinX"] && $Y >= $Parameters["MaxX"]) {
6154 5466
                        if ( isset($Parameters["R"]) ) { $R = $Parameters["R"]; } else { $R = 0; }
6155 5467
                        if ( isset($Parameters["G"]) ) { $G = $Parameters["G"]; } else { $G = 0; }
6156 5468
                        if ( isset($Parameters["B"]) ) { $B = $Parameters["B"]; } else { $B = 0; }
@@ -6173,18 +5485,17 @@  discard block
 block discarded – undo
6173 5485
       }
6174 5486
 
6175 5487
      /* Draw the polygon border, if required */
6176
-     if ( !$NoBorder)
6177
-      {
6178
-       foreach($Segments as $Key => $Coords)
6179
-        $this->drawLine($Coords["X1"],$Coords["Y1"],$Coords["X2"],$Coords["Y2"],array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Threshold"=>$Threshold));
5488
+     if ( !$NoBorder) {
5489
+       foreach($Segments as $Key => $Coords) {
5490
+               $this->drawLine($Coords["X1"],$Coords["Y1"],$Coords["X2"],$Coords["Y2"],array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Threshold"=>$Threshold));
5491
+       }
6180 5492
       }
6181 5493
 
6182 5494
      $this->Shadow = $RestoreShadow;
6183 5495
     }
6184 5496
 
6185 5497
    /* Return the abscissa margin */
6186
-   function getAbscissaMargin($Data)
6187
-    {
5498
+   function getAbscissaMargin($Data) {
6188 5499
      foreach($Data["Axis"] as $AxisID => $Values) { if ( $Values["Identity"] == AXIS_X ) { return($Values["Margin"]); } }
6189 5500
      return(0);
6190 5501
     }
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pSpring.class.php 1 patch
Braces   +112 added lines, -223 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
  define("LABEL_LIGHT"		, 690032);
30 30
 
31 31
  /* pSpring class definition */
32
- class pSpring
33
-  {
32
+ class pSpring {
34 33
    var $History;
35 34
    var $pChartObject;
36 35
    var $Data;
@@ -43,8 +42,7 @@  discard block
 block discarded – undo
43 42
    var $Labels;
44 43
 
45 44
    /* Class creator */
46
-   function pSpring()
47
-    {
45
+   function pSpring() {
48 46
      /* Initialise data arrays */
49 47
      $this->Data = "";
50 48
      $this->Links = "";
@@ -83,8 +81,7 @@  discard block
 block discarded – undo
83 81
     }
84 82
 
85 83
    /* Set default links options */
86
-   function setLinkDefaults($Settings="")
87
-    {
84
+   function setLinkDefaults($Settings="") {
88 85
      if ( isset($Settings["R"]) )     { $this->Default["LinkR"] = $Settings["R"]; }
89 86
      if ( isset($Settings["G"]) )     { $this->Default["LinkG"] = $Settings["G"]; }
90 87
      if ( isset($Settings["B"]) )     { $this->Default["LinkB"] = $Settings["B"]; }
@@ -92,8 +89,7 @@  discard block
 block discarded – undo
92 89
     }
93 90
 
94 91
    /* Set default links options */
95
-   function setLabelsSettings($Settings="")
96
-    {
92
+   function setLabelsSettings($Settings="") {
97 93
      if ( isset($Settings["Type"]) )  { $this->Labels["Type"] = $Settings["Type"]; }
98 94
      if ( isset($Settings["R"]) )     { $this->Labels["R"] = $Settings["R"]; }
99 95
      if ( isset($Settings["G"]) )     { $this->Labels["G"] = $Settings["G"]; }
@@ -102,22 +98,18 @@  discard block
 block discarded – undo
102 98
     }
103 99
 
104 100
    /* Auto compute the FreeZone size based on the number of connections */
105
-   function autoFreeZone()
106
-    {
101
+   function autoFreeZone() {
107 102
      /* Check connections reciprocity */
108
-     foreach($this->Data as $Key => $Settings)
109
-      {
103
+     foreach($this->Data as $Key => $Settings) {
110 104
        if ( isset($Settings["Connections"]) )
111
-        { $this->Data[$Key]["FreeZone"] = count($Settings["Connections"])*10 + 20; }
112
-       else
105
+        { $this->Data[$Key]["FreeZone"] = count($Settings["Connections"])*10 + 20; } else
113 106
         { $this->Data[$Key]["FreeZone"] = 20; }
114 107
       }
115 108
 
116 109
     }
117 110
 
118 111
    /* Set link properties */
119
-   function linkProperties($FromNode,$ToNode,$Settings)
120
-    {
112
+   function linkProperties($FromNode,$ToNode,$Settings) {
121 113
      if ( !isset($this->Data[$FromNode]) ) { return(0); }
122 114
      if ( !isset($this->Data[$ToNode]) )   { return(0); }
123 115
 
@@ -136,8 +128,7 @@  discard block
 block discarded – undo
136 128
      $this->Links[$FromNode][$ToNode]["Ticks"] = $Ticks; $this->Links[$ToNode][$FromNode]["Ticks"] = $Ticks;
137 129
     }
138 130
 
139
-   function setNodeDefaults($Settings="")
140
-    {
131
+   function setNodeDefaults($Settings="") {
141 132
      if ( isset($Settings["R"]) ) { $this->Default["R"]					= $Settings["R"]; }
142 133
      if ( isset($Settings["G"]) ) { $this->Default["G"]					= $Settings["G"]; }
143 134
      if ( isset($Settings["B"]) ) { $this->Default["B"]					= $Settings["B"]; }
@@ -158,8 +149,7 @@  discard block
 block discarded – undo
158 149
     }
159 150
 
160 151
    /* Add a node */
161
-   function addNode($NodeID,$Settings="")
162
-    {
152
+   function addNode($NodeID,$Settings="") {
163 153
      /* if the node already exists, ignore */
164 154
      if (isset($this->Data[$NodeID])) { return(0); }
165 155
 
@@ -196,27 +186,21 @@  discard block
 block discarded – undo
196 186
      $this->Data[$NodeID]["Size"]		= $Size;
197 187
      $this->Data[$NodeID]["Shape"]		= $Shape;
198 188
      $this->Data[$NodeID]["FreeZone"]		= $FreeZone;
199
-     if ( $Connections != NULL )
200
-      {
201
-       if ( is_array($Connections ) )
202
-        {
203
-         foreach($Connections as $Key => $Value)
204
-          $this->Data[$NodeID]["Connections"][] = $Value;
205
-        }
206
-       else
189
+     if ( $Connections != NULL ) {
190
+       if ( is_array($Connections ) ) {
191
+         foreach($Connections as $Key => $Value) {
192
+                   $this->Data[$NodeID]["Connections"][] = $Value;
193
+         }
194
+        } else
207 195
         $this->Data[$NodeID]["Connections"][] = $Connections;
208 196
       }
209 197
     }
210 198
 
211 199
    /* Set color attribute for a list of nodes */
212
-   function setNodesColor($Nodes,$Settings="")
213
-    {
214
-     if ( is_array($Nodes) )
215
-      {
216
-       foreach ($Nodes as $Key => $NodeID)
217
-        {
218
-         if (isset($this->Data[$NodeID]) )
219
-          {
200
+   function setNodesColor($Nodes,$Settings="") {
201
+     if ( is_array($Nodes) ) {
202
+       foreach ($Nodes as $Key => $NodeID) {
203
+         if (isset($this->Data[$NodeID]) ) {
220 204
            if ( isset($Settings["R"]) ) { $this->Data[$NodeID]["R"] = $Settings["R"]; }
221 205
            if ( isset($Settings["G"]) ) { $this->Data[$NodeID]["G"] = $Settings["G"]; }
222 206
            if ( isset($Settings["B"]) ) { $this->Data[$NodeID]["B"] = $Settings["B"]; }
@@ -228,9 +212,7 @@  discard block
 block discarded – undo
228 212
            if ( isset($Settings["Surrounding"]) ) { $this->Data[$NodeID]["BorderR"] = $this->Data[$NodeID]["R"] + $Settings["Surrounding"]; $this->Data[$NodeID]["BorderG"] = $this->Data[$NodeID]["G"] + $Settings["Surrounding"]; $this->Data[$NodeID]["BorderB"] = $this->Data[$NodeID]["B"] + $Settings["Surrounding"]; }
229 213
           }
230 214
         }
231
-      }
232
-     else
233
-      {
215
+      } else {
234 216
        if ( isset($Settings["R"]) ) { $this->Data[$Nodes]["R"] = $Settings["R"]; }
235 217
        if ( isset($Settings["G"]) ) { $this->Data[$Nodes]["G"] = $Settings["G"]; }
236 218
        if ( isset($Settings["B"]) ) { $this->Data[$Nodes]["B"] = $Settings["B"]; }
@@ -248,25 +230,19 @@  discard block
 block discarded – undo
248 230
     { return($this->Data); }
249 231
 
250 232
    /* Check if a connection exists and create it if required */
251
-   function checkConnection($SourceID, $TargetID)
252
-    {
253
-     if ( isset($this->Data[$SourceID]["Connections"]) )
254
-      {
233
+   function checkConnection($SourceID, $TargetID) {
234
+     if ( isset($this->Data[$SourceID]["Connections"]) ) {
255 235
        foreach ($this->Data[$SourceID]["Connections"] as $Key => $ConnectionID)
256 236
         { if ( $TargetID == $ConnectionID ) { return(TRUE); } }
257 237
       }
258 238
      $this->Data[$SourceID]["Connections"][] = $TargetID;
259 239
     }
260 240
    /* Get the median linked nodes position */
261
-   function getMedianOffset($Key,$X,$Y)
262
-    {
241
+   function getMedianOffset($Key,$X,$Y) {
263 242
      $Cpt = 1;
264
-     if ( isset($this->Data[$Key]["Connections"]) )
265
-      {
266
-       foreach($this->Data[$Key]["Connections"] as $ID => $NodeID)
267
-        {
268
-         if ( isset($this->Data[$NodeID]["X"]) && isset($this->Data[$NodeID]["Y"]) )
269
-          {
243
+     if ( isset($this->Data[$Key]["Connections"]) ) {
244
+       foreach($this->Data[$Key]["Connections"] as $ID => $NodeID) {
245
+         if ( isset($this->Data[$NodeID]["X"]) && isset($this->Data[$NodeID]["Y"]) ) {
270 246
            $X = $X + $this->Data[$NodeID]["X"];
271 247
            $Y = $Y + $this->Data[$NodeID]["Y"];
272 248
            $Cpt++;
@@ -277,13 +253,11 @@  discard block
 block discarded – undo
277 253
     }
278 254
 
279 255
    /* Return the ID of the attached partner with the biggest weight */
280
-   function getBiggestPartner($Key)
281
-    {
256
+   function getBiggestPartner($Key) {
282 257
      if ( !isset($this->Data[$Key]["Connections"]) ) { return(""); }
283 258
 
284 259
      $MaxWeight = 0; $Result = "";
285
-     foreach($this->Data[$Key]["Connections"] as $Key => $PeerID)
286
-      {
260
+     foreach($this->Data[$Key]["Connections"] as $Key => $PeerID) {
287 261
        if ( $this->Data[$PeerID]["Weight"] > $MaxWeight )
288 262
         { $MaxWeight = $this->Data[$PeerID]["Weight"]; $Result = $PeerID; }
289 263
       }
@@ -291,18 +265,16 @@  discard block
 block discarded – undo
291 265
     }
292 266
 
293 267
    /* Do the initial node positions computing pass */
294
-   function firstPass($Algorithm)
295
-    {
268
+   function firstPass($Algorithm) {
296 269
      $CenterX = ($this->X2 - $this->X1) / 2 + $this->X1;
297 270
      $CenterY = ($this->Y2 - $this->Y1) / 2 + $this->Y1;
298 271
 
299 272
      /* Check connections reciprocity */
300
-     foreach($this->Data as $Key => $Settings)
301
-      {
302
-       if ( isset($Settings["Connections"]) )
303
-        {
304
-         foreach($Settings["Connections"] as $ID => $ConnectionID)
305
-          $this->checkConnection($ConnectionID,$Key);
273
+     foreach($this->Data as $Key => $Settings) {
274
+       if ( isset($Settings["Connections"]) ) {
275
+         foreach($Settings["Connections"] as $ID => $ConnectionID) {
276
+                   $this->checkConnection($ConnectionID,$Key);
277
+         }
306 278
         }
307 279
       }
308 280
 
@@ -313,16 +285,12 @@  discard block
 block discarded – undo
313 285
      foreach($this->Data as $Key => $Settings)
314 286
       { if ( isset($Settings["Connections"]) ) { if ( $MaxConnections < count($Settings["Connections"] ) ) { $MaxConnections = count($Settings["Connections"]); } } }
315 287
 
316
-     if ( $Algorithm == ALGORITHM_WEIGHTED )
317
-      {
318
-       foreach($this->Data as $Key => $Settings)
319
-        {
288
+     if ( $Algorithm == ALGORITHM_WEIGHTED ) {
289
+       foreach($this->Data as $Key => $Settings) {
320 290
          if ( $Settings["Type"] == NODE_TYPE_CENTRAL ) { $this->Data[$Key]["X"] = $CenterX; $this->Data[$Key]["Y"] = $CenterY; }
321
-         if ( $Settings["Type"] == NODE_TYPE_FREE )
322
-          {
291
+         if ( $Settings["Type"] == NODE_TYPE_FREE ) {
323 292
            if ( isset($Settings["Connections"]) )
324
-            { $Connections = count($Settings["Connections"]); }
325
-           else
293
+            { $Connections = count($Settings["Connections"]); } else
326 294
             { $Connections = 0; }
327 295
 
328 296
            $Ring  = $MaxConnections - $Connections;
@@ -332,12 +300,9 @@  discard block
 block discarded – undo
332 300
            $this->Data[$Key]["Y"] = sin(deg2rad($Angle)) * ($Ring*$this->RingSize) + $CenterY;
333 301
           }
334 302
         }
335
-      }
336
-     elseif ( $Algorithm == ALGORITHM_CENTRAL )
337
-      {
303
+      } elseif ( $Algorithm == ALGORITHM_CENTRAL ) {
338 304
        /* Put a weight on each nodes */
339
-       foreach($this->Data as $Key => $Settings)
340
-        {
305
+       foreach($this->Data as $Key => $Settings) {
341 306
          if ( isset($Settings["Connections"]) )
342 307
           $this->Data[$Key]["Weight"] = count($Settings["Connections"]);
343 308
          else
@@ -345,33 +310,25 @@  discard block
 block discarded – undo
345 310
         }
346 311
 
347 312
        $MaxConnections = $MaxConnections + 1;
348
-       for($i=$MaxConnections;$i>=0;$i--)
349
-        {
350
-         foreach($this->Data as $Key => $Settings)
351
-          {
313
+       for($i=$MaxConnections;$i>=0;$i--) {
314
+         foreach($this->Data as $Key => $Settings) {
352 315
            if ( $Settings["Type"] == NODE_TYPE_CENTRAL ) { $this->Data[$Key]["X"] = $CenterX; $this->Data[$Key]["Y"] = $CenterY; }
353
-           if ( $Settings["Type"] == NODE_TYPE_FREE )
354
-            {
316
+           if ( $Settings["Type"] == NODE_TYPE_FREE ) {
355 317
              if ( isset($Settings["Connections"]) )
356
-              { $Connections = count($Settings["Connections"]); }
357
-             else
318
+              { $Connections = count($Settings["Connections"]); } else
358 319
               { $Connections = 0; }
359 320
 
360
-             if ( $Connections == $i )
361
-              {
321
+             if ( $Connections == $i ) {
362 322
                $BiggestPartner = $this->getBiggestPartner($Key);
363
-               if ( $BiggestPartner != "" )
364
-                {
323
+               if ( $BiggestPartner != "" ) {
365 324
                  $Ring          = $this->Data[$BiggestPartner]["FreeZone"];
366 325
                  $Weight        = $this->Data[$BiggestPartner]["Weight"];
367 326
                  $AngleDivision = 360 / $this->Data[$BiggestPartner]["Weight"];
368 327
                  $Done          = FALSE; $Tries = 0;
369
-                 while (!$Done && $Tries <= $Weight*2)
370
-                  {
328
+                 while (!$Done && $Tries <= $Weight*2) {
371 329
                    $Tries++;
372 330
                    $Angle = floor(rand(0,$Weight)*$AngleDivision);
373
-                   if ( !isset($this->Data[$BiggestPartner]["Angular"][$Angle]) || !isset($this->Data[$BiggestPartner]["Angular"]) )
374
-                    {
331
+                   if ( !isset($this->Data[$BiggestPartner]["Angular"][$Angle]) || !isset($this->Data[$BiggestPartner]["Angular"]) ) {
375 332
                      $this->Data[$BiggestPartner]["Angular"][$Angle] = $Angle;
376 333
                      $Done = TRUE; 
377 334
                     }
@@ -389,24 +346,17 @@  discard block
 block discarded – undo
389 346
             }
390 347
           }
391 348
         }
392
-      }
393
-     elseif ( $Algorithm == ALGORITHM_CIRCULAR )
394
-      {
349
+      } elseif ( $Algorithm == ALGORITHM_CIRCULAR ) {
395 350
        $MaxConnections = $MaxConnections + 1;
396
-       for($i=$MaxConnections;$i>=0;$i--)
397
-        {
398
-         foreach($this->Data as $Key => $Settings)
399
-          {
351
+       for($i=$MaxConnections;$i>=0;$i--) {
352
+         foreach($this->Data as $Key => $Settings) {
400 353
            if ( $Settings["Type"] == NODE_TYPE_CENTRAL ) { $this->Data[$Key]["X"] = $CenterX; $this->Data[$Key]["Y"] = $CenterY; }
401
-           if ( $Settings["Type"] == NODE_TYPE_FREE )
402
-            {
354
+           if ( $Settings["Type"] == NODE_TYPE_FREE ) {
403 355
              if ( isset($Settings["Connections"]) )
404
-              { $Connections = count($Settings["Connections"]); }
405
-             else
356
+              { $Connections = count($Settings["Connections"]); } else
406 357
               { $Connections = 0; }
407 358
 
408
-             if ( $Connections == $i )
409
-              {
359
+             if ( $Connections == $i ) {
410 360
                $Ring  = $MaxConnections - $Connections;
411 361
                $Angle = rand(0,360);
412 362
 
@@ -421,13 +371,9 @@  discard block
 block discarded – undo
421 371
             }
422 372
           }
423 373
         }
424
-      }
425
-     elseif ( $Algorithm == ALGORITHM_RANDOM )
426
-      {
427
-       foreach($this->Data as $Key => $Settings)
428
-        {
429
-         if ( $Settings["Type"] == NODE_TYPE_FREE )
430
-          {
374
+      } elseif ( $Algorithm == ALGORITHM_RANDOM ) {
375
+       foreach($this->Data as $Key => $Settings) {
376
+         if ( $Settings["Type"] == NODE_TYPE_FREE ) {
431 377
            $this->Data[$Key]["X"] = $CenterX + rand(-20,20);
432 378
            $this->Data[$Key]["Y"] = $CenterY + rand(-20,20);
433 379
           }
@@ -437,23 +383,18 @@  discard block
 block discarded – undo
437 383
     }
438 384
 
439 385
    /* Compute one pass */
440
-   function doPass()
441
-    {
386
+   function doPass() {
442 387
      /* Compute vectors */
443
-     foreach($this->Data as $Key => $Settings)
444
-      {
445
-       if ( $Settings["Type"] != NODE_TYPE_CENTRAL )
446
-        {
388
+     foreach($this->Data as $Key => $Settings) {
389
+       if ( $Settings["Type"] != NODE_TYPE_CENTRAL ) {
447 390
          unset($this->Data[$Key]["Vectors"]);
448 391
 
449 392
          $X1 = $Settings["X"];
450 393
          $Y1 = $Settings["Y"];
451 394
 
452 395
          /* Repulsion vectors */
453
-         foreach($this->Data as $Key2 => $Settings2)
454
-          {
455
-           if ( $Key != $Key2 )
456
-            {
396
+         foreach($this->Data as $Key2 => $Settings2) {
397
+           if ( $Key != $Key2 ) {
457 398
              $X2 = $this->Data[$Key2]["X"];
458 399
              $Y2 = $this->Data[$Key2]["Y"];
459 400
              $FreeZone = $this->Data[$Key2]["FreeZone"];
@@ -462,8 +403,7 @@  discard block
 block discarded – undo
462 403
              $Angle    = $this->getAngle($X1,$Y1,$X2,$Y2) + 180;
463 404
 
464 405
              /* Nodes too close, repulsion occurs */
465
-             if ( $Distance < $FreeZone )
466
-              {
406
+             if ( $Distance < $FreeZone ) {
467 407
                $Force = log(pow(2,$FreeZone-$Distance));
468 408
                if ( $Force > 1 )
469 409
                 { $this->Data[$Key]["Vectors"][] = array("Type"=>"R","Angle"=>$Angle % 360,"Force"=>$Force); }
@@ -472,12 +412,9 @@  discard block
 block discarded – undo
472 412
           }
473 413
 
474 414
          /* Attraction vectors */
475
-         if ( isset($Settings["Connections"]) )
476
-          {
477
-           foreach($Settings["Connections"] as $ID => $NodeID)
478
-            {
479
-             if ( isset($this->Data[$NodeID]) )
480
-              {
415
+         if ( isset($Settings["Connections"]) ) {
416
+           foreach($Settings["Connections"] as $ID => $NodeID) {
417
+             if ( isset($this->Data[$NodeID]) ) {
481 418
                $X2 = $this->Data[$NodeID]["X"];
482 419
                $Y2 = $this->Data[$NodeID]["Y"];
483 420
                $FreeZone = $this->Data[$Key2]["FreeZone"];
@@ -499,15 +436,12 @@  discard block
 block discarded – undo
499 436
       }
500 437
 
501 438
      /* Move the nodes accoding to the vectors */
502
-     foreach($this->Data as $Key => $Settings)
503
-      {
439
+     foreach($this->Data as $Key => $Settings) {
504 440
        $X = $Settings["X"];
505 441
        $Y = $Settings["Y"];
506 442
 
507
-       if ( isset($Settings["Vectors"]) && $Settings["Type"] != NODE_TYPE_CENTRAL )
508
-        {
509
-         foreach($Settings["Vectors"] as $ID => $Vector)
510
-          {
443
+       if ( isset($Settings["Vectors"]) && $Settings["Type"] != NODE_TYPE_CENTRAL ) {
444
+         foreach($Settings["Vectors"] as $ID => $Vector) {
511 445
            $Type  = $Vector["Type"];
512 446
            $Force = $Vector["Force"];
513 447
            $Angle = $Vector["Angle"];
@@ -523,11 +457,9 @@  discard block
 block discarded – undo
523 457
       }
524 458
     }
525 459
 
526
-   function lastPass()
527
-    {
460
+   function lastPass() {
528 461
      /* Put everything inside the graph area */
529
-     foreach($this->Data as $Key => $Settings)
530
-      {
462
+     foreach($this->Data as $Key => $Settings) {
531 463
        $X = $Settings["X"];
532 464
        $Y = $Settings["Y"];
533 465
 
@@ -542,17 +474,13 @@  discard block
 block discarded – undo
542 474
 
543 475
      /* Dump all links */
544 476
      $Links = "";
545
-     foreach($this->Data as $Key => $Settings)
546
-      {
477
+     foreach($this->Data as $Key => $Settings) {
547 478
        $X1 = $Settings["X"];
548 479
        $Y1 = $Settings["Y"];
549 480
 
550
-       if ( isset($Settings["Connections"]) )
551
-        {
552
-         foreach ($Settings["Connections"] as $ID => $NodeID)
553
-          {
554
-           if ( isset($this->Data[$NodeID]) )
555
-            {
481
+       if ( isset($Settings["Connections"]) ) {
482
+         foreach ($Settings["Connections"] as $ID => $NodeID) {
483
+           if ( isset($this->Data[$NodeID]) ) {
556 484
              $X2 = $this->Data[$NodeID]["X"];
557 485
              $Y2 = $this->Data[$NodeID]["Y"];
558 486
 
@@ -564,28 +492,21 @@  discard block
 block discarded – undo
564 492
 
565 493
      /* Check collisions */
566 494
      $Conflicts = 0;
567
-     foreach($this->Data as $Key => $Settings)
568
-      {
495
+     foreach($this->Data as $Key => $Settings) {
569 496
        $X1 = $Settings["X"];
570 497
        $Y1 = $Settings["Y"];
571 498
 
572
-       if ( isset($Settings["Connections"]) )
573
-        {
574
-         foreach ($Settings["Connections"] as $ID => $NodeID)
575
-          {
576
-           if ( isset($this->Data[$NodeID]) )
577
-            {
499
+       if ( isset($Settings["Connections"]) ) {
500
+         foreach ($Settings["Connections"] as $ID => $NodeID) {
501
+           if ( isset($this->Data[$NodeID]) ) {
578 502
              $X2 = $this->Data[$NodeID]["X"];
579 503
              $Y2 = $this->Data[$NodeID]["Y"];
580 504
 
581
-             foreach($Links as $IDLinks => $Link)
582
-              {
505
+             foreach($Links as $IDLinks => $Link) {
583 506
                $X3 = $Link["X1"]; $Y3 = $Link["Y1"]; $X4 = $Link["X2"]; $Y4 = $Link["Y2"];
584 507
 
585
-               if ( !($X1 == $X3 && $X2 == $X4 && $Y1 == $Y3 && $Y2 == $Y4 ) )
586
-                {
587
-                 if ( $this->intersect($X1,$Y1,$X2,$Y2,$X3,$Y3,$X4,$Y4) )
588
-                  {
508
+               if ( !($X1 == $X3 && $X2 == $X4 && $Y1 == $Y3 && $Y2 == $Y4 ) ) {
509
+                 if ( $this->intersect($X1,$Y1,$X2,$Y2,$X3,$Y3,$X4,$Y4) ) {
589 510
                    if ( $Link["Source"] != $Settings["Name"] && $Link["Source"] != $this->Data[$NodeID]["Name"] && $Link["Destination"] != $Settings["Name"] && $Link["Destination"] != $this->Data[$NodeID]["Name"] )
590 511
                     { $Conflicts++; }
591 512
                   }
@@ -599,8 +520,7 @@  discard block
 block discarded – undo
599 520
     }
600 521
 
601 522
    /* Center the graph */
602
-   function center()
603
-    {
523
+   function center() {
604 524
      /* Determine the real center */
605 525
      $TargetCenterX = ($this->X2 - $this->X1) / 2 + $this->X1;
606 526
      $TargetCenterY = ($this->Y2 - $this->Y1) / 2 + $this->Y1;
@@ -608,8 +528,7 @@  discard block
 block discarded – undo
608 528
      /* Get current boundaries */
609 529
      $XMin = $this->X2; $XMax = $this->X1;
610 530
      $YMin = $this->Y2; $YMax = $this->Y1;
611
-     foreach($this->Data as $Key => $Settings)
612
-      {
531
+     foreach($this->Data as $Key => $Settings) {
613 532
        $X = $Settings["X"];
614 533
        $Y = $Settings["Y"];
615 534
 
@@ -626,16 +545,14 @@  discard block
 block discarded – undo
626 545
      $YOffset = $TargetCenterY - $CurrentCenterY;
627 546
 
628 547
      /* Correct the points position */
629
-     foreach($this->Data as $Key => $Settings)
630
-      {
548
+     foreach($this->Data as $Key => $Settings) {
631 549
        $this->Data[$Key]["X"] = $Settings["X"] + $XOffset;
632 550
        $this->Data[$Key]["Y"] = $Settings["Y"] + $YOffset;
633 551
       }
634 552
     }
635 553
 
636 554
    /* Create the encoded string */
637
-   function drawSpring($Object,$Settings="")
638
-    {
555
+   function drawSpring($Object,$Settings="") {
639 556
      $this->pChartObject = $Object;
640 557
 
641 558
      $Pass			= isset($Settings["Pass"]) ? $Settings["Pass"] : 50;
@@ -656,16 +573,14 @@  discard block
 block discarded – undo
656 573
      $this->Y2		= $Object->GraphAreaY2;
657 574
 
658 575
      $Conflicts = 1; $Jobs = 0; $this->History["MinimumConflicts"] = -1;
659
-     while ($Conflicts != 0 && $Jobs < $Retries )
660
-      {
576
+     while ($Conflicts != 0 && $Jobs < $Retries ) {
661 577
        $Jobs++;
662 578
 
663 579
        /* Compute the initial settings */
664 580
        $this->firstPass($Algorithm);
665 581
 
666 582
        /* Apply the vectors */
667
-       if ( $Pass > 0 ) 
668
-        {
583
+       if ( $Pass > 0 ) {
669 584
          for ($i=0; $i<=$Pass; $i++) { $this->doPass(); }
670 585
         }
671 586
 
@@ -681,24 +596,19 @@  discard block
 block discarded – undo
681 596
 
682 597
      /* Draw the connections */
683 598
      $Drawn = "";
684
-     foreach($this->Data as $Key => $Settings)
685
-      {
599
+     foreach($this->Data as $Key => $Settings) {
686 600
        $X	= $Settings["X"];
687 601
        $Y	= $Settings["Y"];
688 602
 
689
-       if ( isset($Settings["Connections"]) )
690
-        {
691
-         foreach ($Settings["Connections"] as $ID => $NodeID)
692
-          {
603
+       if ( isset($Settings["Connections"]) ) {
604
+         foreach ($Settings["Connections"] as $ID => $NodeID) {
693 605
            if ( !isset($Drawn[$Key]) )    { $Drawn[$Key] = ""; }
694 606
            if ( !isset($Drawn[$NodeID]) ) { $Drawn[$NodeID] = ""; }
695 607
 
696
-           if ( isset($this->Data[$NodeID]) && !isset($Drawn[$Key][$NodeID]) && !isset($Drawn[$NodeID][$Key]) )
697
-            {
608
+           if ( isset($this->Data[$NodeID]) && !isset($Drawn[$Key][$NodeID]) && !isset($Drawn[$NodeID][$Key]) ) {
698 609
              $Color = array("R"=>$this->Default["LinkR"],"G"=>$this->Default["LinkG"],"B"=>$this->Default["LinkB"],"Alpha"=>$this->Default["Alpha"]);
699 610
 
700
-             if ( $this->Links != "" )
701
-              {
611
+             if ( $this->Links != "" ) {
702 612
                if ( isset($this->Links[$Key][$NodeID]["R"]) )
703 613
                 { $Color = array("R"=>$this->Links[$Key][$NodeID]["R"],"G"=>$this->Links[$Key][$NodeID]["G"],"B"=>$this->Links[$Key][$NodeID]["B"],"Alpha"=>$this->Links[$Key][$NodeID]["Alpha"]); }
704 614
 
@@ -711,10 +621,8 @@  discard block
 block discarded – undo
711 621
              $this->pChartObject->drawLine($X,$Y,$X2,$Y2,$Color);
712 622
              $Drawn[$Key][$NodeID] = TRUE;
713 623
 
714
-             if ( isset($this->Links) && $this->Links != "" )
715
-              {
716
-               if ( isset($this->Links[$Key][$NodeID]["Name"]) || isset($this->Links[$NodeID][$Key]["Name"]) )
717
-                {
624
+             if ( isset($this->Links) && $this->Links != "" ) {
625
+               if ( isset($this->Links[$Key][$NodeID]["Name"]) || isset($this->Links[$NodeID][$Key]["Name"]) ) {
718 626
                  $Name  = isset($this->Links[$Key][$NodeID]["Name"]) ? $this->Links[$Key][$NodeID]["Name"] : $this->Links[$NodeID][$Key]["Name"];
719 627
                  $TxtX  = ($X2 - $X)/2 + $X;
720 628
                  $TxtY  = ($Y2 - $Y)/2 + $Y;
@@ -736,10 +644,8 @@  discard block
 block discarded – undo
736 644
       }
737 645
 
738 646
      /* Draw the quiet zones */
739
-     if ( $DrawQuietZone )
740
-      {
741
-       foreach($this->Data as $Key => $Settings)
742
-        {
647
+     if ( $DrawQuietZone ) {
648
+       foreach($this->Data as $Key => $Settings) {
743 649
          $X	 = $Settings["X"];
744 650
          $Y	 = $Settings["Y"];
745 651
          $FreeZone = $Settings["FreeZone"];
@@ -750,8 +656,7 @@  discard block
 block discarded – undo
750 656
 
751 657
 
752 658
      /* Draw the nodes */
753
-     foreach($this->Data as $Key => $Settings)
754
-      {
659
+     foreach($this->Data as $Key => $Settings) {
755 660
        $X	 = $Settings["X"];
756 661
        $Y	 = $Settings["Y"];
757 662
        $Name	 = $Settings["Name"];
@@ -761,35 +666,26 @@  discard block
 block discarded – undo
761 666
 
762 667
        $Color	 = array("R"=>$Settings["R"],"G"=>$Settings["G"],"B"=>$Settings["B"],"Alpha"=>$Settings["Alpha"],"BorderR"=>$Settings["BorderR"],"BorderG"=>$Settings["BorderG"],"BorderB"=>$Settings["BorderB"],"BorderApha"=>$Settings["BorderAlpha"]);
763 668
 
764
-       if ( $Shape == NODE_SHAPE_CIRCLE )
765
-        {
669
+       if ( $Shape == NODE_SHAPE_CIRCLE ) {
766 670
          $this->pChartObject->drawFilledCircle($X,$Y,$Size,$Color);
767
-        }
768
-       elseif ( $Shape == NODE_SHAPE_TRIANGLE )
769
-        {
671
+        } elseif ( $Shape == NODE_SHAPE_TRIANGLE ) {
770 672
          $Points = "";
771 673
          $Points[] = cos(deg2rad(270)) * $Size + $X; $Points[] = sin(deg2rad(270)) * $Size + $Y;
772 674
          $Points[] = cos(deg2rad(45)) * $Size + $X;  $Points[] = sin(deg2rad(45)) * $Size + $Y;
773 675
          $Points[] = cos(deg2rad(135)) * $Size + $X; $Points[] = sin(deg2rad(135)) * $Size + $Y;
774 676
          $this->pChartObject->drawPolygon($Points,$Color);
775
-        }
776
-       elseif ( $Shape == NODE_SHAPE_SQUARE )
777
-        {
677
+        } elseif ( $Shape == NODE_SHAPE_SQUARE ) {
778 678
          $Offset = $Size/2; $Size = $Size / 2;
779 679
          $this->pChartObject->drawFilledRectangle($X-$Offset,$Y-$Offset,$X+$Offset,$Y+$Offset,$Color);
780 680
         }
781 681
 
782
-       if ( $Name != "" )
783
-        {
682
+       if ( $Name != "" ) {
784 683
          $LabelOptions = array("R"=>$this->Labels["R"],"G"=>$this->Labels["G"],"B"=>$this->Labels["B"],"Alpha"=>$this->Labels["Alpha"]);
785 684
 
786
-         if ( $this->Labels["Type"] == LABEL_LIGHT )
787
-          {
685
+         if ( $this->Labels["Type"] == LABEL_LIGHT ) {
788 686
            $LabelOptions["Align"] = TEXT_ALIGN_BOTTOMLEFT;
789 687
            $this->pChartObject->drawText($X,$Y,$Name,$LabelOptions);
790
-          }
791
-         elseif ( $this->Labels["Type"] == LABEL_CLASSIC )
792
-          {
688
+          } elseif ( $this->Labels["Type"] == LABEL_CLASSIC ) {
793 689
            $LabelOptions["Align"]         = TEXT_ALIGN_TOPMIDDLE;
794 690
            $LabelOptions["DrawBox"]       = TRUE;
795 691
            $LabelOptions["BoxAlpha"]      = 50;
@@ -804,17 +700,13 @@  discard block
 block discarded – undo
804 700
       }
805 701
 
806 702
      /* Draw the vectors */
807
-     if ( $DrawVectors )
808
-      {
809
-       foreach($this->Data as $Key => $Settings)
810
-        {
703
+     if ( $DrawVectors ) {
704
+       foreach($this->Data as $Key => $Settings) {
811 705
          $X1 = $Settings["X"];
812 706
          $Y1 = $Settings["Y"];
813 707
 
814
-         if ( isset($Settings["Vectors"]) && $Settings["Type"] != NODE_TYPE_CENTRAL )
815
-          {
816
-           foreach($Settings["Vectors"] as $ID => $Vector)
817
-            {
708
+         if ( isset($Settings["Vectors"]) && $Settings["Type"] != NODE_TYPE_CENTRAL ) {
709
+           foreach($Settings["Vectors"] as $ID => $Vector) {
818 710
              $Type  = $Vector["Type"];
819 711
              $Force = $Vector["Force"];
820 712
              $Angle = $Vector["Angle"];
@@ -838,14 +730,12 @@  discard block
 block discarded – undo
838 730
     { return (sqrt(($X2-$X1)*($X2-$X1)+($Y2-$Y1)*($Y2-$Y1))); }
839 731
 
840 732
    /* Return the angle made by a line and the X axis */
841
-   function getAngle($X1,$Y1,$X2,$Y2)
842
-    {
733
+   function getAngle($X1,$Y1,$X2,$Y2) {
843 734
      $Opposite = $Y2 - $Y1; $Adjacent = $X2 - $X1;$Angle = rad2deg(atan2($Opposite,$Adjacent));
844 735
      if ($Angle > 0) { return($Angle); } else { return(360-abs($Angle)); }
845 736
     }
846 737
 
847
-   function intersect($X1,$Y1,$X2,$Y2,$X3,$Y3,$X4,$Y4)
848
-    {
738
+   function intersect($X1,$Y1,$X2,$Y2,$X3,$Y3,$X4,$Y4) {
849 739
      $A = (($X3 * $Y4 - $X4 * $Y3) * ($X1 - $X2) - ($X1 * $Y2 - $X2 * $Y1) * ($X3 - $X4));
850 740
      $B = (($Y1 - $Y2) * ($X3 - $X4) - ($Y3 - $Y4) * ($X1 - $X2));
851 741
 
@@ -856,8 +746,7 @@  discard block
 block discarded – undo
856 746
      if ( $C == 0 ) { return(FALSE); }
857 747
      $Yi = $Xi * (($Y1 - $Y2)/$C) + (($X1 * $Y2 - $X2 * $Y1)/$C);
858 748
 
859
-     if ( $Xi >= min($X1,$X2) && $Xi >= min($X3,$X4) && $Xi <= max($X1,$X2) && $Xi <= max($X3,$X4))
860
-      {
749
+     if ( $Xi >= min($X1,$X2) && $Xi >= min($X3,$X4) && $Xi <= max($X1,$X2) && $Xi <= max($X3,$X4)) {
861 750
        if ( $Yi >= min($Y1,$Y2) && $Yi >= min($Y3,$Y4) && $Yi <= max($Y1,$Y2) && $Yi <= max($Y3,$Y4))
862 751
         { return(TRUE); }
863 752
       }
Please login to merge, or discard this patch.
sites/default/boinc/modules/boincstats/includes/pchart/class/pPie.class.php 1 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.
default/boinc/modules/boincstats/includes/pchart/class/pBubble.class.php 1 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.
default/boinc/modules/boincstats/includes/pchart/class/pImage.class.php 1 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.
default/boinc/modules/boincstats/includes/pchart/class/pCache.class.php 1 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.
default/boinc/modules/boincstats/includes/pchart/class/pIndicator.class.php 1 patch
Braces   +26 added lines, -55 removed lines patch added patch discarded remove patch
@@ -23,19 +23,16 @@  discard block
 block discarded – undo
23 23
  define("INDICATOR_VALUE_LABEL"		, 700022);
24 24
 
25 25
  /* pIndicator class definition */
26
- class pIndicator
27
-  {
26
+ class pIndicator {
28 27
    var $pChartObject;
29 28
 
30 29
    /* Class creator */
31
-   function pIndicator($pChartObject)
32
-    {
30
+   function pIndicator($pChartObject) {
33 31
      $this->pChartObject = $pChartObject;
34 32
     }
35 33
 
36 34
    /* Draw an indicator */
37
-   function draw($X,$Y,$Width,$Height,$Format="")
38
-    {
35
+   function draw($X,$Y,$Width,$Height,$Format="") {
39 36
      $Values			= isset($Format["Values"]) ? $Format["Values"] : VOID;
40 37
      $IndicatorSections		= isset($Format["IndicatorSections"]) ? $Format["IndicatorSections"] : NULL;
41 38
      $ValueDisplay		= isset($Format["ValueDisplay"]) ? $Format["ValueDisplay"] : INDICATOR_VALUE_BUBBLE;
@@ -70,8 +67,7 @@  discard block
 block discarded – undo
70 67
 
71 68
      /* Determine indicator visual configuration */
72 69
      $OverallMin = $IndicatorSections[0]["End"]; $OverallMax = $IndicatorSections[0]["Start"];
73
-     foreach ($IndicatorSections as $Key => $Settings)
74
-      {
70
+     foreach ($IndicatorSections as $Key => $Settings) {
75 71
        if ( $Settings["End"] > $OverallMax )   { $OverallMax = $Settings["End"]; }
76 72
        if ( $Settings["Start"] < $OverallMin ) { $OverallMin = $Settings["Start"]; }
77 73
       }
@@ -79,16 +75,14 @@  discard block
 block discarded – undo
79 75
      $XScale    = $RealWidth / ($OverallMax-$OverallMin);
80 76
 
81 77
      $X1 = $X; $ValuesPos = "";
82
-     foreach ($IndicatorSections as $Key => $Settings)
83
-      {
78
+     foreach ($IndicatorSections as $Key => $Settings) {
84 79
        $Color      = array("R"=>$Settings["R"],"G"=>$Settings["G"],"B"=>$Settings["B"]);
85 80
        $Caption    = $Settings["Caption"];
86 81
        $SubCaption = $Settings["Start"]." - ".$Settings["End"];
87 82
 
88 83
        $X2 = $X1 + ($Settings["End"] - $Settings["Start"]) * $XScale;
89 84
 
90
-       if ( $Key == 0 && $DrawLeftHead )
91
-        {
85
+       if ( $Key == 0 && $DrawLeftHead ) {
92 86
          $Poly = ""; $Poly[] = $X1-1; $Poly[] = $Y; $Poly[] = $X1-1; $Poly[] = $Y+$Height; $Poly[] = $X1-1-$HeadSize; $Poly[] = $Y+($Height/2);
93 87
          $this->pChartObject->drawPolygon($Poly,$Color);
94 88
          $this->pChartObject->drawLine($X1-2,$Y,$X1-2-$HeadSize,$Y+($Height/2),$Color);
@@ -97,30 +91,23 @@  discard block
 block discarded – undo
97 91
 
98 92
        /* Determine the position of the breaks */
99 93
        $Break = "";
100
-       foreach($Values as $iKey => $Value)
101
-        {
102
-         if ( $Value >= $Settings["Start"] && $Value <= $Settings["End"] )
103
-          {
94
+       foreach($Values as $iKey => $Value) {
95
+         if ( $Value >= $Settings["Start"] && $Value <= $Settings["End"] ) {
104 96
            $XBreak  = $X1 + ($Value - $Settings["Start"]) * $XScale;
105 97
            $ValuesPos[$Value] = $XBreak;
106 98
            $Break[] = floor($XBreak);
107 99
           }
108 100
         }
109 101
 
110
-       if ( $ValueDisplay == INDICATOR_VALUE_LABEL )
111
-        {
102
+       if ( $ValueDisplay == INDICATOR_VALUE_LABEL ) {
112 103
          if ( $Break == "" )
113 104
           $this->pChartObject->drawFilledRectangle($X1,$Y,$X2,$Y+$Height,$Color);
114
-         else
115
-          {
105
+         else {
116 106
            sort($Break);
117 107
            $Poly = ""; $Poly[] = $X1; $Poly[] = $Y; $LastPointWritten = FALSE;
118
-           foreach($Break as $iKey => $Value)
119
-            {
108
+           foreach($Break as $iKey => $Value) {
120 109
              if ( $Value-5 >= $X1 )
121
-              { $Poly[] = $Value-5; $Poly[] = $Y; }
122
-             elseif ($X1 - ($Value-5) > 0 )
123
-              {
110
+              { $Poly[] = $Value-5; $Poly[] = $Y; } elseif ($X1 - ($Value-5) > 0 ) {
124 111
                $Offset = $X1 - ($Value-5);
125 112
                $Poly = ""; $Poly[] = $X1; $Poly[] = $Y + $Offset;
126 113
               }
@@ -128,9 +115,7 @@  discard block
 block discarded – undo
128 115
              $Poly[] = $Value;   $Poly[] = $Y+5;
129 116
 
130 117
              if ( $Value+5 <= $X2 )
131
-              { $Poly[] = $Value+5; $Poly[] = $Y; }
132
-             elseif (($Value+5) > $X2 )
133
-              {
118
+              { $Poly[] = $Value+5; $Poly[] = $Y; } elseif (($Value+5) > $X2 ) {
134 119
                $Offset = ($Value+5) - $X2;
135 120
                $Poly[] = $X2; $Poly[] = $Y + $Offset;
136 121
                $LastPointWritten = TRUE;
@@ -143,37 +128,31 @@  discard block
 block discarded – undo
143 128
 
144 129
            $this->pChartObject->drawPolygon($Poly,$Color);
145 130
           }
146
-        }
147
-       else
131
+        } else
148 132
         $this->pChartObject->drawFilledRectangle($X1,$Y,$X2,$Y+$Height,$Color);
149 133
 
150
-       if ( $Key == count($IndicatorSections)-1 && $DrawRightHead )
151
-        {
134
+       if ( $Key == count($IndicatorSections)-1 && $DrawRightHead ) {
152 135
          $Poly = ""; $Poly[] = $X2+1; $Poly[] = $Y; $Poly[] = $X2+1; $Poly[] = $Y+$Height; $Poly[] = $X2+1+$HeadSize; $Poly[] = $Y+($Height/2);
153 136
          $this->pChartObject->drawPolygon($Poly,$Color);
154 137
          $this->pChartObject->drawLine($X2+1,$Y,$X2+1+$HeadSize,$Y+($Height/2),$Color);
155 138
          $this->pChartObject->drawLine($X2+1,$Y+$Height,$X2+1+$HeadSize,$Y+($Height/2),$Color);
156 139
         }
157 140
 
158
-       if ( $CaptionPosition == INDICATOR_CAPTION_INSIDE )
159
-        {
141
+       if ( $CaptionPosition == INDICATOR_CAPTION_INSIDE ) {
160 142
          $TxtPos  = $this->pChartObject->getTextBox($X1,$Y+$Height+$TextPadding,$CaptionFontName,$CaptionFontSize,0,$Caption);
161 143
          $YOffset = ($TxtPos[0]["Y"] - $TxtPos[2]["Y"]) + $TextPadding;
162 144
 
163
-         if ( $CaptionLayout == INDICATOR_CAPTION_EXTENDED )
164
-          {
145
+         if ( $CaptionLayout == INDICATOR_CAPTION_EXTENDED ) {
165 146
            $TxtPos  = $this->pChartObject->getTextBox($X1,$Y+$Height+$TextPadding,$CaptionFontName,$CaptionFontSize,0,$SubCaption);
166 147
            $YOffset = $YOffset + ($TxtPos[0]["Y"] - $TxtPos[2]["Y"]) + $TextPadding*2;
167 148
           }
168 149
 
169 150
          $XOffset = $TextPadding;
170
-        }
171
-       else
151
+        } else
172 152
         { $YOffset = 0; $XOffset = 0; }
173 153
 
174 154
        if ( $CaptionColorFactor == NULL )
175
-        { $CaptionColor    = array("Align"=>TEXT_ALIGN_TOPLEFT,"FontName"=>$CaptionFontName,"FontSize"=>$CaptionFontSize,"R"=>$CaptionR,"G"=>$CaptionG,"B"=>$CaptionB,"Alpha"=>$CaptionAlpha); }
176
-       else
155
+        { $CaptionColor    = array("Align"=>TEXT_ALIGN_TOPLEFT,"FontName"=>$CaptionFontName,"FontSize"=>$CaptionFontSize,"R"=>$CaptionR,"G"=>$CaptionG,"B"=>$CaptionB,"Alpha"=>$CaptionAlpha); } else
177 156
         { $CaptionColor    = array("Align"=>TEXT_ALIGN_TOPLEFT,"FontName"=>$CaptionFontName,"FontSize"=>$CaptionFontSize,"R"=>$Settings["R"]+$CaptionColorFactor,"G"=>$Settings["G"]+$CaptionColorFactor,"B"=>$Settings["B"]+$CaptionColorFactor); }
178 157
 
179 158
        if ( $SubCaptionColorFactor == NULL )
@@ -186,8 +165,7 @@  discard block
 block discarded – undo
186 165
 
187 166
        if ( $CaptionLayout == INDICATOR_CAPTION_DEFAULT )
188 167
         $this->pChartObject->drawText($X1,$Y+$Height+$TextPadding,$Caption,$CaptionColor);
189
-       elseif ( $CaptionLayout == INDICATOR_CAPTION_EXTENDED )
190
-        {
168
+       elseif ( $CaptionLayout == INDICATOR_CAPTION_EXTENDED ) {
191 169
          $TxtPos        = $this->pChartObject->getTextBox($X1,$Y+$Height+$TextPadding,$CaptionFontName,$CaptionFontSize,0,$Caption);
192 170
          $CaptionHeight = $TxtPos[0]["Y"] - $TxtPos[2]["Y"];
193 171
 
@@ -203,18 +181,13 @@  discard block
 block discarded – undo
203 181
      $RestoreShadow = $this->pChartObject->Shadow;
204 182
      $this->pChartObject->Shadow = FALSE;
205 183
 
206
-     foreach($Values as $Key => $Value)
207
-      {
208
-       if ( $Value >= $OverallMin && $Value <= $OverallMax )
209
-        {
210
-         foreach ($IndicatorSections as $Key => $Settings)
211
-          {
212
-           if ( $Value >= $Settings["Start"] && $Value <= $Settings["End"] )
213
-            {
184
+     foreach($Values as $Key => $Value) {
185
+       if ( $Value >= $OverallMin && $Value <= $OverallMax ) {
186
+         foreach ($IndicatorSections as $Key => $Settings) {
187
+           if ( $Value >= $Settings["Start"] && $Value <= $Settings["End"] ) {
214 188
              $X1 = $ValuesPos[$Value]; //$X + $Key*$SectionsMargin + ($Value - $OverallMin) * $XScale;
215 189
 
216
-             if ( $ValueDisplay == INDICATOR_VALUE_BUBBLE )
217
-              {
190
+             if ( $ValueDisplay == INDICATOR_VALUE_BUBBLE ) {
218 191
                $TxtPos = $this->pChartObject->getTextBox($X1,$Y,$ValueFontName,$ValueFontSize,0,$Value.$Unit);
219 192
                $Radius = floor(($TxtPos[1]["X"] - $TxtPos[0]["X"] + $TextPadding*4)/2);
220 193
 
@@ -223,9 +196,7 @@  discard block
 block discarded – undo
223 196
 
224 197
                $TextSettings = array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontName"=>$ValueFontName,"FontSize"=>$ValueFontSize);
225 198
                $this->pChartObject->drawText($X1-1,$Y-1,$Value.$Unit,$TextSettings);
226
-              }
227
-             elseif( $ValueDisplay == INDICATOR_VALUE_LABEL )
228
-              {
199
+              } elseif( $ValueDisplay == INDICATOR_VALUE_LABEL ) {
229 200
                $Caption = "";
230 201
                $Caption[] = array("Format"=>array("R"=>$Settings["R"],"G"=>$Settings["G"],"B"=>$Settings["B"],"Alpha"=>100),"Caption"=>$Value.$Unit);
231 202
                $this->pChartObject->drawLabelBox(floor($X1),floor($Y)+2,"Value - ".$Settings["Caption"],$Caption);
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pData.class.php 1 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.
default/boinc/modules/boincstats/includes/pchart/class/pScatter.class.php 1 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.