|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* JPGraph v4.0.3 |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
namespace Amenadiel\JpGraph\Graph; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* @class RectPatternRDiag |
|
11
|
|
|
* // Implements right diagonal pattern |
|
12
|
|
|
*/ |
|
13
|
|
|
class RectPatternRDiag extends RectPattern |
|
14
|
|
|
{ |
|
15
|
|
|
public function __construct($aColor = 'black', $aWeight = 1, $aLineSpacing = 12) |
|
16
|
|
|
{ |
|
17
|
|
|
parent::__construct($aColor, $aWeight); |
|
18
|
|
|
$this->linespacing = $aLineSpacing; |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
public function DoPattern($aImg) |
|
22
|
|
|
{ |
|
23
|
|
|
// -------------------- |
|
24
|
|
|
// | / / / / /| |
|
25
|
|
|
// |/ / / / / | |
|
26
|
|
|
// | / / / / | |
|
27
|
|
|
// -------------------- |
|
28
|
|
|
$xe = $this->rect->xe; |
|
29
|
|
|
$ye = $this->rect->ye; |
|
30
|
|
|
$x0 = $this->rect->x + round($this->linespacing / 2); |
|
31
|
|
|
$y0 = $this->rect->y; |
|
32
|
|
|
$x1 = $this->rect->x; |
|
33
|
|
|
$y1 = $this->rect->y + round($this->linespacing / 2); |
|
34
|
|
|
|
|
35
|
|
|
while ($x0 <= $xe && $y1 <= $ye) { |
|
36
|
|
|
$aImg->Line($x0, $y0, $x1, $y1); |
|
37
|
|
|
$x0 += $this->linespacing; |
|
38
|
|
|
$y1 += $this->linespacing; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
if ($xe - $x1 > $ye - $y0) { |
|
42
|
|
|
// Width larger than height |
|
43
|
|
|
$x1 = $this->rect->x + ($y1 - $ye); |
|
44
|
|
|
$y1 = $ye; |
|
45
|
|
|
$y0 = $this->rect->y; |
|
46
|
|
|
while ($x0 <= $xe) { |
|
47
|
|
|
$aImg->Line($x0, $y0, $x1, $y1); |
|
48
|
|
|
$x0 += $this->linespacing; |
|
49
|
|
|
$x1 += $this->linespacing; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
$y0 = $this->rect->y + ($x0 - $xe); |
|
53
|
|
|
$x0 = $xe; |
|
54
|
|
|
} else { |
|
55
|
|
|
// Height larger than width |
|
56
|
|
|
$diff = $x0 - $xe; |
|
57
|
|
|
$y0 = $diff + $this->rect->y; |
|
58
|
|
|
$x0 = $xe; |
|
59
|
|
|
$x1 = $this->rect->x; |
|
60
|
|
|
while ($y1 <= $ye) { |
|
61
|
|
|
$aImg->Line($x0, $y0, $x1, $y1); |
|
62
|
|
|
$y1 += $this->linespacing; |
|
63
|
|
|
$y0 += $this->linespacing; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
$diff = $y1 - $ye; |
|
67
|
|
|
$y1 = $ye; |
|
68
|
|
|
$x1 = $diff + $this->rect->x; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
while ($y0 <= $ye) { |
|
72
|
|
|
$aImg->Line($x0, $y0, $x1, $y1); |
|
73
|
|
|
$y0 += $this->linespacing; |
|
74
|
|
|
$x1 += $this->linespacing; |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|