Test Failed
Push — master ( e6b57e...dd7c2d )
by Christophe
07:44
created

Options/AnnotationChart/AnnotationChartOptions.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options\AnnotationChart;
4
5
use CMEN\GoogleChartsBundle\GoogleCharts\Options\ChartOptionsDraw;
6
use DateTime;
7
8
/**
9
 * @author Christophe Meneses
10
 */
11
class AnnotationChartOptions extends ChartOptionsDraw
12
{
13
    /**
14
     * If set to true, any annotation text that includes HTML tags will be rendered as HTML.
15
     *
16
     * @var boolean
17
     */
18
    protected $allowHtml;
19
20
    /**
21
     * A suffix to be added to all values in the legend and tick labels in the vertical axes.
22
     *
23
     * @var string
24
     */
25
    protected $allValuesSuffix;
26
27
    /**
28
     * The width (in percent) of the annotations area, out of the entire chart area. Must be a number in the range 5-80.
29
     *
30
     * @var int
31
     */
32
    protected $annotationsWidth;
33
34
    /**
35
     * The colors to use for the chart lines and labels. An array of strings. Each element is a string in a valid HTML
36
     * color format. For example 'red' or '#00cc00'.
37
     *
38
     * @var string[]
39
     */
40
    protected $colors;
41
42
    /**
43
     * The format used to display the date information in the top right corner. The format of this field is as
44
     * specified by the java SimpleDateFormat class.
45
     *
46
     * @var string
47
     */
48
    protected $dateFormat;
49
50
    /**
51
     * If set to false, the chart will hide the annotations table, and the annotations and annotationText will not be
52
     * visible (the annotations table will also not be displayed if there are no annotations in your data, regardless
53
     * of this option). When this option is set to true, after every numeric column, two optional annotation string
54
     * columns can be added, one for the annotation title and one for the annotation text.
55
     *
56
     * @var boolean
57
     */
58
    protected $displayAnnotations;
59
60
    /**
61
     * If set to true, the chart will display a filter control to filter annotations. Use this option when there are
62
     * many annotations.
63
     *
64
     * @var boolean
65
     */
66
    protected $displayAnnotationsFilter;
67
68
    /**
69
     * Whether to display a small bar separator ( | ) between the series values and the date in the legend, where
70
     * true means yes.
71
     *
72
     * @var boolean
73
     */
74
    protected $displayDateBarSeparator;
75
76
    /**
77
     * Whether to display a shortened, rounded version of the values on the top of the graph, to save space; false
78
     * indicates that it may. For example, if set to false, 56123.45 might be displayed as 56.12k.
79
     *
80
     * @var boolean
81
     */
82
    protected $displayExactValues;
83
84
    /**
85
     * Whether to display dots next to the values in the legend text, where true means yes.
86
     *
87
     * @var boolean
88
     */
89
    protected $displayLegendDots;
90
91
    /**
92
     * Whether to display the highlighted values in the legend, where true means yes.
93
     *
94
     * @var boolean
95
     */
96
    protected $displayLegendValues;
97
98
    /**
99
     *  Whether to show the zoom range selection area (the area at the bottom of the chart), where false means no.
100
     *
101
     * The outline in the zoom selector is a log scale version of the first series in the chart, scaled to fit the
102
     * height of the zoom selector.
103
     *
104
     * @var boolean
105
     */
106
    protected $displayRangeSelector;
107
108
    /**
109
     * Whether to show the zoom buttons ("1d 5d 1m" and so on), where false means no.
110
     *
111
     * @var boolean
112
     */
113
    protected $displayZoomButtons;
114
115
    /**
116
     * A number from 0—100 (inclusive) specifying the alpha of the fill below each line in the line graph. 100 means
117
     * 100% opaque, and 0 means no fill at all. The fill color is the same color as the line above it.
118
     *
119
     * @var int
120
     */
121
    protected $fill;
122
123
    /**
124
     * Whether to put the colored legend on the same row with the zoom buttons and the date ('sameRow'), or on a new
125
     * row ('newRow').
126
     *
127
     * @var string
128
     */
129
    protected $legendPosition;
130
131
    /**
132
     * The maximum value to show on the Y axis. If the maximum data point exceeds this value, this setting will be
133
     * ignored, and the chart will be adjusted to show the next major tick mark above the maximum data point. This
134
     * will take precedence over the Y axis maximum determined by scaleType.
135
     *
136
     * This is similar to maxValue in core charts.
137
     *
138
     * @var int
139
     */
140
    protected $max;
141
142
    /**
143
     * The minimum value to show on the Y axis. If the minimum data point is less than this value, this setting will
144
     * be ignored, and the chart will be adjusted to show the next major tick mark below the minimum data point. This
145
     * will take precedence over the Y axis minimum determined by scaleType.
146
     *
147
     * This is similar to minValue in core charts.
148
     *
149
     * @var int
150
     */
151
    protected $min;
152
153
    /**
154
     * Specifies the number format patterns to be used to format the values at the top of the graph.
155
     *
156
     * The patterns should be in the format as specified by the java DecimalFormat class.
157
     *  - If not specified, the default format pattern is used.
158
     *  - If a single string pattern is specified, it is used for all of the values.
159
     *  - If a map is specified, the keys are (zero-based) indexes of series, and the values are the patterns to be
160
     *      used to format the specified series.
161
     *
162
     * You are not required to include a format for every series on the chart; any unspecified series will use the
163
     * default format.
164
     *
165
     * If this option is specified, the displayExactValues option is ignored.
166
     *
167
     * @var string
168
     */
169
    protected $numberFormats;
170
171
    /**
172
     * Specifies which values to show on the Y axis tick marks in the graph. The default is to have a single scale
173
     * on the right side, which applies to both series; but you can have different sides of the graph scaled to
174
     * different series values.
175
     *
176
     * This option takes an array of zero to three numbers specifying the (zero-based) index of the series to use as
177
     * the scale value. Where these values are shown depends on how many values you include in your array :
178
     * - If you specify an empty array, the chart will not show Y values next to the tick marks.
179
     * - If you specify one value, the scale of the indicated series will be displayed on the right side of the chart
180
     *   only.
181
     * - If you specify two values, a the scale for the second series will be added to the right of the chart.
182
     * - If you specify three values, a scale for the third series will be added to the middle of the chart.
183
     * - Any values after the third in the array will be ignored.
184
     *
185
     * When displaying more than one scale, it is advisable to set the scaleType option to either 'allfixed' or
186
     * 'allmaximized'.
187
     *
188
     * @var int[]
189
     */
190
    protected $scaleColumns;
191
192
    /**
193
     * Number format to be used for the axis tick labels. The default of '#' displays as an integer.
194
     *
195
     * @var string
196
     */
197
    protected $scaleFormat;
198
199
    /**
200
     * Sets the maximum and minimum values shown on the Y axis. The following options are available :
201
     * - 'maximized' - The Y axis will span the minimum to the maximum values of the series. If you have more than one
202
     *   series, use allmaximized.
203
     * - 'fixed' [default] - The Y axis varies, depending on the data values values:
204
     *     - If all values are >=0, the Y axis will span from zero to the maximum data value.
205
     *     - If all values are <=0, the Y axis will span from zero to the minimum data value.
206
     *     - If values are both positive and negative, the Y axis will range from the series maximum to the series
207
     *       minimum. For multiple series, use 'allfixed'.
208
     * - 'allmaximized' - Same as 'maximized,' but used when multiple scales are displayed. Both charts will be
209
     *   maximized within the same scale, which means that one will be misrepresented against the Y axis, but hovering
210
     *   over each series will display its true value.
211
     * - 'allfixed' - Same as 'fixed,' but used when multiple scales are displayed. This setting adjusts each scale
212
     *   to the series to which it applies (use this in conjunction with scaleColumns).
213
214
     * If you specify the min and/or max options, they will take precedence over the minimum and maximum values
215
     * determined by your scale type.
216
     *
217
     * @var string
218
     */
219
    protected $scaleType;
220
221
    /**
222
     * @var Table
223
     */
224
    protected $table;
225
226
    /**
227
     * A number from 0—10 (inclusive) specifying the thickness of the lines, where 0 is the thinnest.
228
     *
229
     * @var int
230
     */
231
    protected $thickness;
232
233
    /**
234
     * Sets the end date/time of the selected zoom range.
235
     *
236
     * @var DateTime
237
     */
238
    protected $zoomEndTime;
239
240
    /**
241
     * Sets the start date/time of the selected zoom range.
242
     *
243
     * @var DateTime
244
     */
245
    protected $zoomStartTime;
246
247
248
    /**
249
     * AnnotationChartOptions constructor.
250
     */
251
    public function __construct()
252
    {
253
        parent::__construct();
254
255
        $this->table = new Table();
256
    }
257
258
259
    /**
260
     * @return Table
261
     */
262
    public function getTable()
263
    {
264
        return $this->table;
265
    }
266
267
    /**
268
     * @param boolean $allowHtml
269
     *
270
     * @return $this
271
     */
272
    public function setAllowHtml($allowHtml)
273
    {
274
        $this->allowHtml = $allowHtml;
275
276
        return $this;
277
    }
278
279
    /**
280
     * @param string $allValuesSuffix
281
     *
282
     * @return $this
283
     */
284
    public function setAllValuesSuffix($allValuesSuffix)
285
    {
286
        $this->allValuesSuffix = $allValuesSuffix;
287
288
        return $this;
289
    }
290
291
    /**
292
     * @param int $annotationsWidth
293
     *
294
     * @return $this
295
     */
296
    public function setAnnotationsWidth($annotationsWidth)
297
    {
298
        $this->annotationsWidth = $annotationsWidth;
299
300
        return $this;
301
    }
302
303
    /**
304
     * @param \string[] $colors
305
     *
306
     * @return $this
307
     */
308
    public function setColors($colors)
309
    {
310
        $this->colors = $colors;
0 ignored issues
show
Documentation Bug introduced by
It seems like $colors of type array<integer,object<string>> is incompatible with the declared type array<integer,string> of property $colors.

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..

Loading history...
311
312
        return $this;
313
    }
314
315
    /**
316
     * @param string $dateFormat
317
     *
318
     * @return $this
319
     */
320
    public function setDateFormat($dateFormat)
321
    {
322
        $this->dateFormat = $dateFormat;
323
324
        return $this;
325
    }
326
327
    /**
328
     * @param boolean $displayAnnotations
329
     *
330
     * @return $this
331
     */
332
    public function setDisplayAnnotations($displayAnnotations)
333
    {
334
        $this->displayAnnotations = $displayAnnotations;
335
336
        return $this;
337
    }
338
339
    /**
340
     * @param boolean $displayAnnotationsFilter
341
     *
342
     * @return $this
343
     */
344
    public function setDisplayAnnotationsFilter($displayAnnotationsFilter)
345
    {
346
        $this->displayAnnotationsFilter = $displayAnnotationsFilter;
347
348
        return $this;
349
    }
350
351
    /**
352
     * @param boolean $displayDateBarSeparator
353
     *
354
     * @return $this
355
     */
356
    public function setDisplayDateBarSeparator($displayDateBarSeparator)
357
    {
358
        $this->displayDateBarSeparator = $displayDateBarSeparator;
359
360
        return $this;
361
    }
362
363
    /**
364
     * @param boolean $displayExactValues
365
     *
366
     * @return $this
367
     */
368
    public function setDisplayExactValues($displayExactValues)
369
    {
370
        $this->displayExactValues = $displayExactValues;
371
372
        return $this;
373
    }
374
375
    /**
376
     * @param boolean $displayLegendDots
377
     *
378
     * @return $this
379
     */
380
    public function setDisplayLegendDots($displayLegendDots)
381
    {
382
        $this->displayLegendDots = $displayLegendDots;
383
384
        return $this;
385
    }
386
387
    /**
388
     * @param boolean $displayLegendValues
389
     *
390
     * @return $this
391
     */
392
    public function setDisplayLegendValues($displayLegendValues)
393
    {
394
        $this->displayLegendValues = $displayLegendValues;
395
396
        return $this;
397
    }
398
399
    /**
400
     * @param boolean $displayRangeSelector
401
     *
402
     * @return $this
403
     */
404
    public function setDisplayRangeSelector($displayRangeSelector)
405
    {
406
        $this->displayRangeSelector = $displayRangeSelector;
407
408
        return $this;
409
    }
410
411
    /**
412
     * @param boolean $displayZoomButtons
413
     *
414
     * @return $this
415
     */
416
    public function setDisplayZoomButtons($displayZoomButtons)
417
    {
418
        $this->displayZoomButtons = $displayZoomButtons;
419
420
        return $this;
421
    }
422
423
    /**
424
     * @param int $fill
425
     *
426
     * @return $this
427
     */
428
    public function setFill($fill)
429
    {
430
        $this->fill = $fill;
431
432
        return $this;
433
    }
434
435
    /**
436
     * @param string $legendPosition
437
     *
438
     * @return $this
439
     */
440
    public function setLegendPosition($legendPosition)
441
    {
442
        $this->legendPosition = $legendPosition;
443
444
        return $this;
445
    }
446
447
    /**
448
     * @param int $max
449
     *
450
     * @return $this
451
     */
452
    public function setMax($max)
453
    {
454
        $this->max = $max;
455
456
        return $this;
457
    }
458
459
    /**
460
     * @param int $min
461
     *
462
     * @return $this
463
     */
464
    public function setMin($min)
465
    {
466
        $this->min = $min;
467
468
        return $this;
469
    }
470
471
    /**
472
     * @param string $numberFormats
473
     *
474
     * @return $this
475
     */
476
    public function setNumberFormats($numberFormats)
477
    {
478
        $this->numberFormats = $numberFormats;
479
480
        return $this;
481
    }
482
483
    /**
484
     * @param \int[] $scaleColumns
485
     *
486
     * @return $this
487
     */
488
    public function setScaleColumns($scaleColumns)
489
    {
490
        $this->scaleColumns = $scaleColumns;
491
492
        return $this;
493
    }
494
495
    /**
496
     * @param string $scaleFormat
497
     *
498
     * @return $this
499
     */
500
    public function setScaleFormat($scaleFormat)
501
    {
502
        $this->scaleFormat = $scaleFormat;
503
504
        return $this;
505
    }
506
507
    /**
508
     * @param string $scaleType
509
     *
510
     * @return $this
511
     */
512
    public function setScaleType($scaleType)
513
    {
514
        $this->scaleType = $scaleType;
515
516
        return $this;
517
    }
518
519
    /**
520
     * @param DateTime $zoomStartTime
521
     *
522
     * @return $this
523
     */
524
    public function setZoomStartTime($zoomStartTime)
525
    {
526
        $this->zoomStartTime = $zoomStartTime;
527
528
        return $this;
529
    }
530
531
    /**
532
     * @param int $thickness
533
     *
534
     * @return $this
535
     */
536
    public function setThickness($thickness)
537
    {
538
        $this->thickness = $thickness;
539
540
        return $this;
541
    }
542
543
    /**
544
     * @param DateTime $zoomEndTime
545
     *
546
     * @return $this
547
     */
548
    public function setZoomEndTime($zoomEndTime)
549
    {
550
        $this->zoomEndTime = $zoomEndTime;
551
552
        return $this;
553
    }
554
}
555