Skip to content

Commit fde7730

Browse files
authored
Merge pull request #2801 from PHPOffice/ScatterChart-Point-Size
Add point size option for scatter charts
2 parents 853cc22 + 70f5ec6 commit fde7730

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
99

1010
### Added
1111

12-
- Nothing
12+
- Add point size option for scatter charts
1313

1414
### Changed
1515

phpstan-baseline.neon

+1-1
Original file line numberDiff line numberDiff line change
@@ -4957,7 +4957,7 @@ parameters:
49574957

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

49634963
-

src/PhpSpreadsheet/Chart/DataSeriesValues.php

+27
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ class DataSeriesValues
4545
*/
4646
private $pointMarker;
4747

48+
/**
49+
* Series Point Size.
50+
*
51+
* @var int
52+
*/
53+
private $pointSize = 3;
54+
4855
/**
4956
* Point Count (The number of datapoints in the dataseries).
5057
*
@@ -175,6 +182,26 @@ public function setPointMarker($marker)
175182
return $this;
176183
}
177184

185+
/**
186+
* Get Point Size.
187+
*/
188+
public function getPointSize(): int
189+
{
190+
return $this->pointSize;
191+
}
192+
193+
/**
194+
* Set Point Size.
195+
*
196+
* @return $this
197+
*/
198+
public function setPointSize(int $size = 3)
199+
{
200+
$this->pointSize = $size;
201+
202+
return $this;
203+
}
204+
178205
/**
179206
* Get Series Format Code.
180207
*

src/PhpSpreadsheet/Writer/Xlsx/Chart.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ private function writePlotGroup(?DataSeries $plotGroup, $groupType, XMLWriter $o
11401140

11411141
if ($plotSeriesMarker !== 'none') {
11421142
$objWriter->startElement('c:size');
1143-
$objWriter->writeAttribute('val', 3);
1143+
$objWriter->writeAttribute('val', (string) $plotSeriesValues->getPointSize());
11441144
$objWriter->endElement();
11451145
}
11461146

0 commit comments

Comments
 (0)