Completed
Pull Request — develop (#565)
by
unknown
06:14
created

ObjectsChart::render()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3.3332

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 4
cts 6
cp 0.6667
rs 9.8666
c 0
b 0
f 0
cc 3
nc 3
nop 0
crap 3.3332
1
<?php
2
3
namespace PhpOffice\PhpPresentation\Writer\ODPresentation;
4
5
use PhpOffice\Common\Adapter\Zip\ZipInterface;
6
use PhpOffice\Common\Drawing as CommonDrawing;
7
use PhpOffice\Common\Text;
8
use PhpOffice\Common\XMLWriter;
9
use PhpOffice\PhpPresentation\Shape\Chart;
10
use PhpOffice\PhpPresentation\Shape\Chart\Title;
11
use PhpOffice\PhpPresentation\Shape\Chart\Type\AbstractTypeBar;
12
use PhpOffice\PhpPresentation\Shape\Chart\Type\AbstractTypePie;
13
use PhpOffice\PhpPresentation\Shape\Chart\Type\Area;
14
use PhpOffice\PhpPresentation\Shape\Chart\Type\Bar;
15
use PhpOffice\PhpPresentation\Shape\Chart\Type\Bar3D;
16
use PhpOffice\PhpPresentation\Shape\Chart\Type\Doughnut;
17
use PhpOffice\PhpPresentation\Shape\Chart\Type\Line;
18
use PhpOffice\PhpPresentation\Shape\Chart\Type\Pie3D;
19
use PhpOffice\PhpPresentation\Shape\Chart\Type\Scatter;
20
use PhpOffice\PhpPresentation\Style\Fill;
21
use PhpOffice\PhpPresentation\Style\Outline;
22
23
class ObjectsChart extends AbstractDecoratorWriter
24
{
25
    /**
26
     * @var XMLWriter
27
     */
28
    protected $xmlContent;
29
    /**
30
     * @var mixed
31
     */
32
    protected $arrayData;
33
    /**
34
     * @var mixed
35
     */
36
    protected $arrayTitle;
37
    /**
38
     * @var integer
39
     */
40
    protected $numData;
41
    /**
42
     * @var integer
43
     */
44
    protected $numSeries;
45
    /**
46
     * @var string
47
     */
48
    protected $rangeCol;
49
50
    /**
51
     * @return ZipInterface
52
     * @throws \Exception
53
     */
54 39
    public function render()
55
    {
56 39
        foreach ($this->getArrayChart() as $keyChart => $shapeChart) {
57 1
            $content = $this->writeContentPart($shapeChart);
58
59
            if (!empty($content)) {
60
                $this->getZip()->addFromString('Object '.$keyChart.'/content.xml', $content);
61
            }
62
        }
63
64 38
        return $this->getZip();
65
    }
66
67
    /**
68
     * @param Chart $chart
69
     * @return string
70
     * @throws \Exception
71
     */
72 1
    protected function writeContentPart(Chart $chart)
73
    {
74 1
        $this->xmlContent = new XMLWriter(XMLWriter::STORAGE_MEMORY);
75
76 1
        $chartType = $chart->getPlotArea()->getType();
77
78
        // Data
79 1
        $this->arrayData = array();
80 1
        $this->arrayTitle = array();
81 1
        $this->numData = 0;
82 1
        foreach ($chartType->getSeries() as $series) {
83
            $inc = 0;
84
            $this->arrayTitle[] = $series->getTitle();
85
            foreach ($series->getValues() as $key => $value) {
86
                if (!isset($this->arrayData[$inc])) {
87
                    $this->arrayData[$inc] = array();
88
                }
89
                if (empty($this->arrayData[$inc])) {
90
                    $this->arrayData[$inc][] = $key;
91
                }
92
                $this->arrayData[$inc][] = $value;
93
                $inc++;
94
            }
95
            if ($inc > $this->numData) {
96
                $this->numData = $inc;
97
            }
98
        }
99
100
        // office:document-content
101 1
        $this->xmlContent->startElement('office:document-content');
102 1
        $this->xmlContent->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0');
103 1
        $this->xmlContent->writeAttribute('xmlns:style', 'urn:oasis:names:tc:opendocument:xmlns:style:1.0');
104 1
        $this->xmlContent->writeAttribute('xmlns:text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0');
105 1
        $this->xmlContent->writeAttribute('xmlns:table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0');
106 1
        $this->xmlContent->writeAttribute('xmlns:draw', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0');
107 1
        $this->xmlContent->writeAttribute('xmlns:fo', 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0');
108 1
        $this->xmlContent->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
109 1
        $this->xmlContent->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
110 1
        $this->xmlContent->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0');
111 1
        $this->xmlContent->writeAttribute('xmlns:number', 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0');
112 1
        $this->xmlContent->writeAttribute('xmlns:svg', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0');
113 1
        $this->xmlContent->writeAttribute('xmlns:chart', 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0');
114 1
        $this->xmlContent->writeAttribute('xmlns:dr3d', 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0');
115 1
        $this->xmlContent->writeAttribute('xmlns:math', 'http://www.w3.org/1998/Math/MathML');
116 1
        $this->xmlContent->writeAttribute('xmlns:form', 'urn:oasis:names:tc:opendocument:xmlns:form:1.0');
117 1
        $this->xmlContent->writeAttribute('xmlns:script', 'urn:oasis:names:tc:opendocument:xmlns:script:1.0');
118 1
        $this->xmlContent->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office');
119 1
        $this->xmlContent->writeAttribute('xmlns:ooow', 'http://openoffice.org/2004/writer');
120 1
        $this->xmlContent->writeAttribute('xmlns:oooc', 'http://openoffice.org/2004/calc');
121 1
        $this->xmlContent->writeAttribute('xmlns:dom', 'http://www.w3.org/2001/xml-events');
122 1
        $this->xmlContent->writeAttribute('xmlns:xforms', 'http://www.w3.org/2002/xforms');
123 1
        $this->xmlContent->writeAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema');
124 1
        $this->xmlContent->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
125 1
        $this->xmlContent->writeAttribute('xmlns:rpt', 'http://openoffice.org/2005/report');
126 1
        $this->xmlContent->writeAttribute('xmlns:of', 'urn:oasis:names:tc:opendocument:xmlns:of:1.2');
127 1
        $this->xmlContent->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml');
128 1
        $this->xmlContent->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#');
129 1
        $this->xmlContent->writeAttribute('xmlns:tableooo', 'http://openoffice.org/2009/table');
130 1
        $this->xmlContent->writeAttribute('xmlns:chartooo', 'http://openoffice.org/2010/chart');
131 1
        $this->xmlContent->writeAttribute('xmlns:drawooo', 'http://openoffice.org/2010/draw');
132 1
        $this->xmlContent->writeAttribute('xmlns:calcext', 'urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0');
133 1
        $this->xmlContent->writeAttribute('xmlns:loext', 'urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0');
134 1
        $this->xmlContent->writeAttribute('xmlns:field', 'urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0');
135 1
        $this->xmlContent->writeAttribute('xmlns:formx', 'urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0');
136 1
        $this->xmlContent->writeAttribute('xmlns:css3t', 'http://www.w3.org/TR/css3-text/');
137 1
        $this->xmlContent->writeAttribute('office:version', '1.2');
138
139
        // office:automatic-styles
140 1
        $this->xmlContent->startElement('office:automatic-styles');
141
142
        // Styles
143 1
        $this->writeChartStyle($chart);
144 1
        $this->writeAxisStyle($chart);
145
        $this->numSeries = 0;
146
        foreach ($chartType->getSeries() as $series) {
147
            $this->writeSeriesStyle($chart, $series);
148
            $this->numSeries++;
149
        }
150
        $this->writeFloorStyle();
151
        $this->writeLegendStyle($chart);
152
        $this->writePlotAreaStyle($chart);
153
        $this->writeTitleStyle($chart->getTitle());
154
        $this->writeWallStyle($chart);
155
156
        // > office:automatic-styles
157
        $this->xmlContent->endElement();
158
159
        // office:body
160
        $this->xmlContent->startElement('office:body');
161
        // office:chart
162
        $this->xmlContent->startElement('office:chart');
163
        // office:chart
164
        $this->xmlContent->startElement('chart:chart');
165
        $this->xmlContent->writeAttribute('svg:width', Text::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getWidth()), 3) . 'cm');
166
        $this->xmlContent->writeAttribute('svg:height', Text::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getHeight()), 3) . 'cm');
167
        $this->xmlContent->writeAttribute('xlink:href', '.');
168
        $this->xmlContent->writeAttribute('xlink:type', 'simple');
169
        $this->xmlContent->writeAttribute('chart:style-name', 'styleChart');
170
        $this->xmlContent->writeAttributeIf($chartType instanceof Area, 'chart:class', 'chart:area');
171
        $this->xmlContent->writeAttributeIf($chartType instanceof AbstractTypeBar, 'chart:class', 'chart:bar');
172
        if (!($chartType instanceof Doughnut)) {
173
            $this->xmlContent->writeAttributeIf($chartType instanceof AbstractTypePie, 'chart:class', 'chart:circle');
174
        }
175
        $this->xmlContent->writeAttributeIf($chartType instanceof Doughnut, 'chart:class', 'chart:ring');
176
        $this->xmlContent->writeAttributeIf($chartType instanceof Line, 'chart:class', 'chart:line');
177
        $this->xmlContent->writeAttributeIf($chartType instanceof Scatter, 'chart:class', 'chart:scatter');
178
179
        $this->writeTitle($chart->getTitle());
180
        $this->writeLegend($chart);
181
        $this->writePlotArea($chart);
182
        $this->writeTable();
183
184
        // > chart:chart
185
        $this->xmlContent->endElement();
186
        // > office:chart
187
        $this->xmlContent->endElement();
188
        // > office:body
189
        $this->xmlContent->endElement();
190
        // > office:document-content
191
        $this->xmlContent->endElement();
192
193
        return $this->xmlContent->getData();
194
    }
195
196
    /**
197
     * @param Chart $chart
198
     * @throws \Exception
199
     */
200
    private function writeAxis(Chart $chart)
201
    {
202
        $chartType = $chart->getPlotArea()->getType();
203
204
        // chart:axis
205
        $this->xmlContent->startElement('chart:axis');
206
        $this->xmlContent->writeAttribute('chart:dimension', 'x');
207
        $this->xmlContent->writeAttribute('chart:name', 'primary-x');
208
        $this->xmlContent->writeAttribute('chart:style-name', 'styleAxisX');
209
        // chart:axis > chart:categories
210
        $this->xmlContent->startElement('chart:categories');
211
        $this->xmlContent->writeAttribute('table:cell-range-address', 'table-local.$A$2:.$A$'.($this->numData+1));
212
        $this->xmlContent->endElement();
213
        // chart:axis > chart:grid
214
        $this->writeGridline($chart->getPlotArea()->getAxisX()->getMajorGridlines(), 'styleAxisXGridlinesMajor', 'major');
215
        // chart:axis > chart:grid
216
        $this->writeGridline($chart->getPlotArea()->getAxisX()->getMinorGridlines(), 'styleAxisXGridlinesMinor', 'minor');
217
        // ##chart:axis
218
        $this->xmlContent->endElement();
219
220
        // chart:axis
221
        $this->xmlContent->startElement('chart:axis');
222
        $this->xmlContent->writeAttribute('chart:dimension', 'y');
223
        $this->xmlContent->writeAttribute('chart:name', 'primary-y');
224
        $this->xmlContent->writeAttribute('chart:style-name', 'styleAxisY');
225
        // chart:axis > chart:grid
226
        $this->writeGridline($chart->getPlotArea()->getAxisY()->getMajorGridlines(), 'styleAxisYGridlinesMajor', 'major');
227
        // chart:axis > chart:grid
228
        $this->writeGridline($chart->getPlotArea()->getAxisY()->getMinorGridlines(), 'styleAxisYGridlinesMinor', 'minor');
229
        // ##chart:axis
230
        $this->xmlContent->endElement();
231
232
        if ($chartType instanceof Bar3D || $chartType instanceof Pie3D) {
233
            // chart:axis
234
            $this->xmlContent->startElement('chart:axis');
235
            $this->xmlContent->writeAttribute('chart:dimension', 'z');
236
            $this->xmlContent->writeAttribute('chart:name', 'primary-z');
237
            // > chart:axis
238
            $this->xmlContent->endElement();
239
        }
240
    }
241
242
    /**
243
     * @param Chart\Gridlines $oGridlines
244
     * @param string $styleName
245
     * @param string $chartClass
246
     */
247
    protected function writeGridline(Chart\Gridlines $oGridlines, $styleName, $chartClass)
248
    {
249
        if (!($oGridlines instanceof Chart\Gridlines)) {
250
            return ;
251
        }
252
253
        $this->xmlContent->startElement('chart:grid');
254
        $this->xmlContent->writeAttribute('chart:style-name', $styleName);
255
        $this->xmlContent->writeAttribute('chart:class', $chartClass);
256
        $this->xmlContent->endElement();
257
    }
258
259
    /**
260
     * @param Chart $chart
261
     * @throws \Exception
262
     * @todo Set function in \PhpPresentation\Shape\Chart\Axis for defining width and color of the axis
263
     */
264 1
    protected function writeAxisStyle(Chart $chart)
265
    {
266 1
        $chartType = $chart->getPlotArea()->getType();
267
268
        // AxisX
269
        // style:style
270 1
        $this->xmlContent->startElement('style:style');
271 1
        $this->xmlContent->writeAttribute('style:name', 'styleAxisX');
272 1
        $this->xmlContent->writeAttribute('style:family', 'chart');
273
        // style:style > style:chart-properties
274 1
        $this->xmlContent->startElement('style:chart-properties');
275 1
        $this->xmlContent->writeAttribute('chart:display-label', 'true');
276 1
        $this->xmlContent->writeAttribute('chart:tick-marks-major-inner', 'false');
277 1
        $this->xmlContent->writeAttribute('chart:tick-marks-major-outer', 'false');
278 1
        if ($chartType instanceof AbstractTypePie) {
279
            $this->xmlContent->writeAttribute('chart:reverse-direction', 'true');
280
        }
281 1
        if ($chart->getPlotArea()->getAxisX()->getMinBounds() != null) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing $chart->getPlotArea()->getAxisX()->getMinBounds() of type integer|null against null; this is ambiguous if the integer can be zero. Consider using a strict comparison !== instead.
Loading history...
282
            $this->xmlContent->writeAttribute('chart:minimum', $chart->getPlotArea()->getAxisX()->getMinBounds());
283
        }
284 1
        if ($chart->getPlotArea()->getAxisX()->getMaxBounds() != null) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing $chart->getPlotArea()->getAxisX()->getMaxBounds() of type integer|null against null; this is ambiguous if the integer can be zero. Consider using a strict comparison !== instead.
Loading history...
285
            $this->xmlContent->writeAttribute('chart:maximum', $chart->getPlotArea()->getAxisX()->getMaxBounds());
286
        }
287 1
        $this->xmlContent->endElement();
288
        // style:style > style:graphic-properties
289 1
        $this->xmlContent->startElement('style:graphic-properties');
290 1
        $this->xmlContent->writeAttribute('draw:stroke', 'solid');
291 1
        $this->xmlContent->writeAttribute('svg:stroke-width', '0.026cm');
292 1
        $this->xmlContent->writeAttribute('svg:stroke-color', '#878787');
293 1
        $this->xmlContent->endElement();
294
        // style:style > style:text-properties
295 1
        $oFont = $chart->getPlotArea()->getAxisX()->getFont();
296 1
        $this->xmlContent->startElement('style:text-properties');
297 1
        $this->xmlContent->writeAttribute('fo:color', '#'.$oFont->getColor()->getRGB());
298 1
        $this->xmlContent->writeAttribute('fo:font-family', $oFont->getName());
299 1
        $this->xmlContent->writeAttribute('fo:font-size', $oFont->getSize().'pt');
300 1
        $this->xmlContent->writeAttribute('fo:font-style', $oFont->isItalic() ? 'italic' : 'normal');
301 1
        $this->xmlContent->endElement();
302
        // ##style:style
303 1
        $this->xmlContent->endElement();
304
305
        // AxisX GridLines Major
306 1
        $this->writeGridlineStyle($chart->getPlotArea()->getAxisX()->getMajorGridlines(), 'styleAxisXGridlinesMajor');
307
308
        // AxisX GridLines Minor
309
        $this->writeGridlineStyle($chart->getPlotArea()->getAxisX()->getMinorGridlines(), 'styleAxisXGridlinesMinor');
310
311
        // AxisY
312
        // style:style
313
        $this->xmlContent->startElement('style:style');
314
        $this->xmlContent->writeAttribute('style:name', 'styleAxisY');
315
        $this->xmlContent->writeAttribute('style:family', 'chart');
316
        // style:style > style:chart-properties
317
        $this->xmlContent->startElement('style:chart-properties');
318
        $this->xmlContent->writeAttribute('chart:display-label', 'true');
319
        $this->xmlContent->writeAttribute('chart:tick-marks-major-inner', 'false');
320
        $this->xmlContent->writeAttribute('chart:tick-marks-major-outer', 'false');
321
        if ($chartType instanceof AbstractTypePie) {
322
            $this->xmlContent->writeAttribute('chart:reverse-direction', 'true');
323
        }
324
        if ($chart->getPlotArea()->getAxisY()->getMinBounds() !== null) {
325
            $this->xmlContent->writeAttribute('chart:minimum', $chart->getPlotArea()->getAxisY()->getMinBounds());
326
        }
327
        if ($chart->getPlotArea()->getAxisY()->getMaxBounds() !== null) {
328
            $this->xmlContent->writeAttribute('chart:maximum', $chart->getPlotArea()->getAxisY()->getMaxBounds());
329
        }
330
        $this->xmlContent->endElement();
331
        // style:graphic-properties
332
        $this->xmlContent->startElement('style:graphic-properties');
333
        $this->xmlContent->writeAttribute('draw:stroke', 'solid');
334
        $this->xmlContent->writeAttribute('svg:stroke-width', '0.026cm');
335
        $this->xmlContent->writeAttribute('svg:stroke-color', '#878787');
336
        $this->xmlContent->endElement();
337
        // style:style > style:text-properties
338
        $oFont = $chart->getPlotArea()->getAxisY()->getFont();
339
        $this->xmlContent->startElement('style:text-properties');
340
        $this->xmlContent->writeAttribute('fo:color', '#'.$oFont->getColor()->getRGB());
341
        $this->xmlContent->writeAttribute('fo:font-family', $oFont->getName());
342
        $this->xmlContent->writeAttribute('fo:font-size', $oFont->getSize().'pt');
343
        $this->xmlContent->writeAttribute('fo:font-style', $oFont->isItalic() ? 'italic' : 'normal');
344
        $this->xmlContent->endElement();
345
        // ## style:style
346
        $this->xmlContent->endElement();
347
348
        // AxisY GridLines Major
349
        $this->writeGridlineStyle($chart->getPlotArea()->getAxisY()->getMajorGridlines(), 'styleAxisYGridlinesMajor');
350
351
        // AxisY GridLines Minor
352
        $this->writeGridlineStyle($chart->getPlotArea()->getAxisY()->getMinorGridlines(), 'styleAxisYGridlinesMinor');
353
    }
354
355
    /**
356
     * @param Chart\Gridlines $oGridlines
357
     * @param string $styleName
358
     */
359
    protected function writeGridlineStyle(Chart\Gridlines $oGridlines, $styleName)
360
    {
361
        if (!($oGridlines instanceof Chart\Gridlines)) {
362
            return;
363
        }
364
        // style:style
365
        $this->xmlContent->startElement('style:style');
366
        $this->xmlContent->writeAttribute('style:name', $styleName);
367
        $this->xmlContent->writeAttribute('style:family', 'chart');
368
        // style:style > style:graphic-properties
369
        $this->xmlContent->startElement('style:graphic-properties');
370
        $this->xmlContent->writeAttribute('svg:stroke-width', number_format(CommonDrawing::pointsToCentimeters($oGridlines->getOutline()->getWidth()), 2, '.', '').'cm');
371
        $this->xmlContent->writeAttribute('svg:stroke-color', '#'.$oGridlines->getOutline()->getFill()->getStartColor()->getRGB());
372
        $this->xmlContent->endElement();
373
        // ##style:style
374
        $this->xmlContent->endElement();
375
    }
376
377
    /**
378
     * @param Chart $chart
379
     */
380 1
    private function writeChartStyle(Chart $chart)
381
    {
382
        // style:style
383 1
        $this->xmlContent->startElement('style:style');
384 1
        $this->xmlContent->writeAttribute('style:name', 'styleChart');
385 1
        $this->xmlContent->writeAttribute('style:family', 'chart');
386
        // style:graphic-properties
387 1
        $this->xmlContent->startElement('style:graphic-properties');
388 1
        $this->xmlContent->writeAttribute('draw:stroke', $chart->getFill()->getFillType());
389 1
        $this->xmlContent->writeAttribute('draw:fill-color', '#'.$chart->getFill()->getStartColor()->getRGB());
390
        // > style:graphic-properties
391 1
        $this->xmlContent->endElement();
392
        // > style:style
393 1
        $this->xmlContent->endElement();
394 1
    }
395
396
    private function writeFloor()
397
    {
398
        // chart:floor
399
        $this->xmlContent->startElement('chart:floor');
400
        $this->xmlContent->writeAttribute('chart:style-name', 'styleFloor');
401
        // > chart:floor
402
        $this->xmlContent->endElement();
403
    }
404
405
    private function writeFloorStyle()
406
    {
407
        // style:style
408
        $this->xmlContent->startElement('style:style');
409
        $this->xmlContent->writeAttribute('style:name', 'styleFloor');
410
        $this->xmlContent->writeAttribute('style:family', 'chart');
411
        // style:chart-properties
412
        $this->xmlContent->startElement('style:graphic-properties');
413
        $this->xmlContent->writeAttribute('draw:fill', 'none');
414
        //@todo : Permit edit color and size border of floor
415
        $this->xmlContent->writeAttribute('draw:stroke', 'solid');
416
        $this->xmlContent->writeAttribute('svg:stroke-width', '0.026cm');
417
        $this->xmlContent->writeAttribute('svg:stroke-color', '#878787');
418
        // > style:chart-properties
419
        $this->xmlContent->endElement();
420
        // > style:style
421
        $this->xmlContent->endElement();
422
    }
423
424
    /**
425
     * @param Chart $chart
426
     */
427
    private function writeLegend(Chart $chart)
428
    {
429
        // chart:legend
430
        $this->xmlContent->startElement('chart:legend');
431
        switch ($chart->getLegend()->getPosition()) {
432
            case Chart\Legend::POSITION_BOTTOM:
433
                $position = 'bottom';
434
                break;
435
            case Chart\Legend::POSITION_LEFT:
436
                $position = 'start';
437
                break;
438
            case Chart\Legend::POSITION_TOP:
439
                $position = 'top';
440
                break;
441
            case Chart\Legend::POSITION_TOPRIGHT:
442
                $position = 'top-end';
443
                break;
444
            case Chart\Legend::POSITION_RIGHT:
445
            default:
446
                $position = 'end';
447
                break;
448
        }
449
        $this->xmlContent->writeAttribute('chart:legend-position', $position);
450
        $this->xmlContent->writeAttribute('svg:x', Text::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getLegend()->getOffsetX()), 3) . 'cm');
451
        $this->xmlContent->writeAttribute('svg:y', Text::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getLegend()->getOffsetY()), 3) . 'cm');
