1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options\GaugeChart; |
4
|
|
|
|
5
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\Animation; |
6
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\ChartOptions; |
7
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\MaxTrait; |
8
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\MinTrait; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @author Christophe Meneses |
12
|
|
|
*/ |
13
|
|
|
class GaugeChartOptions extends ChartOptions |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var Animation |
17
|
|
|
*/ |
18
|
|
|
protected $animation; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* The color to use for the green section, in HTML color notation. |
22
|
|
|
* |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
protected $greenColor; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* The lowest value for a range marked by a green color. |
29
|
|
|
* |
30
|
|
|
* @var int |
31
|
|
|
*/ |
32
|
|
|
protected $greenFrom; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* The highest value for a range marked by a green color. |
36
|
|
|
* |
37
|
|
|
* @var int |
38
|
|
|
*/ |
39
|
|
|
protected $greenTo; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Labels for major tick marks. The number of labels define the number of major ticks in all gauges. The default |
43
|
|
|
* is five major ticks, with the labels of the minimal and maximal gauge value. |
44
|
|
|
* |
45
|
|
|
* @var array |
46
|
|
|
*/ |
47
|
|
|
protected $majorTicks; |
48
|
|
|
|
49
|
|
|
use MaxTrait; |
50
|
|
|
|
51
|
|
|
use MinTrait; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* The number of minor tick section in each major tick section. |
55
|
|
|
* |
56
|
|
|
* @var int |
57
|
|
|
*/ |
58
|
|
|
protected $minorTicks; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* The color to use for the red section, in HTML color notation. |
62
|
|
|
* |
63
|
|
|
* @var string |
64
|
|
|
*/ |
65
|
|
|
protected $redColor; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* The lowest value for a range marked by a red color. |
69
|
|
|
* |
70
|
|
|
* @var int |
71
|
|
|
*/ |
72
|
|
|
protected $redFrom; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* The highest value for a range marked by a red color. |
76
|
|
|
* |
77
|
|
|
* @var int |
78
|
|
|
*/ |
79
|
|
|
protected $redTo; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* The color to use for the yellow section, in HTML color notation. |
83
|
|
|
* |
84
|
|
|
* @var string |
85
|
|
|
*/ |
86
|
|
|
protected $yellowColor; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* The lowest value for a range marked by a yellow color. |
90
|
|
|
* |
91
|
|
|
* @var int |
92
|
|
|
*/ |
93
|
|
|
protected $yellowFrom; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* The highest value for a range marked by a yellow color. |
97
|
|
|
* |
98
|
|
|
* @var int |
99
|
|
|
*/ |
100
|
|
|
protected $yellowTo; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* GaugeChartOptions constructor. |
104
|
|
|
*/ |
105
|
|
|
public function __construct() |
106
|
|
|
{ |
107
|
|
|
parent::__construct(); |
108
|
|
|
|
109
|
|
|
$this->animation = new Animation(); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return Animation |
114
|
|
|
*/ |
115
|
|
|
public function getAnimation() |
116
|
|
|
{ |
117
|
|
|
return $this->animation; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param string $greenColor |
122
|
|
|
* |
123
|
|
|
* @return $this |
124
|
|
|
*/ |
125
|
|
|
public function setGreenColor($greenColor) |
126
|
|
|
{ |
127
|
|
|
$this->greenColor = $greenColor; |
128
|
|
|
|
129
|
|
|
return $this; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @param int $greenFrom |
134
|
|
|
* |
135
|
|
|
* @return $this |
136
|
|
|
*/ |
137
|
|
|
public function setGreenFrom($greenFrom) |
138
|
|
|
{ |
139
|
|
|
$this->greenFrom = $greenFrom; |
140
|
|
|
|
141
|
|
|
return $this; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @param int $greenTo |
146
|
|
|
* |
147
|
|
|
* @return $this |
148
|
|
|
*/ |
149
|
|
|
public function setGreenTo($greenTo) |
150
|
|
|
{ |
151
|
|
|
$this->greenTo = $greenTo; |
152
|
|
|
|
153
|
|
|
return $this; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @param array $majorTicks |
158
|
|
|
* |
159
|
|
|
* @return $this |
160
|
|
|
*/ |
161
|
|
|
public function setMajorTicks($majorTicks) |
162
|
|
|
{ |
163
|
|
|
$this->majorTicks = $majorTicks; |
164
|
|
|
|
165
|
|
|
return $this; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @param int $minorTicks |
170
|
|
|
* |
171
|
|
|
* @return $this |
172
|
|
|
*/ |
173
|
|
|
public function setMinorTicks($minorTicks) |
174
|
|
|
{ |
175
|
|
|
$this->minorTicks = $minorTicks; |
176
|
|
|
|
177
|
|
|
return $this; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @param string $redColor |
182
|
|
|
* |
183
|
|
|
* @return $this |
184
|
|
|
*/ |
185
|
|
|
public function setRedColor($redColor) |
186
|
|
|
{ |
187
|
|
|
$this->redColor = $redColor; |
188
|
|
|
|
189
|
|
|
return $this; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @param int $redFrom |
194
|
|
|
* |
195
|
|
|
* @return $this |
196
|
|
|
*/ |
197
|
|
|
public function setRedFrom($redFrom) |
198
|
|
|
{ |
199
|
|
|
$this->redFrom = $redFrom; |
200
|
|
|
|
201
|
|
|
return $this; |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* @param int $redTo |
206
|
|
|
* |
207
|
|
|
* @return $this |
208
|
|
|
*/ |
209
|
|
|
public function setRedTo($redTo) |
210
|
|
|
{ |
211
|
|
|
$this->redTo = $redTo; |
212
|
|
|
|
213
|
|
|
return $this; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* @param string $yellowColor |
218
|
|
|
* |
219
|
|
|
* @return $this |
220
|
|
|
*/ |
221
|
|
|
public function setYellowColor($yellowColor) |
222
|
|
|
{ |
223
|
|
|
$this->yellowColor = $yellowColor; |
224
|
|
|
|
225
|
|
|
return $this; |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @param int $yellowFrom |
230
|
|
|
* |
231
|
|
|
* @return $this |
232
|
|
|
*/ |
233
|
|
|
public function setYellowFrom($yellowFrom) |
234
|
|
|
{ |
235
|
|
|
$this->yellowFrom = $yellowFrom; |
236
|
|
|
|
237
|
|
|
return $this; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* @param int $yellowTo |
242
|
|
|
* |
243
|
|
|
* @return $this |
244
|
|
|
*/ |
245
|
|
|
public function setYellowTo($yellowTo) |
246
|
|
|
{ |
247
|
|
|
$this->yellowTo = $yellowTo; |
248
|
|
|
|
249
|
|
|
return $this; |
250
|
|
|
} |
251
|
|
|
} |
252
|
|
|
|