PhpOffice\PhpPresentation\Writer\ODPresentation\ObjectsChart::writeSeries PHP Méthode

writeSeries() private méthode

private writeSeries ( Chart $chart, Series $series )
$chart PhpOffice\PhpPresentation\Shape\Chart
$series PhpOffice\PhpPresentation\Shape\Chart\Series
    private function writeSeries(Chart $chart, Chart\Series $series)
    {
        $chartType = $chart->getPlotArea()->getType();
        $numRange = count($series->getValues());
        // chart:series
        $this->xmlContent->startElement('chart:series');
        $this->xmlContent->writeAttribute('chart:values-cell-range-address', 'table-local.$' . $this->rangeCol . '$2:.$' . $this->rangeCol . '$' . ($numRange + 1));
        $this->xmlContent->writeAttribute('chart:label-cell-address', 'table-local.$' . $this->rangeCol . '$1');
        if ($chartType instanceof Area) {
            $this->xmlContent->writeAttribute('chart:class', 'chart:area');
        } elseif ($chartType instanceof AbstractTypeBar) {
            $this->xmlContent->writeAttribute('chart:class', 'chart:bar');
        } elseif ($chartType instanceof Line) {
            $this->xmlContent->writeAttribute('chart:class', 'chart:line');
        } elseif ($chartType instanceof AbstractTypePie) {
            $this->xmlContent->writeAttribute('chart:class', 'chart:circle');
        } elseif ($chartType instanceof Scatter) {
            $this->xmlContent->writeAttribute('chart:class', 'chart:scatter');
        }
        $this->xmlContent->writeAttribute('chart:style-name', 'styleSeries' . $this->numSeries);
        if ($chartType instanceof Area || $chartType instanceof AbstractTypeBar || $chartType instanceof Line || $chartType instanceof Scatter) {
            $dataPointFills = $series->getDataPointFills();
            $incRepeat = $numRange;
            if (!empty($dataPointFills)) {
                $inc = 0;
                $incRepeat = 0;
                $newFill = new Fill();
                do {
                    if ($series->getDataPointFill($inc)->getHashCode() != $newFill->getHashCode()) {
                        // chart:data-point
                        $this->xmlContent->startElement('chart:data-point');
                        $this->xmlContent->writeAttribute('chart:repeated', $incRepeat);
                        // > chart:data-point
                        $this->xmlContent->endElement();
                        $incRepeat = 0;
                        // chart:data-point
                        $this->xmlContent->startElement('chart:data-point');
                        $this->xmlContent->writeAttribute('chart:style-name', 'styleSeries' . $this->numSeries . '_' . $inc);
                        // > chart:data-point
                        $this->xmlContent->endElement();
                    }
                    $inc++;
                    $incRepeat++;
                } while ($inc < $numRange);
                $incRepeat--;
            }
            // chart:data-point
            $this->xmlContent->startElement('chart:data-point');
            $this->xmlContent->writeAttribute('chart:repeated', $incRepeat);
            // > chart:data-point
            $this->xmlContent->endElement();
        } elseif ($chartType instanceof AbstractTypePie) {
            $count = count($series->getDataPointFills());
            for ($inc = 0; $inc < $count; $inc++) {
                // chart:data-point
                $this->xmlContent->startElement('chart:data-point');
                $this->xmlContent->writeAttribute('chart:style-name', 'styleSeries' . $this->numSeries . '_' . $inc);
                // > chart:data-point
                $this->xmlContent->endElement();
            }
        }
        // > chart:series
        $this->xmlContent->endElement();
    }