function fnSlide_Area(PhpPresentation $objPHPPresentation) { global $oFill; global $oShadow; // Generate sample data for chart echo date('H:i:s') . ' Generate sample data for chart' . EOL; $seriesData = array('Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7); // Create templated slide echo EOL . date('H:i:s') . ' Create templated slide' . EOL; $currentSlide = createTemplatedSlide($objPHPPresentation); // Create a line chart (that should be inserted in a shape) echo date('H:i:s') . ' Create a area chart (that should be inserted in a chart shape)' . EOL; $areaChart = new Area(); $series = new Series('Downloads', $seriesData); $series->setShowSeriesName(true); $series->setShowValue(true); $series->getFill()->setStartColor(new Color('FF93A9CE')); $series->setLabelPosition(Series::LABEL_INSIDEEND); $areaChart->addSeries($series); // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)' . EOL; $shape = $currentSlide->createChartShape(); $shape->getTitle()->setVisible(false); $shape->setName('PHPPresentation Daily Downloads')->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $shape->setShadow($oShadow); $shape->setFill($oFill); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); $shape->getTitle()->setText('PHPPresentation Daily Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getPlotArea()->setType($areaChart); $shape->getView3D()->setRotationX(30); $shape->getView3D()->setPerspective(30); $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); $shape->getLegend()->getFont()->setItalic(true); }
public function testLabelPosition() { $object = new Series(); $this->assertEmpty($object->getHashIndex()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setLabelPosition(Series::LABEL_INSIDEBASE)); $this->assertEquals(Series::LABEL_INSIDEBASE, $object->getLabelPosition()); }