452
        $this->xmlContent->writeAttribute('style:legend-expansion', 'high');
453
        $this->xmlContent->writeAttribute('chart:style-name', 'styleLegend');
454
        // > chart:legend
455
        $this->xmlContent->endElement();
456
    }
457
458
    /**
459
     * @param Chart $chart
460
     */
461
    private function writeLegendStyle(Chart $chart)
462
    {
463
        // style:style
464
        $this->xmlContent->startElement('style:style');
465
        $this->xmlContent->writeAttribute('style:name', 'styleLegend');
466
        $this->xmlContent->writeAttribute('style:family', 'chart');
467
        // style:chart-properties
468
        $this->xmlContent->startElement('style:chart-properties');
469
        $this->xmlContent->writeAttribute('chart:auto-position', 'true');
470
        // > style:chart-properties
471
        $this->xmlContent->endElement();
472
        // style:text-properties
473
        $this->xmlContent->startElement('style:text-properties');
474
        $this->xmlContent->writeAttribute('fo:color', '#'.$chart->getLegend()->getFont()->getColor()->getRGB());
475
        $this->xmlContent->writeAttribute('fo:font-family', $chart->getLegend()->getFont()->getName());
476
        $this->xmlContent->writeAttribute('fo:font-size', $chart->getLegend()->getFont()->getSize().'pt');
477
        $this->xmlContent->writeAttribute('fo:font-style', $chart->getLegend()->getFont()->isItalic() ? 'italic' : 'normal');
478
        // > style:text-properties
479
        $this->xmlContent->endElement();
480
        // > style:style
481
        $this->xmlContent->endElement();
482
    }
