Merge pull request #2801 from PHPOffice/ScatterChart-Point-Size

Add point size option for scatter charts
This commit is contained in:
Mark Baker 2022-05-03 09:00:44 +02:00 committed by GitHub
commit fde77306ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 3 deletions

View File

@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
### Added
- Nothing
- Add point size option for scatter charts
### Changed

View File

@ -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
-

View File

@ -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.
*

View File

@ -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();
}