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; |
13
|
|
|
|
14
|
|
|
use JsonSerializable; |
15
|
|
|
use WBW\Library\Core\Utility\Argument\ArrayUtility; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Highcharts drilldown. |
19
|
|
|
* |
20
|
|
|
* @author webeweb <https://github.com/webeweb/> |
21
|
|
|
* @package WBW\Bundle\HighchartsBundle\API\Chart |
22
|
|
|
* @version 5.0.14 |
23
|
|
|
* @final |
24
|
|
|
*/ |
25
|
|
|
final class HighchartsDrilldown implements JsonSerializable { |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Active axis label style. |
29
|
|
|
* |
30
|
|
|
* @var array |
31
|
|
|
* @since 3.0.8 |
32
|
|
|
*/ |
33
|
|
|
private $activeAxisLabelStyle = ["cursor" => "pointer", "color" => "#003399", "fontWeight" => "bold", "textDecoration" => "underline"]; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Active data label style. |
37
|
|
|
* |
38
|
|
|
* @var array |
39
|
|
|
* @since 3.0.8 |
40
|
|
|
*/ |
41
|
|
|
private $activeDataLabelStyle = ["cursor" => "pointer", "color" => "#003399", "fontWeight" => "bold", "textDecoration" => "underline"]; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Allow point drilldown. |
45
|
|
|
* |
46
|
|
|
* @var boolean |
47
|
|
|
* @since 4.1.7 |
48
|
|
|
*/ |
49
|
|
|
private $allowPointDrilldown = true; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Animation. |
53
|
|
|
* |
54
|
|
|
* @var boolean|array |
55
|
|
|
* @since 3.0.8 |
56
|
|
|
*/ |
57
|
|
|
private $animation; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Drill up button. |
61
|
|
|
* |
62
|
|
|
* @var array |
63
|
|
|
* @since 3.0.8 |
64
|
|
|
*/ |
65
|
|
|
private $drillUpButton; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Series. |
69
|
|
|
* |
70
|
|
|
* @var array |
71
|
|
|
* @since 3.0.8 |
72
|
|
|
*/ |
73
|
|
|
private $series; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Constructor. |
77
|
|
|
* |
78
|
|
|
* @param boolean $ignoreDefaultValues Ignore the default values. |
79
|
|
|
*/ |
80
|
|
|
public function __construct($ignoreDefaultValues = true) { |
81
|
|
|
if (true === $ignoreDefaultValues) { |
82
|
|
|
$this->clear(); |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Clear. |
88
|
|
|
* |
89
|
|
|
* @return void |
90
|
|
|
*/ |
91
|
|
|
public function clear() { |
92
|
|
|
|
93
|
|
|
// Clear the active axis label style. |
94
|
|
|
$this->activeAxisLabelStyle = null; |
|
|
|
|
95
|
|
|
|
96
|
|
|
// Clear the active data label style. |
97
|
|
|
$this->activeDataLabelStyle = null; |
|
|
|
|
98
|
|
|
|
99
|
|
|
// Clear the allow point drilldown. |
100
|
|
|
$this->allowPointDrilldown = null; |
101
|
|
|
|
102
|
|
|
// Clear the animation. |
103
|
|
|
$this->animation = null; |
104
|
|
|
|
105
|
|
|
// Clear the drill up button. |
106
|
|
|
$this->drillUpButton = null; |
|
|
|
|
107
|
|
|
|
108
|
|
|
// Clear the series. |
109
|
|
|
$this->series = null; |
|
|
|
|
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Get the active axis label style. |
114
|
|
|
* |
115
|
|
|
* @return array Returns the active axis label style. |
116
|
|
|
*/ |
117
|
|
|
public function getActiveAxisLabelStyle() { |
118
|
|
|
return $this->activeAxisLabelStyle; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Get the active data label style. |
123
|
|
|
* |
124
|
|
|
* @return array Returns the active data label style. |
125
|
|
|
*/ |
126
|
|
|
public function getActiveDataLabelStyle() { |
127
|
|
|
return $this->activeDataLabelStyle; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Get the allow point drilldown. |
132
|
|
|
* |
133
|
|
|
* @return boolean Returns the allow point drilldown. |
134
|
|
|
*/ |
135
|
|
|
public function getAllowPointDrilldown() { |
136
|
|
|
return $this->allowPointDrilldown; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Get the animation. |
141
|
|
|
* |
142
|
|
|
* @return boolean|array Returns the animation. |
143
|
|
|
*/ |
144
|
|
|
public function getAnimation() { |
145
|
|
|
return $this->animation; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Get the drill up button. |
150
|
|
|
* |
151
|
|
|
* @return array Returns the drill up button. |
152
|
|
|
*/ |
153
|
|
|
public function getDrillUpButton() { |
154
|
|
|
return $this->drillUpButton; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Get the series. |
159
|
|
|
* |
160
|
|
|
* @return array Returns the series. |
161
|
|
|
*/ |
162
|
|
|
public function getSeries() { |
163
|
|
|
return $this->series; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Serialize this instance. |
168
|
|
|
* |
169
|
|
|
* @return array Returns an array representing this instance. |
170
|
|
|
*/ |
171
|
|
|
public function jsonSerialize() { |
172
|
|
|
return $this->toArray(); |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* Set the active axis label style. |
177
|
|
|
* |
178
|
|
|
* @param array $activeAxisLabelStyle The active axis label style. |
179
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsDrilldown Returns the highcharts drilldown. |
180
|
|
|
*/ |
181
|
|
|
public function setActiveAxisLabelStyle(array $activeAxisLabelStyle = null) { |
182
|
|
|
$this->activeAxisLabelStyle = $activeAxisLabelStyle; |
|
|
|
|
183
|
|
|
return $this; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Set the active data label style. |
188
|
|
|
* |
189
|
|
|
* @param array $activeDataLabelStyle The active data label style. |
190
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsDrilldown Returns the highcharts drilldown. |
191
|
|
|
*/ |
192
|
|
|
public function setActiveDataLabelStyle(array $activeDataLabelStyle = null) { |
193
|
|
|
$this->activeDataLabelStyle = $activeDataLabelStyle; |
|
|
|
|
194
|
|
|
return $this; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* Set the allow point drilldown. |
199
|
|
|
* |
200
|
|
|
* @param boolean $allowPointDrilldown The allow point drilldown. |
201
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsDrilldown Returns the highcharts drilldown. |
202
|
|
|
*/ |
203
|
|
|
public function setAllowPointDrilldown($allowPointDrilldown) { |
204
|
|
|
$this->allowPointDrilldown = $allowPointDrilldown; |
205
|
|
|
return $this; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* Set the animation. |
210
|
|
|
* |
211
|
|
|
* @param boolean|array $animation The animation. |
212
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsDrilldown Returns the highcharts drilldown. |
213
|
|
|
*/ |
214
|
|
|
public function setAnimation($animation) { |
215
|
|
|
$this->animation = $animation; |
216
|
|
|
return $this; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* Set the drill up button. |
221
|
|
|
* |
222
|
|
|
* @param array $drillUpButton The drill up button. |
223
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsDrilldown Returns the highcharts drilldown. |
224
|
|
|
*/ |
225
|
|
|
public function setDrillUpButton(array $drillUpButton = null) { |
226
|
|
|
$this->drillUpButton = $drillUpButton; |
|
|
|
|
227
|
|
|
return $this; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* Set the series. |
232
|
|
|
* |
233
|
|
|
* @param array $series The series. |
234
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsDrilldown Returns the highcharts drilldown. |
235
|
|
|
*/ |
236
|
|
|
public function setSeries(array $series = null) { |
237
|
|
|
$this->series = $series; |
|
|
|
|
238
|
|
|
return $this; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* Convert into an array representing this instance. |
243
|
|
|
* |
244
|
|
|
* @return array Returns an array representing this instance. |
245
|
|
|
*/ |
246
|
|
|
public function toArray() { |
247
|
|
|
|
248
|
|
|
// Initialize the output. |
249
|
|
|
$output = []; |
250
|
|
|
|
251
|
|
|
// Set the active axis label style. |
252
|
|
|
ArrayUtility::set($output, "activeAxisLabelStyle", $this->activeAxisLabelStyle, [null]); |
253
|
|
|
|
254
|
|
|
// Set the active data label style. |
255
|
|
|
ArrayUtility::set($output, "activeDataLabelStyle", $this->activeDataLabelStyle, [null]); |
256
|
|
|
|
257
|
|
|
// Set the allow point drilldown. |
258
|
|
|
ArrayUtility::set($output, "allowPointDrilldown", $this->allowPointDrilldown, [null]); |
259
|
|
|
|
260
|
|
|
// Set the animation. |
261
|
|
|
ArrayUtility::set($output, "animation", $this->animation, [null]); |
262
|
|
|
|
263
|
|
|
// Set the drill up button. |
264
|
|
|
ArrayUtility::set($output, "drillUpButton", $this->drillUpButton, [null]); |
265
|
|
|
|
266
|
|
|
// Set the series. |
267
|
|
|
ArrayUtility::set($output, "series", $this->series, [null]); |
268
|
|
|
|
269
|
|
|
// Return the output. |
270
|
|
|
return $output; |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
} |
274
|
|
|
|
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..