483
484
    /**
485
     * @param Chart $chart
486
     * @throws \Exception
487
     */
488
    private function writePlotArea(Chart $chart)
489
    {
490
        $chartType = $chart->getPlotArea()->getType();
491
492
        // chart:plot-area
493
        $this->xmlContent->startElement('chart:plot-area');
494
        $this->xmlContent->writeAttribute('chart:style-name', 'stylePlotArea');
495
        if ($chartType instanceof Bar3D || $chartType instanceof Pie3D) {
496
            $this->xmlContent->writeAttribute('dr3d:ambient-color', '#cccccc');
497
            $this->xmlContent->writeAttribute('dr3d:lighting-mode', 'true');
498
        }
499
        if ($chartType instanceof Bar3D || $chartType instanceof Pie3D) {
500
            // dr3d:light
501
            $arrayLight = array(
502
                array('#808080', '(0 0 1)', 'false', 'true'),
503
                array('#666666', '(0.2 0.4 1)', 'true', 'false'),
504
                array('#808080', '(0 0 1)', 'false', 'false'),
505
                array('#808080', '(0 0 1)', 'false', 'false'),
506
                array('#808080', '(0 0 1)', 'false', 'false'),
507
                array('#808080', '(0 0 1)', 'false', 'false'),
508
                array('#808080', '(0 0 1)', 'false', 'false'),
509
            );
510
            foreach ($arrayLight as $light) {
511
                $this->xmlContent->startElement('dr3d:light');
512
                $this->xmlContent->writeAttribute('dr3d:diffuse-color', $light[0]);
513
                $this->xmlContent->writeAttribute('dr3d:direction', $light[1]);
514
                $this->xmlContent->writeAttribute('dr3d:enabled', $light[2]);
515
                $this->xmlContent->writeAttribute('dr3d:specular', $light[3]);
516
                $this->xmlContent->endElement();
517
            }
518
        }
519
520
        //**** Axis ****
521
        $this->writeAxis($chart);
522
523
        //**** Series ****
524
        $this->rangeCol = 'B';
525
        $this->numSeries = 0;
526
        foreach ($chartType->getSeries() as $series) {
527
            $this->writeSeries($chart, $series);
528
            $this->rangeCol++;
529
            $this->numSeries++;
530
        }
531
532
        //**** Wall ****
533
        $this->writeWall();
534
        //**** Floor ****
535
        $this->writeFloor();
536
        // > chart:plot-area
537
        $this->xmlContent->endElement();
538
    }
