PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
tablepress / libraries / vendor / PhpSpreadsheet / Worksheet / Sparkline / SparklineGroup.php

SparklineGroup.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Worksheet/Sparkline/SparklineGroup.php

408 lines 7.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TablePress\PhpOffice\PhpSpreadsheet\Worksheet\Sparkline;
4
5 use TablePress\PhpOffice\PhpSpreadsheet\Cell\CellAddress;
6
7 /**
8 * A group of sparklines that share formatting (type, colours, markers, axis).
9 *
10 * In OOXML this is the `x14:sparklineGroup` element. A group contains one or
11 * more {@see Sparkline} objects (`x14:sparkline`), each pairing a data range
12 * with the cell it is drawn in.
13 */
14 class SparklineGroup
15 {
16 // displayEmptyCellsAs values.
17 public const EMPTY_AS_GAP = 'gap';
18 public const EMPTY_AS_ZERO = 'zero';
19 public const EMPTY_AS_SPAN = 'span';
20
21 // Axis min/max scaling type values (minAxisType / maxAxisType).
22 public const AXIS_INDIVIDUAL = 'individual';
23 public const AXIS_GROUP = 'group';
24 public const AXIS_CUSTOM = 'custom';
25
26 private SparklineType $type = SparklineType::Line;
27
28 /**
29 * The sparklines belonging to this group.
30 *
31 * @var Sparkline[]
32 */
33 private array $sparklines = [];
34
35 private float $lineWeight = 0.75;
36
37 private bool $displayMarkers = false;
38
39 private bool $displayHigh = false;
40
41 private bool $displayLow = false;
42
43 private bool $displayFirst = false;
44
45 private bool $displayLast = false;
46
47 private bool $displayNegative = false;
48
49 private bool $displayXAxis = false;
50
51 private bool $displayHidden = false;
52
53 private bool $rightToLeft = false;
54
55 private string $displayEmptyCellsAs = self::EMPTY_AS_GAP;
56
57 private string $minAxisType = self::AXIS_INDIVIDUAL;
58
59 private string $maxAxisType = self::AXIS_INDIVIDUAL;
60
61 private ?float $manualMin = null;
62
63 private ?float $manualMax = null;
64
65 // Colours are stored as ARGB hex strings (e.g. 'FF376092'), or null when unset.
66 private ?string $colorSeries = 'FF376092';
67
68 private ?string $colorNegative = 'FFD00000';
69
70 private ?string $colorAxis = 'FF000000';
71
72 private ?string $colorMarkers = 'FFD00000';
73
74 private ?string $colorFirst = 'FFD00000';
75
76 private ?string $colorLast = 'FFD00000';
77
78 private ?string $colorHigh = 'FFD00000';
79
80 private ?string $colorLow = 'FFD00000';
81
82 public function getType(): SparklineType
83 {
84 return $this->type;
85 }
86
87 /**
88 * @param mixed $type
89 */
90 public function setType($type): self
91 {
92 $this->type = $type;
93
94 return $this;
95 }
96
97 /**
98 * @return Sparkline[]
99 */
100 public function getSparklines(): array
101 {
102 return $this->sparklines;
103 }
104
105 public function addSparkline(Sparkline $sparkline): self
106 {
107 $this->sparklines[] = $sparkline;
108
109 return $this;
110 }
111
112 /**
113 * Convenience helper: create and add a sparkline from a location cell and
114 * data range, returning this group for chaining.
115 * @param \TablePress\PhpOffice\PhpSpreadsheet\Cell\CellAddress|string $location
116 */
117 public function createSparkline($location, string $dataRange): self
118 {
119 return $this->addSparkline(new Sparkline($location, $dataRange));
120 }
121
122 /**
123 * @param Sparkline[] $sparklines
124 */
125 public function setSparklines(array $sparklines): self
126 {
127 $this->sparklines = array_values($sparklines);
128
129 return $this;
130 }
131
132 public function getLineWeight(): float
133 {
134 return $this->lineWeight;
135 }
136
137 public function setLineWeight(float $lineWeight): self
138 {
139 $this->lineWeight = $lineWeight;
140
141 return $this;
142 }
143
144 public function getDisplayMarkers(): bool
145 {
146 return $this->displayMarkers;
147 }
148
149 public function setDisplayMarkers(bool $displayMarkers): self
150 {
151 $this->displayMarkers = $displayMarkers;
152
153 return $this;
154 }
155
156 public function getDisplayHigh(): bool
157 {
158 return $this->displayHigh;
159 }
160
161 public function setDisplayHigh(bool $displayHigh): self
162 {
163 $this->displayHigh = $displayHigh;
164
165 return $this;
166 }
167
168 public function getDisplayLow(): bool
169 {
170 return $this->displayLow;
171 }
172
173 public function setDisplayLow(bool $displayLow): self
174 {
175 $this->displayLow = $displayLow;
176
177 return $this;
178 }
179
180 public function getDisplayFirst(): bool
181 {
182 return $this->displayFirst;
183 }
184
185 public function setDisplayFirst(bool $displayFirst): self
186 {
187 $this->displayFirst = $displayFirst;
188
189 return $this;
190 }
191
192 public function getDisplayLast(): bool
193 {
194 return $this->displayLast;
195 }
196
197 public function setDisplayLast(bool $displayLast): self
198 {
199 $this->displayLast = $displayLast;
200
201 return $this;
202 }
203
204 public function getDisplayNegative(): bool
205 {
206 return $this->displayNegative;
207 }
208
209 public function setDisplayNegative(bool $displayNegative): self
210 {
211 $this->displayNegative = $displayNegative;
212
213 return $this;
214 }
215
216 public function getDisplayXAxis(): bool
217 {
218 return $this->displayXAxis;
219 }
220
221 public function setDisplayXAxis(bool $displayXAxis): self
222 {
223 $this->displayXAxis = $displayXAxis;
224
225 return $this;
226 }
227
228 public function getDisplayHidden(): bool
229 {
230 return $this->displayHidden;
231 }
232
233 public function setDisplayHidden(bool $displayHidden): self
234 {
235 $this->displayHidden = $displayHidden;
236
237 return $this;
238 }
239
240 public function getRightToLeft(): bool
241 {
242 return $this->rightToLeft;
243 }
244
245 public function setRightToLeft(bool $rightToLeft): self
246 {
247 $this->rightToLeft = $rightToLeft;
248
249 return $this;
250 }
251
252 public function getDisplayEmptyCellsAs(): string
253 {
254 return $this->displayEmptyCellsAs;
255 }
256
257 public function setDisplayEmptyCellsAs(string $displayEmptyCellsAs): self
258 {
259 $this->displayEmptyCellsAs = $displayEmptyCellsAs;
260
261 return $this;
262 }
263
264 public function getMinAxisType(): string
265 {
266 return $this->minAxisType;
267 }
268
269 public function setMinAxisType(string $minAxisType): self
270 {
271 $this->minAxisType = $minAxisType;
272
273 return $this;
274 }
275
276 public function getMaxAxisType(): string
277 {
278 return $this->maxAxisType;
279 }
280
281 public function setMaxAxisType(string $maxAxisType): self
282 {
283 $this->maxAxisType = $maxAxisType;
284
285 return $this;
286 }
287
288 public function getManualMin(): ?float
289 {
290 return $this->manualMin;
291 }
292
293 public function setManualMin(?float $manualMin): self
294 {
295 $this->manualMin = $manualMin;
296
297 return $this;
298 }
299
300 public function getManualMax(): ?float
301 {
302 return $this->manualMax;
303 }
304
305 public function setManualMax(?float $manualMax): self
306 {
307 $this->manualMax = $manualMax;
308
309 return $this;
310 }
311
312 public function getColorSeries(): ?string
313 {
314 return $this->colorSeries;
315 }
316
317 public function setColorSeries(?string $colorSeries): self
318 {
319 $this->colorSeries = $colorSeries;
320
321 return $this;
322 }
323
324 public function getColorNegative(): ?string
325 {
326 return $this->colorNegative;
327 }
328
329 public function setColorNegative(?string $colorNegative): self
330 {
331 $this->colorNegative = $colorNegative;
332
333 return $this;
334 }
335
336 public function getColorAxis(): ?string
337 {
338 return $this->colorAxis;
339 }
340
341 public function setColorAxis(?string $colorAxis): self
342 {
343 $this->colorAxis = $colorAxis;
344
345 return $this;
346 }
347
348 public function getColorMarkers(): ?string
349 {
350 return $this->colorMarkers;
351 }
352
353 public function setColorMarkers(?string $colorMarkers): self
354 {
355 $this->colorMarkers = $colorMarkers;
356
357 return $this;
358 }
359
360 public function getColorFirst(): ?string
361 {
362 return $this->colorFirst;
363 }
364
365 public function setColorFirst(?string $colorFirst): self
366 {
367 $this->colorFirst = $colorFirst;
368
369 return $this;
370 }
371
372 public function getColorLast(): ?string
373 {
374 return $this->colorLast;
375 }
376
377 public function setColorLast(?string $colorLast): self
378 {
379 $this->colorLast = $colorLast;
380
381 return $this;
382 }
383
384 public function getColorHigh(): ?string
385 {
386 return $this->colorHigh;
387 }
388
389 public function setColorHigh(?string $colorHigh): self
390 {
391 $this->colorHigh = $colorHigh;
392
393 return $this;
394 }
395
396 public function getColorLow(): ?string
397 {
398 return $this->colorLow;
399 }
400
401 public function setColorLow(?string $colorLow): self
402 {
403 $this->colorLow = $colorLow;
404
405 return $this;
406 }
407 }
408