Skip to content

BA-5434 extension control of marker and line styles #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions src/PhpSpreadsheet/Chart/DataSeriesValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ class DataSeriesValues
/** @var bool */
private $showSeparator = false;

/** @var array|null */
private $markers = null;

/** @var array|null */
private $lineType = null;

/**
* Create a new DataSeriesValues object.
*
Expand Down Expand Up @@ -433,6 +439,43 @@ public function setShowSeparator(bool $showSeparator): self
return $this;
}

/**
* @return array|null
*/
public function getMarkers(): ?array
{
return $this->markers;
}

/**
* @param array arrayPointMarker
* @return self
*/
public function setMarkers(array $markers): self
{
$this->markers = $markers;

return $this;
}

/**
* @return array|null
*/
public function getLineType(): ?array
{
return $this->lineType;
}

/**
* @param array|null $lineType
* @return self
*/
public function setLineType(?array $lineType): self
{
$this->lineType = $lineType;
return $this;
}

/**
* Set Series Data Values.
*
Expand Down
17 changes: 17 additions & 0 deletions src/PhpSpreadsheet/Writer/Xlsx/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -1283,12 +1283,29 @@ private function writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMulti
if ($fillColor !== null && !is_array($fillColor)) {
$this->writeSolidFill($objWriter, $fillColor);
}

if (
$plotSeriesValues->getLineType()
&& $plotSeriesValues->getLineType()[$plotSeriesIdx]
) {
$objWriter->startElement('a:prstDash');
$objWriter->writeAttribute('val', $plotSeriesValues->getLineType()[$plotSeriesIdx]);
$objWriter->endElement();
}

$objWriter->endElement();
$objWriter->endElement();
}

if ($plotSeriesValues) {
$plotSeriesMarker = $plotSeriesValues->getPointMarker();
if (
$plotSeriesValues->getMarkers()
&& $plotSeriesValues->getMarkers()[$plotSeriesIdx]
) {
$plotSeriesMarker = $plotSeriesValues->getMarkers()[$plotSeriesIdx];
}

$markerSize = $plotSeriesValues->getMarkerSize();
if ($plotSeriesMarker) {
$objWriter->startElement('c:marker');
Expand Down