539
540
    /**
541
     * @param Chart $chart
542
     * @throws \Exception
543
     * @link : http://books.evc-cit.info/odbook/ch08.html#chart-plot-area-section
544
     */
545
    private function writePlotAreaStyle(Chart $chart)
546
    {
547
        $chartType = $chart->getPlotArea()->getType();
548
549
        // style:style
550
        $this->xmlContent->startElement('style:style');
551
        $this->xmlContent->writeAttribute('style:name', 'stylePlotArea');
552
        $this->xmlContent->writeAttribute('style:family', 'chart');
553
        // style:text-properties
554
        $this->xmlContent->startElement('style:chart-properties');
555
        if ($chartType instanceof Bar3D) {
556
            $this->xmlContent->writeAttribute('chart:three-dimensional', 'true');
557
            $this->xmlContent->writeAttribute('chart:right-angled-axes', 'true');
558
        } elseif ($chartType instanceof Pie3D) {
559
            $this->xmlContent->writeAttribute('chart:three-dimensional', 'true');
560
            $this->xmlContent->writeAttribute('chart:right-angled-axes', 'true');
561
        }
562
        if ($chartType instanceof AbstractTypeBar) {
563
            $chartVertical = 'false';
564
            if ($chartType->getBarDirection() == AbstractTypeBar::DIRECTION_HORIZONTAL) {
565
                $chartVertical = 'true';
566
            }
567
            $this->xmlContent->writeAttribute('chart:vertical', $chartVertical);
568
            if ($chartType->getBarGrouping() == Bar::GROUPING_CLUSTERED) {
569
                $this->xmlContent->writeAttribute('chart:stacked', 'false');
570
                $this->xmlContent->writeAttribute('chart:overlap', '0');
571
            } elseif ($chartType->getBarGrouping() == Bar::GROUPING_STACKED) {
572
                $this->xmlContent->writeAttribute('chart:stacked', 'true');
573
                $this->xmlContent->writeAttribute('chart:overlap', '100');
574
            } elseif ($chartType->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED) {
575
                $this->xmlContent->writeAttribute('chart:stacked', 'true');
576
                $this->xmlContent->writeAttribute('chart:overlap', '100');
577
                $this->xmlContent->writeAttribute('chart:percentage', 'true');
578
            }
579
        }
580
        $labelFormat = 'value';
581
        if ($chartType instanceof AbstractTypeBar) {
582
            if ($chartType->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED) {
583
                $labelFormat = 'percentage';
584
            }
585
        }
586
        $this->xmlContent->writeAttribute('chart:data-label-number', $labelFormat);
587
588
        // > style:text-properties
589
        $this->xmlContent->endElement();
590
        // > style:style
591
        $this->xmlContent->endElement();
592
    }
