Can't give you exploding penguins.... so here's the next best thing: exploding pies and donuts

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@86908 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2012-02-24 17:08:13 +00:00
parent 778ec9e7af
commit 49e485e010

View File

@ -241,7 +241,15 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->writeAttribute('val', 100 ); $objWriter->writeAttribute('val', 100 );
$objWriter->endElement(); $objWriter->endElement();
} }
} elseif ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$objWriter->startElement('c:bubbleScale');
$objWriter->writeAttribute('val', 25 );
$objWriter->endElement();
$objWriter->startElement('c:showNegBubbles');
$objWriter->writeAttribute('val', 0 );
$objWriter->endElement();
} }
// Generate 2 unique numbers to use for axId values // Generate 2 unique numbers to use for axId values
@ -280,7 +288,11 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
($groupType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($groupType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) &&
($groupType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { ($groupType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
$this->_writeCatAx($objWriter,$plotArea,$xAxisLabel,$groupType,$id1,$id2,$catIsMultiLevelSeries); if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$this->_writeValAx($objWriter,$plotArea,$xAxisLabel,$groupType,$id1,$id2,$catIsMultiLevelSeries);
} else {
$this->_writeCatAx($objWriter,$plotArea,$xAxisLabel,$groupType,$id1,$id2,$catIsMultiLevelSeries);
}
$this->_writeValAx($objWriter,$plotArea,$yAxisLabel,$groupType,$id1,$id2,$valIsMultiLevelSeries); $this->_writeValAx($objWriter,$plotArea,$yAxisLabel,$groupType,$id1,$id2,$valIsMultiLevelSeries);
} }
@ -530,9 +542,11 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
} }
if ($isMultiLevelSeries) { if ($isMultiLevelSeries) {
$objWriter->startElement('c:noMultiLvlLbl'); if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$objWriter->writeAttribute('val', 0); $objWriter->startElement('c:noMultiLvlLbl');
$objWriter->endElement(); $objWriter->writeAttribute('val', 0);
$objWriter->endElement();
}
} }
$objWriter->endElement(); $objWriter->endElement();
@ -608,6 +622,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
$objWriter->startElement('c:dPt'); $objWriter->startElement('c:dPt');
$objWriter->startElement('c:idx'); $objWriter->startElement('c:idx');
$objWriter->writeAttribute('val', 3); $objWriter->writeAttribute('val', 3);
@ -658,7 +673,27 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$plotSeriesCategory = $plotGroup->getPlotCategoryByIndex($plotSeriesRef); $plotSeriesCategory = $plotGroup->getPlotCategoryByIndex($plotSeriesRef);
if ($plotSeriesCategory && ($plotSeriesCategory->getPointCount() > 0)) { if ($plotSeriesCategory && ($plotSeriesCategory->getPointCount() > 0)) {
$catIsMultiLevelSeries = $catIsMultiLevelSeries || $plotSeriesCategory->isMultiLevelSeries(); $catIsMultiLevelSeries = $catIsMultiLevelSeries || $plotSeriesCategory->isMultiLevelSeries();
$objWriter->startElement('c:cat');
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
if (!is_null($plotGroup->getPlotStyle())) {
$plotStyle = $plotGroup->getPlotStyle();
if ($plotStyle) {
$objWriter->startElement('c:explosion');
$objWriter->writeAttribute('val', 25);
$objWriter->endElement();
}
}
}
if ($groupType == PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$objWriter->startElement('c:xVal');
} else {
$objWriter->startElement('c:cat');
}
$this->_writePlotSeriesValues($plotSeriesCategory, $objWriter, $groupType, 'str'); $this->_writePlotSeriesValues($plotSeriesCategory, $objWriter, $groupType, 'str');
$objWriter->endElement(); $objWriter->endElement();
} }
@ -667,7 +702,13 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$plotSeriesValues = $plotGroup->getPlotValuesByIndex($plotSeriesRef); $plotSeriesValues = $plotGroup->getPlotValuesByIndex($plotSeriesRef);
if ($plotSeriesValues) { if ($plotSeriesValues) {
$valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries(); $valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries();
$objWriter->startElement('c:val');
if ($groupType == PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$objWriter->startElement('c:yVal');
} else {
$objWriter->startElement('c:val');
}
$this->_writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, 'num'); $this->_writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, 'num');
$objWriter->endElement(); $objWriter->endElement();
} }