Radars and some fixes to bubbles

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@86922 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2012-02-24 23:58:02 +00:00
parent 49e485e010
commit 8bbb468122
1 changed files with 57 additions and 5 deletions

View File

@ -215,6 +215,17 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$plotGroup = $plotArea->getPlotGroupByIndex($i);
$groupType = $plotGroup->getPlotType();
if ($groupType == $chartType) {
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_RADARCHART) {
$objWriter->startElement('c:radarStyle');
$objWriter->writeAttribute('val', 'marker' );
$objWriter->endElement();
} elseif ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART) {
$objWriter->startElement('c:scatterStyle');
$objWriter->writeAttribute('val', 'lineMarker' );
$objWriter->endElement();
}
$this->_writePlotGroup($plotGroup, $groupType, $objWriter, $catIsMultiLevelSeries, $valIsMultiLevelSeries, $plotGroupingType);
}
}
@ -504,8 +515,10 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->writeAttribute('val', 0);
$objWriter->endElement();
$layout = $yAxisLabel->getLayout();
$this->_writeLayout($layout, $objWriter);
if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$layout = $yAxisLabel->getLayout();
$this->_writeLayout($layout, $objWriter);
}
$objWriter->endElement();
}
@ -662,7 +675,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
}
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||
($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) {
($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D) ||
($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART)) {
$objWriter->startElement('c:invertIfNegative');
$objWriter->writeAttribute('val', 0);
@ -688,7 +702,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
}
}
if ($groupType == PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$objWriter->startElement('c:xVal');
} else {
$objWriter->startElement('c:cat');
@ -703,7 +717,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
if ($plotSeriesValues) {
$valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries();
if ($groupType == PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$objWriter->startElement('c:yVal');
} else {
$objWriter->startElement('c:val');
@ -713,6 +727,10 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->endElement();
}
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$this->_writeBubbles($plotSeriesValues, $objWriter);
}
$objWriter->endElement();
}
@ -826,6 +844,40 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
}
}
private function _writeBubbles($plotSeriesValues, $objWriter)
{
if (is_null($plotSeriesValues)) {
return;
}
$objWriter->startElement('c:bubbleSize');
$objWriter->startElement('c:numLit');
$objWriter->startElement('c:formatCode');
$objWriter->writeRawData( 'General' );
$objWriter->endElement();
$objWriter->startElement('c:ptCount');
$objWriter->writeAttribute('val', $plotSeriesValues->getPointCount() );
$objWriter->endElement();
foreach($plotSeriesValues->getDataValues() as $plotSeriesKey => $plotSeriesValue) {
$objWriter->startElement('c:pt');
$objWriter->writeAttribute('idx', $plotSeriesKey );
$objWriter->startElement('c:v');
$objWriter->writeRawData( 1 );
$objWriter->endElement();
$objWriter->endElement();
}
$objWriter->endElement();
$objWriter->endElement();
$objWriter->startElement('c:bubble3D');
$objWriter->writeAttribute('val', 0 );
$objWriter->endElement();
}
private function _writeLayout(PHPExcel_Chart_Layout $layout = NULL, $objWriter)
{
$objWriter->startElement('c:layout');