Skip to content

Commit

Permalink
Workaround for line chart fill color
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagomalheiro committed Mar 17, 2021
1 parent 6490c3f commit c817106
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/PhpSpreadsheet/Writer/Xlsx/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ private function writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMulti
$objWriter->startElement('c:ser');

$plotLabel = $plotGroup->getPlotLabelByIndex($plotSeriesIdx);
if ($plotLabel) {
if ($plotLabel && $groupType !== DataSeries::TYPE_LINECHART) {
$fillColor = $plotLabel->getFillColor();
if ($fillColor !== null && !is_array($fillColor)) {
$objWriter->startElement('c:spPr');
Expand Down Expand Up @@ -1141,6 +1141,13 @@ private function writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMulti
if ($groupType == DataSeries::TYPE_STOCKCHART) {
$objWriter->startElement('a:noFill');
$objWriter->endElement();
} elseif ($plotLabel && $plotLabel->getFillColor() !== null) {
$fillColor = $plotLabel->getFillColor();
$objWriter->startElement('a:solidFill');
$objWriter->startElement('a:srgbClr');
$objWriter->writeAttribute('val', $fillColor);
$objWriter->endElement();
$objWriter->endElement();
}
$objWriter->endElement();
$objWriter->endElement();
Expand Down

0 comments on commit c817106

Please sign in to comment.