1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PhpOffice\PhpSpreadsheet\Chart; |
4
|
|
|
|
5
|
|
|
class Layout |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* layoutTarget. |
9
|
|
|
* |
10
|
|
|
* @var string |
11
|
|
|
*/ |
12
|
|
|
private $layoutTarget; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* X Mode. |
16
|
|
|
* |
17
|
|
|
* @var string |
18
|
|
|
*/ |
19
|
|
|
private $xMode; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Y Mode. |
23
|
|
|
* |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
private $yMode; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* X-Position. |
30
|
|
|
* |
31
|
|
|
* @var float |
32
|
|
|
*/ |
33
|
|
|
private $xPos; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Y-Position. |
37
|
|
|
* |
38
|
|
|
* @var float |
39
|
|
|
*/ |
40
|
|
|
private $yPos; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* width. |
44
|
|
|
* |
45
|
|
|
* @var float |
46
|
|
|
*/ |
47
|
|
|
private $width; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* height. |
51
|
|
|
* |
52
|
|
|
* @var float |
53
|
|
|
*/ |
54
|
|
|
private $height; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* show legend key |
58
|
|
|
* Specifies that legend keys should be shown in data labels. |
59
|
|
|
* |
60
|
|
|
* @var bool |
61
|
|
|
*/ |
62
|
|
|
private $showLegendKey; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* show value |
66
|
|
|
* Specifies that the value should be shown in a data label. |
67
|
|
|
* |
68
|
|
|
* @var bool |
69
|
|
|
*/ |
70
|
|
|
private $showVal; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* show category name |
74
|
|
|
* Specifies that the category name should be shown in the data label. |
75
|
|
|
* |
76
|
|
|
* @var bool |
77
|
|
|
*/ |
78
|
|
|
private $showCatName; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* show data series name |
82
|
|
|
* Specifies that the series name should be shown in the data label. |
83
|
|
|
* |
84
|
|
|
* @var bool |
85
|
|
|
*/ |
86
|
|
|
private $showSerName; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* show percentage |
90
|
|
|
* Specifies that the percentage should be shown in the data label. |
91
|
|
|
* |
92
|
|
|
* @var bool |
93
|
|
|
*/ |
94
|
|
|
private $showPercent; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* show bubble size. |
98
|
|
|
* |
99
|
|
|
* @var bool |
100
|
|
|
*/ |
101
|
|
|
private $showBubbleSize; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* show leader lines |
105
|
|
|
* Specifies that leader lines should be shown for the data label. |
106
|
|
|
* |
107
|
|
|
* @var bool |
108
|
|
|
*/ |
109
|
|
|
private $showLeaderLines; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Create a new Layout. |
113
|
|
|
*/ |
114
|
10 |
|
public function __construct(array $layout = []) |
115
|
|
|
{ |
116
|
10 |
|
if (isset($layout['layoutTarget'])) { |
117
|
2 |
|
$this->layoutTarget = $layout['layoutTarget']; |
118
|
|
|
} |
119
|
10 |
|
if (isset($layout['xMode'])) { |
120
|
2 |
|
$this->xMode = $layout['xMode']; |
121
|
|
|
} |
122
|
10 |
|
if (isset($layout['yMode'])) { |
123
|
2 |
|
$this->yMode = $layout['yMode']; |
124
|
|
|
} |
125
|
10 |
|
if (isset($layout['x'])) { |
126
|
2 |
|
$this->xPos = (float) $layout['x']; |
127
|
|
|
} |
128
|
10 |
|
if (isset($layout['y'])) { |
129
|
2 |
|
$this->yPos = (float) $layout['y']; |
130
|
|
|
} |
131
|
10 |
|
if (isset($layout['w'])) { |
132
|
2 |
|
$this->width = (float) $layout['w']; |
133
|
|
|
} |
134
|
10 |
|
if (isset($layout['h'])) { |
135
|
2 |
|
$this->height = (float) $layout['h']; |
136
|
|
|
} |
137
|
10 |
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Get Layout Target. |
141
|
|
|
* |
142
|
|
|
* @return string |
143
|
|
|
*/ |
144
|
6 |
|
public function getLayoutTarget() |
145
|
|
|
{ |
146
|
6 |
|
return $this->layoutTarget; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Set Layout Target. |
151
|
|
|
* |
152
|
|
|
* @param string $value |
153
|
|
|
* |
154
|
|
|
* @return $this |
155
|
|
|
*/ |
156
|
2 |
|
public function setLayoutTarget($value) |
157
|
|
|
{ |
158
|
2 |
|
$this->layoutTarget = $value; |
159
|
|
|
|
160
|
2 |
|
return $this; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* Get X-Mode. |
165
|
|
|
* |
166
|
|
|
* @return string |
167
|
|
|
*/ |
168
|
5 |
|
public function getXMode() |
169
|
|
|
{ |
170
|
5 |
|
return $this->xMode; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* Set X-Mode. |
175
|
|
|
* |
176
|
|
|
* @param string $value |
177
|
|
|
* |
178
|
|
|
* @return $this |
179
|
|
|
*/ |
180
|
|
|
public function setXMode($value) |
181
|
|
|
{ |
182
|
|
|
$this->xMode = (string) $value; |
183
|
|
|
|
184
|
|
|
return $this; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* Get Y-Mode. |
189
|
|
|
* |
190
|
|
|
* @return string |
191
|
|
|
*/ |
192
|
5 |
|
public function getYMode() |
193
|
|
|
{ |
194
|
5 |
|
return $this->yMode; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* Set Y-Mode. |
199
|
|
|
* |
200
|
|
|
* @param string $value |
201
|
|
|
* |
202
|
|
|
* @return $this |
203
|
|
|
*/ |
204
|
|
|
public function setYMode($value) |
205
|
|
|
{ |
206
|
|
|
$this->yMode = (string) $value; |
207
|
|
|
|
208
|
|
|
return $this; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* Get X-Position. |
213
|
|
|
* |
214
|
|
|
* @return number |
215
|
|
|
*/ |
216
|
5 |
|
public function getXPosition() |
217
|
|
|
{ |
218
|
5 |
|
return $this->xPos; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* Set X-Position. |
223
|
|
|
* |
224
|
|
|
* @param float $value |
225
|
|
|
* |
226
|
|
|
* @return $this |
227
|
|
|
*/ |
228
|
|
|
public function setXPosition($value) |
229
|
|
|
{ |
230
|
|
|
$this->xPos = (float) $value; |
231
|
|
|
|
232
|
|
|
return $this; |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
/** |
236
|
|
|
* Get Y-Position. |
237
|
|
|
* |
238
|
|
|
* @return number |
239
|
|
|
*/ |
240
|
5 |
|
public function getYPosition() |
241
|
|
|
{ |
242
|
5 |
|
return $this->yPos; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* Set Y-Position. |
247
|
|
|
* |
248
|
|
|
* @param float $value |
249
|
|
|
* |
250
|
|
|
* @return $this |
251
|
|
|
*/ |
252
|
|
|
public function setYPosition($value) |
253
|
|
|
{ |
254
|
|
|
$this->yPos = (float) $value; |
255
|
|
|
|
256
|
|
|
return $this; |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* Get Width. |
261
|
|
|
* |
262
|
|
|
* @return number |
263
|
|
|
*/ |
264
|
5 |
|
public function getWidth() |
265
|
|
|
{ |
266
|
5 |
|
return $this->width; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* Set Width. |
271
|
|
|
* |
272
|
|
|
* @param float $value |
273
|
|
|
* |
274
|
|
|
* @return $this |
275
|
|
|
*/ |
276
|
|
|
public function setWidth($value) |
277
|
|
|
{ |
278
|
|
|
$this->width = $value; |
279
|
|
|
|
280
|
|
|
return $this; |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* Get Height. |
285
|
|
|
* |
286
|
|
|
* @return number |
287
|
|
|
*/ |
288
|
5 |
|
public function getHeight() |
289
|
|
|
{ |
290
|
5 |
|
return $this->height; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
/** |
294
|
|
|
* Set Height. |
295
|
|
|
* |
296
|
|
|
* @param float $value |
297
|
|
|
* |
298
|
|
|
* @return $this |
299
|
|
|
*/ |
300
|
|
|
public function setHeight($value) |
301
|
|
|
{ |
302
|
|
|
$this->height = $value; |
303
|
|
|
|
304
|
|
|
return $this; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* Get show legend key. |
309
|
|
|
* |
310
|
|
|
* @return bool |
311
|
|
|
*/ |
312
|
5 |
|
public function getShowLegendKey() |
313
|
|
|
{ |
314
|
5 |
|
return $this->showLegendKey; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* Set show legend key |
319
|
|
|
* Specifies that legend keys should be shown in data labels. |
320
|
|
|
* |
321
|
|
|
* @param bool $value Show legend key |
322
|
|
|
* |
323
|
|
|
* @return $this |
324
|
|
|
*/ |
325
|
5 |
|
public function setShowLegendKey($value) |
326
|
|
|
{ |
327
|
5 |
|
$this->showLegendKey = $value; |
328
|
|
|
|
329
|
5 |
|
return $this; |
330
|
|
|
} |
331
|
|
|
|
332
|
|
|
/** |
333
|
|
|
* Get show value. |
334
|
|
|
* |
335
|
|
|
* @return bool |
336
|
|
|
*/ |
337
|
5 |
|
public function getShowVal() |
338
|
|
|
{ |
339
|
5 |
|
return $this->showVal; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* Set show val |
344
|
|
|
* Specifies that the value should be shown in data labels. |
345
|
|
|
* |
346
|
|
|
* @param bool $value Show val |
347
|
|
|
* |
348
|
|
|
* @return $this |
349
|
|
|
*/ |
350
|
7 |
|
public function setShowVal($value) |
351
|
|
|
{ |
352
|
7 |
|
$this->showVal = $value; |
353
|
|
|
|
354
|
7 |
|
return $this; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* Get show category name. |
359
|
|
|
* |
360
|
|
|
* @return bool |
361
|
|
|
*/ |
362
|
5 |
|
public function getShowCatName() |
363
|
|
|
{ |
364
|
5 |
|
return $this->showCatName; |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* Set show cat name |
369
|
|
|
* Specifies that the category name should be shown in data labels. |
370
|
|
|
* |
371
|
|
|
* @param bool $value Show cat name |
372
|
|
|
* |
373
|
|
|
* @return $this |
374
|
|
|
*/ |
375
|
7 |
|
public function setShowCatName($value) |
376
|
|
|
{ |
377
|
7 |
|
$this->showCatName = $value; |
378
|
|
|
|
379
|
7 |
|
return $this; |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* Get show data series name. |
384
|
|
|
* |
385
|
|
|
* @return bool |
386
|
|
|
*/ |
387
|
5 |
|
public function getShowSerName() |
388
|
|
|
{ |
389
|
5 |
|
return $this->showSerName; |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
/** |
393
|
|
|
* Set show ser name |
394
|
|
|
* Specifies that the series name should be shown in data labels. |
395
|
|
|
* |
396
|
|
|
* @param bool $value Show series name |
397
|
|
|
* |
398
|
|
|
* @return $this |
399
|
|
|
*/ |
400
|
5 |
|
public function setShowSerName($value) |
401
|
|
|
{ |
402
|
5 |
|
$this->showSerName = $value; |
403
|
|
|
|
404
|
5 |
|
return $this; |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* Get show percentage. |
409
|
|
|
* |
410
|
|
|
* @return bool |
411
|
|
|
*/ |
412
|
5 |
|
public function getShowPercent() |
413
|
|
|
{ |
414
|
5 |
|
return $this->showPercent; |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
/** |
418
|
|
|
* Set show percentage |
419
|
|
|
* Specifies that the percentage should be shown in data labels. |
420
|
|
|
* |
421
|
|
|
* @param bool $value Show percentage |
422
|
|
|
* |
423
|
|
|
* @return $this |
424
|
|
|
*/ |
425
|
7 |
|
public function setShowPercent($value) |
426
|
|
|
{ |
427
|
7 |
|
$this->showPercent = $value; |
428
|
|
|
|
429
|
7 |
|
return $this; |
430
|
|
|
} |
431
|
|
|
|
432
|
|
|
/** |
433
|
|
|
* Get show bubble size. |
434
|
|
|
* |
435
|
|
|
* @return bool |
436
|
|
|
*/ |
437
|
5 |
|
public function getShowBubbleSize() |
438
|
|
|
{ |
439
|
5 |
|
return $this->showBubbleSize; |
440
|
|
|
} |
441
|
|
|
|
442
|
|
|
/** |
443
|
|
|
* Set show bubble size |
444
|
|
|
* Specifies that the bubble size should be shown in data labels. |
445
|
|
|
* |
446
|
|
|
* @param bool $value Show bubble size |
447
|
|
|
* |
448
|
|
|
* @return $this |
449
|
|
|
*/ |
450
|
5 |
|
public function setShowBubbleSize($value) |
451
|
|
|
{ |
452
|
5 |
|
$this->showBubbleSize = $value; |
453
|
|
|
|
454
|
5 |
|
return $this; |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
/** |
458
|
|
|
* Get show leader lines. |
459
|
|
|
* |
460
|
|
|
* @return bool |
461
|
|
|
*/ |
462
|
5 |
|
public function getShowLeaderLines() |
463
|
|
|
{ |
464
|
5 |
|
return $this->showLeaderLines; |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
/** |
468
|
|
|
* Set show leader lines |
469
|
|
|
* Specifies that leader lines should be shown in data labels. |
470
|
|
|
* |
471
|
|
|
* @param bool $value Show leader lines |
472
|
|
|
* |
473
|
|
|
* @return $this |
474
|
|
|
*/ |
475
|
3 |
|
public function setShowLeaderLines($value) |
476
|
|
|
{ |
477
|
3 |
|
$this->showLeaderLines = $value; |
478
|
|
|
|
479
|
3 |
|
return $this; |
480
|
|
|
} |
481
|
|
|
} |
482
|
|
|
|