1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Halfpastfour\PHPChartJS\Options\Legend; |
4
|
|
|
|
5
|
|
|
use Halfpastfour\PHPChartJS\ArraySerializableInterface; |
6
|
|
|
use Halfpastfour\PHPChartJS\Delegate\ArraySerializable; |
7
|
|
|
use JsonSerializable; |
8
|
|
|
use Laminas\Json\Expr; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class PieLegend |
12
|
|
|
* |
13
|
|
|
* @package Halfpastfour\PHPChartJS\Options\Legend |
14
|
|
|
*/ |
15
|
|
|
class Labels implements ArraySerializableInterface, JsonSerializable |
16
|
|
|
{ |
17
|
|
|
use ArraySerializable; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var int |
21
|
|
|
*/ |
22
|
|
|
private $boxWidth; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var int |
26
|
|
|
*/ |
27
|
|
|
private $fontSize; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
private $fontStyle; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
private $fontColor; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
private $fontFamily; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var int |
46
|
|
|
*/ |
47
|
|
|
private $padding; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var Expr |
51
|
|
|
*/ |
52
|
|
|
private $generateLabels; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var bool |
56
|
|
|
*/ |
57
|
|
|
private $usePointStyle; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return int |
61
|
|
|
*/ |
62
|
|
|
public function getBoxWidth() |
63
|
|
|
{ |
64
|
|
|
return $this->boxWidth; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param int $boxWidth |
69
|
|
|
* |
70
|
|
|
* @return Labels |
71
|
|
|
*/ |
72
|
|
|
public function setBoxWidth($boxWidth) |
73
|
|
|
{ |
74
|
|
|
$this->boxWidth = intval($boxWidth); |
75
|
|
|
|
76
|
|
|
return $this; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @return mixed |
81
|
|
|
*/ |
82
|
|
|
public function getFontSize() |
83
|
|
|
{ |
84
|
|
|
return $this->fontSize; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @param int $fontSize |
89
|
|
|
* |
90
|
|
|
* @return Labels |
91
|
|
|
*/ |
92
|
|
|
public function setFontSize($fontSize) |
93
|
|
|
{ |
94
|
|
|
$this->fontSize = intval($fontSize); |
95
|
|
|
|
96
|
|
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return string |
101
|
|
|
*/ |
102
|
|
|
public function getFontStyle() |
103
|
|
|
{ |
104
|
|
|
return $this->fontStyle; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @param string $fontStyle |
109
|
|
|
* |
110
|
|
|
* @return Labels |
111
|
|
|
*/ |
112
|
|
|
public function setFontStyle($fontStyle) |
113
|
|
|
{ |
114
|
|
|
$this->fontStyle = strval($fontStyle); |
115
|
|
|
|
116
|
|
|
return $this; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @return string |
121
|
|
|
*/ |
122
|
|
|
public function getFontColor() |
123
|
|
|
{ |
124
|
|
|
return $this->fontColor; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @param string $fontColor |
129
|
|
|
* |
130
|
|
|
* @return Labels |
131
|
|
|
*/ |
132
|
|
|
public function setFontColor($fontColor) |
133
|
|
|
{ |
134
|
|
|
$this->fontColor = strval($fontColor); |
135
|
|
|
|
136
|
|
|
return $this; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @return string |
141
|
|
|
*/ |
142
|
|
|
public function getFontFamily() |
143
|
|
|
{ |
144
|
|
|
return $this->fontFamily; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @param string $fontFamily |
149
|
|
|
* |
150
|
|
|
* @return Labels |
151
|
|
|
*/ |
152
|
|
|
public function setFontFamily($fontFamily) |
153
|
|
|
{ |
154
|
|
|
$this->fontFamily = strval($fontFamily); |
155
|
|
|
|
156
|
|
|
return $this; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @return int |
161
|
|
|
*/ |
162
|
|
|
public function getPadding() |
163
|
|
|
{ |
164
|
|
|
return $this->padding; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @param int $padding |
169
|
|
|
* |
170
|
|
|
* @return Labels |
171
|
|
|
*/ |
172
|
|
|
public function setPadding($padding) |
173
|
|
|
{ |
174
|
|
|
$this->padding = intval($padding); |
175
|
|
|
|
176
|
|
|
return $this; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @return Expr |
181
|
|
|
*/ |
182
|
|
|
public function getGenerateLabels() |
183
|
|
|
{ |
184
|
|
|
return $this->generateLabels; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @param string $generateLabels |
189
|
|
|
* |
190
|
|
|
* @return Labels |
191
|
|
|
*/ |
192
|
|
|
public function setGenerateLabels($generateLabels) |
193
|
|
|
{ |
194
|
|
|
$this->generateLabels = new Expr(strval($generateLabels)); |
195
|
|
|
|
196
|
|
|
return $this; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @return bool |
201
|
|
|
*/ |
202
|
|
|
public function isUsePointStyle() |
203
|
|
|
{ |
204
|
|
|
return $this->usePointStyle; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* @param bool $usePointStyle |
209
|
|
|
* |
210
|
|
|
* @return Labels |
211
|
|
|
*/ |
212
|
|
|
public function setUsePointStyle($usePointStyle) |
213
|
|
|
{ |
214
|
|
|
$this->usePointStyle = ! ! $usePointStyle; |
215
|
|
|
|
216
|
|
|
return $this; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @return array |
221
|
|
|
*/ |
222
|
|
|
public function jsonSerialize() |
223
|
|
|
{ |
224
|
|
|
return $this->getArrayCopy(); |
225
|
|
|
} |
226
|
|
|
} |
227
|
|
|
|