|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options\AnnotationChart; |
|
4
|
|
|
|
|
5
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\AllowHtmlTrait; |
|
6
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\ChartOptionsInterface; |
|
7
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\ColorsTrait; |
|
8
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\MaxTrait; |
|
9
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\MinTrait; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* @author Christophe Meneses |
|
13
|
|
|
*/ |
|
14
|
|
|
class AnnotationChartOptions implements ChartOptionsInterface |
|
15
|
|
|
{ |
|
16
|
|
|
use AllowHtmlTrait; |
|
17
|
|
|
|
|
18
|
|
|
use ColorsTrait; |
|
19
|
|
|
|
|
20
|
|
|
use MaxTrait; |
|
21
|
|
|
|
|
22
|
|
|
use MinTrait; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* A suffix to be added to all values in the legend and tick labels in the vertical axes. |
|
26
|
|
|
* |
|
27
|
|
|
* @var string |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $allValuesSuffix; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* The width (in percent) of the annotations area, out of the entire chart area. Must be a number in the range 5-80. |
|
33
|
|
|
* |
|
34
|
|
|
* @var int |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $annotationsWidth; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* The format used to display the date information in the top right corner. The format of this field is as |
|
40
|
|
|
* specified by the java SimpleDateFormat class. |
|
41
|
|
|
* |
|
42
|
|
|
* @var string |
|
43
|
|
|
*/ |
|
44
|
|
|
protected $dateFormat; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* If set to false, the chart will hide the annotations table, and the annotations and annotationText will not be |
|
48
|
|
|
* visible (the annotations table will also not be displayed if there are no annotations in your data, regardless |
|
49
|
|
|
* of this option). When this option is set to true, after every numeric column, two optional annotation string |
|
50
|
|
|
* columns can be added, one for the annotation title and one for the annotation text. |
|
51
|
|
|
* |
|
52
|
|
|
* @var bool |
|
53
|
|
|
*/ |
|
54
|
|
|
protected $displayAnnotations; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* If set to true, the chart will display a filter control to filter annotations. Use this option when there are |
|
58
|
|
|
* many annotations. |
|
59
|
|
|
* |
|
60
|
|
|
* @var bool |
|
61
|
|
|
*/ |
|
62
|
|
|
protected $displayAnnotationsFilter; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Whether to display a small bar separator ( | ) between the series values and the date in the legend, where |
|
66
|
|
|
* true means yes. |
|
67
|
|
|
* |
|
68
|
|
|
* @var bool |
|
69
|
|
|
*/ |
|
70
|
|
|
protected $displayDateBarSeparator; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Whether to display a shortened, rounded version of the values on the top of the graph, to save space; false |
|
74
|
|
|
* indicates that it may. For example, if set to false, 56123.45 might be displayed as 56.12k. |
|
75
|
|
|
* |
|
76
|
|
|
* @var bool |
|
77
|
|
|
*/ |
|
78
|
|
|
protected $displayExactValues; |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Whether to display dots next to the values in the legend text, where true means yes. |
|
82
|
|
|
* |
|
83
|
|
|
* @var bool |
|
84
|
|
|
*/ |
|
85
|
|
|
protected $displayLegendDots; |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Whether to display the highlighted values in the legend, where true means yes. |
|
89
|
|
|
* |
|
90
|
|
|
* @var bool |
|
91
|
|
|
*/ |
|
92
|
|
|
protected $displayLegendValues; |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Whether to show the zoom range selection area (the area at the bottom of the chart), where false means no. |
|
96
|
|
|
* |
|
97
|
|
|
* The outline in the zoom selector is a log scale version of the first series in the chart, scaled to fit the |
|
98
|
|
|
* height of the zoom selector. |
|
99
|
|
|
* |
|
100
|
|
|
* @var bool |
|
101
|
|
|
*/ |
|
102
|
|
|
protected $displayRangeSelector; |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* Whether to show the zoom buttons ("1d 5d 1m" and so on), where false means no. |
|
106
|
|
|
* |
|
107
|
|
|
* @var bool |
|
108
|
|
|
*/ |
|
109
|
|
|
protected $displayZoomButtons; |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* A number from 0—100 (inclusive) specifying the alpha of the fill below each line in the line graph. 100 means |
|
113
|
|
|
* 100% opaque, and 0 means no fill at all. The fill color is the same color as the line above it. |
|
114
|
|
|
* |
|
115
|
|
|
* @var int |
|
116
|
|
|
*/ |
|
117
|
|
|
protected $fill; |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* Whether to put the colored legend on the same row with the zoom buttons and the date ('sameRow'), or on a new |
|
121
|
|
|
* row ('newRow'). |
|
122
|
|
|
* |
|
123
|
|
|
* @var string |
|
124
|
|
|
*/ |
|
125
|
|
|
protected $legendPosition; |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* Specifies the number format patterns to be used to format the values at the top of the graph. |
|
129
|
|
|
* |
|
130
|
|
|
* The patterns should be in the format as specified by the java DecimalFormat class. |
|
131
|
|
|
* - If not specified, the default format pattern is used. |
|
132
|
|
|
* - If a single string pattern is specified, it is used for all of the values. |
|
133
|
|
|
* - If a map is specified, the keys are (zero-based) indexes of series, and the values are the patterns to be |
|
134
|
|
|
* used to format the specified series. |
|
135
|
|
|
* |
|
136
|
|
|
* You are not required to include a format for every series on the chart; any unspecified series will use the |
|
137
|
|
|
* default format. |
|
138
|
|
|
* |
|
139
|
|
|
* If this option is specified, the displayExactValues option is ignored. |
|
140
|
|
|
* |
|
141
|
|
|
* @var string |
|
142
|
|
|
*/ |
|
143
|
|
|
protected $numberFormats; |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* Specifies which values to show on the Y axis tick marks in the graph. The default is to have a single scale |
|
147
|
|
|
* on the right side, which applies to both series; but you can have different sides of the graph scaled to |
|
148
|
|
|
* different series values. |
|
149
|
|
|
* |
|
150
|
|
|
* This option takes an array of zero to three numbers specifying the (zero-based) index of the series to use as |
|
151
|
|
|
* the scale value. Where these values are shown depends on how many values you include in your array : |
|
152
|
|
|
* - If you specify an empty array, the chart will not show Y values next to the tick marks. |
|
153
|
|
|
* - If you specify one value, the scale of the indicated series will be displayed on the right side of the chart |
|
154
|
|
|
* only. |
|
155
|
|
|
* - If you specify two values, a the scale for the second series will be added to the right of the chart. |
|
156
|
|
|
* - If you specify three values, a scale for the third series will be added to the middle of the chart. |
|
157
|
|
|
* - Any values after the third in the array will be ignored. |
|
158
|
|
|
* |
|
159
|
|
|
* When displaying more than one scale, it is advisable to set the scaleType option to either 'allfixed' or |
|
160
|
|
|
* 'allmaximized'. |
|
161
|
|
|
* |
|
162
|
|
|
* @var int[] |
|
163
|
|
|
*/ |
|
164
|
|
|
protected $scaleColumns; |
|
165
|
|
|
|
|
166
|
|
|
/** |
|
167
|
|
|
* Number format to be used for the axis tick labels. The default of '#' displays as an integer. |
|
168
|
|
|
* |
|
169
|
|
|
* @var string |
|
170
|
|
|
*/ |
|
171
|
|
|
protected $scaleFormat; |
|
172
|
|
|
|
|
173
|
|
|
/** |
|
174
|
|
|
* Sets the maximum and minimum values shown on the Y axis. The following options are available : |
|
175
|
|
|
* - 'maximized' - The Y axis will span the minimum to the maximum values of the series. If you have more than one |
|
176
|
|
|
* series, use allmaximized. |
|
177
|
|
|
* - 'fixed' [default] - The Y axis varies, depending on the data values values: |
|
178
|
|
|
* - If all values are >=0, the Y axis will span from zero to the maximum data value. |
|
179
|
|
|
* - If all values are <=0, the Y axis will span from zero to the minimum data value. |
|
180
|
|
|
* - If values are both positive and negative, the Y axis will range from the series maximum to the series |
|
181
|
|
|
* minimum. For multiple series, use 'allfixed'. |
|
182
|
|
|
* - 'allmaximized' - Same as 'maximized,' but used when multiple scales are displayed. Both charts will be |
|
183
|
|
|
* maximized within the same scale, which means that one will be misrepresented against the Y axis, but hovering |
|
184
|
|
|
* over each series will display its true value. |
|
185
|
|
|
* - 'allfixed' - Same as 'fixed,' but used when multiple scales are displayed. This setting adjusts each scale |
|
186
|
|
|
* to the series to which it applies (use this in conjunction with scaleColumns). |
|
187
|
|
|
* |
|
188
|
|
|
* If you specify the min and/or max options, they will take precedence over the minimum and maximum values |
|
189
|
|
|
* determined by your scale type. |
|
190
|
|
|
* |
|
191
|
|
|
* @var string |
|
192
|
|
|
*/ |
|
193
|
|
|
protected $scaleType; |
|
194
|
|
|
|
|
195
|
|
|
/** |
|
196
|
|
|
* @var Table |
|
197
|
|
|
*/ |
|
198
|
|
|
protected $table; |
|
199
|
|
|
|
|
200
|
|
|
/** |
|
201
|
|
|
* A number from 0—10 (inclusive) specifying the thickness of the lines, where 0 is the thinnest. |
|
202
|
|
|
* |
|
203
|
|
|
* @var int |
|
204
|
|
|
*/ |
|
205
|
|
|
protected $thickness; |
|
206
|
|
|
|
|
207
|
|
|
/** |
|
208
|
|
|
* Sets the end date/time of the selected zoom range. |
|
209
|
|
|
* |
|
210
|
|
|
* @var \DateTime |
|
211
|
|
|
*/ |
|
212
|
|
|
protected $zoomEndTime; |
|
213
|
|
|
|
|
214
|
|
|
/** |
|
215
|
|
|
* Sets the start date/time of the selected zoom range. |
|
216
|
|
|
* |
|
217
|
|
|
* @var \DateTime |
|
218
|
|
|
*/ |
|
219
|
|
|
protected $zoomStartTime; |
|
220
|
|
|
|
|
221
|
2 |
|
public function __construct() |
|
222
|
|
|
{ |
|
223
|
2 |
|
$this->table = new Table(); |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
1 |
|
public function getTable(): Table |
|
227
|
|
|
{ |
|
228
|
1 |
|
return $this->table; |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
/** |
|
232
|
|
|
* @return $this |
|
233
|
|
|
*/ |
|
234
|
1 |
|
public function setAllValuesSuffix(string $allValuesSuffix) |
|
235
|
|
|
{ |
|
236
|
1 |
|
$this->allValuesSuffix = $allValuesSuffix; |
|
237
|
|
|
|
|
238
|
1 |
|
return $this; |
|
239
|
|
|
} |
|
240
|
|
|
|
|
241
|
|
|
/** |
|
242
|
|
|
* @return $this |
|
243
|
|
|
*/ |
|
244
|
1 |
|
public function setAnnotationsWidth(int $annotationsWidth) |
|
245
|
|
|
{ |
|
246
|
1 |
|
$this->annotationsWidth = $annotationsWidth; |
|
247
|
|
|
|
|
248
|
1 |
|
return $this; |
|
249
|
|
|
} |
|
250
|
|
|
|
|
251
|
|
|
/** |
|
252
|
|
|
* @return $this |
|
253
|
|
|
*/ |
|
254
|
1 |
|
public function setDateFormat(string $dateFormat) |
|
255
|
|
|
{ |
|
256
|
1 |
|
$this->dateFormat = $dateFormat; |
|
257
|
|
|
|
|
258
|
1 |
|
return $this; |
|
259
|
|
|
} |
|
260
|
|
|
|
|
261
|
|
|
/** |
|
262
|
|
|
* @return $this |
|
263
|
|
|
*/ |
|
264
|
1 |
|
public function setDisplayAnnotations(bool $displayAnnotations) |
|
265
|
|
|
{ |
|
266
|
1 |
|
$this->displayAnnotations = $displayAnnotations; |
|
267
|
|
|
|
|
268
|
1 |
|
return $this; |
|
269
|
|
|
} |
|
270
|
|
|
|
|
271
|
|
|
/** |
|
272
|
|
|
* @return $this |
|
273
|
|
|
*/ |
|
274
|
1 |
|
public function setDisplayAnnotationsFilter(bool $displayAnnotationsFilter) |
|
275
|
|
|
{ |
|
276
|
1 |
|
$this->displayAnnotationsFilter = $displayAnnotationsFilter; |
|
277
|
|
|
|
|
278
|
1 |
|
return $this; |
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
/** |
|
282
|
|
|
* @return $this |
|
283
|
|
|
*/ |
|
284
|
1 |
|
public function setDisplayDateBarSeparator(bool $displayDateBarSeparator) |
|
285
|
|
|
{ |
|
286
|
1 |
|
$this->displayDateBarSeparator = $displayDateBarSeparator; |
|
287
|
|
|
|
|
288
|
1 |
|
return $this; |
|
289
|
|
|
} |
|
290
|
|
|
|
|
291
|
|
|
/** |
|
292
|
|
|
* @return $this |
|
293
|
|
|
*/ |
|
294
|
1 |
|
public function setDisplayExactValues(bool $displayExactValues) |
|
295
|
|
|
{ |
|
296
|
1 |
|
$this->displayExactValues = $displayExactValues; |
|
297
|
|
|
|
|
298
|
1 |
|
return $this; |
|
299
|
|
|
} |
|
300
|
|
|
|
|
301
|
|
|
/** |
|
302
|
|
|
* @return $this |
|
303
|
|
|
*/ |
|
304
|
1 |
|
public function setDisplayLegendDots(bool $displayLegendDots) |
|
305
|
|
|
{ |
|
306
|
1 |
|
$this->displayLegendDots = $displayLegendDots; |
|
307
|
|
|
|
|
308
|
1 |
|
return $this; |
|
309
|
|
|
} |
|
310
|
|
|
|
|
311
|
|
|
/** |
|
312
|
|
|
* @return $this |
|
313
|
|
|
*/ |
|
314
|
1 |
|
public function setDisplayLegendValues(bool $displayLegendValues) |
|
315
|
|
|
{ |
|
316
|
1 |
|
$this->displayLegendValues = $displayLegendValues; |
|
317
|
|
|
|
|
318
|
1 |
|
return $this; |
|
319
|
|
|
} |
|
320
|
|
|
|
|
321
|
|
|
/** |
|
322
|
|
|
* @return $this |
|
323
|
|
|
*/ |
|
324
|
1 |
|
public function setDisplayRangeSelector(bool $displayRangeSelector) |
|
325
|
|
|
{ |
|
326
|
1 |
|
$this->displayRangeSelector = $displayRangeSelector; |
|
327
|
|
|
|
|
328
|
1 |
|
return $this; |
|
329
|
|
|
} |
|
330
|
|
|
|
|
331
|
|
|
/** |
|
332
|
|
|
* @return $this |
|
333
|
|
|
*/ |
|
334
|
1 |
|
public function setDisplayZoomButtons(bool $displayZoomButtons) |
|
335
|
|
|
{ |
|
336
|
1 |
|
$this->displayZoomButtons = $displayZoomButtons; |
|
337
|
|
|
|
|
338
|
1 |
|
return $this; |
|
339
|
|
|
} |
|
340
|
|
|
|
|
341
|
|
|
/** |
|
342
|
|
|
* @return $this |
|
343
|
|
|
*/ |
|
344
|
1 |
|
public function setFill(int $fill) |
|
345
|
|
|
{ |
|
346
|
1 |
|
$this->fill = $fill; |
|
347
|
|
|
|
|
348
|
1 |
|
return $this; |
|
349
|
|
|
} |
|
350
|
|
|
|
|
351
|
|
|
/** |
|
352
|
|
|
* @return $this |
|
353
|
|
|
*/ |
|
354
|
1 |
|
public function setLegendPosition(string $legendPosition) |
|
355
|
|
|
{ |
|
356
|
1 |
|
$this->legendPosition = $legendPosition; |
|
357
|
|
|
|
|
358
|
1 |
|
return $this; |
|
359
|
|
|
} |
|
360
|
|
|
|
|
361
|
|
|
/** |
|
362
|
|
|
* @return $this |
|
363
|
|
|
*/ |
|
364
|
1 |
|
public function setNumberFormats(string $numberFormats) |
|
365
|
|
|
{ |
|
366
|
1 |
|
$this->numberFormats = $numberFormats; |
|
367
|
|
|
|
|
368
|
1 |
|
return $this; |
|
369
|
|
|
} |
|
370
|
|
|
|
|
371
|
|
|
/** |
|
372
|
|
|
* @param int[] $scaleColumns |
|
373
|
|
|
* |
|
374
|
|
|
* @return $this |
|
375
|
|
|
*/ |
|
376
|
1 |
|
public function setScaleColumns(array $scaleColumns) |
|
377
|
|
|
{ |
|
378
|
1 |
|
$this->scaleColumns = $scaleColumns; |
|
379
|
|
|
|
|
380
|
1 |
|
return $this; |
|
381
|
|
|
} |
|
382
|
|
|
|
|
383
|
|
|
/** |
|
384
|
|
|
* @return $this |
|
385
|
|
|
*/ |
|
386
|
1 |
|
public function setScaleFormat(string $scaleFormat) |
|
387
|
|
|
{ |
|
388
|
1 |
|
$this->scaleFormat = $scaleFormat; |
|
389
|
|
|
|
|
390
|
1 |
|
return $this; |
|
391
|
|
|
} |
|
392
|
|
|
|
|
393
|
|
|
/** |
|
394
|
|
|
* @return $this |
|
395
|
|
|
*/ |
|
396
|
1 |
|
public function setScaleType(string $scaleType) |
|
397
|
|
|
{ |
|
398
|
1 |
|
$this->scaleType = $scaleType; |
|
399
|
|
|
|
|
400
|
1 |
|
return $this; |
|
401
|
|
|
} |
|
402
|
|
|
|
|
403
|
|
|
/** |
|
404
|
|
|
* @return $this |
|
405
|
|
|
*/ |
|
406
|
1 |
|
public function setZoomStartTime(\DateTime $zoomStartTime) |
|
407
|
|
|
{ |
|
408
|
1 |
|
$this->zoomStartTime = $zoomStartTime; |
|
409
|
|
|
|
|
410
|
1 |
|
return $this; |
|
411
|
|
|
} |
|
412
|
|
|
|
|
413
|
|
|
/** |
|
414
|
|
|
* @return $this |
|
415
|
|
|
*/ |
|
416
|
1 |
|
public function setThickness(int $thickness) |
|
417
|
|
|
{ |
|
418
|
1 |
|
$this->thickness = $thickness; |
|
419
|
|
|
|
|
420
|
1 |
|
return $this; |
|
421
|
|
|
} |
|
422
|
|
|
|
|
423
|
|
|
/** |
|
424
|
|
|
* @return $this |
|
425
|
|
|
*/ |
|
426
|
1 |
|
public function setZoomEndTime(\DateTime $zoomEndTime) |
|
427
|
|
|
{ |
|
428
|
1 |
|
$this->zoomEndTime = $zoomEndTime; |
|
429
|
|
|
|
|
430
|
1 |
|
return $this; |
|
431
|
|
|
} |
|
432
|
|
|
} |
|
433
|
|
|
|