PhpOffice\PhpPresentation\Shape\Chart\Series::getDataPointFill PHP Method

getDataPointFill() public method

Get DataPointFill
public getDataPointFill ( integer $dataPointIndex ) : PhpOffice\PhpPresentation\Style\Fill
$dataPointIndex integer Data point index.
return PhpOffice\PhpPresentation\Style\Fill
    public function getDataPointFill($dataPointIndex)
    {
        if (!isset($this->dataPointFills[$dataPointIndex])) {
            $this->dataPointFills[$dataPointIndex] = new Fill();
        }
        return $this->dataPointFills[$dataPointIndex];
    }

Usage Example

Example #1
0
 public function testTypeBar()
 {
     $seriesData = array('A' => 1, 'B' => 2, 'C' => 4, 'D' => 3, 'E' => 2);
     $oPhpPresentation = new PhpPresentation();
     $oSlide = $oPhpPresentation->getActiveSlide();
     $oShape = $oSlide->createChartShape();
     $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80);
     $oBar = new Bar();
     $oSeries = new Series('Downloads', $seriesData);
     $oSeries->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_BLUE));
     $oSeries->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKBLUE));
     $oSeries->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKGREEN));
     $oSeries->getDataPointFill(3)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKRED));
     $oSeries->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKYELLOW));
     $oBar->addSeries($oSeries);
     $oShape->getPlotArea()->setType($oBar);
     $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007');
     $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData';
     $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml'));
     $element = '/c:chartSpace/c:chart/c:plotArea/c:barChart';
     $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/' . $oShape->getIndexedFilename()));
     $element = '/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser';
     $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/' . $oShape->getIndexedFilename()));
     $element = '/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dPt/c:spPr';
     $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/' . $oShape->getIndexedFilename()));
     $element = '/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:tx/c:v';
     $this->assertEquals($oSeries->getTitle(), $oXMLDoc->getElement($element, 'ppt/charts/' . $oShape->getIndexedFilename())->nodeValue);
 }
All Usage Examples Of PhpOffice\PhpPresentation\Shape\Chart\Series::getDataPointFill