1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PhpOffice\PhpSpreadsheet\Chart; |
4
|
|
|
|
5
|
|
|
use PhpOffice\PhpSpreadsheet\Settings; |
6
|
|
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; |
7
|
|
|
|
8
|
|
|
class Chart |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* Chart Name. |
12
|
|
|
* |
13
|
|
|
* @var string |
14
|
|
|
*/ |
15
|
|
|
private $name = ''; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Worksheet. |
19
|
|
|
* |
20
|
|
|
* @var Worksheet |
21
|
|
|
*/ |
22
|
|
|
private $worksheet; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Chart Title. |
26
|
|
|
* |
27
|
|
|
* @var Title |
28
|
|
|
*/ |
29
|
|
|
private $title; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Chart Legend. |
33
|
|
|
* |
34
|
|
|
* @var Legend |
35
|
|
|
*/ |
36
|
|
|
private $legend; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* X-Axis Label. |
40
|
|
|
* |
41
|
|
|
* @var Title |
42
|
|
|
*/ |
43
|
|
|
private $xAxisLabel; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Y-Axis Label. |
47
|
|
|
* |
48
|
|
|
* @var Title |
49
|
|
|
*/ |
50
|
|
|
private $yAxisLabel; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Chart Plot Area. |
54
|
|
|
* |
55
|
|
|
* @var PlotArea |
56
|
|
|
*/ |
57
|
|
|
private $plotArea; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Plot Visible Only. |
61
|
|
|
* |
62
|
|
|
* @var bool |
63
|
|
|
*/ |
64
|
|
|
private $plotVisibleOnly = true; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Display Blanks as. |
68
|
|
|
* |
69
|
|
|
* @var string |
70
|
|
|
*/ |
71
|
|
|
private $displayBlanksAs = '0'; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Chart Asix Y as. |
75
|
|
|
* |
76
|
|
|
* @var Axis |
77
|
|
|
*/ |
78
|
|
|
private $yAxis; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Chart Asix X as. |
82
|
|
|
* |
83
|
|
|
* @var Axis |
84
|
|
|
*/ |
85
|
|
|
private $xAxis; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Chart Major Gridlines as. |
89
|
|
|
* |
90
|
|
|
* @var GridLines |
91
|
|
|
*/ |
92
|
|
|
private $majorGridlines; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Chart Minor Gridlines as. |
96
|
|
|
* |
97
|
|
|
* @var GridLines |
98
|
|
|
*/ |
99
|
|
|
private $minorGridlines; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Top-Left Cell Position. |
103
|
|
|
* |
104
|
|
|
* @var string |
105
|
|
|
*/ |
106
|
|
|
private $topLeftCellRef = 'A1'; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Top-Left X-Offset. |
110
|
|
|
* |
111
|
|
|
* @var int |
112
|
|
|
*/ |
113
|
|
|
private $topLeftXOffset = 0; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Top-Left Y-Offset. |
117
|
|
|
* |
118
|
|
|
* @var int |
119
|
|
|
*/ |
120
|
|
|
private $topLeftYOffset = 0; |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Bottom-Right Cell Position. |
124
|
|
|
* |
125
|
|
|
* @var string |
126
|
|
|
*/ |
127
|
|
|
private $bottomRightCellRef = 'A1'; |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Bottom-Right X-Offset. |
131
|
|
|
* |
132
|
|
|
* @var int |
133
|
|
|
*/ |
134
|
|
|
private $bottomRightXOffset = 10; |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Bottom-Right Y-Offset. |
138
|
|
|
* |
139
|
|
|
* @var int |
140
|
|
|
*/ |
141
|
|
|
private $bottomRightYOffset = 10; |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Create a new Chart. |
145
|
|
|
* |
146
|
|
|
* @param mixed $name |
147
|
|
|
* @param mixed $plotVisibleOnly |
148
|
|
|
* @param mixed $displayBlanksAs |
149
|
|
|
*/ |
150
|
15 |
|
public function __construct($name, Title $title = null, Legend $legend = null, PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', Title $xAxisLabel = null, Title $yAxisLabel = null, Axis $xAxis = null, Axis $yAxis = null, GridLines $majorGridlines = null, GridLines $minorGridlines = null) |
151
|
|
|
{ |
152
|
15 |
|
$this->name = $name; |
153
|
15 |
|
$this->title = $title; |
154
|
15 |
|
$this->legend = $legend; |
155
|
15 |
|
$this->xAxisLabel = $xAxisLabel; |
156
|
15 |
|
$this->yAxisLabel = $yAxisLabel; |
157
|
15 |
|
$this->plotArea = $plotArea; |
158
|
15 |
|
$this->plotVisibleOnly = $plotVisibleOnly; |
159
|
15 |
|
$this->displayBlanksAs = $displayBlanksAs; |
160
|
15 |
|
$this->xAxis = $xAxis; |
161
|
15 |
|
$this->yAxis = $yAxis; |
162
|
15 |
|
$this->majorGridlines = $majorGridlines; |
163
|
15 |
|
$this->minorGridlines = $minorGridlines; |
164
|
15 |
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Get Name. |
168
|
|
|
* |
169
|
|
|
* @return string |
170
|
|
|
*/ |
171
|
2 |
|
public function getName() |
172
|
|
|
{ |
173
|
2 |
|
return $this->name; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Get Worksheet. |
178
|
|
|
* |
179
|
|
|
* @return Worksheet |
180
|
|
|
*/ |
181
|
13 |
|
public function getWorksheet() |
182
|
|
|
{ |
183
|
13 |
|
return $this->worksheet; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Set Worksheet. |
188
|
|
|
* |
189
|
|
|
* @param Worksheet $pValue |
190
|
|
|
* |
191
|
|
|
* @throws Exception |
192
|
|
|
* |
193
|
|
|
* @return Chart |
194
|
|
|
*/ |
195
|
15 |
|
public function setWorksheet(Worksheet $pValue = null) |
196
|
|
|
{ |
197
|
15 |
|
$this->worksheet = $pValue; |
198
|
|
|
|
199
|
15 |
|
return $this; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Get Title. |
204
|
|
|
* |
205
|
|
|
* @return Title |
206
|
|
|
*/ |
207
|
14 |
|
public function getTitle() |
208
|
|
|
{ |
209
|
14 |
|
return $this->title; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Set Title. |
214
|
|
|
* |
215
|
|
|
* @param Title $title |
216
|
|
|
* |
217
|
|
|
* @return Chart |
218
|
|
|
*/ |
219
|
|
|
public function setTitle(Title $title) |
220
|
|
|
{ |
221
|
|
|
$this->title = $title; |
222
|
|
|
|
223
|
|
|
return $this; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Get Legend. |
228
|
|
|
* |
229
|
|
|
* @return Legend |
230
|
|
|
*/ |
231
|
14 |
|
public function getLegend() |
232
|
|
|
{ |
233
|
14 |
|
return $this->legend; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* Set Legend. |
238
|
|
|
* |
239
|
|
|
* @param Legend $legend |
240
|
|
|
* |
241
|
|
|
* @return Chart |
242
|
|
|
*/ |
243
|
|
|
public function setLegend(Legend $legend) |
244
|
|
|
{ |
245
|
|
|
$this->legend = $legend; |
246
|
|
|
|
247
|
|
|
return $this; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* Get X-Axis Label. |
252
|
|
|
* |
253
|
|
|
* @return Title |
254
|
|
|
*/ |
255
|
14 |
|
public function getXAxisLabel() |
256
|
|
|
{ |
257
|
14 |
|
return $this->xAxisLabel; |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* Set X-Axis Label. |
262
|
|
|
* |
263
|
|
|
* @param Title $label |
264
|
|
|
* |
265
|
|
|
* @return Chart |
266
|
|
|
*/ |
267
|
|
|
public function setXAxisLabel(Title $label) |
268
|
|
|
{ |
269
|
|
|
$this->xAxisLabel = $label; |
270
|
|
|
|
271
|
|
|
return $this; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
/** |
275
|
|
|
* Get Y-Axis Label. |
276
|
|
|
* |
277
|
|
|
* @return Title |
278
|
|
|
*/ |
279
|
14 |
|
public function getYAxisLabel() |
280
|
|
|
{ |
281
|
14 |
|
return $this->yAxisLabel; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
/** |
285
|
|
|
* Set Y-Axis Label. |
286
|
|
|
* |
287
|
|
|
* @param Title $label |
288
|
|
|
* |
289
|
|
|
* @return Chart |
290
|
|
|
*/ |
291
|
|
|
public function setYAxisLabel(Title $label) |
292
|
|
|
{ |
293
|
|
|
$this->yAxisLabel = $label; |
294
|
|
|
|
295
|
|
|
return $this; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* Get Plot Area. |
300
|
|
|
* |
301
|
|
|
* @return PlotArea |
302
|
|
|
*/ |
303
|
14 |
|
public function getPlotArea() |
304
|
|
|
{ |
305
|
14 |
|
return $this->plotArea; |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* Get Plot Visible Only. |
310
|
|
|
* |
311
|
|
|
* @return bool |
312
|
|
|
*/ |
313
|
|
|
public function getPlotVisibleOnly() |
314
|
|
|
{ |
315
|
|
|
return $this->plotVisibleOnly; |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* Set Plot Visible Only. |
320
|
|
|
* |
321
|
|
|
* @param bool $plotVisibleOnly |
322
|
|
|
* |
323
|
|
|
* @return Chart |
324
|
|
|
*/ |
325
|
|
|
public function setPlotVisibleOnly($plotVisibleOnly) |
326
|
|
|
{ |
327
|
|
|
$this->plotVisibleOnly = $plotVisibleOnly; |
328
|
|
|
|
329
|
|
|
return $this; |
330
|
|
|
} |
331
|
|
|
|
332
|
|
|
/** |
333
|
|
|
* Get Display Blanks as. |
334
|
|
|
* |
335
|
|
|
* @return string |
336
|
|
|
*/ |
337
|
|
|
public function getDisplayBlanksAs() |
338
|
|
|
{ |
339
|
|
|
return $this->displayBlanksAs; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* Set Display Blanks as. |
344
|
|
|
* |
345
|
|
|
* @param string $displayBlanksAs |
346
|
|
|
* |
347
|
|
|
* @return Chart |
348
|
|
|
*/ |
349
|
|
|
public function setDisplayBlanksAs($displayBlanksAs) |
350
|
|
|
{ |
351
|
|
|
$this->displayBlanksAs = $displayBlanksAs; |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
/** |
355
|
|
|
* Get yAxis. |
356
|
|
|
* |
357
|
|
|
* @return Axis |
358
|
|
|
*/ |
359
|
13 |
|
public function getChartAxisY() |
360
|
|
|
{ |
361
|
13 |
|
if ($this->yAxis !== null) { |
362
|
|
|
return $this->yAxis; |
363
|
|
|
} |
364
|
|
|
|
365
|
13 |
|
return new Axis(); |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
/** |
369
|
|
|
* Get xAxis. |
370
|
|
|
* |
371
|
|
|
* @return Axis |
372
|
|
|
*/ |
373
|
13 |
|
public function getChartAxisX() |
374
|
|
|
{ |
375
|
13 |
|
if ($this->xAxis !== null) { |
376
|
|
|
return $this->xAxis; |
377
|
|
|
} |
378
|
|
|
|
379
|
13 |
|
return new Axis(); |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* Get Major Gridlines. |
384
|
|
|
* |
385
|
|
|
* @return GridLines |
386
|
|
|
*/ |
387
|
13 |
|
public function getMajorGridlines() |
388
|
|
|
{ |
389
|
13 |
|
if ($this->majorGridlines !== null) { |
390
|
|
|
return $this->majorGridlines; |
391
|
|
|
} |
392
|
|
|
|
393
|
13 |
|
return new GridLines(); |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
/** |
397
|
|
|
* Get Minor Gridlines. |
398
|
|
|
* |
399
|
|
|
* @return GridLines |
400
|
|
|
*/ |
401
|
13 |
|
public function getMinorGridlines() |
402
|
|
|
{ |
403
|
13 |
|
if ($this->minorGridlines !== null) { |
404
|
|
|
return $this->minorGridlines; |
405
|
|
|
} |
406
|
|
|
|
407
|
13 |
|
return new GridLines(); |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
/** |
411
|
|
|
* Set the Top Left position for the chart. |
412
|
|
|
* |
413
|
|
|
* @param string $cell |
414
|
|
|
* @param int $xOffset |
415
|
|
|
* @param int $yOffset |
416
|
|
|
* |
417
|
|
|
* @return Chart |
418
|
|
|
*/ |
419
|
15 |
|
public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null) |
420
|
|
|
{ |
421
|
15 |
|
$this->topLeftCellRef = $cell; |
422
|
15 |
|
if ($xOffset !== null) { |
423
|
2 |
|
$this->setTopLeftXOffset($xOffset); |
424
|
|
|
} |
425
|
15 |
|
if ($yOffset !== null) { |
426
|
2 |
|
$this->setTopLeftYOffset($yOffset); |
427
|
|
|
} |
428
|
|
|
|
429
|
15 |
|
return $this; |
430
|
|
|
} |
431
|
|
|
|
432
|
|
|
/** |
433
|
|
|
* Get the top left position of the chart. |
434
|
|
|
* |
435
|
|
|
* @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell |
436
|
|
|
*/ |
437
|
13 |
|
public function getTopLeftPosition() |
438
|
|
|
{ |
439
|
|
|
return [ |
440
|
13 |
|
'cell' => $this->topLeftCellRef, |
441
|
13 |
|
'xOffset' => $this->topLeftXOffset, |
442
|
13 |
|
'yOffset' => $this->topLeftYOffset, |
443
|
|
|
]; |
444
|
|
|
} |
445
|
|
|
|
446
|
|
|
/** |
447
|
|
|
* Get the cell address where the top left of the chart is fixed. |
448
|
|
|
* |
449
|
|
|
* @return string |
450
|
|
|
*/ |
451
|
|
|
public function getTopLeftCell() |
452
|
|
|
{ |
453
|
|
|
return $this->topLeftCellRef; |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
/** |
457
|
|
|
* Set the Top Left cell position for the chart. |
458
|
|
|
* |
459
|
|
|
* @param string $cell |
460
|
|
|
* |
461
|
|
|
* @return Chart |
462
|
|
|
*/ |
463
|
|
|
public function setTopLeftCell($cell) |
464
|
|
|
{ |
465
|
|
|
$this->topLeftCellRef = $cell; |
466
|
|
|
|
467
|
|
|
return $this; |
468
|
|
|
} |
469
|
|
|
|
470
|
|
|
/** |
471
|
|
|
* Set the offset position within the Top Left cell for the chart. |
472
|
|
|
* |
473
|
|
|
* @param int $xOffset |
474
|
|
|
* @param int $yOffset |
475
|
|
|
* |
476
|
|
|
* @return Chart |
477
|
|
|
*/ |
478
|
|
|
public function setTopLeftOffset($xOffset, $yOffset) |
479
|
|
|
{ |
480
|
|
|
if ($xOffset !== null) { |
481
|
|
|
$this->setTopLeftXOffset($xOffset); |
482
|
|
|
} |
483
|
|
|
|
484
|
|
|
if ($yOffset !== null) { |
485
|
|
|
$this->setTopLeftYOffset($yOffset); |
486
|
|
|
} |
487
|
|
|
|
488
|
|
|
return $this; |
489
|
|
|
} |
490
|
|
|
|
491
|
|
|
/** |
492
|
|
|
* Get the offset position within the Top Left cell for the chart. |
493
|
|
|
* |
494
|
|
|
* @return int[] |
495
|
|
|
*/ |
496
|
|
|
public function getTopLeftOffset() |
497
|
|
|
{ |
498
|
|
|
return [ |
499
|
|
|
'X' => $this->topLeftXOffset, |
500
|
|
|
'Y' => $this->topLeftYOffset, |
501
|
|
|
]; |
502
|
|
|
} |
503
|
|
|
|
504
|
2 |
|
public function setTopLeftXOffset($xOffset) |
505
|
|
|
{ |
506
|
2 |
|
$this->topLeftXOffset = $xOffset; |
507
|
|
|
|
508
|
2 |
|
return $this; |
509
|
|
|
} |
510
|
|
|
|
511
|
|
|
public function getTopLeftXOffset() |
512
|
|
|
{ |
513
|
|
|
return $this->topLeftXOffset; |
514
|
|
|
} |
515
|
|
|
|
516
|
2 |
|
public function setTopLeftYOffset($yOffset) |
517
|
|
|
{ |
518
|
2 |
|
$this->topLeftYOffset = $yOffset; |
519
|
|
|
|
520
|
2 |
|
return $this; |
521
|
|
|
} |
522
|
|
|
|
523
|
|
|
public function getTopLeftYOffset() |
524
|
|
|
{ |
525
|
|
|
return $this->topLeftYOffset; |
526
|
|
|
} |
527
|
|
|
|
528
|
|
|
/** |
529
|
|
|
* Set the Bottom Right position of the chart. |
530
|
|
|
* |
531
|
|
|
* @param string $cell |
532
|
|
|
* @param int $xOffset |
533
|
|
|
* @param int $yOffset |
534
|
|
|
* |
535
|
|
|
* @return Chart |
536
|
|
|
*/ |
537
|
15 |
|
public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null) |
538
|
|
|
{ |
539
|
15 |
|
$this->bottomRightCellRef = $cell; |
540
|
15 |
|
if ($xOffset !== null) { |
541
|
2 |
|
$this->setBottomRightXOffset($xOffset); |
542
|
|
|
} |
543
|
15 |
|
if ($yOffset !== null) { |
544
|
2 |
|
$this->setBottomRightYOffset($yOffset); |
545
|
|
|
} |
546
|
|
|
|
547
|
15 |
|
return $this; |
548
|
|
|
} |
549
|
|
|
|
550
|
|
|
/** |
551
|
|
|
* Get the bottom right position of the chart. |
552
|
|
|
* |
553
|
|
|
* @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell |
554
|
|
|
*/ |
555
|
13 |
|
public function getBottomRightPosition() |
556
|
|
|
{ |
557
|
|
|
return [ |
558
|
13 |
|
'cell' => $this->bottomRightCellRef, |
559
|
13 |
|
'xOffset' => $this->bottomRightXOffset, |
560
|
13 |
|
'yOffset' => $this->bottomRightYOffset, |
561
|
|
|
]; |
562
|
|
|
} |
563
|
|
|
|
564
|
|
|
public function setBottomRightCell($cell) |
565
|
|
|
{ |
566
|
|
|
$this->bottomRightCellRef = $cell; |
567
|
|
|
|
568
|
|
|
return $this; |
569
|
|
|
} |
570
|
|
|
|
571
|
|
|
/** |
572
|
|
|
* Get the cell address where the bottom right of the chart is fixed. |
573
|
|
|
* |
574
|
|
|
* @return string |
575
|
|
|
*/ |
576
|
|
|
public function getBottomRightCell() |
577
|
|
|
{ |
578
|
|
|
return $this->bottomRightCellRef; |
579
|
|
|
} |
580
|
|
|
|
581
|
|
|
/** |
582
|
|
|
* Set the offset position within the Bottom Right cell for the chart. |
583
|
|
|
* |
584
|
|
|
* @param int $xOffset |
585
|
|
|
* @param int $yOffset |
586
|
|
|
* |
587
|
|
|
* @return Chart |
588
|
|
|
*/ |
589
|
|
|
public function setBottomRightOffset($xOffset, $yOffset) |
590
|
|
|
{ |
591
|
|
|
if ($xOffset !== null) { |
592
|
|
|
$this->setBottomRightXOffset($xOffset); |
593
|
|
|
} |
594
|
|
|
|
595
|
|
|
if ($yOffset !== null) { |
596
|
|
|
$this->setBottomRightYOffset($yOffset); |
597
|
|
|
} |
598
|
|
|
|
599
|
|
|
return $this; |
600
|
|
|
} |
601
|
|
|
|
602
|
|
|
/** |
603
|
|
|
* Get the offset position within the Bottom Right cell for the chart. |
604
|
|
|
* |
605
|
|
|
* @return int[] |
606
|
|
|
*/ |
607
|
|
|
public function getBottomRightOffset() |
608
|
|
|
{ |
609
|
|
|
return [ |
610
|
|
|
'X' => $this->bottomRightXOffset, |
611
|
|
|
'Y' => $this->bottomRightYOffset, |
612
|
|
|
]; |
613
|
|
|
} |
614
|
|
|
|
615
|
2 |
|
public function setBottomRightXOffset($xOffset) |
616
|
|
|
{ |
617
|
2 |
|
$this->bottomRightXOffset = $xOffset; |
618
|
|
|
|
619
|
2 |
|
return $this; |
620
|
|
|
} |
621
|
|
|
|
622
|
|
|
public function getBottomRightXOffset() |
623
|
|
|
{ |
624
|
|
|
return $this->bottomRightXOffset; |
625
|
|
|
} |
626
|
|
|
|
627
|
2 |
|
public function setBottomRightYOffset($yOffset) |
628
|
|
|
{ |
629
|
2 |
|
$this->bottomRightYOffset = $yOffset; |
630
|
|
|
|
631
|
2 |
|
return $this; |
632
|
|
|
} |
633
|
|
|
|
634
|
|
|
public function getBottomRightYOffset() |
635
|
|
|
{ |
636
|
|
|
return $this->bottomRightYOffset; |
637
|
|
|
} |
638
|
|
|
|
639
|
14 |
|
public function refresh() |
640
|
|
|
{ |
641
|
14 |
|
if ($this->worksheet !== null) { |
642
|
14 |
|
$this->plotArea->refresh($this->worksheet); |
643
|
|
|
} |
644
|
14 |
|
} |
645
|
|
|
|
646
|
|
|
/** |
647
|
|
|
* Render the chart to given file (or stream). |
648
|
|
|
* |
649
|
|
|
* @param string $outputDestination Name of the file render to |
650
|
|
|
* |
651
|
|
|
* @return bool true on success |
652
|
|
|
*/ |
653
|
1 |
|
public function render($outputDestination = null) |
654
|
|
|
{ |
655
|
1 |
|
if ($outputDestination == 'php://output') { |
656
|
|
|
$outputDestination = null; |
657
|
|
|
} |
658
|
|
|
|
659
|
1 |
|
$libraryName = Settings::getChartRenderer(); |
660
|
1 |
|
if ($libraryName === null) { |
661
|
|
|
return false; |
662
|
|
|
} |
663
|
|
|
|
664
|
|
|
// Ensure that data series values are up-to-date before we render |
665
|
1 |
|
$this->refresh(); |
666
|
|
|
|
667
|
1 |
|
$renderer = new $libraryName($this); |
668
|
|
|
|
669
|
1 |
|
return $renderer->render($outputDestination); |
670
|
|
|
} |
671
|
|
|
} |
672
|
|
|
|