PluginProbe
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin / 6.5.1.7
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin v6.5.1.7
6.5.1.7 6.5.1.6 6.5.1.5 6.5.1.4 6.5.1.3 6.5.1.2 6.5.1.1 6.5.0.9 6.5.0.8 6.5.0.7 6.5.0.6 trunk 3.4.2.40 3.4.2.41 3.4.2.42 3.4.2.43 3.4.2.44 3.4.2.45 3.4.2.46 3.4.2.47 3.4.2.48 3.4.2.49 3.4.2.50 6.3.2 6.3.3.1 All 47 releases
wpdatatables / lib / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Chart / Layout.php

Layout.php in wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin 6.5.1.7, at lib/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Layout.php

578 lines 11.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PhpOffice\PhpSpreadsheet\Chart;
4
5 use PhpOffice\PhpSpreadsheet\Style\Font;
6
7 class Layout
8 {
9 /**
10 * layoutTarget.
11 *
12 * @var ?string
13 */
14 private $layoutTarget;
15
16 /**
17 * X Mode.
18 *
19 * @var ?string
20 */
21 private $xMode;
22
23 /**
24 * Y Mode.
25 *
26 * @var ?string
27 */
28 private $yMode;
29
30 /**
31 * X-Position.
32 *
33 * @var ?float
34 */
35 private $xPos;
36
37 /**
38 * Y-Position.
39 *
40 * @var ?float
41 */
42 private $yPos;
43
44 /**
45 * width.
46 *
47 * @var ?float
48 */
49 private $width;
50
51 /**
52 * height.
53 *
54 * @var ?float
55 */
56 private $height;
57
58 /**
59 * Position - t=top.
60 *
61 * @var string
62 */
63 private $dLblPos = '';
64
65 /** @var string */
66 private $numFmtCode = '';
67
68 /** @var bool */
69 private $numFmtLinked = false;
70
71 /**
72 * show legend key
73 * Specifies that legend keys should be shown in data labels.
74 *
75 * @var ?bool
76 */
77 private $showLegendKey;
78
79 /**
80 * show value
81 * Specifies that the value should be shown in a data label.
82 *
83 * @var ?bool
84 */
85 private $showVal;
86
87 /**
88 * show category name
89 * Specifies that the category name should be shown in the data label.
90 *
91 * @var ?bool
92 */
93 private $showCatName;
94
95 /**
96 * show data series name
97 * Specifies that the series name should be shown in the data label.
98 *
99 * @var ?bool
100 */
101 private $showSerName;
102
103 /**
104 * show percentage
105 * Specifies that the percentage should be shown in the data label.
106 *
107 * @var ?bool
108 */
109 private $showPercent;
110
111 /**
112 * show bubble size.
113 *
114 * @var ?bool
115 */
116 private $showBubbleSize;
117
118 /**
119 * show leader lines
120 * Specifies that leader lines should be shown for the data label.
121 *
122 * @var ?bool
123 */
124 private $showLeaderLines;
125
126 /** @var ?ChartColor */
127 private $labelFillColor;
128
129 /** @var ?ChartColor */
130 private $labelBorderColor;
131
132 /** @var ?Font */
133 private $labelFont;
134
135 /** @var Properties */
136 private $labelEffects;
137
138 /**
139 * Create a new Layout.
140 */
141 public function __construct(array $layout = [])
142 {
143 if (isset($layout['layoutTarget'])) {
144 $this->layoutTarget = $layout['layoutTarget'];
145 }
146 if (isset($layout['xMode'])) {
147 $this->xMode = $layout['xMode'];
148 }
149 if (isset($layout['yMode'])) {
150 $this->yMode = $layout['yMode'];
151 }
152 if (isset($layout['x'])) {
153 $this->xPos = (float) $layout['x'];
154 }
155 if (isset($layout['y'])) {
156 $this->yPos = (float) $layout['y'];
157 }
158 if (isset($layout['w'])) {
159 $this->width = (float) $layout['w'];
160 }
161 if (isset($layout['h'])) {
162 $this->height = (float) $layout['h'];
163 }
164 if (isset($layout['dLblPos'])) {
165 $this->dLblPos = (string) $layout['dLblPos'];
166 }
167 if (isset($layout['numFmtCode'])) {
168 $this->numFmtCode = (string) $layout['numFmtCode'];
169 }
170 $this->initBoolean($layout, 'showLegendKey');
171 $this->initBoolean($layout, 'showVal');
172 $this->initBoolean($layout, 'showCatName');
173 $this->initBoolean($layout, 'showSerName');
174 $this->initBoolean($layout, 'showPercent');
175 $this->initBoolean($layout, 'showBubbleSize');
176 $this->initBoolean($layout, 'showLeaderLines');
177 $this->initBoolean($layout, 'numFmtLinked');
178 $this->initColor($layout, 'labelFillColor');
179 $this->initColor($layout, 'labelBorderColor');
180 $labelFont = $layout['labelFont'] ?? null;
181 if ($labelFont instanceof Font) {
182 $this->labelFont = $labelFont;
183 }
184 $labelFontColor = $layout['labelFontColor'] ?? null;
185 if ($labelFontColor instanceof ChartColor) {
186 $this->setLabelFontColor($labelFontColor);
187 }
188 $labelEffects = $layout['labelEffects'] ?? null;
189 if ($labelEffects instanceof Properties) {
190 $this->labelEffects = $labelEffects;
191 }
192 }
193
194 private function initBoolean(array $layout, string $name): void
195 {
196 if (isset($layout[$name])) {
197 $this->$name = (bool) $layout[$name];
198 }
199 }
200
201 private function initColor(array $layout, string $name): void
202 {
203 if (isset($layout[$name]) && $layout[$name] instanceof ChartColor) {
204 $this->$name = $layout[$name];
205 }
206 }
207
208 /**
209 * Get Layout Target.
210 *
211 * @return ?string
212 */
213 public function getLayoutTarget()
214 {
215 return $this->layoutTarget;
216 }
217
218 /**
219 * Set Layout Target.
220 *
221 * @param ?string $target
222 *
223 * @return $this
224 */
225 public function setLayoutTarget($target)
226 {
227 $this->layoutTarget = $target;
228
229 return $this;
230 }
231
232 /**
233 * Get X-Mode.
234 *
235 * @return ?string
236 */
237 public function getXMode()
238 {
239 return $this->xMode;
240 }
241
242 /**
243 * Set X-Mode.
244 *
245 * @param ?string $mode
246 *
247 * @return $this
248 */
249 public function setXMode($mode)
250 {
251 $this->xMode = (string) $mode;
252
253 return $this;
254 }
255
256 /**
257 * Get Y-Mode.
258 *
259 * @return ?string
260 */
261 public function getYMode()
262 {
263 return $this->yMode;
264 }
265
266 /**
267 * Set Y-Mode.
268 *
269 * @param ?string $mode
270 *
271 * @return $this
272 */
273 public function setYMode($mode)
274 {
275 $this->yMode = (string) $mode;
276
277 return $this;
278 }
279
280 /**
281 * Get X-Position.
282 *
283 * @return null|float|int
284 */
285 public function getXPosition()
286 {
287 return $this->xPos;
288 }
289
290 /**
291 * Set X-Position.
292 *
293 * @param ?float $position
294 *
295 * @return $this
296 */
297 public function setXPosition($position)
298 {
299 $this->xPos = (float) $position;
300
301 return $this;
302 }
303
304 /**
305 * Get Y-Position.
306 *
307 * @return null|float
308 */
309 public function getYPosition()
310 {
311 return $this->yPos;
312 }
313
314 /**
315 * Set Y-Position.
316 *
317 * @param ?float $position
318 *
319 * @return $this
320 */
321 public function setYPosition($position)
322 {
323 $this->yPos = (float) $position;
324
325 return $this;
326 }
327
328 /**
329 * Get Width.
330 *
331 * @return ?float
332 */
333 public function getWidth()
334 {
335 return $this->width;
336 }
337
338 /**
339 * Set Width.
340 *
341 * @param ?float $width
342 *
343 * @return $this
344 */
345 public function setWidth($width)
346 {
347 $this->width = $width;
348
349 return $this;
350 }
351
352 /**
353 * Get Height.
354 *
355 * @return null|float
356 */
357 public function getHeight()
358 {
359 return $this->height;
360 }
361
362 /**
363 * Set Height.
364 *
365 * @param ?float $height
366 *
367 * @return $this
368 */
369 public function setHeight($height)
370 {
371 $this->height = $height;
372
373 return $this;
374 }
375
376 public function getShowLegendKey(): ?bool
377 {
378 return $this->showLegendKey;
379 }
380
381 /**
382 * Set show legend key
383 * Specifies that legend keys should be shown in data labels.
384 */
385 public function setShowLegendKey(?bool $showLegendKey): self
386 {
387 $this->showLegendKey = $showLegendKey;
388
389 return $this;
390 }
391
392 public function getShowVal(): ?bool
393 {
394 return $this->showVal;
395 }
396
397 /**
398 * Set show val
399 * Specifies that the value should be shown in data labels.
400 */
401 public function setShowVal(?bool $showDataLabelValues): self
402 {
403 $this->showVal = $showDataLabelValues;
404
405 return $this;
406 }
407
408 public function getShowCatName(): ?bool
409 {
410 return $this->showCatName;
411 }
412
413 /**
414 * Set show cat name
415 * Specifies that the category name should be shown in data labels.
416 */
417 public function setShowCatName(?bool $showCategoryName): self
418 {
419 $this->showCatName = $showCategoryName;
420
421 return $this;
422 }
423
424 public function getShowSerName(): ?bool
425 {
426 return $this->showSerName;
427 }
428
429 /**
430 * Set show data series name.
431 * Specifies that the series name should be shown in data labels.
432 */
433 public function setShowSerName(?bool $showSeriesName): self
434 {
435 $this->showSerName = $showSeriesName;
436
437 return $this;
438 }
439
440 public function getShowPercent(): ?bool
441 {
442 return $this->showPercent;
443 }
444
445 /**
446 * Set show percentage.
447 * Specifies that the percentage should be shown in data labels.
448 */
449 public function setShowPercent(?bool $showPercentage): self
450 {
451 $this->showPercent = $showPercentage;
452
453 return $this;
454 }
455
456 public function getShowBubbleSize(): ?bool
457 {
458 return $this->showBubbleSize;
459 }
460
461 /**
462 * Set show bubble size.
463 * Specifies that the bubble size should be shown in data labels.
464 */
465 public function setShowBubbleSize(?bool $showBubbleSize): self
466 {
467 $this->showBubbleSize = $showBubbleSize;
468
469 return $this;
470 }
471
472 public function getShowLeaderLines(): ?bool
473 {
474 return $this->showLeaderLines;
475 }
476
477 /**
478 * Set show leader lines.
479 * Specifies that leader lines should be shown in data labels.
480 */
481 public function setShowLeaderLines(?bool $showLeaderLines): self
482 {
483 $this->showLeaderLines = $showLeaderLines;
484
485 return $this;
486 }
487
488 public function getLabelFillColor(): ?ChartColor
489 {
490 return $this->labelFillColor;
491 }
492
493 public function setLabelFillColor(?ChartColor $chartColor): self
494 {
495 $this->labelFillColor = $chartColor;
496
497 return $this;
498 }
499
500 public function getLabelBorderColor(): ?ChartColor
501 {
502 return $this->labelBorderColor;
503 }
504
505 public function setLabelBorderColor(?ChartColor $chartColor): self
506 {
507 $this->labelBorderColor = $chartColor;
508
509 return $this;
510 }
511
512 public function getLabelFont(): ?Font
513 {
514 return $this->labelFont;
515 }
516
517 public function getLabelEffects(): ?Properties
518 {
519 return $this->labelEffects;
520 }
521
522 public function getLabelFontColor(): ?ChartColor
523 {
524 if ($this->labelFont === null) {
525 return null;
526 }
527
528 return $this->labelFont->getChartColor();
529 }
530
531 public function setLabelFontColor(?ChartColor $chartColor): self
532 {
533 if ($this->labelFont === null) {
534 $this->labelFont = new Font();
535 $this->labelFont->setSize(null, true);
536 }
537 $this->labelFont->setChartColorFromObject($chartColor);
538
539 return $this;
540 }
541
542 public function getDLblPos(): string
543 {
544 return $this->dLblPos;
545 }
546
547 public function setDLblPos(string $dLblPos): self
548 {
549 $this->dLblPos = $dLblPos;
550
551 return $this;
552 }
553
554 public function getNumFmtCode(): string
555 {
556 return $this->numFmtCode;
557 }
558
559 public function setNumFmtCode(string $numFmtCode): self
560 {
561 $this->numFmtCode = $numFmtCode;
562
563 return $this;
564 }
565
566 public function getNumFmtLinked(): bool
567 {
568 return $this->numFmtLinked;
569 }
570
571 public function setNumFmtLinked(bool $numFmtLinked): self
572 {
573 $this->numFmtLinked = $numFmtLinked;
574
575 return $this;
576 }
577 }
578