|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the highcharts-bundle package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) 2017 WEBEWEB |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace WBW\Bundle\HighchartsBundle\API\Chart\YAxis; |
|
13
|
|
|
|
|
14
|
|
|
use JsonSerializable; |
|
15
|
|
|
use WBW\Library\Core\Utility\Argument\ArrayUtility; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Highcharts stack labels. |
|
19
|
|
|
* |
|
20
|
|
|
* @author webeweb <https://github.com/webeweb/> |
|
21
|
|
|
* @package WBW\Bundle\HighchartsBundle\API\Chart\YAxis |
|
22
|
|
|
* @version 5.0.14 |
|
23
|
|
|
* @final |
|
24
|
|
|
*/ |
|
25
|
|
|
final class HighchartsStackLabels implements JsonSerializable { |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Align. |
|
29
|
|
|
* |
|
30
|
|
|
* @var string |
|
31
|
|
|
* @since 2.1.5 |
|
32
|
|
|
*/ |
|
33
|
|
|
private $align; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Enabled. |
|
37
|
|
|
* |
|
38
|
|
|
* @var boolean |
|
39
|
|
|
* @since 2.1.5 |
|
40
|
|
|
*/ |
|
41
|
|
|
private $enabled = false; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Format. |
|
45
|
|
|
* |
|
46
|
|
|
* @var string |
|
47
|
|
|
* @since 3.0.2 |
|
48
|
|
|
*/ |
|
49
|
|
|
private $format = "{total}"; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Formatter. |
|
53
|
|
|
* |
|
54
|
|
|
* @var string |
|
55
|
|
|
* @since 2.1.5 |
|
56
|
|
|
*/ |
|
57
|
|
|
private $formatter; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Rotation. |
|
61
|
|
|
* |
|
62
|
|
|
* @var integer |
|
63
|
|
|
* @since 2.1.5 |
|
64
|
|
|
*/ |
|
65
|
|
|
private $rotation = 0; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Style. |
|
69
|
|
|
* |
|
70
|
|
|
* @var array |
|
71
|
|
|
* @since 2.1.5 |
|
72
|
|
|
*/ |
|
73
|
|
|
private $style = ["color" => "#000000", "fontSize" => "11px", "fontWeight" => "bold", "textShadow" => "1px 1px contrast, -1px -1px contrast, -1px 1px contrast, 1px -1px contrast"]; |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Text align. |
|
77
|
|
|
* |
|
78
|
|
|
* @var string |
|
79
|
|
|
* @since 2.1.5 |
|
80
|
|
|
*/ |
|
81
|
|
|
private $textAlign; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Use HTML. |
|
85
|
|
|
* |
|
86
|
|
|
* @var boolean |
|
87
|
|
|
* @since 3.0 |
|
88
|
|
|
*/ |
|
89
|
|
|
private $useHTML = false; |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* Vertical align. |
|
93
|
|
|
* |
|
94
|
|
|
* @var string |
|
95
|
|
|
* @since 2.1.5 |
|
96
|
|
|
*/ |
|
97
|
|
|
private $verticalAlign; |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* X. |
|
101
|
|
|
* |
|
102
|
|
|
* @var integer |
|
103
|
|
|
* @since 2.1.5 |
|
104
|
|
|
*/ |
|
105
|
|
|
private $x; |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* Y. |
|
109
|
|
|
* |
|
110
|
|
|
* @var integer |
|
111
|
|
|
* @since 2.1.5 |
|
112
|
|
|
*/ |
|
113
|
|
|
private $y; |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* Constructor. |
|
117
|
|
|
* |
|
118
|
|
|
* @param boolean $ignoreDefaultValues Ignore the default values. |
|
119
|
|
|
*/ |
|
120
|
|
|
public function __construct($ignoreDefaultValues = true) { |
|
121
|
|
|
if (true === $ignoreDefaultValues) { |
|
122
|
|
|
$this->clear(); |
|
123
|
|
|
} |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* Clear. |
|
128
|
|
|
* |
|
129
|
|
|
* @return void |
|
130
|
|
|
*/ |
|
131
|
|
|
public function clear() { |
|
132
|
|
|
|
|
133
|
|
|
// Clear the align. |
|
134
|
|
|
$this->align = null; |
|
135
|
|
|
|
|
136
|
|
|
// Clear the enabled. |
|
137
|
|
|
$this->enabled = null; |
|
138
|
|
|
|
|
139
|
|
|
// Clear the format. |
|
140
|
|
|
$this->format = null; |
|
141
|
|
|
|
|
142
|
|
|
// Clear the formatter. |
|
143
|
|
|
$this->formatter = null; |
|
144
|
|
|
|
|
145
|
|
|
// Clear the rotation. |
|
146
|
|
|
$this->rotation = null; |
|
147
|
|
|
|
|
148
|
|
|
// Clear the style. |
|
149
|
|
|
$this->style = null; |
|
|
|
|
|
|
150
|
|
|
|
|
151
|
|
|
// Clear the text align. |
|
152
|
|
|
$this->textAlign = null; |
|
153
|
|
|
|
|
154
|
|
|
// Clear the use HTML. |
|
155
|
|
|
$this->useHTML = null; |
|
156
|
|
|
|
|
157
|
|
|
// Clear the vertical align. |
|
158
|
|
|
$this->verticalAlign = null; |
|
159
|
|
|
|
|
160
|
|
|
// Clear the x. |
|
161
|
|
|
$this->x = null; |
|
162
|
|
|
|
|
163
|
|
|
// Clear the y. |
|
164
|
|
|
$this->y = null; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* Get the align. |
|
169
|
|
|
* |
|
170
|
|
|
* @return string Returns the align. |
|
171
|
|
|
*/ |
|
172
|
|
|
public function getAlign() { |
|
173
|
|
|
return $this->align; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* Get the enabled. |
|
178
|
|
|
* |
|
179
|
|
|
* @return boolean Returns the enabled. |
|
180
|
|
|
*/ |
|
181
|
|
|
public function getEnabled() { |
|
182
|
|
|
return $this->enabled; |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* Get the format. |
|
187
|
|
|
* |
|
188
|
|
|
* @return string Returns the format. |
|
189
|
|
|
*/ |
|
190
|
|
|
public function getFormat() { |
|
191
|
|
|
return $this->format; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* Get the formatter. |
|
196
|
|
|
* |
|
197
|
|
|
* @return string Returns the formatter. |
|
198
|
|
|
*/ |
|
199
|
|
|
public function getFormatter() { |
|
200
|
|
|
return $this->formatter; |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
/** |
|
204
|
|
|
* Get the rotation. |
|
205
|
|
|
* |
|
206
|
|
|
* @return integer Returns the rotation. |
|
207
|
|
|
*/ |
|
208
|
|
|
public function getRotation() { |
|
209
|
|
|
return $this->rotation; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
/** |
|
213
|
|
|
* Get the style. |
|
214
|
|
|
* |
|
215
|
|
|
* @return array Returns the style. |
|
216
|
|
|
*/ |
|
217
|
|
|
public function getStyle() { |
|
218
|
|
|
return $this->style; |
|
219
|
|
|
} |
|
220
|
|
|
|
|
221
|
|
|
/** |
|
222
|
|
|
* Get the text align. |
|
223
|
|
|
* |
|
224
|
|
|
* @return string Returns the text align. |
|
225
|
|
|
*/ |
|
226
|
|
|
public function getTextAlign() { |
|
227
|
|
|
return $this->textAlign; |
|
228
|
|
|
} |
|
229
|
|
|
|
|
230
|
|
|
/** |
|
231
|
|
|
* Get the use HTML. |
|
232
|
|
|
* |
|
233
|
|
|
* @return boolean Returns the use HTML. |
|
234
|
|
|
*/ |
|
235
|
|
|
public function getUseHTML() { |
|
236
|
|
|
return $this->useHTML; |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
/** |
|
240
|
|
|
* Get the vertical align. |
|
241
|
|
|
* |
|
242
|
|
|
* @return string Returns the vertical align. |
|
243
|
|
|
*/ |
|
244
|
|
|
public function getVerticalAlign() { |
|
245
|
|
|
return $this->verticalAlign; |
|
246
|
|
|
} |
|
247
|
|
|
|
|
248
|
|
|
/** |
|
249
|
|
|
* Get the x. |
|
250
|
|
|
* |
|
251
|
|
|
* @return integer Returns the x. |
|
252
|
|
|
*/ |
|
253
|
|
|
public function getX() { |
|
254
|
|
|
return $this->x; |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
/** |
|
258
|
|
|
* Get the y. |
|
259
|
|
|
* |
|
260
|
|
|
* @return integer Returns the y. |
|
261
|
|
|
*/ |
|
262
|
|
|
public function getY() { |
|
263
|
|
|
return $this->y; |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
/** |
|
267
|
|
|
* Serialize this instance. |
|
268
|
|
|
* |
|
269
|
|
|
* @return array Returns an array representing this instance. |
|
270
|
|
|
*/ |
|
271
|
|
|
public function jsonSerialize() { |
|
272
|
|
|
return $this->toArray(); |
|
273
|
|
|
} |
|
274
|
|
|
|
|
275
|
|
|
/** |
|
276
|
|
|
* Set the align. |
|
277
|
|
|
* |
|
278
|
|
|
* @param string $align The align. |
|
279
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\YAxis\HighchartsStackLabels Returns the highcharts stack labels. |
|
280
|
|
|
*/ |
|
281
|
|
|
public function setAlign($align) { |
|
282
|
|
|
switch ($align) { |
|
283
|
|
|
case "center": |
|
284
|
|
|
case "left": |
|
285
|
|
|
case "right": |
|
286
|
|
|
$this->align = $align; |
|
287
|
|
|
break; |
|
288
|
|
|
} |
|
289
|
|
|
return $this; |
|
290
|
|
|
} |
|
291
|
|
|
|
|
292
|
|
|
/** |
|
293
|
|
|
* Set the enabled. |
|
294
|
|
|
* |
|
295
|
|
|
* @param boolean $enabled The enabled. |
|
296
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\YAxis\HighchartsStackLabels Returns the highcharts stack labels. |
|
297
|
|
|
*/ |
|
298
|
|
|
public function setEnabled($enabled) { |
|
299
|
|
|
$this->enabled = $enabled; |
|
300
|
|
|
return $this; |
|
301
|
|
|
} |
|
302
|
|
|
|
|
303
|
|
|
/** |
|
304
|
|
|
* Set the format. |
|
305
|
|
|
* |
|
306
|
|
|
* @param string $format The format. |
|
307
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\YAxis\HighchartsStackLabels Returns the highcharts stack labels. |
|
308
|
|
|
*/ |
|
309
|
|
|
public function setFormat($format) { |
|
310
|
|
|
$this->format = $format; |
|
311
|
|
|
return $this; |
|
312
|
|
|
} |
|
313
|
|
|
|
|
314
|
|
|
/** |
|
315
|
|
|
* Set the formatter. |
|
316
|
|
|
* |
|
317
|
|
|
* @param string $formatter The formatter. |
|
318
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\YAxis\HighchartsStackLabels Returns the highcharts stack labels. |
|
319
|
|
|
*/ |
|
320
|
|
|
public function setFormatter($formatter) { |
|
321
|
|
|
$this->formatter = $formatter; |
|
322
|
|
|
return $this; |
|
323
|
|
|
} |
|
324
|
|
|
|
|
325
|
|
|
/** |
|
326
|
|
|
* Set the rotation. |
|
327
|
|
|
* |
|
328
|
|
|
* @param integer $rotation The rotation. |
|
329
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\YAxis\HighchartsStackLabels Returns the highcharts stack labels. |
|
330
|
|
|
*/ |
|
331
|
|
|
public function setRotation($rotation) { |
|
332
|
|
|
$this->rotation = $rotation; |
|
333
|
|
|
return $this; |
|
334
|
|
|
} |
|
335
|
|
|
|
|
336
|
|
|
/** |
|
337
|
|
|
* Set the style. |
|
338
|
|
|
* |
|
339
|
|
|
* @param array $style The style. |
|
340
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\YAxis\HighchartsStackLabels Returns the highcharts stack labels. |
|
341
|
|
|
*/ |
|
342
|
|
|
public function setStyle(array $style = null) { |
|
343
|
|
|
$this->style = $style; |
|
|
|
|
|
|
344
|
|
|
return $this; |
|
345
|
|
|
} |
|
346
|
|
|
|
|
347
|
|
|
/** |
|
348
|
|
|
* Set the text align. |
|
349
|
|
|
* |
|
350
|
|
|
* @param string $textAlign The text align. |
|
351
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\YAxis\HighchartsStackLabels Returns the highcharts stack labels. |
|
352
|
|
|
*/ |
|
353
|
|
|
public function setTextAlign($textAlign) { |
|
354
|
|
|
switch ($textAlign) { |
|
355
|
|
|
case "center": |
|
356
|
|
|
case "left": |
|
357
|
|
|
case "right": |
|
358
|
|
|
$this->textAlign = $textAlign; |
|
359
|
|
|
break; |
|
360
|
|
|
} |
|
361
|
|
|
return $this; |
|
362
|
|
|
} |
|
363
|
|
|
|
|
364
|
|
|
/** |
|
365
|
|
|
* Set the use HTML. |
|
366
|
|
|
* |
|
367
|
|
|
* @param boolean $useHTML The use HTML. |
|
368
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\YAxis\HighchartsStackLabels Returns the highcharts stack labels. |
|
369
|
|
|
*/ |
|
370
|
|
|
public function setUseHTML($useHTML) { |
|
371
|
|
|
$this->useHTML = $useHTML; |
|
372
|
|
|
return $this; |
|
373
|
|
|
} |
|
374
|
|
|
|
|
375
|
|
|
/** |
|
376
|
|
|
* Set the vertical align. |
|
377
|
|
|
* |
|
378
|
|
|
* @param string $verticalAlign The vertical align. |
|
379
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\YAxis\HighchartsStackLabels Returns the highcharts stack labels. |
|
380
|
|
|
*/ |
|
381
|
|
|
public function setVerticalAlign($verticalAlign) { |
|
382
|
|
|
switch ($verticalAlign) { |
|
383
|
|
|
case "bottom": |
|
384
|
|
|
case "middle": |
|
385
|
|
|
case "top": |
|
386
|
|
|
$this->verticalAlign = $verticalAlign; |
|
387
|
|
|
break; |
|
388
|
|
|
} |
|
389
|
|
|
return $this; |
|
390
|
|
|
} |
|
391
|
|
|
|
|
392
|
|
|
/** |
|
393
|
|
|
* Set the x. |
|
394
|
|
|
* |
|
395
|
|
|
* @param integer $x The x. |
|
396
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\YAxis\HighchartsStackLabels Returns the highcharts stack labels. |
|
397
|
|
|
*/ |
|
398
|
|
|
public function setX($x) { |
|
399
|
|
|
$this->x = $x; |
|
400
|
|
|
return $this; |
|
401
|
|
|
} |
|
402
|
|
|
|
|
403
|
|
|
/** |
|
404
|
|
|
* Set the y. |
|
405
|
|
|
* |
|
406
|
|
|
* @param integer $y The y. |
|
407
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\YAxis\HighchartsStackLabels Returns the highcharts stack labels. |
|
408
|
|
|
*/ |
|
409
|
|
|
public function setY($y) { |
|
410
|
|
|
$this->y = $y; |
|
411
|
|
|
return $this; |
|
412
|
|
|
} |
|
413
|
|
|
|
|
414
|
|
|
/** |
|
415
|
|
|
* Convert into an array representing this instance. |
|
416
|
|
|
* |
|
417
|
|
|
* @return array Returns an array representing this instance. |
|
418
|
|
|
*/ |
|
419
|
|
|
public function toArray() { |
|
420
|
|
|
|
|
421
|
|
|
// Initialize the output. |
|
422
|
|
|
$output = []; |
|
423
|
|
|
|
|
424
|
|
|
// Set the align. |
|
425
|
|
|
ArrayUtility::set($output, "align", $this->align, [null]); |
|
426
|
|
|
|
|
427
|
|
|
// Set the enabled. |
|
428
|
|
|
ArrayUtility::set($output, "enabled", $this->enabled, [null]); |
|
429
|
|
|
|
|
430
|
|
|
// Set the format. |
|
431
|
|
|
ArrayUtility::set($output, "format", $this->format, [null]); |
|
432
|
|
|
|
|
433
|
|
|
// Set the formatter. |
|
434
|
|
|
ArrayUtility::set($output, "formatter", $this->formatter, [null]); |
|
435
|
|
|
|
|
436
|
|
|
// Set the rotation. |
|
437
|
|
|
ArrayUtility::set($output, "rotation", $this->rotation, [null]); |
|
438
|
|
|
|
|
439
|
|
|
// Set the style. |
|
440
|
|
|
ArrayUtility::set($output, "style", $this->style, [null]); |
|
441
|
|
|
|
|
442
|
|
|
// Set the text align. |
|
443
|
|
|
ArrayUtility::set($output, "textAlign", $this->textAlign, [null]); |
|
444
|
|
|
|
|
445
|
|
|
// Set the use HTML. |
|
446
|
|
|
ArrayUtility::set($output, "useHTML", $this->useHTML, [null]); |
|
447
|
|
|
|
|
448
|
|
|
// Set the vertical align. |
|
449
|
|
|
ArrayUtility::set($output, "verticalAlign", $this->verticalAlign, [null]); |
|
450
|
|
|
|
|
451
|
|
|
// Set the x. |
|
452
|
|
|
ArrayUtility::set($output, "x", $this->x, [null]); |
|
453
|
|
|
|
|
454
|
|
|
// Set the y. |
|
455
|
|
|
ArrayUtility::set($output, "y", $this->y, [null]); |
|
456
|
|
|
|
|
457
|
|
|
// Return the output. |
|
458
|
|
|
return $output; |
|
459
|
|
|
} |
|
460
|
|
|
|
|
461
|
|
|
} |
|
462
|
|
|
|
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..