593
594
    /**
595
     * @param Chart $chart
596
     * @param Chart\Series $series
597
     * @throws \Exception
598
     */
599
    private function writeSeries(Chart $chart, Chart\Series $series)
600
    {
601
        $chartType = $chart->getPlotArea()->getType();
602
603
        $numRange = count($series->getValues());
604
        // chart:series
605
        $this->xmlContent->startElement('chart:series');
606
        $this->xmlContent->writeAttribute('chart:values-cell-range-address', 'table-local.$'.$this->rangeCol.'$2:.$'.$this->rangeCol.'$'.($numRange+1));
607
        $this->xmlContent->writeAttribute('chart:label-cell-address', 'table-local.$'.$this->rangeCol.'$1');
608
        // if ($chartType instanceof Area) {
609
        //     $this->xmlContent->writeAttribute('chart:class', 'chart:area');
610
        // } elseif ($chartType instanceof AbstractTypeBar) {
611
        //     $this->xmlContent->writeAttribute('chart:class', 'chart:bar');
612
        // } elseif ($chartType instanceof Line) {
613
        //     $this->xmlContent->writeAttribute('chart:class', 'chart:line');
614
        // } elseif ($chartType instanceof AbstractTypePie) {
615
        //     $this->xmlContent->writeAttribute('chart:class', 'chart:circle');
616
        // } elseif ($chartType instanceof Scatter) {
617
        //     $this->xmlContent->writeAttribute('chart:class', 'chart:scatter');
618
        // }
619
        $this->xmlContent->writeAttribute('chart:style-name', 'styleSeries'.$this->numSeries);
620
        if ($chartType instanceof Area || $chartType instanceof AbstractTypeBar || $chartType instanceof Line || $chartType instanceof Scatter) {
621
            $dataPointFills = $series->getDataPointFills();
622
623
            $incRepeat = $numRange;
624
            if (!empty($dataPointFills)) {
625
                $inc = 0;
626
                $incRepeat = 1;
627
                $newFill = new Fill();
628
                do {
629
                    if ($series->getDataPointFill($inc)->getHashCode() !== $newFill->getHashCode()) {
630
                        // chart:data-point
631
                        $this->xmlContent->startElement('chart:data-point');
632
                        $this->xmlContent->writeAttribute('chart:repeated', $incRepeat);
633
                        // > chart:data-point
634
                        $this->xmlContent->endElement();
635
                        $incRepeat = 1;
636
637
                        // chart:data-point
638
                        $this->xmlContent->startElement('chart:data-point');
639
                        $this->xmlContent->writeAttribute('chart:style-name', 'styleSeries'.$this->numSeries.'_'.$inc);
640
                        // > chart:data-point
641
                        $this->xmlContent->endElement();
642
                    }
643
                    $inc++;
644
                    $incRepeat++;
645
                } while ($inc < $numRange);
646
                $incRepeat--;
647
            }
648
            // chart:data-point
649
            $this->xmlContent->startElement('chart:data-point');
650
            $this->xmlContent->writeAttribute('chart:repeated', $incRepeat);
651
            // > chart:data-point
652
            $this->xmlContent->endElement();
653
        } elseif ($chartType instanceof AbstractTypePie) {
654
            $count = count($series->getDataPointFills());
655
            for ($inc = 0; $inc < $count; $inc++) {
656
                // chart:data-point
657
                $this->xmlContent->startElement('chart:data-point');
658
                $this->xmlContent->writeAttribute('chart:style-name', 'styleSeries'.$this->numSeries.'_'.$inc);
659
                // > chart:data-point
660
                $this->xmlContent->endElement();
661
            }
662
        }
663
664
        // > chart:series
665
        $this->xmlContent->endElement();
666
    }
