function fnSlide_Pie(PhpPresentation $objPHPPresentation) { global $oFill; global $oShadow; // Create templated slide echo EOL . date('H:i:s') . ' Create templated slide' . EOL; $currentSlide = createTemplatedSlide($objPHPPresentation); // Generate sample data for second chart echo date('H:i:s') . ' Generate sample data for chart' . EOL; $seriesData = array('Monday' => 18, 'Tuesday' => 23, 'Wednesday' => 14, 'Thursday' => 12, 'Friday' => 20, 'Saturday' => 8, 'Sunday' => 10); // Create a pie chart (that should be inserted in a shape) echo date('H:i:s') . ' Create a non-3D pie chart (that should be inserted in a chart shape)' . EOL; $pieChart = new Pie(); $pieChart->setExplosion(15); $series = new Series('Downloads', $seriesData); $series->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF7CB5EC')); $series->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF434348')); $series->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF90ED7D')); $series->getDataPointFill(3)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFF7A35C')); $series->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8085E9')); $series->getDataPointFill(5)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFF15C80')); $series->getDataPointFill(6)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE4D354')); $series->setShowPercentage(true); $series->setShowValue(false); $series->setShowSeriesName(false); $series->setShowCategoryName(true); $pieChart->addSeries($series); // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)' . EOL; $shape = $currentSlide->createChartShape(); $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($pieChart); $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); $shape->getLegend()->getFont()->setItalic(true); }
public function testShowValue() { $object = new Series(); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowValue(true)); $this->assertTrue($object->hasShowValue()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowValue(false)); $this->assertFalse($object->hasShowValue()); }
$oFill = new Fill(); $oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20')); $oShadow = new Shadow(); $oShadow->setVisible(true)->setDirection(45)->setDistance(10); // 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 line chart (that should be inserted in a chart shape)' . EOL; $lineChart = new Line(); $series = new Series('Downloads', $seriesData); $series->setShowSeriesName(true); $series->setShowValue(true); $lineChart->addSeries($series); // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)' . EOL; $shape = $currentSlide->createChartShape(); $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($lineChart); $shape->getView3D()->setRotationX(30); $shape->getView3D()->setPerspective(30); $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); $shape->getLegend()->getFont()->setItalic(true);