Skip to content

Commit 543e19a

Browse files
authored
Merge pull request #410 from PHPOffice/issue271pptx
#271 : PowerPoint2007/ODPresentation Writer : Support for rotation for axis label
2 parents 6c46ff2 + 56a6b19 commit 543e19a

File tree

10 files changed

+347
-154
lines changed

10 files changed

+347
-154
lines changed

docs/changes/1.0.0.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# 1.0.0 - WIP
22

33
## Bugfix
4-
- PowerPoint2007 : Text is subscripted when set superscript to false - @qmachard GH-360
4+
- PowerPoint2007 Writer : Text is subscripted when set superscript to false - @qmachard GH-360
55
- Core : Defining width & height of a shape don't return any error if width & height were equal to 0 - @surger GH-555
6+
- ODPresentation Writer : Display axis title depending the visibility - @Progi1984 GH-410
67

78
## Changes
89
- Dropped support for HHVM - @sunspikes GH-556
@@ -36,6 +37,9 @@
3637
- PowerPoint2007 Reader
3738
- PowerPoint2007 Writer
3839
- Support for Border & Fill for Chart's Marker in PowerPoint2007 Writer - @ksmeeks0001 GH-627 & @Progi1986 GH-658
40+
- Support for rotation for axis label - @Progi1986 GH-410
41+
- ODPresentation Writer
42+
- PowerPoint2007 Writer
3943

4044
## Project Management
4145
- Migrated from Travis CI to Github Actions - @Progi1984 GH-635

docs/usage/shapes/chart.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@ $chartShape = $slide->createChartShape();
1212

1313
### Axis
1414

15+
#### Title
16+
17+
You can define title for each axis (X & Y) with `setTitle` method.
18+
You can apply a rotation with the `setTitleRotation` method with an expected paremeter in degrees.
19+
20+
``` php
21+
<?php
22+
23+
use PhpOffice\PhpPresentation\Shape\Chart\Gridlines;
24+
25+
$line = new Line();
26+
27+
$shape = $slide->createChartShape();
28+
$shape->getPlotArea()->setType($line);
29+
30+
$shape->getPlotArea()->getAxisX()->setTitle('Axis X');
31+
$shape->getPlotArea()->getAxisX()->setTitleRotation(45);
32+
```
33+
34+
#### Gridlines
35+
1536
You can define gridlines (minor and major) for each axis (X & Y).
1637
For each gridline, you can custom the width (in points), the fill type and the fill color.
1738

@@ -31,6 +52,8 @@ $shape->getPlotArea()->setType($line);
3152
$shape->getPlotArea()->getAxisX()->setMajorGridlines($gridlines);
3253
```
3354

55+
#### Bounds (Min & Max)
56+
3457
For Axis, you can define the min & max bounds with `setMinBounds` & `setMaxBounds` methods.
3558
For resetting them, you pass null as parameter to these methods.
3659

@@ -47,6 +70,8 @@ $shape->getPlotArea()->getAxisX()->setMinBounds(0);
4770
$shape->getPlotArea()->getAxisX()->setMaxBounds(200);
4871
```
4972

73+
#### Outline
74+
5075
You can define outline for each axis (X & Y).
5176

5277
``` php
@@ -59,9 +84,10 @@ $shape->getPlotArea()->setType($line);
5984
$shape->getPlotArea()->getAxisX()->getOutline()->setWidth(10);
6085
$shape->getPlotArea()->getAxisX()->getOutline()->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_BLUE));
6186
```
87+
#### Tick Marks
6288

6389
For Axis Y, you can define tick mark with `setMinorTickMark` & `setMajorTickMark` methods.
64-
For resetting them, you pass Axis::TICK_MARK_NONE as parameter to these methods.
90+
For resetting them, you pass `Axis::TICK_MARK_NONE` as parameter to these methods.
6591

6692
``` php
6793
<?php
@@ -76,6 +102,8 @@ $shape->getPlotArea()->getAxisY()->setMinorTickMark(Axis::TICK_MARK_NONE);
76102
$shape->getPlotArea()->getAxisY()->setMajorTickMark(Axis::TICK_MARK_INSIDE);
77103
```
78104

105+
#### Unit
106+
79107
For Axis Y, you can define unit with `setMinorUnit` & `setMajorUnit` methods.
80108
For resetting them, you pass null as parameter to these methods.
81109

@@ -91,6 +119,7 @@ $shape->getPlotArea()->setType($line);
91119
$shape->getPlotArea()->getAxisY()->setMinorUnit(null);
92120
$shape->getPlotArea()->getAxisY()->setMajorUnit(0.05);
93121
```
122+
#### Visibility
94123

95124
You can define visibility for each axis (X & Y).
96125

samples/Sample_05_Chart_Line.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@
174174
$shape4->getTitle()->setText('Chart with Outline on Axis');
175175
$shape4->getPlotArea()->setType($lineChart4);
176176
$shape4->getPlotArea()->getAxisX()->setOutline($oOutlineAxisX);
177+
$shape4->getPlotArea()->getAxisX()->setTitleRotation(45);
177178
$shape4->getPlotArea()->getAxisY()->setOutline($oOutlineAxisY);
179+
$shape4->getPlotArea()->getAxisY()->setTitleRotation(135);
178180
$currentSlide->addShape($shape4);
179181

180182
// Create templated slide

samples/Sample_Header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function createTemplatedSlide(PhpOffice\PhpPresentation\PhpPresentation $objPHPP
183183
$shape = $slide->createDrawingShape();
184184
$shape->setName('PHPPresentation logo')
185185
->setDescription('PHPPresentation logo')
186-
->setPath('./resources/phppowerpoint_logo.gif')
186+
->setPath(__DIR__ . '/resources/phppowerpoint_logo.gif')
187187
->setHeight(36)
188188
->setOffsetX(10)
189189
->setOffsetY(10);

0 commit comments

Comments
 (0)