Add setName Method for Chart (#3001)
Addresses a problem identified in issue #2991. Chart name is set in constructor, but there is no method to subsequently change it. This PR adds a method to do so.
This commit is contained in:
parent
0492ea6d8a
commit
f34e0ead29
|
|
@ -188,6 +188,13 @@ class Chart
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setName(string $name): self
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Worksheet.
|
* Get Worksheet.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,9 @@ class ChartMethodTest extends TestCase
|
||||||
$xAxis, // xAxis
|
$xAxis, // xAxis
|
||||||
$yAxis // yAxis
|
$yAxis // yAxis
|
||||||
);
|
);
|
||||||
$chart2 = new Chart('chart1');
|
$chart2 = new Chart('xyz');
|
||||||
$chart2
|
$chart2
|
||||||
|
->setName('chart1')
|
||||||
->setLegend($legend)
|
->setLegend($legend)
|
||||||
->setPlotArea($plotArea)
|
->setPlotArea($plotArea)
|
||||||
->setPlotVisibleOnly(true)
|
->setPlotVisibleOnly(true)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue