Skip to content

Commit

Permalink
Merge pull request #2801 from PHPOffice/ScatterChart-Point-Size
Browse files Browse the repository at this point in the history
Add point size option for scatter charts
  • Loading branch information
MarkBaker authored May 3, 2022
2 parents 853cc22 + 70f5ec6 commit fde7730
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).

### Added

- Nothing
- Add point size option for scatter charts

### Changed

Expand Down
2 changes: 1 addition & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4957,7 +4957,7 @@ parameters:

-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#"
count: 45
count: 44
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php

-
Expand Down
27 changes: 27 additions & 0 deletions src/PhpSpreadsheet/Chart/DataSeriesValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ class DataSeriesValues
*/
private $pointMarker;

/**
* Series Point Size.
*
* @var int
*/
private $pointSize = 3;

/**
* Point Count (The number of datapoints in the dataseries).
*
Expand Down Expand Up @@ -175,6 +182,26 @@ public function setPointMarker($marker)
return $this;
}

/**
* Get Point Size.
*/
public function getPointSize(): int
{
return $this->pointSize;
}

/**
* Set Point Size.
*
* @return $this
*/
public function setPointSize(int $size = 3)
{
$this->pointSize = $size;

return $this;
}

/**
* Get Series Format Code.
*
Expand Down
2 changes: 1 addition & 1 deletion src/PhpSpreadsheet/Writer/Xlsx/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ private function writePlotGroup(?DataSeries $plotGroup, $groupType, XMLWriter $o

if ($plotSeriesMarker !== 'none') {
$objWriter->startElement('c:size');
$objWriter->writeAttribute('val', 3);
$objWriter->writeAttribute('val', (string) $plotSeriesValues->getPointSize());
$objWriter->endElement();
}

Expand Down

0 comments on commit fde7730

Please sign in to comment.