Skip to content

Commit

Permalink
#171 : PowerPoint2007 : Interval Unit in Axis-X
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Jul 28, 2021
1 parent f8c8206 commit f1f1969
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
26 changes: 17 additions & 9 deletions samples/Sample_05_Chart_Line.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f1f1969

Please sign in to comment.