diff --git a/src/PhpSpreadsheet/Chart/Chart.php b/src/PhpSpreadsheet/Chart/Chart.php index 556b0eff..b962978d 100644 --- a/src/PhpSpreadsheet/Chart/Chart.php +++ b/src/PhpSpreadsheet/Chart/Chart.php @@ -188,6 +188,13 @@ class Chart return $this->name; } + public function setName(string $name): self + { + $this->name = $name; + + return $this; + } + /** * Get Worksheet. */ diff --git a/tests/PhpSpreadsheetTests/Chart/ChartMethodTest.php b/tests/PhpSpreadsheetTests/Chart/ChartMethodTest.php index 027ddc53..5c3622ad 100644 --- a/tests/PhpSpreadsheetTests/Chart/ChartMethodTest.php +++ b/tests/PhpSpreadsheetTests/Chart/ChartMethodTest.php @@ -93,8 +93,9 @@ class ChartMethodTest extends TestCase $xAxis, // xAxis $yAxis // yAxis ); - $chart2 = new Chart('chart1'); + $chart2 = new Chart('xyz'); $chart2 + ->setName('chart1') ->setLegend($legend) ->setPlotArea($plotArea) ->setPlotVisibleOnly(true)