|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* JPGraph v3.6.15 |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
namespace Amenadiel\JpGraph\Graph; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* @class Ticks |
|
11
|
|
|
* // Description: Abstract base class for drawing linear and logarithmic |
|
12
|
|
|
* // tick marks on axis |
|
13
|
|
|
*/ |
|
14
|
|
|
class Ticks |
|
15
|
|
|
{ |
|
16
|
|
|
public $label_formatstr = ''; // C-style format string to use for labels |
|
17
|
|
|
public $label_formfunc = ''; |
|
18
|
|
|
public $label_dateformatstr = ''; |
|
19
|
|
|
public $direction = 1; // Should ticks be in(=1) the plot area or outside (=-1) |
|
20
|
|
|
public $supress_last = false; |
|
21
|
|
|
public $supress_tickmarks = false; |
|
22
|
|
|
public $supress_minor_tickmarks = false; |
|
23
|
|
|
public $maj_ticks_pos = []; |
|
24
|
|
|
public $maj_ticklabels_pos = []; |
|
25
|
|
|
public $ticks_pos = []; |
|
26
|
|
|
public $maj_ticks_label = []; |
|
27
|
|
|
public $precision; |
|
28
|
|
|
|
|
29
|
|
|
protected $minor_abs_size = 3; |
|
30
|
|
|
protected $major_abs_size = 5; |
|
31
|
|
|
protected $scale; |
|
32
|
|
|
protected $is_set = false; |
|
33
|
|
|
protected $supress_zerolabel = false; |
|
34
|
|
|
protected $supress_first = false; |
|
35
|
|
|
protected $mincolor = ''; |
|
36
|
|
|
protected $majcolor = ''; |
|
37
|
|
|
protected $weight = 1; |
|
38
|
|
|
protected $label_usedateformat = false; |
|
39
|
|
|
|
|
40
|
3 |
|
public function __construct($aScale) |
|
41
|
|
|
{ |
|
42
|
3 |
|
$this->scale = $aScale; |
|
43
|
3 |
|
$this->precision = -1; |
|
44
|
3 |
|
} |
|
45
|
|
|
|
|
46
|
|
|
// Set format string for automatic labels |
|
47
|
4 |
|
public function SetLabelFormat($aFormatString, $aDate = false) |
|
48
|
|
|
{ |
|
49
|
4 |
|
$this->label_formatstr = $aFormatString; |
|
50
|
4 |
|
$this->label_usedateformat = $aDate; |
|
51
|
4 |
|
} |
|
52
|
|
|
|
|
53
|
1 |
|
public function SetLabelDateFormat($aFormatString) |
|
54
|
|
|
{ |
|
55
|
1 |
|
$this->label_dateformatstr = $aFormatString; |
|
56
|
1 |
|
} |
|
57
|
|
|
|
|
58
|
4 |
|
public function SetFormatCallback($aCallbackFuncName) |
|
59
|
|
|
{ |
|
60
|
4 |
|
$this->label_formfunc = $aCallbackFuncName; |
|
61
|
4 |
|
} |
|
62
|
|
|
|
|
63
|
|
|
// Don't display the first zero label |
|
64
|
3 |
|
public function SupressZeroLabel($aFlag = true) |
|
65
|
|
|
{ |
|
66
|
3 |
|
$this->supress_zerolabel = $aFlag; |
|
67
|
3 |
|
} |
|
68
|
|
|
|
|
69
|
|
|
// Don't display minor tick marks |
|
70
|
14 |
|
public function SupressMinorTickMarks($aHide = true) |
|
71
|
|
|
{ |
|
72
|
14 |
|
$this->supress_minor_tickmarks = $aHide; |
|
73
|
14 |
|
} |
|
74
|
|
|
|
|
75
|
|
|
// Don't display major tick marks |
|
76
|
14 |
|
public function SupressTickMarks($aHide = true) |
|
77
|
|
|
{ |
|
78
|
14 |
|
$this->supress_tickmarks = $aHide; |
|
79
|
14 |
|
} |
|
80
|
|
|
|
|
81
|
|
|
// Hide the first tick mark |
|
82
|
5 |
|
public function SupressFirst($aHide = true) |
|
83
|
|
|
{ |
|
84
|
5 |
|
$this->supress_first = $aHide; |
|
85
|
5 |
|
} |
|
86
|
|
|
|
|
87
|
|
|
// Hide the last tick mark |
|
88
|
10 |
|
public function SupressLast($aHide = true) |
|
89
|
|
|
{ |
|
90
|
10 |
|
$this->supress_last = $aHide; |
|
91
|
10 |
|
} |
|
92
|
|
|
|
|
93
|
|
|
// Size (in pixels) of minor tick marks |
|
94
|
14 |
|
public function GetMinTickAbsSize() |
|
95
|
|
|
{ |
|
96
|
14 |
|
return $this->minor_abs_size; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
// Size (in pixels) of major tick marks |
|
100
|
14 |
|
public function GetMajTickAbsSize() |
|
101
|
|
|
{ |
|
102
|
14 |
|
return $this->major_abs_size; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
public function SetSize($aMajSize, $aMinSize = 3) |
|
106
|
|
|
{ |
|
107
|
|
|
$this->major_abs_size = $aMajSize; |
|
108
|
|
|
$this->minor_abs_size = $aMinSize; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
// Have the ticks been specified |
|
112
|
6 |
|
public function IsSpecified() |
|
113
|
|
|
{ |
|
114
|
6 |
|
return $this->is_set; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
14 |
|
public function SetSide($aSide) |
|
118
|
|
|
{ |
|
119
|
14 |
|
$this->direction = $aSide; |
|
120
|
14 |
|
} |
|
121
|
|
|
|
|
122
|
|
|
// Which side of the axis should the ticks be on |
|
123
|
5 |
|
public function SetDirection($aSide = SIDE_RIGHT) |
|
124
|
|
|
{ |
|
125
|
5 |
|
$this->direction = $aSide; |
|
126
|
5 |
|
} |
|
127
|
|
|
|
|
128
|
|
|
// Set colors for major and minor tick marks |
|
129
|
|
|
public function SetMarkColor($aMajorColor, $aMinorColor = '') |
|
130
|
|
|
{ |
|
131
|
|
|
$this->SetColor($aMajorColor, $aMinorColor); |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
public function SetColor($aMajorColor, $aMinorColor = '') |
|
135
|
|
|
{ |
|
136
|
|
|
$this->majcolor = $aMajorColor; |
|
137
|
|
|
|
|
138
|
|
|
// If not specified use same as major |
|
139
|
|
|
if ($aMinorColor == '') { |
|
140
|
|
|
$this->mincolor = $aMajorColor; |
|
141
|
|
|
} else { |
|
142
|
|
|
$this->mincolor = $aMinorColor; |
|
143
|
|
|
} |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
public function SetWeight($aWeight) |
|
147
|
|
|
{ |
|
148
|
|
|
$this->weight = $aWeight; |
|
149
|
|
|
} |
|
150
|
|
|
} // @class |
|
151
|
|
|
|