From f1f19691871cb85cda8e8fdc8c1f2479880936d1 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 30 May 2017 13:45:23 +0200 Subject: [PATCH] #171 : PowerPoint2007 : Interval Unit in Axis-X --- samples/Sample_05_Chart_Line.php | 26 ++++++++++++------- .../Writer/PowerPoint2007/PptCharts.php | 7 +++++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/samples/Sample_05_Chart_Line.php b/samples/Sample_05_Chart_Line.php index c0c59ef44..b9b23e42a 100644 --- a/samples/Sample_05_Chart_Line.php +++ b/samples/Sample_05_Chart_Line.php @@ -35,15 +35,22 @@ // Generate sample data for chart echo date('H:i:s') . ' Generate sample data for chart' . EOL; -$seriesData = [ - 'Monday' => 12, - 'Tuesday' => 15, - 'Wednesday' => 13, - 'Thursday' => 17, - 'Friday' => 14, - 'Saturday' => 9, - 'Sunday' => 7, -]; +$seriesData = array( + 'Monday 01' => 12, + 'Tuesday 02' => 15, + 'Wednesday 03' => 13, + 'Thursday 04' => 17, + 'Friday 05' => 14, + 'Saturday 06' => 9, + 'Sunday 07' => 7, + 'Monday 08' => 8, + 'Tuesday 09' => 8, + 'Wednesday 10' => 15, + 'Thursday 11' => 16, + 'Friday 12' => 14, + 'Saturday 13' => 14, + 'Sunday 14' => 13, +); // Create templated slide echo EOL . date('H:i:s') . ' Create templated slide' . EOL; @@ -71,6 +78,7 @@ $shape->getView3D()->setPerspective(30); $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); $shape->getLegend()->getFont()->setItalic(true); +$shape->getPlotArea()->getAxisX()->setMajorUnit(5); // Create templated slide echo EOL . date('H:i:s') . ' Create templated slide' . EOL; diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php b/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php index eab8f4b1f..ada5fb77b 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php @@ -2314,6 +2314,13 @@ protected function writeAxis(XMLWriter $objWriter, Chart\Axis $oAxis, string $ty $objWriter->startElement('c:lblOffset'); $objWriter->writeAttribute('val', '100'); $objWriter->endElement(); + + // c:majorUnit + if ($oAxis->getMajorUnit() != null) { + $objWriter->startElement('c:tickLblSkip'); + $objWriter->writeAttribute('val', $oAxis->getMajorUnit()); + $objWriter->endElement(); + } } if (Chart\Axis::AXIS_Y == $typeAxis) {