diff --git a/src/PhpWord/Style/Chart.php b/src/PhpWord/Style/Chart.php
index 06b4829c3c..f6de7c2239 100644
--- a/src/PhpWord/Style/Chart.php
+++ b/src/PhpWord/Style/Chart.php
@@ -66,6 +66,13 @@ class Chart extends AbstractStyle
*/
private $showLegend = false;
+ /**
+ * Chart legend Position.
+ *
+ * @var string
+ */
+ private $legendPosition = 'r';
+
/**
* A list of display options for data labels
*
@@ -285,6 +292,35 @@ public function setShowLegend($value = false)
return $this;
}
+ /**
+ * Get chart legend position
+ *
+ * @return string
+ */
+ public function getLegendPosition()
+ {
+ return $this->legendPosition;
+ }
+
+ /**
+ * Set chart legend position. choices:
+ * "r" - right of chart
+ * "b" - bottom of chart
+ * "t" - top of chart
+ * "l" - left of chart
+ * "tr" - top right of chart
+ *
+ * default: right
+ *
+ * @param bool $value
+ */
+ public function setLegendPosition($value = 'r')
+ {
+ $this->legendPosition = $value;
+
+ return $this;
+ }
+
/*
* Show labels for axis
*
diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php
index 812d3bf1e3..dd738d1ef7 100644
--- a/src/PhpWord/Writer/Word2007/Part/Chart.php
+++ b/src/PhpWord/Writer/Word2007/Part/Chart.php
@@ -131,6 +131,7 @@ private function writePlotArea(XMLWriter $xmlWriter)
$title = $style->getTitle();
$showLegend = $style->isShowLegend();
+ $legendPosition = $style->getLegendPosition();
//Chart title
if ($title) {
@@ -154,7 +155,7 @@ private function writePlotArea(XMLWriter $xmlWriter)
//Chart legend
if ($showLegend) {
- $xmlWriter->writeRaw('');
+ $xmlWriter->writeRaw('');
}
$xmlWriter->startElement('c:plotArea');