@@ -11,242 +11,242 @@ |
||
11 | 11 | */ |
12 | 12 | abstract class Chart implements ChartInterface |
13 | 13 | { |
14 | - /** |
|
15 | - * The internal type of chart. |
|
16 | - */ |
|
17 | - const TYPE = null; |
|
18 | - |
|
19 | - /** |
|
20 | - * The list of models that should be used for this chart type. |
|
21 | - */ |
|
22 | - const MODEL = [ |
|
23 | - 'dataset' => DataSet::class, |
|
24 | - 'options' => Options::class, |
|
25 | - ]; |
|
26 | - |
|
27 | - /** |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - protected $id; |
|
31 | - |
|
32 | - /** |
|
33 | - * @var int |
|
34 | - */ |
|
35 | - protected $height; |
|
36 | - |
|
37 | - /** |
|
38 | - * @var int |
|
39 | - */ |
|
40 | - protected $width; |
|
41 | - |
|
42 | - /** |
|
43 | - * @var string |
|
44 | - */ |
|
45 | - protected $title; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var LabelsCollection |
|
49 | - */ |
|
50 | - protected $labels; |
|
51 | - |
|
52 | - /** |
|
53 | - * @var Options |
|
54 | - */ |
|
55 | - protected $options; |
|
56 | - |
|
57 | - /** |
|
58 | - * @var DataSetCollection |
|
59 | - */ |
|
60 | - protected $dataSets; |
|
61 | - |
|
62 | - /** |
|
63 | - * @return string |
|
64 | - */ |
|
65 | - public function getId() |
|
66 | - { |
|
67 | - if (is_null($this->id)) { |
|
68 | - $this->id = uniqid('chart'); |
|
69 | - } |
|
70 | - |
|
71 | - return $this->id; |
|
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * @param string $id |
|
76 | - * |
|
77 | - * @return Chart |
|
78 | - */ |
|
79 | - public function setId($id) |
|
80 | - { |
|
81 | - $this->id = strval($id); |
|
82 | - |
|
83 | - return $this; |
|
84 | - } |
|
85 | - |
|
86 | - /** |
|
87 | - * @return int |
|
88 | - */ |
|
89 | - public function getHeight() |
|
90 | - { |
|
91 | - return $this->height; |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * @param int $height |
|
96 | - * |
|
97 | - * @return Chart |
|
98 | - */ |
|
99 | - public function setHeight($height) |
|
100 | - { |
|
101 | - $this->height = intval($height); |
|
102 | - |
|
103 | - return $this; |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * @return int |
|
108 | - */ |
|
109 | - public function getWidth() |
|
110 | - { |
|
111 | - return $this->width; |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * @param int $width |
|
116 | - * |
|
117 | - * @return Chart |
|
118 | - */ |
|
119 | - public function setWidth($width) |
|
120 | - { |
|
121 | - $this->width = intval($width); |
|
122 | - |
|
123 | - return $this; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * @return string |
|
128 | - */ |
|
129 | - public function getTitle() |
|
130 | - { |
|
131 | - return $this->title; |
|
132 | - } |
|
133 | - |
|
134 | - /** |
|
135 | - * @param string $title |
|
136 | - * |
|
137 | - * @return Chart |
|
138 | - */ |
|
139 | - public function setTitle($title) |
|
140 | - { |
|
141 | - $this->title = strval($title); |
|
142 | - |
|
143 | - return $this; |
|
144 | - } |
|
145 | - |
|
146 | - /** |
|
147 | - * @return LabelsCollection |
|
148 | - */ |
|
149 | - public function labels() |
|
150 | - { |
|
151 | - if (is_null($this->labels)) { |
|
152 | - $this->labels = new LabelsCollection(); |
|
153 | - } |
|
154 | - |
|
155 | - return $this->labels; |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * @param string $label |
|
160 | - * |
|
161 | - * @return $this |
|
162 | - */ |
|
163 | - public function addLabel($label) |
|
164 | - { |
|
165 | - $this->labels()->append($label); |
|
166 | - |
|
167 | - return $this; |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * @param $offset |
|
172 | - * |
|
173 | - * @return string|bool |
|
174 | - */ |
|
175 | - public function getLabel($offset) |
|
176 | - { |
|
177 | - return $this->labels()->offsetGet($offset); |
|
178 | - } |
|
179 | - |
|
180 | - /** |
|
181 | - * @return DataSetCollection |
|
182 | - */ |
|
183 | - public function dataSets() |
|
184 | - { |
|
185 | - if (is_null($this->dataSets)) { |
|
186 | - $this->dataSets = new DataSetCollection(); |
|
187 | - } |
|
188 | - |
|
189 | - return $this->dataSets; |
|
190 | - } |
|
191 | - |
|
192 | - /** |
|
193 | - * @param DataSet $dataSet |
|
194 | - * |
|
195 | - * @return $this |
|
196 | - */ |
|
197 | - public function addDataSet(DataSet $dataSet) |
|
198 | - { |
|
199 | - $this->dataSets()->append($dataSet->setOwner($this)); |
|
200 | - |
|
201 | - return $this; |
|
202 | - } |
|
203 | - |
|
204 | - /** |
|
205 | - * @param $offset |
|
206 | - * |
|
207 | - * @return DataSet|bool |
|
208 | - */ |
|
209 | - public function getDataSet($offset) |
|
210 | - { |
|
211 | - return $this->dataSets()->offsetGet($offset); |
|
212 | - } |
|
213 | - |
|
214 | - /** |
|
215 | - * @param bool $pretty |
|
216 | - * |
|
217 | - * @return string |
|
218 | - */ |
|
219 | - public function render($pretty = false) |
|
220 | - { |
|
221 | - $renderer = new Html($this); |
|
222 | - |
|
223 | - return $renderer->render($pretty ? $renderer::RENDER_PRETTY : null); |
|
224 | - } |
|
225 | - |
|
226 | - /** |
|
227 | - * @return DataSet |
|
228 | - */ |
|
229 | - public function createDataSet() |
|
230 | - { |
|
231 | - $datasetClass = static::MODEL['dataset']; |
|
232 | - /** @var \Halfpastfour\PHPChartJS\DataSet $dataSet */ |
|
233 | - $dataSet = new $datasetClass(); |
|
234 | - $dataSet->setOwner($this); |
|
235 | - |
|
236 | - return $dataSet; |
|
237 | - } |
|
238 | - |
|
239 | - /** |
|
240 | - * @return Options |
|
241 | - */ |
|
242 | - public function options() |
|
243 | - { |
|
244 | - if (is_null($this->options)) { |
|
245 | - $optionsClass = static::MODEL['options']; |
|
246 | - $this->options = new $optionsClass($this); |
|
247 | - $this->options->setOwner($this); |
|
248 | - } |
|
249 | - |
|
250 | - return $this->options; |
|
251 | - } |
|
14 | + /** |
|
15 | + * The internal type of chart. |
|
16 | + */ |
|
17 | + const TYPE = null; |
|
18 | + |
|
19 | + /** |
|
20 | + * The list of models that should be used for this chart type. |
|
21 | + */ |
|
22 | + const MODEL = [ |
|
23 | + 'dataset' => DataSet::class, |
|
24 | + 'options' => Options::class, |
|
25 | + ]; |
|
26 | + |
|
27 | + /** |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + protected $id; |
|
31 | + |
|
32 | + /** |
|
33 | + * @var int |
|
34 | + */ |
|
35 | + protected $height; |
|
36 | + |
|
37 | + /** |
|
38 | + * @var int |
|
39 | + */ |
|
40 | + protected $width; |
|
41 | + |
|
42 | + /** |
|
43 | + * @var string |
|
44 | + */ |
|
45 | + protected $title; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var LabelsCollection |
|
49 | + */ |
|
50 | + protected $labels; |
|
51 | + |
|
52 | + /** |
|
53 | + * @var Options |
|
54 | + */ |
|
55 | + protected $options; |
|
56 | + |
|
57 | + /** |
|
58 | + * @var DataSetCollection |
|
59 | + */ |
|
60 | + protected $dataSets; |
|
61 | + |
|
62 | + /** |
|
63 | + * @return string |
|
64 | + */ |
|
65 | + public function getId() |
|
66 | + { |
|
67 | + if (is_null($this->id)) { |
|
68 | + $this->id = uniqid('chart'); |
|
69 | + } |
|
70 | + |
|
71 | + return $this->id; |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * @param string $id |
|
76 | + * |
|
77 | + * @return Chart |
|
78 | + */ |
|
79 | + public function setId($id) |
|
80 | + { |
|
81 | + $this->id = strval($id); |
|
82 | + |
|
83 | + return $this; |
|
84 | + } |
|
85 | + |
|
86 | + /** |
|
87 | + * @return int |
|
88 | + */ |
|
89 | + public function getHeight() |
|
90 | + { |
|
91 | + return $this->height; |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * @param int $height |
|
96 | + * |
|
97 | + * @return Chart |
|
98 | + */ |
|
99 | + public function setHeight($height) |
|
100 | + { |
|
101 | + $this->height = intval($height); |
|
102 | + |
|
103 | + return $this; |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * @return int |
|
108 | + */ |
|
109 | + public function getWidth() |
|
110 | + { |
|
111 | + return $this->width; |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * @param int $width |
|
116 | + * |
|
117 | + * @return Chart |
|
118 | + */ |
|
119 | + public function setWidth($width) |
|
120 | + { |
|
121 | + $this->width = intval($width); |
|
122 | + |
|
123 | + return $this; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * @return string |
|
128 | + */ |
|
129 | + public function getTitle() |
|
130 | + { |
|
131 | + return $this->title; |
|
132 | + } |
|
133 | + |
|
134 | + /** |
|
135 | + * @param string $title |
|
136 | + * |
|
137 | + * @return Chart |
|
138 | + */ |
|
139 | + public function setTitle($title) |
|
140 | + { |
|
141 | + $this->title = strval($title); |
|
142 | + |
|
143 | + return $this; |
|
144 | + } |
|
145 | + |
|
146 | + /** |
|
147 | + * @return LabelsCollection |
|
148 | + */ |
|
149 | + public function labels() |
|
150 | + { |
|
151 | + if (is_null($this->labels)) { |
|
152 | + $this->labels = new LabelsCollection(); |
|
153 | + } |
|
154 | + |
|
155 | + return $this->labels; |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * @param string $label |
|
160 | + * |
|
161 | + * @return $this |
|
162 | + */ |
|
163 | + public function addLabel($label) |
|
164 | + { |
|
165 | + $this->labels()->append($label); |
|
166 | + |
|
167 | + return $this; |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * @param $offset |
|
172 | + * |
|
173 | + * @return string|bool |
|
174 | + */ |
|
175 | + public function getLabel($offset) |
|
176 | + { |
|
177 | + return $this->labels()->offsetGet($offset); |
|
178 | + } |
|
179 | + |
|
180 | + /** |
|
181 | + * @return DataSetCollection |
|
182 | + */ |
|
183 | + public function dataSets() |
|
184 | + { |
|
185 | + if (is_null($this->dataSets)) { |
|
186 | + $this->dataSets = new DataSetCollection(); |
|
187 | + } |
|
188 | + |
|
189 | + return $this->dataSets; |
|
190 | + } |
|
191 | + |
|
192 | + /** |
|
193 | + * @param DataSet $dataSet |
|
194 | + * |
|
195 | + * @return $this |
|
196 | + */ |
|
197 | + public function addDataSet(DataSet $dataSet) |
|
198 | + { |
|
199 | + $this->dataSets()->append($dataSet->setOwner($this)); |
|
200 | + |
|
201 | + return $this; |
|
202 | + } |
|
203 | + |
|
204 | + /** |
|
205 | + * @param $offset |
|
206 | + * |
|
207 | + * @return DataSet|bool |
|
208 | + */ |
|
209 | + public function getDataSet($offset) |
|
210 | + { |
|
211 | + return $this->dataSets()->offsetGet($offset); |
|
212 | + } |
|
213 | + |
|
214 | + /** |
|
215 | + * @param bool $pretty |
|
216 | + * |
|
217 | + * @return string |
|
218 | + */ |
|
219 | + public function render($pretty = false) |
|
220 | + { |
|
221 | + $renderer = new Html($this); |
|
222 | + |
|
223 | + return $renderer->render($pretty ? $renderer::RENDER_PRETTY : null); |
|
224 | + } |
|
225 | + |
|
226 | + /** |
|
227 | + * @return DataSet |
|
228 | + */ |
|
229 | + public function createDataSet() |
|
230 | + { |
|
231 | + $datasetClass = static::MODEL['dataset']; |
|
232 | + /** @var \Halfpastfour\PHPChartJS\DataSet $dataSet */ |
|
233 | + $dataSet = new $datasetClass(); |
|
234 | + $dataSet->setOwner($this); |
|
235 | + |
|
236 | + return $dataSet; |
|
237 | + } |
|
238 | + |
|
239 | + /** |
|
240 | + * @return Options |
|
241 | + */ |
|
242 | + public function options() |
|
243 | + { |
|
244 | + if (is_null($this->options)) { |
|
245 | + $optionsClass = static::MODEL['options']; |
|
246 | + $this->options = new $optionsClass($this); |
|
247 | + $this->options->setOwner($this); |
|
248 | + } |
|
249 | + |
|
250 | + return $this->options; |
|
251 | + } |
|
252 | 252 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function createDataSet() |
230 | 230 | { |
231 | - $datasetClass = static::MODEL['dataset']; |
|
231 | + $datasetClass = static::MODEL[ 'dataset' ]; |
|
232 | 232 | /** @var \Halfpastfour\PHPChartJS\DataSet $dataSet */ |
233 | 233 | $dataSet = new $datasetClass(); |
234 | 234 | $dataSet->setOwner($this); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | public function options() |
243 | 243 | { |
244 | 244 | if (is_null($this->options)) { |
245 | - $optionsClass = static::MODEL['options']; |
|
245 | + $optionsClass = static::MODEL[ 'options' ]; |
|
246 | 246 | $this->options = new $optionsClass($this); |
247 | 247 | $this->options->setOwner($this); |
248 | 248 | } |
@@ -9,28 +9,28 @@ |
||
9 | 9 | */ |
10 | 10 | trait ChartOwned |
11 | 11 | { |
12 | - /** |
|
13 | - * @var ChartInterface |
|
14 | - */ |
|
15 | - private $owner; |
|
12 | + /** |
|
13 | + * @var ChartInterface |
|
14 | + */ |
|
15 | + private $owner; |
|
16 | 16 | |
17 | - /** |
|
18 | - * @param ChartInterface $chart |
|
19 | - * |
|
20 | - * @return $this |
|
21 | - */ |
|
22 | - public function setOwner(ChartInterface $chart) |
|
23 | - { |
|
24 | - $this->owner = $chart; |
|
17 | + /** |
|
18 | + * @param ChartInterface $chart |
|
19 | + * |
|
20 | + * @return $this |
|
21 | + */ |
|
22 | + public function setOwner(ChartInterface $chart) |
|
23 | + { |
|
24 | + $this->owner = $chart; |
|
25 | 25 | |
26 | - return $this; |
|
27 | - } |
|
26 | + return $this; |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * @return ChartInterface |
|
31 | - */ |
|
32 | - public function owner() |
|
33 | - { |
|
34 | - return $this->owner; |
|
35 | - } |
|
29 | + /** |
|
30 | + * @return ChartInterface |
|
31 | + */ |
|
32 | + public function owner() |
|
33 | + { |
|
34 | + return $this->owner; |
|
35 | + } |
|
36 | 36 | } |
@@ -12,24 +12,24 @@ |
||
12 | 12 | */ |
13 | 13 | trait JsonSerializable |
14 | 14 | { |
15 | - /** |
|
16 | - * @return array |
|
17 | - */ |
|
18 | - public function jsonSerialize() |
|
19 | - { |
|
20 | - return array_map(function ($value) { |
|
21 | - if ($value instanceof JsonSerializableInterface) { |
|
22 | - return $value->jsonSerialize(); |
|
23 | - } elseif ($value instanceof ArraySerializableInterface) { |
|
24 | - return $value->getArrayCopy(); |
|
25 | - } |
|
15 | + /** |
|
16 | + * @return array |
|
17 | + */ |
|
18 | + public function jsonSerialize() |
|
19 | + { |
|
20 | + return array_map(function ($value) { |
|
21 | + if ($value instanceof JsonSerializableInterface) { |
|
22 | + return $value->jsonSerialize(); |
|
23 | + } elseif ($value instanceof ArraySerializableInterface) { |
|
24 | + return $value->getArrayCopy(); |
|
25 | + } |
|
26 | 26 | |
27 | - return $value; |
|
28 | - }, $this->getArrayCopy()); |
|
29 | - } |
|
27 | + return $value; |
|
28 | + }, $this->getArrayCopy()); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * @return array |
|
33 | - */ |
|
34 | - abstract public function getArrayCopy(); |
|
31 | + /** |
|
32 | + * @return array |
|
33 | + */ |
|
34 | + abstract public function getArrayCopy(); |
|
35 | 35 | } |
@@ -13,370 +13,370 @@ |
||
13 | 13 | */ |
14 | 14 | class DataSet implements ChartOwnedInterface, ArraySerializableInterface, JsonSerializableInterface |
15 | 15 | { |
16 | - use ChartOwned; |
|
17 | - use Delegate\ArraySerializable; |
|
18 | - use Delegate\JsonSerializable; |
|
19 | - |
|
20 | - /** |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - protected $type; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var Data |
|
27 | - */ |
|
28 | - protected $data; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var string |
|
32 | - */ |
|
33 | - protected $label; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var string |
|
37 | - */ |
|
38 | - protected $xAxisID; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var string |
|
42 | - */ |
|
43 | - protected $yAxisID; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var string|string[] |
|
47 | - */ |
|
48 | - protected $backgroundColor; |
|
49 | - |
|
50 | - /** |
|
51 | - * @var string|string[] |
|
52 | - */ |
|
53 | - protected $borderColor; |
|
54 | - |
|
55 | - /** |
|
56 | - * @var int|int[] |
|
57 | - */ |
|
58 | - protected $borderWidth; |
|
59 | - |
|
60 | - /** |
|
61 | - * @var string |
|
62 | - */ |
|
63 | - protected $borderSkipped; |
|
64 | - |
|
65 | - /** |
|
66 | - * @var string|string[] |
|
67 | - */ |
|
68 | - protected $hoverBackgroundColor; |
|
69 | - |
|
70 | - /** |
|
71 | - * @var string|string[] |
|
72 | - */ |
|
73 | - protected $hoverBorderColor; |
|
74 | - |
|
75 | - /** |
|
76 | - * @var int|int[] |
|
77 | - */ |
|
78 | - protected $hoverBorderWidth; |
|
79 | - |
|
80 | - /** |
|
81 | - * @var bool|null |
|
82 | - */ |
|
83 | - protected $hidden; |
|
84 | - |
|
85 | - /** |
|
86 | - * @return string |
|
87 | - */ |
|
88 | - public function getType() |
|
89 | - { |
|
90 | - return $this->type; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * @param string $type |
|
95 | - * |
|
96 | - * @return $this |
|
97 | - */ |
|
98 | - public function setType($type) |
|
99 | - { |
|
100 | - $this->type = $type; |
|
101 | - |
|
102 | - return $this; |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * @return Data |
|
107 | - */ |
|
108 | - public function data() |
|
109 | - { |
|
110 | - if (is_null($this->data)) { |
|
111 | - $this->data = new Data(); |
|
112 | - } |
|
113 | - |
|
114 | - return $this->data; |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * @return string |
|
119 | - */ |
|
120 | - public function getLabel() |
|
121 | - { |
|
122 | - return $this->label; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * @param string $label |
|
127 | - * |
|
128 | - * @return $this |
|
129 | - */ |
|
130 | - public function setLabel($label) |
|
131 | - { |
|
132 | - $this->label = strval($label); |
|
133 | - |
|
134 | - return $this; |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * @return string |
|
139 | - */ |
|
140 | - public function getXAxisID() |
|
141 | - { |
|
142 | - return $this->xAxisID; |
|
143 | - } |
|
144 | - |
|
145 | - /** |
|
146 | - * @param string $xAxisID |
|
147 | - * |
|
148 | - * @return $this |
|
149 | - */ |
|
150 | - public function setXAxisID($xAxisID) |
|
151 | - { |
|
152 | - $this->xAxisID = strval($xAxisID); |
|
153 | - |
|
154 | - return $this; |
|
155 | - } |
|
156 | - |
|
157 | - /** |
|
158 | - * @return string |
|
159 | - */ |
|
160 | - public function getYAxisID() |
|
161 | - { |
|
162 | - return $this->yAxisID; |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * @param string $yAxisID |
|
167 | - * |
|
168 | - * @return $this |
|
169 | - */ |
|
170 | - public function setYAxisID($yAxisID) |
|
171 | - { |
|
172 | - $this->yAxisID = strval($yAxisID); |
|
173 | - |
|
174 | - return $this; |
|
175 | - } |
|
176 | - |
|
177 | - /** |
|
178 | - * @return string|string[] |
|
179 | - */ |
|
180 | - public function getBackgroundColor() |
|
181 | - { |
|
182 | - return $this->backgroundColor; |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * @param string|string[] $backgroundColor |
|
187 | - * |
|
188 | - * @return $this |
|
189 | - */ |
|
190 | - public function setBackgroundColor($backgroundColor) |
|
191 | - { |
|
192 | - if (is_array($backgroundColor)) { |
|
193 | - $backgroundColor = array_map('strval', $backgroundColor); |
|
194 | - } |
|
195 | - if (! is_array($backgroundColor)) { |
|
196 | - $backgroundColor = strval($backgroundColor); |
|
197 | - } |
|
198 | - |
|
199 | - $this->backgroundColor = $backgroundColor; |
|
200 | - |
|
201 | - return $this; |
|
202 | - } |
|
203 | - |
|
204 | - /** |
|
205 | - * @return string|string[] |
|
206 | - */ |
|
207 | - public function getBorderColor() |
|
208 | - { |
|
209 | - return $this->borderColor; |
|
210 | - } |
|
211 | - |
|
212 | - /** |
|
213 | - * @param string|string[] $borderColor |
|
214 | - * |
|
215 | - * @return $this |
|
216 | - */ |
|
217 | - public function setBorderColor($borderColor) |
|
218 | - { |
|
219 | - if (is_array($borderColor)) { |
|
220 | - $borderColor = array_map('strval', $borderColor); |
|
221 | - } |
|
222 | - if (! is_array($borderColor)) { |
|
223 | - $borderColor = strval($borderColor); |
|
224 | - } |
|
225 | - |
|
226 | - $this->borderColor = $borderColor; |
|
227 | - |
|
228 | - return $this; |
|
229 | - } |
|
230 | - |
|
231 | - /** |
|
232 | - * @return int|int[] |
|
233 | - */ |
|
234 | - public function getBorderWidth() |
|
235 | - { |
|
236 | - return $this->borderWidth; |
|
237 | - } |
|
238 | - |
|
239 | - /** |
|
240 | - * @param int|int[] $borderWidth |
|
241 | - * |
|
242 | - * @return $this |
|
243 | - */ |
|
244 | - public function setBorderWidth($borderWidth) |
|
245 | - { |
|
246 | - if (is_array($borderWidth)) { |
|
247 | - $borderWidth = array_map('intval', $borderWidth); |
|
248 | - } |
|
249 | - if (! is_array($borderWidth)) { |
|
250 | - $borderWidth = intval($borderWidth); |
|
251 | - } |
|
252 | - |
|
253 | - $this->borderWidth = $borderWidth; |
|
254 | - |
|
255 | - return $this; |
|
256 | - } |
|
257 | - |
|
258 | - /** |
|
259 | - * @return string |
|
260 | - */ |
|
261 | - public function getBorderSkipped() |
|
262 | - { |
|
263 | - return $this->borderSkipped; |
|
264 | - } |
|
265 | - |
|
266 | - /** |
|
267 | - * @param string $borderSkipped |
|
268 | - * |
|
269 | - * @return $this |
|
270 | - */ |
|
271 | - public function setBorderSkipped($borderSkipped) |
|
272 | - { |
|
273 | - $this->borderSkipped = strval($borderSkipped); |
|
274 | - |
|
275 | - return $this; |
|
276 | - } |
|
277 | - |
|
278 | - /** |
|
279 | - * @return string|string[] |
|
280 | - */ |
|
281 | - public function getHoverBackgroundColor() |
|
282 | - { |
|
283 | - return $this->hoverBackgroundColor; |
|
284 | - } |
|
285 | - |
|
286 | - /** |
|
287 | - * @param string|string[] $hoverBackgroundColor |
|
288 | - * |
|
289 | - * @return $this |
|
290 | - */ |
|
291 | - public function setHoverBackgroundColor($hoverBackgroundColor) |
|
292 | - { |
|
293 | - if (is_array($hoverBackgroundColor)) { |
|
294 | - $hoverBackgroundColor = array_map('strval', $hoverBackgroundColor); |
|
295 | - } |
|
296 | - if (! is_array($hoverBackgroundColor)) { |
|
297 | - $hoverBackgroundColor = strval($hoverBackgroundColor); |
|
298 | - } |
|
299 | - |
|
300 | - $this->hoverBackgroundColor = $hoverBackgroundColor; |
|
301 | - |
|
302 | - return $this; |
|
303 | - } |
|
304 | - |
|
305 | - /** |
|
306 | - * @return string|string[] |
|
307 | - */ |
|
308 | - public function getHoverBorderColor() |
|
309 | - { |
|
310 | - return $this->hoverBorderColor; |
|
311 | - } |
|
312 | - |
|
313 | - /** |
|
314 | - * @param string|string[] $hoverBorderColor |
|
315 | - * |
|
316 | - * @return $this |
|
317 | - */ |
|
318 | - public function setHoverBorderColor($hoverBorderColor) |
|
319 | - { |
|
320 | - if (is_array($hoverBorderColor)) { |
|
321 | - $hoverBorderColor = array_map('strval', $hoverBorderColor); |
|
322 | - } |
|
323 | - if (! is_array($hoverBorderColor)) { |
|
324 | - $hoverBorderColor = strval($hoverBorderColor); |
|
325 | - } |
|
326 | - |
|
327 | - $this->hoverBorderColor = $hoverBorderColor; |
|
328 | - |
|
329 | - return $this; |
|
330 | - } |
|
331 | - |
|
332 | - /** |
|
333 | - * @return int|int[] |
|
334 | - */ |
|
335 | - public function getHoverBorderWidth() |
|
336 | - { |
|
337 | - return $this->hoverBorderWidth; |
|
338 | - } |
|
339 | - |
|
340 | - /** |
|
341 | - * @param int|int[] $hoverBorderWidth |
|
342 | - * |
|
343 | - * @return $this |
|
344 | - */ |
|
345 | - public function setHoverBorderWidth($hoverBorderWidth) |
|
346 | - { |
|
347 | - if (is_array($hoverBorderWidth)) { |
|
348 | - $hoverBorderWidth = array_map('intval', $hoverBorderWidth); |
|
349 | - } |
|
350 | - if (! is_array($hoverBorderWidth)) { |
|
351 | - $hoverBorderWidth = intval($hoverBorderWidth); |
|
352 | - } |
|
353 | - |
|
354 | - $this->hoverBorderWidth = $hoverBorderWidth; |
|
355 | - |
|
356 | - return $this; |
|
357 | - } |
|
358 | - |
|
359 | - /** |
|
360 | - * @return bool|null |
|
361 | - */ |
|
362 | - public function isHidden() |
|
363 | - { |
|
364 | - if (is_null($this->hidden)) { |
|
365 | - $this->hidden = false; |
|
366 | - } |
|
367 | - |
|
368 | - return $this->hidden; |
|
369 | - } |
|
370 | - |
|
371 | - /** |
|
372 | - * @param bool|null $hidden |
|
373 | - * |
|
374 | - * @return $this |
|
375 | - */ |
|
376 | - public function setHidden($hidden) |
|
377 | - { |
|
378 | - $this->hidden = is_null($hidden) ? null : boolval($hidden); |
|
379 | - |
|
380 | - return $this; |
|
381 | - } |
|
16 | + use ChartOwned; |
|
17 | + use Delegate\ArraySerializable; |
|
18 | + use Delegate\JsonSerializable; |
|
19 | + |
|
20 | + /** |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + protected $type; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var Data |
|
27 | + */ |
|
28 | + protected $data; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var string |
|
32 | + */ |
|
33 | + protected $label; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var string |
|
37 | + */ |
|
38 | + protected $xAxisID; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var string |
|
42 | + */ |
|
43 | + protected $yAxisID; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var string|string[] |
|
47 | + */ |
|
48 | + protected $backgroundColor; |
|
49 | + |
|
50 | + /** |
|
51 | + * @var string|string[] |
|
52 | + */ |
|
53 | + protected $borderColor; |
|
54 | + |
|
55 | + /** |
|
56 | + * @var int|int[] |
|
57 | + */ |
|
58 | + protected $borderWidth; |
|
59 | + |
|
60 | + /** |
|
61 | + * @var string |
|
62 | + */ |
|
63 | + protected $borderSkipped; |
|
64 | + |
|
65 | + /** |
|
66 | + * @var string|string[] |
|
67 | + */ |
|
68 | + protected $hoverBackgroundColor; |
|
69 | + |
|
70 | + /** |
|
71 | + * @var string|string[] |
|
72 | + */ |
|
73 | + protected $hoverBorderColor; |
|
74 | + |
|
75 | + /** |
|
76 | + * @var int|int[] |
|
77 | + */ |
|
78 | + protected $hoverBorderWidth; |
|
79 | + |
|
80 | + /** |
|
81 | + * @var bool|null |
|
82 | + */ |
|
83 | + protected $hidden; |
|
84 | + |
|
85 | + /** |
|
86 | + * @return string |
|
87 | + */ |
|
88 | + public function getType() |
|
89 | + { |
|
90 | + return $this->type; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * @param string $type |
|
95 | + * |
|
96 | + * @return $this |
|
97 | + */ |
|
98 | + public function setType($type) |
|
99 | + { |
|
100 | + $this->type = $type; |
|
101 | + |
|
102 | + return $this; |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * @return Data |
|
107 | + */ |
|
108 | + public function data() |
|
109 | + { |
|
110 | + if (is_null($this->data)) { |
|
111 | + $this->data = new Data(); |
|
112 | + } |
|
113 | + |
|
114 | + return $this->data; |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * @return string |
|
119 | + */ |
|
120 | + public function getLabel() |
|
121 | + { |
|
122 | + return $this->label; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * @param string $label |
|
127 | + * |
|
128 | + * @return $this |
|
129 | + */ |
|
130 | + public function setLabel($label) |
|
131 | + { |
|
132 | + $this->label = strval($label); |
|
133 | + |
|
134 | + return $this; |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * @return string |
|
139 | + */ |
|
140 | + public function getXAxisID() |
|
141 | + { |
|
142 | + return $this->xAxisID; |
|
143 | + } |
|
144 | + |
|
145 | + /** |
|
146 | + * @param string $xAxisID |
|
147 | + * |
|
148 | + * @return $this |
|
149 | + */ |
|
150 | + public function setXAxisID($xAxisID) |
|
151 | + { |
|
152 | + $this->xAxisID = strval($xAxisID); |
|
153 | + |
|
154 | + return $this; |
|
155 | + } |
|
156 | + |
|
157 | + /** |
|
158 | + * @return string |
|
159 | + */ |
|
160 | + public function getYAxisID() |
|
161 | + { |
|
162 | + return $this->yAxisID; |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * @param string $yAxisID |
|
167 | + * |
|
168 | + * @return $this |
|
169 | + */ |
|
170 | + public function setYAxisID($yAxisID) |
|
171 | + { |
|
172 | + $this->yAxisID = strval($yAxisID); |
|
173 | + |
|
174 | + return $this; |
|
175 | + } |
|
176 | + |
|
177 | + /** |
|
178 | + * @return string|string[] |
|
179 | + */ |
|
180 | + public function getBackgroundColor() |
|
181 | + { |
|
182 | + return $this->backgroundColor; |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * @param string|string[] $backgroundColor |
|
187 | + * |
|
188 | + * @return $this |
|
189 | + */ |
|
190 | + public function setBackgroundColor($backgroundColor) |
|
191 | + { |
|
192 | + if (is_array($backgroundColor)) { |
|
193 | + $backgroundColor = array_map('strval', $backgroundColor); |
|
194 | + } |
|
195 | + if (! is_array($backgroundColor)) { |
|
196 | + $backgroundColor = strval($backgroundColor); |
|
197 | + } |
|
198 | + |
|
199 | + $this->backgroundColor = $backgroundColor; |
|
200 | + |
|
201 | + return $this; |
|
202 | + } |
|
203 | + |
|
204 | + /** |
|
205 | + * @return string|string[] |
|
206 | + */ |
|
207 | + public function getBorderColor() |
|
208 | + { |
|
209 | + return $this->borderColor; |
|
210 | + } |
|
211 | + |
|
212 | + /** |
|
213 | + * @param string|string[] $borderColor |
|
214 | + * |
|
215 | + * @return $this |
|
216 | + */ |
|
217 | + public function setBorderColor($borderColor) |
|
218 | + { |
|
219 | + if (is_array($borderColor)) { |
|
220 | + $borderColor = array_map('strval', $borderColor); |
|
221 | + } |
|
222 | + if (! is_array($borderColor)) { |
|
223 | + $borderColor = strval($borderColor); |
|
224 | + } |
|
225 | + |
|
226 | + $this->borderColor = $borderColor; |
|
227 | + |
|
228 | + return $this; |
|
229 | + } |
|
230 | + |
|
231 | + /** |
|
232 | + * @return int|int[] |
|
233 | + */ |
|
234 | + public function getBorderWidth() |
|
235 | + { |
|
236 | + return $this->borderWidth; |
|
237 | + } |
|
238 | + |
|
239 | + /** |
|
240 | + * @param int|int[] $borderWidth |
|
241 | + * |
|
242 | + * @return $this |
|
243 | + */ |
|
244 | + public function setBorderWidth($borderWidth) |
|
245 | + { |
|
246 | + if (is_array($borderWidth)) { |
|
247 | + $borderWidth = array_map('intval', $borderWidth); |
|
248 | + } |
|
249 | + if (! is_array($borderWidth)) { |
|
250 | + $borderWidth = intval($borderWidth); |
|
251 | + } |
|
252 | + |
|
253 | + $this->borderWidth = $borderWidth; |
|
254 | + |
|
255 | + return $this; |
|
256 | + } |
|
257 | + |
|
258 | + /** |
|
259 | + * @return string |
|
260 | + */ |
|
261 | + public function getBorderSkipped() |
|
262 | + { |
|
263 | + return $this->borderSkipped; |
|
264 | + } |
|
265 | + |
|
266 | + /** |
|
267 | + * @param string $borderSkipped |
|
268 | + * |
|
269 | + * @return $this |
|
270 | + */ |
|
271 | + public function setBorderSkipped($borderSkipped) |
|
272 | + { |
|
273 | + $this->borderSkipped = strval($borderSkipped); |
|
274 | + |
|
275 | + return $this; |
|
276 | + } |
|
277 | + |
|
278 | + /** |
|
279 | + * @return string|string[] |
|
280 | + */ |
|
281 | + public function getHoverBackgroundColor() |
|
282 | + { |
|
283 | + return $this->hoverBackgroundColor; |
|
284 | + } |
|
285 | + |
|
286 | + /** |
|
287 | + * @param string|string[] $hoverBackgroundColor |
|
288 | + * |
|
289 | + * @return $this |
|
290 | + */ |
|
291 | + public function setHoverBackgroundColor($hoverBackgroundColor) |
|
292 | + { |
|
293 | + if (is_array($hoverBackgroundColor)) { |
|
294 | + $hoverBackgroundColor = array_map('strval', $hoverBackgroundColor); |
|
295 | + } |
|
296 | + if (! is_array($hoverBackgroundColor)) { |
|
297 | + $hoverBackgroundColor = strval($hoverBackgroundColor); |
|
298 | + } |
|
299 | + |
|
300 | + $this->hoverBackgroundColor = $hoverBackgroundColor; |
|
301 | + |
|
302 | + return $this; |
|
303 | + } |
|
304 | + |
|
305 | + /** |
|
306 | + * @return string|string[] |
|
307 | + */ |
|
308 | + public function getHoverBorderColor() |
|
309 | + { |
|
310 | + return $this->hoverBorderColor; |
|
311 | + } |
|
312 | + |
|
313 | + /** |
|
314 | + * @param string|string[] $hoverBorderColor |
|
315 | + * |
|
316 | + * @return $this |
|
317 | + */ |
|
318 | + public function setHoverBorderColor($hoverBorderColor) |
|
319 | + { |
|
320 | + if (is_array($hoverBorderColor)) { |
|
321 | + $hoverBorderColor = array_map('strval', $hoverBorderColor); |
|
322 | + } |
|
323 | + if (! is_array($hoverBorderColor)) { |
|
324 | + $hoverBorderColor = strval($hoverBorderColor); |
|
325 | + } |
|
326 | + |
|
327 | + $this->hoverBorderColor = $hoverBorderColor; |
|
328 | + |
|
329 | + return $this; |
|
330 | + } |
|
331 | + |
|
332 | + /** |
|
333 | + * @return int|int[] |
|
334 | + */ |
|
335 | + public function getHoverBorderWidth() |
|
336 | + { |
|
337 | + return $this->hoverBorderWidth; |
|
338 | + } |
|
339 | + |
|
340 | + /** |
|
341 | + * @param int|int[] $hoverBorderWidth |
|
342 | + * |
|
343 | + * @return $this |
|
344 | + */ |
|
345 | + public function setHoverBorderWidth($hoverBorderWidth) |
|
346 | + { |
|
347 | + if (is_array($hoverBorderWidth)) { |
|
348 | + $hoverBorderWidth = array_map('intval', $hoverBorderWidth); |
|
349 | + } |
|
350 | + if (! is_array($hoverBorderWidth)) { |
|
351 | + $hoverBorderWidth = intval($hoverBorderWidth); |
|
352 | + } |
|
353 | + |
|
354 | + $this->hoverBorderWidth = $hoverBorderWidth; |
|
355 | + |
|
356 | + return $this; |
|
357 | + } |
|
358 | + |
|
359 | + /** |
|
360 | + * @return bool|null |
|
361 | + */ |
|
362 | + public function isHidden() |
|
363 | + { |
|
364 | + if (is_null($this->hidden)) { |
|
365 | + $this->hidden = false; |
|
366 | + } |
|
367 | + |
|
368 | + return $this->hidden; |
|
369 | + } |
|
370 | + |
|
371 | + /** |
|
372 | + * @param bool|null $hidden |
|
373 | + * |
|
374 | + * @return $this |
|
375 | + */ |
|
376 | + public function setHidden($hidden) |
|
377 | + { |
|
378 | + $this->hidden = is_null($hidden) ? null : boolval($hidden); |
|
379 | + |
|
380 | + return $this; |
|
381 | + } |
|
382 | 382 | } |