Tweak to varyColors element

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@86902 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2012-02-24 13:13:38 +00:00
parent e624bb7c9e
commit fdd1b20830
1 changed files with 16 additions and 7 deletions

View File

@ -220,8 +220,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$this->_writeDataLbls($objWriter);
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_LINECHART) ||
($groupType === PHPExcel_Chart_DataSeries::TYPE_LINECHART_3D)) {
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_LINECHART) {
// Line only, Line3D can't be smoothed
$objWriter->startElement('c:smooth');
$objWriter->writeAttribute('val', (integer) $plotGroup->getSmoothLine() );
@ -567,13 +567,22 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->endElement();
}
// TODO Set to 1 if any plotseries values don't have style colours defined, otherwise set to 0
$objWriter->startElement('c:varyColors');
$objWriter->writeAttribute('val', 1);
$objWriter->endElement();
// Get these details before the loop, because we can use the count to check for varyColors
$plotSeriesOrder = $plotGroup->getPlotOrder();
$plotSeriesCount = count($plotSeriesOrder);
if (($groupType !== PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART) &&
($groupType !== PHPExcel_Chart_DataSeries::TYPE_RADARCHART) &&
($groupType !== PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) {
if (($groupType !== PHPExcel_Chart_DataSeries::TYPE_LINECHART) ||
($plotSeriesCount > 1)) {
$objWriter->startElement('c:varyColors');
$objWriter->writeAttribute('val', 1);
$objWriter->endElement();
}
}
foreach($plotSeriesOrder as $plotSeriesIdx => $plotSeriesRef) {
$objWriter->startElement('c:ser');