From 9be433af58c36f129196668a7f99a01ac787e07b Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Sat, 27 Oct 2012 00:02:38 +0100 Subject: [PATCH] Minor charting fixes --- Classes/PHPExcel/Chart/DataSeriesValues.php | 6 ++++++ Classes/PHPExcel/Reader/Excel2007/Chart.php | 4 ++++ Classes/PHPExcel/Writer/Excel2007/Chart.php | 14 +++++++------- Classes/PHPExcel/Writer/Excel2007/Worksheet.php | 4 +++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Classes/PHPExcel/Chart/DataSeriesValues.php b/Classes/PHPExcel/Chart/DataSeriesValues.php index ce1795ff..4a206482 100644 --- a/Classes/PHPExcel/Chart/DataSeriesValues.php +++ b/Classes/PHPExcel/Chart/DataSeriesValues.php @@ -289,6 +289,12 @@ class PHPExcel_Chart_DataSeriesValues ); if ($flatten) { $this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); + foreach($this->_dataValues as &$dataValue) { + if ((!empty($dataValue)) && ($dataValue[0] == '#')) { + $dataValue = 0.0; + } + } + unset($dataValue); } else { $cellRange = explode('!',$this->_dataSource); if (count($cellRange) > 1) { diff --git a/Classes/PHPExcel/Reader/Excel2007/Chart.php b/Classes/PHPExcel/Reader/Excel2007/Chart.php index 1f305db4..f695c4a5 100644 --- a/Classes/PHPExcel/Reader/Excel2007/Chart.php +++ b/Classes/PHPExcel/Reader/Excel2007/Chart.php @@ -347,6 +347,10 @@ class PHPExcel_Reader_Excel2007_Chart } } + if (empty($seriesVal)) { + $seriesVal = NULL; + } + return array( 'formatCode' => $formatCode, 'pointCount' => $pointCount, 'dataValues' => $seriesVal diff --git a/Classes/PHPExcel/Writer/Excel2007/Chart.php b/Classes/PHPExcel/Writer/Excel2007/Chart.php index 00327728..6459c74b 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Chart.php +++ b/Classes/PHPExcel/Writer/Excel2007/Chart.php @@ -463,13 +463,13 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->endElement(); $objWriter->endElement(); + $layout = $xAxisLabel->getLayout(); + $this->_writeLayout($layout, $objWriter); + $objWriter->startElement('c:overlay'); $objWriter->writeAttribute('val', 0); $objWriter->endElement(); - $layout = $xAxisLabel->getLayout(); - $this->_writeLayout($layout, $objWriter); - $objWriter->endElement(); } @@ -589,15 +589,15 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->endElement(); $objWriter->endElement(); - $objWriter->startElement('c:overlay'); - $objWriter->writeAttribute('val', 0); - $objWriter->endElement(); - if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { $layout = $yAxisLabel->getLayout(); $this->_writeLayout($layout, $objWriter); } + $objWriter->startElement('c:overlay'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + $objWriter->endElement(); } diff --git a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php index e5a7679a..0ea07d20 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php +++ b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php @@ -652,7 +652,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->startElement('protectedRange'); $objWriter->writeAttribute('name', 'p' . md5($protectedCell)); $objWriter->writeAttribute('sqref', $protectedCell); - $objWriter->writeAttribute('password', $passwordHash); + if (!empty($passwordHash)) { + $objWriter->writeAttribute('password', $passwordHash); + } $objWriter->endElement(); }