667
668
    /**
669
     * @param Chart $chart
670
     * @param Chart\Series $series
671
     * @throws \Exception
672
     */
673
    private function writeSeriesStyle(Chart $chart, Chart\Series $series)
674
    {
675
        $chartType = $chart->getPlotArea()->getType();
676
677
        // style:style
678
        $this->xmlContent->startElement('style:style');
679
        $this->xmlContent->writeAttribute('style:name', 'styleSeries'.$this->numSeries);
680
        $this->xmlContent->writeAttribute('style:family', 'chart');
681
        // style:chart-properties
682
        $this->xmlContent->startElement('style:chart-properties');
683
        if ($series->hasShowValue()) {
684
            if ($series->hasShowPercentage()) {
685
                $this->xmlContent->writeAttribute('chart:data-label-number', 'value-and-percentage');
686
            } else {
687
                $this->xmlContent->writeAttribute('chart:data-label-number', 'value');
688
            }
689
        } elseif ($series->hasShowPercentage()) {
690
            $this->xmlContent->writeAttribute('chart:data-label-number', 'percentage');
691
        }
692
        if ($series->hasShowCategoryName()) {
693
            $this->xmlContent->writeAttribute('chart:data-label-text', 'true');
694
        }
695
        $this->xmlContent->writeAttribute('chart:label-position', 'center');
696
        if ($chartType instanceof AbstractTypePie) {
697
            $this->xmlContent->writeAttribute('chart:pie-offset', $chartType->getExplosion());
698
        }
699
        if ($chartType instanceof Line || $chartType instanceof Scatter) {
700
            $oMarker = $series->getMarker();
701
            /**
702
             * @link : http://www.datypic.com/sc/odf/a-chart_symbol-type.html
703
             */
704
            $this->xmlContent->writeAttributeIf($oMarker->getSymbol() == Chart\Marker::SYMBOL_NONE, 'chart:symbol-type', 'none');
705
            /**
706
             * @link : http://www.datypic.com/sc/odf/a-chart_symbol-name.html
707
             */
708
            $this->xmlContent->writeAttributeIf($oMarker->getSymbol() != Chart\Marker::SYMBOL_NONE, 'chart:symbol-type', 'named-symbol');
709
            if ($oMarker->getSymbol() != Chart\Marker::SYMBOL_NONE) {
710
                switch ($oMarker->getSymbol()) {
711
                    case Chart\Marker::SYMBOL_DASH:
712
                        $symbolName = 'horizontal-bar';
713
                        break;
714
                    case Chart\Marker::SYMBOL_DOT:
715
                        $symbolName = 'circle';
716
                        break;
717
                    case Chart\Marker::SYMBOL_TRIANGLE:
718
                        $symbolName = 'arrow-up';
719
                        break;
720
                    default:
721
                        $symbolName = $oMarker->getSymbol();
722
                        break;
723
                }
724
                $this->xmlContent->writeAttribute('chart:symbol-name', $symbolName);
725
                $symbolSize = number_format(CommonDrawing::pointsToCentimeters($oMarker->getSize()), 2, '.', '');
726
                $this->xmlContent->writeAttribute('chart:symbol-width', $symbolSize.'cm');
727
                $this->xmlContent->writeAttribute('chart:symbol-height', $symbolSize.'cm');
728
            }
729
        }
730
731
        $separator = $series->getSeparator();
732
        if (!empty($separator)) {
733
            // style:chart-properties/chart:label-separator
734
            $this->xmlContent->startElement('chart:label-separator');
735
            if ($separator == PHP_EOL) {
736
                $this->xmlContent->writeRaw('<text:p><text:line-break /></text:p>');
737
            } else {
738
                $this->xmlContent->writeElement('text:p', $separator);
739
            }
740
            $this->xmlContent->endElement();
741
        }
742
743
        // > style:chart-properties
744
        $this->xmlContent->endElement();
745
        // style:graphic-properties
746
        $this->xmlContent->startElement('style:graphic-properties');
747
        if ($chartType instanceof Line || $chartType instanceof Scatter) {
748
            $outlineWidth = '';
749
            $outlineColor = '';
750
751
            $oOutline = $series->getOutline();
752
            if ($oOutline instanceof Outline) {
753
                $outlineWidth = $oOutline->getWidth();
754
                if (!empty($outlineWidth)) {
755
                    $outlineWidth = number_format(CommonDrawing::pointsToCentimeters($outlineWidth), 3, '.', '');
756
                }
757
                $outlineColor = $oOutline->getFill()->getStartColor()->getRGB();
758
            }
759
            if (empty($outlineWidth)) {
760
                $outlineWidth = '0.079';
761
            }
762
            if (empty($outlineColor)) {
763
                $outlineColor = '4a7ebb';
764
            }
765
            $this->xmlContent->writeAttribute('svg:stroke-width', $outlineWidth.'cm');
766
            $this->xmlContent->writeAttribute('svg:stroke-color', '#'.$outlineColor);
767
        } else {
768
            $this->xmlContent->writeAttribute('draw:stroke', 'none');
769
            if (!($chartType instanceof Area)) {
770
                $this->xmlContent->writeAttribute('draw:fill', $series->getFill()->getFillType());
771
            }
772
        }
773
        $this->xmlContent->writeAttribute('draw:fill-color', '#'.$series->getFill()->getStartColor()->getRGB());
774
        // > style:graphic-properties
775
        $this->xmlContent->endElement();
776
        // style:text-properties
777
        $this->xmlContent->startElement('style:text-properties');
778
        $this->xmlContent->writeAttribute('fo:color', '#'.$series->getFont()->getColor()->getRGB());
779
        $this->xmlContent->writeAttribute('fo:font-family', $series->getFont()->getName());
780
        $this->xmlContent->writeAttribute('fo:font-size', $series->getFont()->getSize().'pt');
781
        // > style:text-properties
782
        $this->xmlContent->endElement();
783
784
        // > style:style
785
        $this->xmlContent->endElement();
786
787
        foreach ($series->getDataPointFills() as $idx => $oFill) {
788
            // style:style
789
            $this->xmlContent->startElement('style:style');
790
            $this->xmlContent->writeAttribute('style:name', 'styleSeries'.$this->numSeries.'_'.$idx);
791
            $this->xmlContent->writeAttribute('style:family', 'chart');
792
            // style:graphic-properties
793
            $this->xmlContent->startElement('style:graphic-properties');
794
            $this->xmlContent->writeAttribute('draw:fill', $oFill->getFillType());
795
            $this->xmlContent->writeAttribute('draw:fill-color', '#'.$oFill->getStartColor()->getRGB());
796
            // > style:graphic-properties
797
            $this->xmlContent->endElement();
798
            // > style:style
799
            $this->xmlContent->endElement();
800
        }
801
    }
