Skip to content

Commit 8bcf795

Browse files
author
Mark Baker
committed
Chart writing bugfixes
1 parent dd69a5a commit 8bcf795

File tree

5 files changed

+36
-18
lines changed

5 files changed

+36
-18
lines changed

Classes/PHPExcel/Writer/Excel2007/Chart.php

+36-18
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ private function _writePlotGroup( $plotGroup,
849849
}
850850

851851
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
852-
$this->_writeBubbles($plotSeriesValues, $objWriter);
852+
$this->_writeBubbles($plotSeriesValues, $objWriter, $pSheet);
853853
}
854854

855855
$objWriter->endElement();
@@ -975,15 +975,17 @@ private function _writePlotSeriesValues( $plotSeriesValues,
975975

976976
$dataValues = $plotSeriesValues->getDataValues();
977977
if (!empty($dataValues)) {
978-
if (!is_array($dataValues)) {
979-
$dataValues = PHPExcel_Calculation_Functions::flattenArray(
980-
PHPExcel_Calculation::getInstance()
981-
->calculateFormula('='.$dataValues,
982-
NULL,
983-
$pSheet->getCell('A1')
984-
)
985-
);
986-
}
978+
// if (!is_array($dataValues)) {
979+
// echo 'NOT AN ARRAY: ';
980+
// var_dump($dataValues);
981+
// $dataValues = PHPExcel_Calculation_Functions::flattenArray(
982+
// PHPExcel_Calculation::getInstance()
983+
// ->calculateFormula('='.$dataValues,
984+
// NULL,
985+
// $pSheet->getCell('A1')
986+
// )
987+
// );
988+
// }
987989
if (is_array($dataValues)) {
988990
foreach($dataValues as $plotSeriesKey => $plotSeriesValue) {
989991
$objWriter->startElement('c:pt');
@@ -1010,7 +1012,7 @@ private function _writePlotSeriesValues( $plotSeriesValues,
10101012
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
10111013
* @throws Exception
10121014
*/
1013-
private function _writeBubbles($plotSeriesValues, $objWriter)
1015+
private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet)
10141016
{
10151017
if (is_null($plotSeriesValues)) {
10161018
return;
@@ -1027,13 +1029,29 @@ private function _writeBubbles($plotSeriesValues, $objWriter)
10271029
$objWriter->writeAttribute('val', $plotSeriesValues->getPointCount() );
10281030
$objWriter->endElement();
10291031

1030-
foreach($plotSeriesValues->getDataValues() as $plotSeriesKey => $plotSeriesValue) {
1031-
$objWriter->startElement('c:pt');
1032-
$objWriter->writeAttribute('idx', $plotSeriesKey );
1033-
$objWriter->startElement('c:v');
1034-
$objWriter->writeRawData( 1 );
1035-
$objWriter->endElement();
1036-
$objWriter->endElement();
1032+
$dataValues = $plotSeriesValues->getDataValues();
1033+
if (!empty($dataValues)) {
1034+
// if (!is_array($dataValues)) {
1035+
// echo 'NOT AN ARRAY: ';
1036+
// var_dump($dataValues);
1037+
// $dataValues = PHPExcel_Calculation_Functions::flattenArray(
1038+
// PHPExcel_Calculation::getInstance()
1039+
// ->calculateFormula('='.$dataValues,
1040+
// NULL,
1041+
// $pSheet->getCell('A1')
1042+
// )
1043+
// );
1044+
// }
1045+
if (is_array($dataValues)) {
1046+
foreach($dataValues as $plotSeriesKey => $plotSeriesValue) {
1047+
$objWriter->startElement('c:pt');
1048+
$objWriter->writeAttribute('idx', $plotSeriesKey );
1049+
$objWriter->startElement('c:v');
1050+
$objWriter->writeRawData( 1 );
1051+
$objWriter->endElement();
1052+
$objWriter->endElement();
1053+
}
1054+
}
10371055
}
10381056

10391057
$objWriter->endElement();
-29.9 KB
Binary file not shown.
-36.1 KB
Binary file not shown.
-140 KB
Binary file not shown.
-44.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)