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