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