802
803
    /**
804
     */
805
    private function writeTable()
806
    {
807
        // table:table
808
        $this->xmlContent->startElement('table:table');
809
        $this->xmlContent->writeAttribute('table:name', 'table-local');
810
811
        // table:table-columns
812
        $this->xmlContent->startElement('table:table-columns');
813
        // table:table-column
814
        $this->xmlContent->startElement('table:table-column');
815
        if (!empty($this->arrayData)) {
816
            $rowFirst = reset($this->arrayData);
817
            $this->xmlContent->writeAttribute('table:number-columns-repeated', count($rowFirst) - 1);
818
        }
819
        // > table:table-column
820
        $this->xmlContent->endElement();
821
        // > table:table-columns
822
        $this->xmlContent->endElement();
823
824
        // table:table-header-columns
825
        $this->xmlContent->startElement('table:table-header-columns');
826
        // table:table-column
827
        $this->xmlContent->writeElement('table:table-column');
828
        // > table:table-header-columns
829
        $this->xmlContent->endElement();
830
831
        // table:table-rows
832
        $this->xmlContent->startElement('table:table-rows');
833
        if (empty($this->arrayData)) {
834
            $this->xmlContent->startElement('table:table-row');
835
            $this->xmlContent->startElement('table:table-cell');
836
            $this->xmlContent->endElement();
837
            $this->xmlContent->endElement();
838
        } else {
839
            foreach ($this->arrayData as $row) {
840
                // table:table-row
841
                $this->xmlContent->startElement('table:table-row');
842
                foreach ($row as $cell) {
843
                    // table:table-cell
844
                    $this->xmlContent->startElement('table:table-cell');
845
846
                    $cellNumeric = is_numeric($cell);
847
                    $this->xmlContent->writeAttributeIf(!$cellNumeric, 'office:value-type', 'string');
848
                    $this->xmlContent->writeAttributeIf($cellNumeric, 'office:value-type', 'float');
849
                    $this->xmlContent->writeAttributeIf($cellNumeric, 'office:value', $cell);
850
                    // text:p
851
                    $this->xmlContent->startElement('text:p');
852
                    $this->xmlContent->text($cell);
853
                    // > text:p
854
                    $this->xmlContent->endElement();
855
                    // > table:table-cell
856
                    $this->xmlContent->endElement();
857
                }
858
                // > table:table-row
859
                $this->xmlContent->endElement();
860
            }
861
        }
862
        // > table:table-rows
863
        $this->xmlContent->endElement();
864
865
        // table:table-header-rows
866
        $this->xmlContent->startElement('table:table-header-rows');
867
        // table:table-row
868
        $this->xmlContent->startElement('table:table-row');
869
        if (empty($this->arrayData)) {
870
            $this->xmlContent->startElement('table:table-cell');
871
            $this->xmlContent->endElement();
872
        } else {
873
            $rowFirst = reset($this->arrayData);
874
            foreach ($rowFirst as $key => $cell) {
875
                // table:table-cell
876
                $this->xmlContent->startElement('table:table-cell');
877
                if (isset($this->arrayTitle[$key - 1])) {
878
                    $this->xmlContent->writeAttribute('office:value-type', 'string');
879
                }
880
                // text:p
881
                $this->xmlContent->startElement('text:p');
882
                if (isset($this->arrayTitle[$key - 1])) {
883
                    $this->xmlContent->text($this->arrayTitle[$key - 1]);
884
                }
885
                // > text:p
886
                $this->xmlContent->endElement();
887
                // > table:table-cell
888
                $this->xmlContent->endElement();
889
            }
890
        }
891
        // > table:table-row
892
        $this->xmlContent->endElement();
893
        // > table:table-header-rows
894
        $this->xmlContent->endElement();
895
896
        // > table:table
897
        $this->xmlContent->endElement();
898
    }
