private function PHPExcel_Writer_Excel2007_Chart::_writePlotGroup in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007/Chart.php \PHPExcel_Writer_Excel2007_Chart::_writePlotGroup()
Write Plot Group (series of related plots)
Parameters
PHPExcel_Chart_DataSeries $plotGroup:
string $groupType Type of plot for dataseries:
PHPExcel_Shared_XMLWriter $objWriter XML Writer:
boolean &$catIsMultiLevelSeries Is category a multi-series category:
boolean &$valIsMultiLevelSeries Is value set a multi-series set:
string &$plotGroupingType Type of grouping for multi-series values:
PHPExcel_Worksheet $pSheet:
Throws
1 call to PHPExcel_Writer_Excel2007_Chart::_writePlotGroup()
- PHPExcel_Writer_Excel2007_Chart::_writePlotArea in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel2007/ Chart.php - Write Chart Plot Area
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel2007/ Chart.php, line 1093
Class
- PHPExcel_Writer_Excel2007_Chart
- PHPExcel_Writer_Excel2007_Chart
Code
private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet) {
if (is_null($plotGroup)) {
return;
}
if ($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART || $groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D) {
$objWriter
->startElement('c:barDir');
$objWriter
->writeAttribute('val', $plotGroup
->getPlotDirection());
$objWriter
->endElement();
}
if (!is_null($plotGroup
->getPlotGrouping())) {
$plotGroupingType = $plotGroup
->getPlotGrouping();
$objWriter
->startElement('c:grouping');
$objWriter
->writeAttribute('val', $plotGroupingType);
$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_RADARCHART && $groupType !== PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) {
if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_LINECHART) {
if ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART || $groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D || $groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART || $plotSeriesCount > 1) {
$objWriter
->startElement('c:varyColors');
$objWriter
->writeAttribute('val', 1);
$objWriter
->endElement();
}
else {
$objWriter
->startElement('c:varyColors');
$objWriter
->writeAttribute('val', 0);
$objWriter
->endElement();
}
}
}
foreach ($plotSeriesOrder as $plotSeriesIdx => $plotSeriesRef) {
$objWriter
->startElement('c:ser');
$objWriter
->startElement('c:idx');
$objWriter
->writeAttribute('val', $this->_seriesIndex + $plotSeriesIdx);
$objWriter
->endElement();
$objWriter
->startElement('c:order');
$objWriter
->writeAttribute('val', $this->_seriesIndex + $plotSeriesRef);
$objWriter
->endElement();
if ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART || $groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D || $groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) {
$objWriter
->startElement('c:dPt');
$objWriter
->startElement('c:idx');
$objWriter
->writeAttribute('val', 3);
$objWriter
->endElement();
$objWriter
->startElement('c:bubble3D');
$objWriter
->writeAttribute('val', 0);
$objWriter
->endElement();
$objWriter
->startElement('c:spPr');
$objWriter
->startElement('a:solidFill');
$objWriter
->startElement('a:srgbClr');
$objWriter
->writeAttribute('val', 'FF9900');
$objWriter
->endElement();
$objWriter
->endElement();
$objWriter
->endElement();
$objWriter
->endElement();
}
// Labels
$plotSeriesLabel = $plotGroup
->getPlotLabelByIndex($plotSeriesRef);
if ($plotSeriesLabel && $plotSeriesLabel
->getPointCount() > 0) {
$objWriter
->startElement('c:tx');
$objWriter
->startElement('c:strRef');
$this
->_writePlotSeriesLabel($plotSeriesLabel, $objWriter);
$objWriter
->endElement();
$objWriter
->endElement();
}
// Formatting for the points
if ($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART || $groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) {
$objWriter
->startElement('c:spPr');
$objWriter
->startElement('a:ln');
$objWriter
->writeAttribute('w', 12700);
if ($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) {
$objWriter
->startElement('a:noFill');
$objWriter
->endElement();
}
$objWriter
->endElement();
$objWriter
->endElement();
}
$plotSeriesValues = $plotGroup
->getPlotValuesByIndex($plotSeriesRef);
if ($plotSeriesValues) {
$plotSeriesMarker = $plotSeriesValues
->getPointMarker();
if ($plotSeriesMarker) {
$objWriter
->startElement('c:marker');
$objWriter
->startElement('c:symbol');
$objWriter
->writeAttribute('val', $plotSeriesMarker);
$objWriter
->endElement();
if ($plotSeriesMarker !== 'none') {
$objWriter
->startElement('c:size');
$objWriter
->writeAttribute('val', 3);
$objWriter
->endElement();
}
$objWriter
->endElement();
}
}
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART || $groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D || $groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$objWriter
->startElement('c:invertIfNegative');
$objWriter
->writeAttribute('val', 0);
$objWriter
->endElement();
}
// Category Labels
$plotSeriesCategory = $plotGroup
->getPlotCategoryByIndex($plotSeriesRef);
if ($plotSeriesCategory && $plotSeriesCategory
->getPointCount() > 0) {
$catIsMultiLevelSeries = $catIsMultiLevelSeries || $plotSeriesCategory
->isMultiLevelSeries();
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 || $groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART) {
$objWriter
->startElement('c:xVal');
}
else {
$objWriter
->startElement('c:cat');
}
$this
->_writePlotSeriesValues($plotSeriesCategory, $objWriter, $groupType, 'str', $pSheet);
$objWriter
->endElement();
}
// Values
if ($plotSeriesValues) {
$valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues
->isMultiLevelSeries();
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART || $groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART) {
$objWriter
->startElement('c:yVal');
}
else {
$objWriter
->startElement('c:val');
}
$this
->_writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, 'num', $pSheet);
$objWriter
->endElement();
}
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$this
->_writeBubbles($plotSeriesValues, $objWriter, $pSheet);
}
$objWriter
->endElement();
}
$this->_seriesIndex += $plotSeriesIdx + 1;
}