public function testHashCode() { $oSeries = new Series(); $object = new Pie3D(); $object->addSeries($oSeries); $this->assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); }
public function testTypePie3DSuperScript() { $seriesData = array('A' => 1, 'B' => 2, 'C' => 4, 'D' => 3, 'E' => 2); $oPHPPowerPoint = new PhpPowerpoint(); $oSlide = $oPHPPowerPoint->getActiveSlide(); $oShape = $oSlide->createChartShape(); $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $oPie3D = new Pie3D(); $oSeries = new Series('Downloads', $seriesData); $oSeries->getFont()->setSuperScript(true); $oPie3D->addSeries($oSeries); $oShape->getPlotArea()->setType($oPie3D); $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); $element = '/c:chartSpace/c:chart/c:plotArea/c:pie3DChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/' . $oShape->getIndexedFilename())); $this->assertEquals('30000', $oXMLDoc->getElementAttribute($element, 'baseline', 'ppt/charts/' . $oShape->getIndexedFilename())); }
function fnSlide_Pie3D(PhpPowerpoint $objPHPPowerPoint) { global $oFill; global $oShadow; // Create templated slide echo EOL . date('H:i:s') . ' Create templated slide' . EOL; $currentSlide = createTemplatedSlide($objPHPPowerPoint); // Generate sample data for second 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 a pie chart (that should be inserted in a shape) echo date('H:i:s') . ' Create a pie chart (that should be inserted in a chart shape)' . EOL; $pie3DChart = new Pie3D(); $pie3DChart->setExplosion(20); $series = new Series('Downloads', $seriesData); $series->setShowSeriesName(true); $series->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4672A8')); $series->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFAB4744')); $series->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8AA64F')); $series->getDataPointFill(3)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF725990')); $series->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4299B0')); $series->getDataPointFill(5)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFDC853E')); $series->getDataPointFill(6)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF93A9CE')); $pie3DChart->addSeries($series); // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)' . EOL; $shape = $currentSlide->createChartShape(); $shape->setName('PHPPowerPoint 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('PHPPowerPoint Daily Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getPlotArea()->setType($pie3DChart); $shape->getView3D()->setRotationX(30); $shape->getView3D()->setPerspective(30); $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); $shape->getLegend()->getFont()->setItalic(true); }
public function testChartPie3DExplosion() { $value = rand(0, 100); $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2)); $oSeries->setShowSeriesName(true); $oPie3D = new Pie3D(); $oPie3D->setExplosion($value); $oPie3D->addSeries($oSeries); $phpPowerPoint = new PhpPowerpoint(); $oSlide = $phpPowerPoint->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oPie3D); $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleSeries0\'][@style:family=\'chart\']/style:chart-properties'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); $this->assertEquals($value, $pres->getElementAttribute($element, 'chart:pie-offset', 'Object 1/content.xml')); }
$shape->getView3D()->setRightAngleAxes(true); $shape->getView3D()->setRotationX(20); $shape->getView3D()->setRotationY(20); $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); $shape->getLegend()->getFont()->setItalic(true); // Create templated slide echo date('H:i:s') . ' Create templated slide' . EOL; $currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function // Generate sample data for second chart echo date('H:i:s') . ' Generate sample data for second chart' . EOL; $seriesData = array('Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7); // Create a pie chart (that should be inserted in a shape) echo date('H:i:s') . ' Create a pie chart (that should be inserted in a chart shape)' . EOL; $pie3DChart = new Pie3D(); $pie3DChart->addSeries(new Series('Downloads', $seriesData)); // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)' . EOL; $shape = $currentSlide->createChartShape(); $shape->setName('PHPPowerPoint Daily Downloads')->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80)->setIncludeSpreadsheet(true); $shape->getShadow()->setVisible(true)->setDirection(45)->setDistance(10); $shape->getFill()->setFillType(Fill::FILL_GRADIENT_LINEAR)->setStartColor(new Color('FFCCCCCC'))->setEndColor(new Color('FFFFFFFF'))->setRotation(270); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); $shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getPlotArea()->setType($pie3DChart); $shape->getView3D()->setRotationX(30); $shape->getView3D()->setPerspective(30); $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); $shape->getLegend()->getFont()->setItalic(true); // Save file
// Generate sample data for second chart echo date('H:i:s') . ' Generate sample data for second chart' . EOL; $seriesData = array('Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7); // Create a pie chart (that should be inserted in a shape) echo date('H:i:s') . ' Create a pie chart (that should be inserted in a chart shape)' . EOL; $pie3DChart = new Pie3D(); $series = new Series('Downloads', $seriesData); $series->setShowSeriesName(true); $series->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4672A8')); $series->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFAB4744')); $series->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8AA64F')); $series->getDataPointFill(3)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF725990')); $series->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4299B0')); $series->getDataPointFill(5)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFDC853E')); $series->getDataPointFill(6)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF93A9CE')); $pie3DChart->addSeries($series); // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)' . EOL; $shape = $currentSlide->createChartShape(); $shape->setName('PHPPowerPoint 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('PHPPowerPoint Daily Downloads'); $shape->getTitle()->getFont()->setItalic(true); $shape->getPlotArea()->setType($pie3DChart); $shape->getView3D()->setRotationX(30); $shape->getView3D()->setPerspective(30); $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); $shape->getLegend()->getFont()->setItalic(true); // Create templated slide
public function testChartPie3D() { $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2)); $oSeries->setShowSeriesName(true); $oSeries->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4672A8')); $oSeries->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFAB4744')); $oSeries->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8AA64F')); $oPie3D = new Pie3D(); $oPie3D->addSeries($oSeries); $phpPowerPoint = new PhpPowerpoint(); $oSlide = $phpPowerPoint->getActiveSlide(); $oChart = $oSlide->createChartShape(); $oChart->getPlotArea()->setType($oPie3D); $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); $element = '/office:document-content/office:body/office:chart/chart:chart'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); $this->assertEquals('chart:circle', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml')); $element = '/office:document-content/office:body/office:chart/chart:chart/chart:plot-area/chart:series/chart:data-point'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); }