899
900
    /**
901
     * @param Title $oTitle
902
     */
903
    private function writeTitle(Title $oTitle)
904
    {
905
        if (!$oTitle->isVisible()) {
906
            return;
907
        }
908
        // chart:title
909
        $this->xmlContent->startElement('chart:title');
910
        $this->xmlContent->writeAttribute('svg:x', Text::numberFormat(CommonDrawing::pixelsToCentimeters($oTitle->getOffsetX()), 3) . 'cm');
911
        $this->xmlContent->writeAttribute('svg:y', Text::numberFormat(CommonDrawing::pixelsToCentimeters($oTitle->getOffsetY()), 3) . 'cm');
912
        $this->xmlContent->writeAttribute('chart:style-name', 'styleTitle');
913
        // > text:p
914
        $this->xmlContent->startElement('text:p');
915
        $this->xmlContent->text($oTitle->getText());
916
        $this->xmlContent->endElement();
917
        // > chart:title
918
        $this->xmlContent->endElement();
919
    }
920
921
    /**
922
     * @param Title $oTitle
923
     */
924
    private function writeTitleStyle(Title $oTitle)
925
    {
926
        if (!$oTitle->isVisible()) {
927
            return;
928
        }
929
        // style:style
930
        $this->xmlContent->startElement('style:style');
931
        $this->xmlContent->writeAttribute('style:name', 'styleTitle');
932
        $this->xmlContent->writeAttribute('style:family', 'chart');
933
        // style:text-properties
934
        $this->xmlContent->startElement('style:text-properties');
935
        $this->xmlContent->writeAttribute('fo:color', '#'.$oTitle->getFont()->getColor()->getRGB());
936
        $this->xmlContent->writeAttribute('fo:font-family', $oTitle->getFont()->getName());
937
        $this->xmlContent->writeAttribute('fo:font-size', $oTitle->getFont()->getSize().'pt');
938
        $this->xmlContent->writeAttribute('fo:font-style', $oTitle->getFont()->isItalic() ? 'italic' : 'normal');
939
        // > style:text-properties
940
        $this->xmlContent->endElement();
941
        // > style:style
942
        $this->xmlContent->endElement();
943
    }
944
945
    private function writeWall()
946
    {
947
        // chart:wall
948
        $this->xmlContent->startElement('chart:wall');
949
        $this->xmlContent->writeAttribute('chart:style-name', 'styleWall');
950
        $this->xmlContent->endElement();
951
    }
952
953
    /**
954
     * @param Chart $chart
955
     * @throws \Exception
956
     */
957
    private function writeWallStyle(Chart $chart)
958
    {
959
        $chartType = $chart->getPlotArea()->getType();
960
961
        // style:style
962
        $this->xmlContent->startElement('style:style');
963
        $this->xmlContent->writeAttribute('style:name', 'styleWall');
964
        $this->xmlContent->writeAttribute('style:family', 'chart');
965
        // style:chart-properties
966
        $this->xmlContent->startElement('style:graphic-properties');
967
        //@todo : Permit edit color and size border of wall
968
        if ($chartType instanceof Line || $chartType instanceof Scatter) {
969
            $this->xmlContent->writeAttribute('draw:fill', 'solid');
970
            $this->xmlContent->writeAttribute('draw:fill-color', '#FFFFFF');
971
        } else {
972
            $this->xmlContent->writeAttribute('draw:fill', 'none');
973
            $this->xmlContent->writeAttribute('draw:stroke', 'solid');
974
            $this->xmlContent->writeAttribute('svg:stroke-width', '0.026cm');
975
            $this->xmlContent->writeAttribute('svg:stroke-color', '#878787');
976
        }
977
        // > style:chart-properties
978
        $this->xmlContent->endElement();
979
        // > style:style
980
        $this->xmlContent->endElement();
981
    }
982
}
983