@@ -278,8 +278,8 @@ |
||
| 278 | 278 | } |
| 279 | 279 | } else { |
| 280 | 280 | //FIX: if negative precision is returned "0f" , instead of formatted values |
| 281 | - $format = $precision > 0?'%01.' . $precision . 'f':'%01.0f'; |
|
| 282 | - $l = sprintf($format, round($aVal, $precision)); |
|
| 281 | + $format = $precision > 0 ? '%01.' . $precision . 'f' : '%01.0f'; |
|
| 282 | + $l = sprintf($format, round($aVal, $precision)); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | if (($this->supress_zerolabel && $l == 0) || ($this->supress_first && $aIdx == 0) || ($this->supress_last && $aIdx == $aNbrTicks - 1)) { |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | $_y1 = $dyStop * $x; |
| 87 | 87 | $_y2 = $dyStart * $x; |
| 88 | 88 | if ($xStart > $xStop) { |
| 89 | - $error1 = $_y1 - (int)($_y1); |
|
| 90 | - $error2 = 1 - $_y2 + (int)$_y2; |
|
| 89 | + $error1 = $_y1 - (int) ($_y1); |
|
| 90 | + $error2 = 1 - $_y2 + (int) $_y2; |
|
| 91 | 91 | $_y1 = $_y1 - $error1; |
| 92 | 92 | $_y2 = $_y2 + $error2; |
| 93 | 93 | } else { |
| 94 | - $error1 = 1 - $_y1 + (int)$_y1; |
|
| 95 | - $error2 = $_y2 - (int)($_y2); |
|
| 94 | + $error1 = 1 - $_y1 + (int) $_y1; |
|
| 95 | + $error2 = $_y2 - (int) ($_y2); |
|
| 96 | 96 | $_y1 = $_y1 + $error1; |
| 97 | 97 | $_y2 = $_y2 - $error2; |
| 98 | 98 | } |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | } else { |
| 127 | 127 | $y = $b * sqrt(1 - ($x * $x) / ($a * $a)); |
| 128 | - $error = $y - (int)($y); |
|
| 129 | - $y = (int)($y); |
|
| 128 | + $error = $y - (int) ($y); |
|
| 129 | + $y = (int) ($y); |
|
| 130 | 130 | $diffColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error); |
| 131 | 131 | $y1 = $y; |
| 132 | 132 | if ($x < $aaAngleX) { |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | } else { |
| 172 | 172 | $y = $b * sqrt(1 - ($x * $x) / ($a * $a)); |
| 173 | - $error = $y - (int)($y); |
|
| 173 | + $error = $y - (int) ($y); |
|
| 174 | 174 | $y = (int) $y; |
| 175 | 175 | $diffColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error); |
| 176 | 176 | $y1 = $y; |
@@ -207,13 +207,13 @@ discard block |
||
| 207 | 207 | $_x1 = $dxStop * $y; |
| 208 | 208 | $_x2 = $dxStart * $y; |
| 209 | 209 | if ($yStart > $yStop) { |
| 210 | - $error1 = $_x1 - (int)($_x1); |
|
| 211 | - $error2 = 1 - $_x2 + (int)$_x2; |
|
| 210 | + $error1 = $_x1 - (int) ($_x1); |
|
| 211 | + $error2 = 1 - $_x2 + (int) $_x2; |
|
| 212 | 212 | $_x1 = $_x1 - $error1; |
| 213 | 213 | $_x2 = $_x2 + $error2; |
| 214 | 214 | } else { |
| 215 | - $error1 = 1 - $_x1 + (int)$_x1; |
|
| 216 | - $error2 = $_x2 - (int)($_x2); |
|
| 215 | + $error1 = 1 - $_x1 + (int) $_x1; |
|
| 216 | + $error2 = $_x2 - (int) ($_x2); |
|
| 217 | 217 | $_x1 = $_x1 + $error1; |
| 218 | 218 | $_x2 = $_x2 - $error2; |
| 219 | 219 | } |
@@ -253,8 +253,8 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | } else { |
| 255 | 255 | $x = $a * sqrt(1 - ($y * $y) / ($b * $b)); |
| 256 | - $error = $x - (int)($x); |
|
| 257 | - $x = (int)($x); |
|
| 256 | + $error = $x - (int) ($x); |
|
| 257 | + $x = (int) ($x); |
|
| 258 | 258 | $diffColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error); |
| 259 | 259 | $x1 = $x; |
| 260 | 260 | if ($y < $aaAngleY && $y <= $yStop) { |
@@ -293,8 +293,8 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | } else { |
| 295 | 295 | $x = $a * sqrt(1 - ($y * $y) / ($b * $b)); |
| 296 | - $error = $x - (int)($x); |
|
| 297 | - $x = (int)($x); |
|
| 296 | + $error = $x - (int) ($x); |
|
| 297 | + $x = (int) ($x); |
|
| 298 | 298 | $diffColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error); |
| 299 | 299 | $x1 = $x; |
| 300 | 300 | if ($y < $aaAngleY && $y < $yStart) { |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $a -= 0.5; // looks better... |
| 370 | 370 | $b -= 0.5; |
| 371 | 371 | |
| 372 | - for ($i=0; $i < 4;$i++) { |
|
| 372 | + for ($i = 0; $i < 4; $i++) { |
|
| 373 | 373 | if ($start < ($i + 1) * M_PI / 2) { |
| 374 | 374 | if ($start > $i * M_PI / 2) { |
| 375 | 375 | if ($stop > ($i + 1) * M_PI / 2) { |
@@ -19,6 +19,10 @@ |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | // Stroke the axis. |
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @param LinearScale $aOtherAxisScale |
|
| 25 | + */ |
|
| 22 | 26 | public function Stroke($aOtherAxisScale, $aStrokeLabels = true) |
| 23 | 27 | { |
| 24 | 28 | if ($this->hide) { |
@@ -84,6 +84,9 @@ discard block |
||
| 84 | 84 | $this->scale->ticks->SetFormatCallback($aFuncName); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | + /** |
|
| 88 | + * @param string $aHAlign |
|
| 89 | + */ |
|
| 87 | 90 | public function SetLabelAlign($aHAlign, $aVAlign = 'top', $aParagraphAlign = 'left') |
| 88 | 91 | { |
| 89 | 92 | $this->label_halign = $aHAlign; |
@@ -188,6 +191,10 @@ discard block |
||
| 188 | 191 | } |
| 189 | 192 | |
| 190 | 193 | // Which side of the axis should the axis title be? |
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * @param integer $aSideOfAxis |
|
| 197 | + */ |
|
| 191 | 198 | public function SetTitleSide($aSideOfAxis) |
| 192 | 199 | { |
| 193 | 200 | $this->title_side = $aSideOfAxis; |
@@ -233,6 +240,9 @@ discard block |
||
| 233 | 240 | $this->label_step = $aStep; |
| 234 | 241 | } |
| 235 | 242 | |
| 243 | + /** |
|
| 244 | + * @param integer $aSidePos |
|
| 245 | + */ |
|
| 236 | 246 | public function SetLabelSide($aSidePos) |
| 237 | 247 | { |
| 238 | 248 | $this->labelPos = $aSidePos; |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | protected $show_last_label = true; |
| 36 | 36 | protected $label_step = 1; // Used by a text axis to specify what multiple of major steps |
| 37 | 37 | // should be labeled. |
| 38 | - protected $labelPos = 0; // Which side of the axis should the labels be? |
|
| 38 | + protected $labelPos = 0; // Which side of the axis should the labels be? |
|
| 39 | 39 | protected $title_adjust; |
| 40 | 40 | protected $title_margin; |
| 41 | 41 | protected $title_side = SIDE_LEFT; |
@@ -231,6 +231,9 @@ |
||
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | + /** |
|
| 235 | + * @param \Amenadiel\JpGraph\Image\RotImage $aImg |
|
| 236 | + */ |
|
| 234 | 237 | public function GetWidth($aImg) |
| 235 | 238 | { |
| 236 | 239 | $txt = new TextProperty(); |
@@ -47,6 +47,10 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | //--------------- |
| 49 | 49 | // CONSTRUCTOR |
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * @param \Amenadiel\JpGraph\Image\RotImage $aImg |
|
| 53 | + */ |
|
| 50 | 54 | public function __construct($aImg) |
| 51 | 55 | { |
| 52 | 56 | $this->iImg = $aImg; |
@@ -153,6 +157,10 @@ discard block |
||
| 153 | 157 | // Specify the width of the titles(labels) for the activities |
| 154 | 158 | // (This is by default set to the minimum width enought for the |
| 155 | 159 | // widest title) |
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * @param integer $aLabelWidth |
|
| 163 | + */ |
|
| 156 | 164 | public function SetLabelWidth($aLabelWidth) |
| 157 | 165 | { |
| 158 | 166 | $this->iLabelWidth = $aLabelWidth; |
@@ -324,6 +332,10 @@ discard block |
||
| 324 | 332 | } |
| 325 | 333 | |
| 326 | 334 | // Get week number |
| 335 | + |
|
| 336 | + /** |
|
| 337 | + * @param integer $aDate |
|
| 338 | + */ |
|
| 327 | 339 | public function GetWeekNbr($aDate, $aSunStart = true) |
| 328 | 340 | { |
| 329 | 341 | // We can't use the internal strftime() since it gets the weeknumber |
@@ -377,6 +389,10 @@ discard block |
||
| 377 | 389 | } |
| 378 | 390 | |
| 379 | 391 | // Get current year |
| 392 | + |
|
| 393 | + /** |
|
| 394 | + * @param integer $aDate |
|
| 395 | + */ |
|
| 380 | 396 | public function GetYear($aDate) |
| 381 | 397 | { |
| 382 | 398 | return 0 + Date("Y", $aDate); |
@@ -395,18 +411,30 @@ discard block |
||
| 395 | 411 | } |
| 396 | 412 | |
| 397 | 413 | // Get day in month |
| 414 | + |
|
| 415 | + /** |
|
| 416 | + * @param integer $aDate |
|
| 417 | + */ |
|
| 398 | 418 | public function GetMonthDayNbr($aDate) |
| 399 | 419 | { |
| 400 | 420 | return 0 + strftime("%d", $aDate); |
| 401 | 421 | } |
| 402 | 422 | |
| 403 | 423 | // Get day in year |
| 424 | + |
|
| 425 | + /** |
|
| 426 | + * @param integer $aDate |
|
| 427 | + */ |
|
| 404 | 428 | public function GetYearDayNbr($aDate) |
| 405 | 429 | { |
| 406 | 430 | return 0 + strftime("%j", $aDate); |
| 407 | 431 | } |
| 408 | 432 | |
| 409 | 433 | // Get month number |
| 434 | + |
|
| 435 | + /** |
|
| 436 | + * @param integer $aDate |
|
| 437 | + */ |
|
| 410 | 438 | public function GetMonthNbr($aDate) |
| 411 | 439 | { |
| 412 | 440 | return 0 + strftime("%m", $aDate); |
@@ -495,6 +523,9 @@ discard block |
||
| 495 | 523 | |
| 496 | 524 | // Convert a time string to minutes |
| 497 | 525 | |
| 526 | + /** |
|
| 527 | + * @param integer $aTimeString |
|
| 528 | + */ |
|
| 498 | 529 | public function TimeToMinutes($aTimeString) |
| 499 | 530 | { |
| 500 | 531 | // Split in hours and minutes |
@@ -995,6 +1026,10 @@ discard block |
||
| 995 | 1026 | } |
| 996 | 1027 | |
| 997 | 1028 | // Stroke year scale and gridlines |
| 1029 | + |
|
| 1030 | + /** |
|
| 1031 | + * @param integer $aYCoord |
|
| 1032 | + */ |
|
| 998 | 1033 | public function StrokeYears($aYCoord, $getHeight = false) |
| 999 | 1034 | { |
| 1000 | 1035 | if ($this->year->iShowLabels) { |
@@ -237,6 +237,9 @@ discard block |
||
| 237 | 237 | $this->margin_color = [250, 250, 250]; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | + /** |
|
| 241 | + * @param string $aFilename |
|
| 242 | + */ |
|
| 240 | 243 | public function SetupCache($aFilename, $aTimeout = 60) |
| 241 | 244 | { |
| 242 | 245 | $this->cache_name = $aFilename; |
@@ -284,6 +287,10 @@ discard block |
||
| 284 | 287 | } |
| 285 | 288 | |
| 286 | 289 | // Should the grid be in front or back of the plot? |
| 290 | + |
|
| 291 | + /** |
|
| 292 | + * @param integer $aDepth |
|
| 293 | + */ |
|
| 287 | 294 | public function SetGridDepth($aDepth) |
| 288 | 295 | { |
| 289 | 296 | $this->grid_depth = $aDepth; |
@@ -295,6 +302,10 @@ discard block |
||
| 295 | 302 | } |
| 296 | 303 | |
| 297 | 304 | // Specify graph angle 0-360 degrees. |
| 305 | + |
|
| 306 | + /** |
|
| 307 | + * @param integer $aAngle |
|
| 308 | + */ |
|
| 298 | 309 | public function SetAngle($aAngle) |
| 299 | 310 | { |
| 300 | 311 | $this->img->SetAngle($aAngle); |
@@ -775,6 +786,10 @@ discard block |
||
| 775 | 786 | // Specify density of ticks when autoscaling 'normal', 'dense', 'sparse', 'verysparse' |
| 776 | 787 | // The dividing factor have been determined heuristically according to my aesthetic |
| 777 | 788 | // sense (or lack off) y.m.m.v ! |
| 789 | + |
|
| 790 | + /** |
|
| 791 | + * @param integer $aYDensity |
|
| 792 | + */ |
|
| 778 | 793 | public function SetTickDensity($aYDensity = TICKD_NORMAL, $aXDensity = TICKD_NORMAL) |
| 779 | 794 | { |
| 780 | 795 | $this->xtick_factor = 30; |
@@ -875,6 +890,10 @@ discard block |
||
| 875 | 890 | } |
| 876 | 891 | |
| 877 | 892 | // Get a complete <MAP>..</MAP> tag for the final image map |
| 893 | + |
|
| 894 | + /** |
|
| 895 | + * @param string $aMapName |
|
| 896 | + */ |
|
| 878 | 897 | public function GetHTMLImageMap($aMapName) |
| 879 | 898 | { |
| 880 | 899 | $im = "<map name=\"$aMapName\" id=\"$aMapName\" >\n"; |
@@ -1050,6 +1069,9 @@ discard block |
||
| 1050 | 1069 | } |
| 1051 | 1070 | } |
| 1052 | 1071 | |
| 1072 | + /** |
|
| 1073 | + * @param string $aCSIMName |
|
| 1074 | + */ |
|
| 1053 | 1075 | public function GetCSIMImgHTML($aCSIMName, $aScriptName = 'auto', $aBorder = 0) |
| 1054 | 1076 | { |
| 1055 | 1077 | if ($aScriptName == 'auto') { |
@@ -1551,6 +1573,10 @@ discard block |
||
| 1551 | 1573 | } |
| 1552 | 1574 | } |
| 1553 | 1575 | |
| 1576 | + /** |
|
| 1577 | + * @param integer $aDepth |
|
| 1578 | + * @param boolean $aCSIM |
|
| 1579 | + */ |
|
| 1554 | 1580 | public function StrokeBands($aDepth, $aCSIM) |
| 1555 | 1581 | { |
| 1556 | 1582 | // Stroke bands |
@@ -217,6 +217,9 @@ |
||
| 217 | 217 | return (boolean) (count($this->txtcol)); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | + /** |
|
| 221 | + * @param \Amenadiel\JpGraph\Image\RotImage $aImg |
|
| 222 | + */ |
|
| 220 | 223 | public function Stroke($aImg) |
| 221 | 224 | { |
| 222 | 225 | // Constant |
@@ -259,6 +259,10 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | // Calculate autoscale. Used if user hasn't given a scale and ticks |
| 261 | 261 | // $maxsteps is the maximum number of major tickmarks allowed. |
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * @param \Amenadiel\JpGraph\Image\RotImage $img |
|
| 265 | + */ |
|
| 262 | 266 | public function AutoScale($img, $min, $max, $maxsteps, $majend = true) |
| 263 | 267 | { |
| 264 | 268 | if (!is_numeric($min) || !is_numeric($max)) { |
@@ -422,6 +426,12 @@ discard block |
||
| 422 | 426 | // [$numsteps,$adjmin,$adjmax,$minstep,$majstep] |
| 423 | 427 | // If $majend==true then the first and last marks on the axis will be major |
| 424 | 428 | // labeled tick marks otherwise it will be adjusted to the closest min tick mark |
| 429 | + |
|
| 430 | + /** |
|
| 431 | + * @param double $min |
|
| 432 | + * @param integer $a |
|
| 433 | + * @param integer $b |
|
| 434 | + */ |
|
| 425 | 435 | public function CalcTicks($maxsteps, $min, $max, $a, $b, $majend = true) |
| 426 | 436 | { |
| 427 | 437 | $diff = $max - $min; |
@@ -465,6 +475,11 @@ discard block |
||
| 465 | 475 | return array($numsteps, $adjmin, $adjmax, $minstep, $majstep); |
| 466 | 476 | } |
| 467 | 477 | |
| 478 | + /** |
|
| 479 | + * @param double $min |
|
| 480 | + * @param integer $a |
|
| 481 | + * @param integer $b |
|
| 482 | + */ |
|
| 468 | 483 | public function CalcTicksFreeze($maxsteps, $min, $max, $a, $b) |
| 469 | 484 | { |
| 470 | 485 | // Same as CalcTicks but don't adjust min/max values |
@@ -489,6 +504,12 @@ discard block |
||
| 489 | 504 | return array($numsteps, $minstep, $majstep); |
| 490 | 505 | } |
| 491 | 506 | |
| 507 | + /** |
|
| 508 | + * @param double $maxsteps |
|
| 509 | + * @param double $min |
|
| 510 | + * @param double $max |
|
| 511 | + * @param integer $a |
|
| 512 | + */ |
|
| 492 | 513 | public function IntCalcTicks($maxsteps, $min, $max, $a, $majend = true) |
| 493 | 514 | { |
| 494 | 515 | $diff = $max - $min; |
@@ -534,6 +555,12 @@ discard block |
||
| 534 | 555 | return array($numsteps, $adjmin, $adjmax, $majstep); |
| 535 | 556 | } |
| 536 | 557 | |
| 558 | + /** |
|
| 559 | + * @param double $maxsteps |
|
| 560 | + * @param double $min |
|
| 561 | + * @param double $max |
|
| 562 | + * @param integer $a |
|
| 563 | + */ |
|
| 537 | 564 | public function IntCalcTicksFreeze($maxsteps, $min, $max, $a) |
| 538 | 565 | { |
| 539 | 566 | // Same as IntCalcTick but don't change min/max values |
@@ -563,6 +590,10 @@ discard block |
||
| 563 | 590 | } |
| 564 | 591 | |
| 565 | 592 | // Determine the minimum of three values witha weight for last value |
| 593 | + |
|
| 594 | + /** |
|
| 595 | + * @param double $weight |
|
| 596 | + */ |
|
| 566 | 597 | public function MatchMin3($a, $b, $c, $weight) |
| 567 | 598 | { |
| 568 | 599 | if ($a < $b) { |