1 | <?php |
||
27 | class DataSeriesValues |
||
28 | { |
||
29 | const DATASERIES_TYPE_STRING = 'String'; |
||
30 | const DATASERIES_TYPE_NUMBER = 'Number'; |
||
31 | |||
32 | private static $dataTypeValues = [ |
||
33 | self::DATASERIES_TYPE_STRING, |
||
34 | self::DATASERIES_TYPE_NUMBER, |
||
35 | ]; |
||
36 | |||
37 | /** |
||
38 | * Series Data Type. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | private $dataType; |
||
43 | |||
44 | /** |
||
45 | * Series Data Source. |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | private $dataSource; |
||
50 | |||
51 | /** |
||
52 | * Format Code. |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | private $formatCode; |
||
57 | |||
58 | /** |
||
59 | * Series Point Marker. |
||
60 | * |
||
61 | * @var string |
||
62 | */ |
||
63 | private $pointMarker; |
||
64 | |||
65 | /** |
||
66 | * Point Count (The number of datapoints in the dataseries). |
||
67 | * |
||
68 | * @var int |
||
69 | */ |
||
70 | private $pointCount = 0; |
||
71 | |||
72 | /** |
||
73 | * Data Values. |
||
74 | * |
||
75 | * @var array of mixed |
||
76 | */ |
||
77 | private $dataValues = []; |
||
78 | |||
79 | /** |
||
80 | * Create a new DataSeriesValues object. |
||
81 | * |
||
82 | * @param mixed $dataType |
||
83 | * @param string $dataSource |
||
84 | * @param null|mixed $formatCode |
||
85 | * @param mixed $pointCount |
||
86 | * @param mixed $dataValues |
||
87 | * @param null|mixed $marker |
||
88 | */ |
||
89 | 17 | public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = [], $marker = null) |
|
98 | |||
99 | /** |
||
100 | * Get Series Data Type. |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | 1 | public function getDataType() |
|
108 | |||
109 | /** |
||
110 | * Set Series Data Type. |
||
111 | * |
||
112 | * @param string $dataType Datatype of this data series |
||
113 | * Typical values are: |
||
114 | * \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues::DATASERIES_TYPE_STRING |
||
115 | * Normally used for axis point values |
||
116 | * \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues::DATASERIES_TYPE_NUMBER |
||
117 | * Normally used for chart data values |
||
118 | * |
||
119 | * @throws Exception |
||
120 | * |
||
121 | * @return DataSeriesValues |
||
122 | */ |
||
123 | 17 | public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER) |
|
132 | |||
133 | /** |
||
134 | * Get Series Data Source (formula). |
||
135 | * |
||
136 | * @return string |
||
137 | */ |
||
138 | 13 | public function getDataSource() |
|
142 | |||
143 | /** |
||
144 | * Set Series Data Source (formula). |
||
145 | * |
||
146 | * @param string $dataSource |
||
147 | * @param mixed $refreshDataValues |
||
148 | * |
||
149 | * @return DataSeriesValues |
||
150 | */ |
||
151 | public function setDataSource($dataSource = null, $refreshDataValues = true) |
||
161 | |||
162 | /** |
||
163 | * Get Point Marker. |
||
164 | * |
||
165 | * @return string |
||
166 | */ |
||
167 | 13 | public function getPointMarker() |
|
171 | |||
172 | /** |
||
173 | * Set Point Marker. |
||
174 | * |
||
175 | * @param string $marker |
||
176 | * |
||
177 | * @return DataSeriesValues |
||
178 | */ |
||
179 | public function setPointMarker($marker = null) |
||
185 | |||
186 | /** |
||
187 | * Get Series Format Code. |
||
188 | * |
||
189 | * @return string |
||
190 | */ |
||
191 | 12 | public function getFormatCode() |
|
195 | |||
196 | /** |
||
197 | * Set Series Format Code. |
||
198 | * |
||
199 | * @param string $formatCode |
||
200 | * |
||
201 | * @return DataSeriesValues |
||
202 | */ |
||
203 | public function setFormatCode($formatCode = null) |
||
209 | |||
210 | /** |
||
211 | * Get Series Point Count. |
||
212 | * |
||
213 | * @return int |
||
214 | */ |
||
215 | 13 | public function getPointCount() |
|
219 | |||
220 | /** |
||
221 | * Identify if the Data Series is a multi-level or a simple series. |
||
222 | * |
||
223 | * @return bool|null |
||
224 | */ |
||
225 | 13 | public function isMultiLevelSeries() |
|
233 | |||
234 | /** |
||
235 | * Return the level count of a multi-level Data Series. |
||
236 | * |
||
237 | * @return int |
||
238 | */ |
||
239 | 2 | public function multiLevelCount() |
|
248 | |||
249 | /** |
||
250 | * Get Series Data Values. |
||
251 | * |
||
252 | * @return array of mixed |
||
253 | */ |
||
254 | 13 | public function getDataValues() |
|
258 | |||
259 | /** |
||
260 | * Get the first Series Data value. |
||
261 | * |
||
262 | * @return mixed |
||
263 | */ |
||
264 | public function getDataValue() |
||
275 | |||
276 | /** |
||
277 | * Set Series Data Values. |
||
278 | * |
||
279 | * @param array $dataValues |
||
280 | * @param bool $refreshDataSource |
||
281 | * TRUE - refresh the value of dataSource based on the values of $dataValues |
||
282 | * FALSE - don't change the value of dataSource |
||
283 | * |
||
284 | * @return DataSeriesValues |
||
285 | */ |
||
286 | public function setDataValues($dataValues = [], $refreshDataSource = true) |
||
297 | |||
298 | private function stripNulls($var) |
||
302 | |||
303 | 13 | public function refresh(\PhpOffice\PhpSpreadsheet\Worksheet $worksheet, $flatten = true) |
|
349 | } |
||
350 |
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..