public function PHPExcel_Writer_Excel2007_Chart::writeChart in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007/Chart.php \PHPExcel_Writer_Excel2007_Chart::writeChart()
Write charts to XML format
Parameters
PHPExcel_Chart $pChart:
Return value
string XML Output
Throws
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel2007/ Chart.php, line 46
Class
- PHPExcel_Writer_Excel2007_Chart
- PHPExcel_Writer_Excel2007_Chart
Code
public function writeChart(PHPExcel_Chart $pChart = NULL) {
// Create XML writer
$objWriter = NULL;
if ($this
->getParentWriter()
->getUseDiskCaching()) {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this
->getParentWriter()
->getDiskCachingDirectory());
}
else {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
}
// Ensure that data series values are up-to-date before we save
$pChart
->refresh();
// XML header
$objWriter
->startDocument('1.0', 'UTF-8', 'yes');
// c:chartSpace
$objWriter
->startElement('c:chartSpace');
$objWriter
->writeAttribute('xmlns:c', 'http://schemas.openxmlformats.org/drawingml/2006/chart');
$objWriter
->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
$objWriter
->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
$objWriter
->startElement('c:date1904');
$objWriter
->writeAttribute('val', 0);
$objWriter
->endElement();
$objWriter
->startElement('c:lang');
$objWriter
->writeAttribute('val', "en-GB");
$objWriter
->endElement();
$objWriter
->startElement('c:roundedCorners');
$objWriter
->writeAttribute('val', 0);
$objWriter
->endElement();
$this
->_writeAlternateContent($objWriter);
$objWriter
->startElement('c:chart');
$this
->_writeTitle($pChart
->getTitle(), $objWriter);
$objWriter
->startElement('c:autoTitleDeleted');
$objWriter
->writeAttribute('val', 0);
$objWriter
->endElement();
$this
->_writePlotArea($pChart
->getPlotArea(), $pChart
->getXAxisLabel(), $pChart
->getYAxisLabel(), $objWriter, $pChart
->getWorksheet(), $pChart
->getChartAxisX(), $pChart
->getChartAxisY(), $pChart
->getMajorGridlines(), $pChart
->getMinorGridlines());
$this
->_writeLegend($pChart
->getLegend(), $objWriter);
$objWriter
->startElement('c:plotVisOnly');
$objWriter
->writeAttribute('val', 1);
$objWriter
->endElement();
$objWriter
->startElement('c:dispBlanksAs');
$objWriter
->writeAttribute('val', "gap");
$objWriter
->endElement();
$objWriter
->startElement('c:showDLblsOverMax');
$objWriter
->writeAttribute('val', 0);
$objWriter
->endElement();
$objWriter
->endElement();
$this
->_writePrintSettings($objWriter);
$objWriter
->endElement();
// Return
return $objWriter
->getData();
}