Skip to content

Commit bf4d7e3

Browse files
committed
#265 : Added two methods for setting Border & Fill in Legend
1 parent 4eae228 commit bf4d7e3

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- ODPresentation Writer : Axis Bounds in Chart - @Progi1984 GH-269
1717
- PowerPoint2007 Writer : Implement character spacing - @jvanoostrom GH-301
1818
- PowerPoint2007 Writer : Axis Bounds in Chart - @Progi1984 GH-269
19+
- Misc : Added two methods for setting Border & Fill in Legend - @Progi1984 GH-265
1920

2021
## 0.7.0 - 2016-09-12
2122

src/PhpPresentation/Shape/Chart/Legend.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,18 @@ public function getBorder()
281281
return $this->border;
282282
}
283283

284+
/**
285+
* Set Border
286+
*
287+
* @param \PhpOffice\PhpPresentation\Style\Border $border
288+
* @return \PhpOffice\PhpPresentation\Shape\RichText\Paragraph
289+
*/
290+
public function setBorder(Border $border)
291+
{
292+
$this->border = $border;
293+
return $this;
294+
}
295+
284296
/**
285297
* Get Fill
286298
*
@@ -291,6 +303,18 @@ public function getFill()
291303
return $this->fill;
292304
}
293305

306+
/**
307+
* Set Fill
308+
*
309+
* @param \PhpOffice\PhpPresentation\Style\Fill $fill
310+
* @return \PhpOffice\PhpPresentation\Shape\RichText\Paragraph
311+
*/
312+
public function setFill(Fill $fill)
313+
{
314+
$this->fill = $fill;
315+
return $this;
316+
}
317+
294318
/**
295319
* Get alignment
296320
*

tests/PhpPresentation/Tests/Shape/Chart/LegendTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,24 @@ public function testAlignment()
4848
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment());
4949
}
5050

51+
public function testBorder()
52+
{
53+
$object = new Legend();
54+
55+
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder());
56+
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setBorder(new Border()));
57+
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder());
58+
}
59+
60+
public function testFill()
61+
{
62+
$object = new Legend();
63+
64+
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill());
65+
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setFill(new Fill()));
66+
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill());
67+
}
68+
5169
public function testFont()
5270
{
5371
$object = new Legend();

0 commit comments

Comments
 (0)