diff --git a/CHANGELOG.md b/CHANGELOG.md index a7d221bd..a40c0e2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). ### Added -- Nothing +- Add point size option for scatter charts ### Changed diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 0e2ede6f..2f679a84 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -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 - diff --git a/src/PhpSpreadsheet/Chart/DataSeriesValues.php b/src/PhpSpreadsheet/Chart/DataSeriesValues.php index 88063336..745f0106 100644 --- a/src/PhpSpreadsheet/Chart/DataSeriesValues.php +++ b/src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -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). * @@ -175,6 +182,26 @@ class DataSeriesValues 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. * diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Chart.php b/src/PhpSpreadsheet/Writer/Xlsx/Chart.php index 23b78a2f..ba7a6545 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Chart.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Chart.php @@ -1140,7 +1140,7 @@ class Chart extends WriterPart if ($plotSeriesMarker !== 'none') { $objWriter->startElement('c:size'); - $objWriter->writeAttribute('val', 3); + $objWriter->writeAttribute('val', (string) $plotSeriesValues->getPointSize()); $objWriter->endElement(); }