Merge branch 'develop' of https://github.com/Tom-Magill/PHPWord into develop_upstream
This commit is contained in:
commit
31968fa814
|
|
@ -51,6 +51,20 @@ class Chart extends AbstractStyle
|
|||
* @var array
|
||||
*/
|
||||
private $colors = array();
|
||||
|
||||
/**
|
||||
* Chart title
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $title = null;
|
||||
|
||||
/**
|
||||
* Chart legend visibility
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $showLegend = false;
|
||||
|
||||
/**
|
||||
* A list of display options for data labels
|
||||
|
|
@ -220,6 +234,50 @@ class Chart extends AbstractStyle
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the chart title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the chart title
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setTitle($value = null)
|
||||
{
|
||||
$this->title = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get chart legend visibility
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getShowLegend()
|
||||
{
|
||||
return $this->showLegend;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set chart legend visibility
|
||||
*
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setShowLegend($value = false)
|
||||
{
|
||||
$this->showLegend = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/*
|
||||
* Show labels for axis
|
||||
|
|
|
|||
|
|
@ -105,8 +105,6 @@ class Chart extends AbstractPart
|
|||
{
|
||||
$xmlWriter->startElement('c:chart');
|
||||
|
||||
$xmlWriter->writeElementBlock('c:autoTitleDeleted', 'val', 1);
|
||||
|
||||
$this->writePlotArea($xmlWriter);
|
||||
|
||||
$xmlWriter->endElement(); // c:chart
|
||||
|
|
@ -130,6 +128,36 @@ class Chart extends AbstractPart
|
|||
$type = $this->element->getType();
|
||||
$style = $this->element->getStyle();
|
||||
$this->options = $this->types[$type];
|
||||
|
||||
$title = $style->getTitle();
|
||||
$showLegend = $style->getShowLegend();
|
||||
|
||||
//Chart title
|
||||
if($title){
|
||||
$xmlWriter->startElement('c:title');
|
||||
$xmlWriter->startElement('c:tx');
|
||||
$xmlWriter->startElement('c:rich');
|
||||
$xmlWriter->writeRaw('
|
||||
<a:bodyPr/>
|
||||
<a:lstStyle/>
|
||||
<a:p>
|
||||
<a:pPr>
|
||||
<a:defRPr/></a:pPr><a:r><a:rPr/><a:t>'.$title.'</a:t></a:r>
|
||||
<a:endParaRPr/>
|
||||
</a:p>');
|
||||
|
||||
$xmlWriter->endElement(); // c:rich
|
||||
$xmlWriter->endElement(); // c:tx
|
||||
$xmlWriter->endElement(); // c:title
|
||||
|
||||
}else{
|
||||
$xmlWriter->writeElementBlock('c:autoTitleDeleted', 'val', 1);
|
||||
}
|
||||
|
||||
//Chart legend
|
||||
if($showLegend){
|
||||
$xmlWriter->writeRaw('<c:legend><c:legendPos val="r"/></c:legend>');
|
||||
}
|
||||
|
||||
$xmlWriter->startElement('c:plotArea');
|
||||
$xmlWriter->writeElement('c:layout');
|
||||
|
|
|
|||
Loading…
Reference in New Issue