diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php b/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php index 4176b61ec..2f57686f8 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php @@ -1280,14 +1280,6 @@ protected function writeTypeDoughnut(XMLWriter $objWriter, Doughnut $subject, bo // c:dLbls $objWriter->startElement('c:dLbls'); - $this->writeElementWithValAttribute($objWriter, 'c:showLegendKey', $series->hasShowLegendKey() ? '1' : '0'); - $this->writeElementWithValAttribute($objWriter, 'c:showVal', $series->hasShowValue() ? '1' : '0'); - $this->writeElementWithValAttribute($objWriter, 'c:showCatName', $series->hasShowCategoryName() ? '1' : '0'); - $this->writeElementWithValAttribute($objWriter, 'c:showSerName', $series->hasShowSeriesName() ? '1' : '0'); - $this->writeElementWithValAttribute($objWriter, 'c:showPercent', $series->hasShowPercentage() ? '1' : '0'); - $this->writeElementWithValAttribute($objWriter, 'c:showBubbleSize', '0'); - $this->writeElementWithValAttribute($objWriter, 'c:showLeaderLines', $series->hasShowLeaderLines() ? '1' : '0'); - if ($series->hasDlblNumFormat()) { //c:numFmt $objWriter->startElement('c:numFmt'); @@ -1343,6 +1335,14 @@ protected function writeTypeDoughnut(XMLWriter $objWriter, Doughnut $subject, bo // c:dLbls\c:txPr\ $objWriter->endElement(); + $this->writeElementWithValAttribute($objWriter, 'c:showLegendKey', $series->hasShowLegendKey() ? '1' : '0'); + $this->writeElementWithValAttribute($objWriter, 'c:showVal', $series->hasShowValue() ? '1' : '0'); + $this->writeElementWithValAttribute($objWriter, 'c:showCatName', $series->hasShowCategoryName() ? '1' : '0'); + $this->writeElementWithValAttribute($objWriter, 'c:showSerName', $series->hasShowSeriesName() ? '1' : '0'); + $this->writeElementWithValAttribute($objWriter, 'c:showPercent', $series->hasShowPercentage() ? '1' : '0'); + $this->writeElementWithValAttribute($objWriter, 'c:showBubbleSize', '0'); + $this->writeElementWithValAttribute($objWriter, 'c:showLeaderLines', $series->hasShowLeaderLines() ? '1' : '0'); + $separator = $series->getSeparator(); if (!empty($separator) && PHP_EOL != $separator) { // c:dLbls\c:separator @@ -1898,6 +1898,15 @@ protected function writeTypeRadar(XMLWriter $objWriter, Radar $subject, bool $in $this->writeSingleValueOrReference($objWriter, $includeSheet, $series->getTitle(), $coords); $objWriter->endElement(); + // c:spPr + $objWriter->startElement('c:spPr'); + // Write fill + $this->writeFill($objWriter, $series->getFill()); + // Write outline + $this->writeOutline($objWriter, $series->getOutline()); + // ## c:spPr + $objWriter->endElement(); + // Marker $this->writeSeriesMarker($objWriter, $series->getMarker()); @@ -1976,15 +1985,6 @@ protected function writeTypeRadar(XMLWriter $objWriter, Radar $subject, bool $in $objWriter->endElement(); - // c:spPr - $objWriter->startElement('c:spPr'); - // Write fill - $this->writeFill($objWriter, $series->getFill()); - // Write outline - $this->writeOutline($objWriter, $series->getOutline()); - // ## c:spPr - $objWriter->endElement(); - // Write X axis data $axisXData = array_keys($series->getValues()); @@ -2002,11 +2002,6 @@ protected function writeTypeRadar(XMLWriter $objWriter, Radar $subject, bool $in $this->writeMultipleValuesOrReference($objWriter, $includeSheet, $axisYData, $coords); $objWriter->endElement(); - // c:smooth - $objWriter->startElement('c:smooth'); - $objWriter->writeAttribute('val', '0'); - $objWriter->endElement(); - $objWriter->endElement(); ++$seriesIndex; diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php index 1e7a9d707..b55fc8764 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php @@ -129,11 +129,16 @@ public function testChartIncludeSpreadsheet(string $chartType): void $element = $chartBaseXmlPath . '/c:ser/c:tx/c:strRef/c:strCache/c:pt/c:v'; $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); $this->assertZipXmlElementEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'Downloads'); + $element = $chartBaseXmlPath . '/c:ser/c:val/c:numRef/c:numCache/c:pt/c:v'; + if ($oChart instanceof Scatter) { + $element = $chartBaseXmlPath . '/c:ser/c:yVal/c:numRef/c:numCache/c:pt/c:v'; + } $this->assertZipXmlElementCount('ppt/charts/' . $oShape->getIndexedFilename(), $element, count($this->seriesData)); foreach (array_values($this->seriesData) as $index => $value) { $this->assertZipXmlElementAtIndexEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, $index, $value); } + $element = '/c:chartSpace/c:externalData'; $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); $this->assertZipXmlAttributeExists('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'r:id'); diff --git a/tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php b/tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php index 02b408ec9..a3a9f5887 100644 --- a/tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php +++ b/tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php @@ -322,7 +322,7 @@ public function assertZipXmlElementCount($filePath, $xPath, $num): void { $this->writePresentationFile($this->oPresentation, $this->writerName); $nodeList = $this->getXmlNodeList($filePath, $xPath); - self::assertEquals($nodeList->length, $num); + self::assertEquals($num, $nodeList->length); } /**