1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Halfpastfour\PHPChartJS\Options\Scales; |
4
|
|
|
|
5
|
|
|
use Halfpastfour\PHPChartJS\ArraySerializableInterface; |
6
|
|
|
use Halfpastfour\PHPChartJS\Delegate\ArraySerializable; |
7
|
|
|
use JsonSerializable; |
8
|
|
|
use Laminas\Json\Expr; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class Ticks |
12
|
|
|
* |
13
|
|
|
* @package Halfpastfour\PHPChartJS\Options\Scales |
14
|
|
|
*/ |
15
|
|
|
class Ticks implements ArraySerializableInterface, JsonSerializable |
16
|
|
|
{ |
17
|
|
|
use ArraySerializable; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var float |
21
|
|
|
*/ |
22
|
|
|
private $suggestedMin; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var bool |
26
|
|
|
*/ |
27
|
|
|
private $beginAtZero; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var float |
31
|
|
|
*/ |
32
|
|
|
private $stepSize; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var bool |
36
|
|
|
*/ |
37
|
|
|
private $autoSkip; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var int |
41
|
|
|
*/ |
42
|
|
|
private $autoSkipPadding; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var Expr |
46
|
|
|
*/ |
47
|
|
|
private $callback; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var bool |
51
|
|
|
*/ |
52
|
|
|
private $display; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var string |
56
|
|
|
*/ |
57
|
|
|
private $fontColor; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var string |
61
|
|
|
*/ |
62
|
|
|
private $fontFamily; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var int |
66
|
|
|
*/ |
67
|
|
|
private $fontSize; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var string |
71
|
|
|
*/ |
72
|
|
|
private $fontStyle; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @var int |
76
|
|
|
*/ |
77
|
|
|
private $labelOffset; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @var int |
81
|
|
|
*/ |
82
|
|
|
private $maxRotation; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @var int |
86
|
|
|
*/ |
87
|
|
|
private $minRotation; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @var bool |
91
|
|
|
*/ |
92
|
|
|
private $mirror; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @var int |
96
|
|
|
*/ |
97
|
|
|
private $padding; |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @var bool |
101
|
|
|
*/ |
102
|
|
|
private $reverse; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @var int |
106
|
|
|
*/ |
107
|
|
|
private $max; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return float |
111
|
|
|
*/ |
112
|
|
|
public function getSuggestedMin() |
113
|
|
|
{ |
114
|
|
|
return $this->suggestedMin; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param float $suggestedMin |
119
|
|
|
* |
120
|
|
|
* @return $this |
121
|
|
|
*/ |
122
|
|
|
public function setSuggestedMin($suggestedMin) |
123
|
|
|
{ |
124
|
|
|
$this->suggestedMin = floatval($suggestedMin); |
125
|
|
|
|
126
|
|
|
return $this; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @return bool |
131
|
|
|
*/ |
132
|
|
|
public function isBeginAtZero() |
133
|
|
|
{ |
134
|
|
|
return $this->beginAtZero; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @param bool $beginAtZero |
139
|
|
|
* |
140
|
|
|
* @return $this |
141
|
|
|
*/ |
142
|
|
|
public function setBeginAtZero($beginAtZero) |
143
|
|
|
{ |
144
|
|
|
$this->beginAtZero = boolval($beginAtZero); |
145
|
|
|
|
146
|
|
|
return $this; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @return float |
151
|
|
|
*/ |
152
|
|
|
public function getStepSize() |
153
|
|
|
{ |
154
|
|
|
return $this->stepSize; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @param float $stepSize |
159
|
|
|
* |
160
|
|
|
* @return $this |
161
|
|
|
*/ |
162
|
|
|
public function setStepSize($stepSize) |
163
|
|
|
{ |
164
|
|
|
$this->stepSize = floatval($stepSize); |
165
|
|
|
|
166
|
|
|
return $this; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @return bool |
171
|
|
|
*/ |
172
|
|
|
public function isAutoSkip() |
173
|
|
|
{ |
174
|
|
|
return $this->autoSkip; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @param bool $autoSkip |
179
|
|
|
* |
180
|
|
|
* @return $this |
181
|
|
|
*/ |
182
|
|
|
public function setAutoSkip($autoSkip) |
183
|
|
|
{ |
184
|
|
|
$this->autoSkip = boolval($autoSkip); |
185
|
|
|
|
186
|
|
|
return $this; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @return int |
191
|
|
|
*/ |
192
|
|
|
public function getAutoSkipPadding() |
193
|
|
|
{ |
194
|
|
|
return $this->autoSkipPadding; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @param int $autoSkipPadding |
199
|
|
|
* |
200
|
|
|
* @return $this |
201
|
|
|
*/ |
202
|
|
|
public function setAutoSkipPadding($autoSkipPadding) |
203
|
|
|
{ |
204
|
|
|
$this->autoSkipPadding = intval($autoSkipPadding); |
205
|
|
|
|
206
|
|
|
return $this; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @return Expr |
211
|
|
|
*/ |
212
|
|
|
public function getCallback() |
213
|
|
|
{ |
214
|
|
|
return $this->callback; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* @param string $callback |
219
|
|
|
* |
220
|
|
|
* @return $this |
221
|
|
|
*/ |
222
|
|
|
public function setCallback($callback) |
223
|
|
|
{ |
224
|
|
|
$this->callback = new Expr(strval($callback)); |
225
|
|
|
|
226
|
|
|
return $this; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @return bool |
231
|
|
|
*/ |
232
|
|
|
public function isDisplay() |
233
|
|
|
{ |
234
|
|
|
return $this->display; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @param bool $display |
239
|
|
|
* |
240
|
|
|
* @return $this |
241
|
|
|
*/ |
242
|
|
|
public function setDisplay($display) |
243
|
|
|
{ |
244
|
|
|
$this->display = boolval($display); |
245
|
|
|
|
246
|
|
|
return $this; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* @return string |
251
|
|
|
*/ |
252
|
|
|
public function getFontColor() |
253
|
|
|
{ |
254
|
|
|
return $this->fontColor; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* @param string $fontColor |
259
|
|
|
* |
260
|
|
|
* @return $this |
261
|
|
|
*/ |
262
|
|
|
public function setFontColor($fontColor) |
263
|
|
|
{ |
264
|
|
|
$this->fontColor = strval($fontColor); |
265
|
|
|
|
266
|
|
|
return $this; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* @return string |
271
|
|
|
*/ |
272
|
|
|
public function getFontFamily() |
273
|
|
|
{ |
274
|
|
|
return $this->fontFamily; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* @param string $fontFamily |
279
|
|
|
* |
280
|
|
|
* @return $this |
281
|
|
|
*/ |
282
|
|
|
public function setFontFamily($fontFamily) |
283
|
|
|
{ |
284
|
|
|
$this->fontFamily = strval($fontFamily); |
285
|
|
|
|
286
|
|
|
return $this; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* @return int |
291
|
|
|
*/ |
292
|
|
|
public function getFontSize() |
293
|
|
|
{ |
294
|
|
|
return $this->fontSize; |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* @param int $fontSize |
299
|
|
|
* |
300
|
|
|
* @return $this |
301
|
|
|
*/ |
302
|
|
|
public function setFontSize($fontSize) |
303
|
|
|
{ |
304
|
|
|
$this->fontSize = intval($fontSize); |
305
|
|
|
|
306
|
|
|
return $this; |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
/** |
310
|
|
|
* @return string |
311
|
|
|
*/ |
312
|
|
|
public function getFontStyle() |
313
|
|
|
{ |
314
|
|
|
return $this->fontStyle; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @param string $fontStyle |
319
|
|
|
* |
320
|
|
|
* @return $this |
321
|
|
|
*/ |
322
|
|
|
public function setFontStyle($fontStyle) |
323
|
|
|
{ |
324
|
|
|
$this->fontStyle = strval($fontStyle); |
325
|
|
|
|
326
|
|
|
return $this; |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* @return int |
331
|
|
|
*/ |
332
|
|
|
public function getLabelOffset() |
333
|
|
|
{ |
334
|
|
|
return $this->labelOffset; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* @param int $labelOffset |
339
|
|
|
* |
340
|
|
|
* @return $this |
341
|
|
|
*/ |
342
|
|
|
public function setLabelOffset($labelOffset) |
343
|
|
|
{ |
344
|
|
|
$this->labelOffset = intval($labelOffset); |
345
|
|
|
|
346
|
|
|
return $this; |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
/** |
350
|
|
|
* @return int |
351
|
|
|
*/ |
352
|
|
|
public function getMaxRotation() |
353
|
|
|
{ |
354
|
|
|
return $this->maxRotation; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* @param int $maxRotation |
359
|
|
|
* |
360
|
|
|
* @return $this |
361
|
|
|
*/ |
362
|
|
|
public function setMaxRotation($maxRotation) |
363
|
|
|
{ |
364
|
|
|
$this->maxRotation = intval($maxRotation); |
365
|
|
|
|
366
|
|
|
return $this; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
/** |
370
|
|
|
* @return int |
371
|
|
|
*/ |
372
|
|
|
public function getMinRotation() |
373
|
|
|
{ |
374
|
|
|
return $this->minRotation; |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
/** |
378
|
|
|
* @param int $minRotation |
379
|
|
|
* |
380
|
|
|
* @return $this |
381
|
|
|
*/ |
382
|
|
|
public function setMinRotation($minRotation) |
383
|
|
|
{ |
384
|
|
|
$this->minRotation = intval($minRotation); |
385
|
|
|
|
386
|
|
|
return $this; |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
/** |
390
|
|
|
* @return bool |
391
|
|
|
*/ |
392
|
|
|
public function isMirror() |
393
|
|
|
{ |
394
|
|
|
return $this->mirror; |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
/** |
398
|
|
|
* @param bool $mirror |
399
|
|
|
* |
400
|
|
|
* @return $this |
401
|
|
|
*/ |
402
|
|
|
public function setMirror($mirror) |
403
|
|
|
{ |
404
|
|
|
$this->mirror = boolval($mirror); |
405
|
|
|
|
406
|
|
|
return $this; |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
/** |
410
|
|
|
* @return int |
411
|
|
|
*/ |
412
|
|
|
public function getPadding() |
413
|
|
|
{ |
414
|
|
|
return $this->padding; |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
/** |
418
|
|
|
* @param int $padding |
419
|
|
|
* |
420
|
|
|
* @return $this |
421
|
|
|
*/ |
422
|
|
|
public function setPadding($padding) |
423
|
|
|
{ |
424
|
|
|
$this->padding = intval($padding); |
425
|
|
|
|
426
|
|
|
return $this; |
427
|
|
|
} |
428
|
|
|
|
429
|
|
|
/** |
430
|
|
|
* @return bool |
431
|
|
|
*/ |
432
|
|
|
public function isReverse() |
433
|
|
|
{ |
434
|
|
|
return $this->reverse; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* @param bool $reverse |
439
|
|
|
* |
440
|
|
|
* @return $this |
441
|
|
|
*/ |
442
|
|
|
public function setReverse($reverse) |
443
|
|
|
{ |
444
|
|
|
$this->reverse = boolval($reverse); |
445
|
|
|
|
446
|
|
|
return $this; |
447
|
|
|
} |
448
|
|
|
|
449
|
|
|
/** |
450
|
|
|
* @return int |
451
|
|
|
*/ |
452
|
|
|
public function getMax() |
453
|
|
|
{ |
454
|
|
|
return $this->max; |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
/** |
458
|
|
|
* @param int $max |
459
|
|
|
* |
460
|
|
|
* @return $this |
461
|
|
|
*/ |
462
|
|
|
public function setMax($max) |
463
|
|
|
{ |
464
|
|
|
$this->max = intval($max); |
465
|
|
|
|
466
|
|
|
return $this; |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
/** |
470
|
|
|
* @return array |
471
|
|
|
*/ |
472
|
|
|
public function jsonSerialize() |
473
|
|
|
{ |
474
|
|
|
return $this->getArrayCopy(); |
475
|
|
|
} |
476
|
|
|
} |
477
|
|
|
|