Skip to content

Commit 3fb01f6

Browse files
authored
Merge branch 'develop' into issue255
2 parents 63748d8 + 429d548 commit 3fb01f6

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
- PowerPoint2007 Writer : Support of margins in cell in table - @carlosafonso @Progi1984 GH-273 GH-315
1313
- Fixed the corruption of file when an addExternalSlide is called - @Progi1984 GH-240
1414

15+
### Changes
16+
- Misc : Added two methods for setting Border & Fill in Legend - @Progi1984 GH-265
17+
1518
### Features
1619
- ODPresentation Writer : Show/Hide Value / Name / Series Name in Chart - @Progi1984 GH-272
1720
- ODPresentation Writer : Axis Bounds in Chart - @Progi1984 GH-269
@@ -26,7 +29,7 @@
2629
- PowerPoint2007 Writer : Support tick mark & unit in Axis for Chart - @Faab GH-218
2730
- PowerPoint2007 Writer : Support separator in Series for Chart - @jphchaput GH-218
2831
- PowerPoint2007 Writer : Add support for Outline in Axis - @Progi1984 GH-255
29-
- Misc : Added two methods for setting Border & Fill in Legend - @Progi1984 GH-265
32+
- PowerPoint2007 Writer : Support autoscale for Chart - @Progi1984 GH-293
3033

3134
## 0.7.0 - 2016-09-12
3235

docs/shapes_chart.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ You can define if some informations are displayed.
156156
$oSeries->setShowSeriesName(true);
157157
$oSeries->setShowValue(true);
158158
159+
View3D
160+
^^^^^^
161+
162+
For enabling the autoscale for a shape, you must reset the height percent.
163+
164+
.. code-block:: php
165+
166+
$oShape->getView3D()->setHeightPercent(null);
167+
159168
Types
160169
-----
161170

src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,15 @@ public function writeChart(Chart $chart)
9797
$objWriter->writeAttribute('val', $chart->getView3D()->getRotationX());
9898
$objWriter->endElement();
9999

100-
// c:hPercent
101-
$objWriter->startElement('c:hPercent');
102-
$objWriter->writeAttribute('val', $chart->getView3D()->getHeightPercent());
103-
$objWriter->endElement();
104-
105100
// c:rotY
106101
$objWriter->startElement('c:rotY');
107102
$objWriter->writeAttribute('val', $chart->getView3D()->getRotationY());
108103
$objWriter->endElement();
109104

105+
// c:hPercent
106+
$hPercent = $chart->getView3D()->getHeightPercent();
107+
$objWriter->writeElementIf($hPercent != null, 'c:hPercent', 'val', $hPercent);
108+
110109
// c:depthPercent
111110
$objWriter->startElement('c:depthPercent');
112111
$objWriter->writeAttribute('val', $chart->getView3D()->getDepthPercent());

tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,4 +880,22 @@ public function testTypeScatterSuperScript()
880880
$this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element);
881881
$this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '30000');
882882
}
883+
884+
public function testView3D()
885+
{
886+
$oSlide = $this->oPresentation->getActiveSlide();
887+
$oLine = new Line();
888+
$oLine->addSeries(new Series('Downloads', $this->seriesData));
889+
$oShape = $oSlide->createChartShape();
890+
$oShape->getPlotArea()->setType($oLine);
891+
892+
$element = '/c:chartSpace/c:chart/c:view3D/c:hPercent';
893+
$this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element);
894+
$this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'val', 100);
895+
896+
$oShape->getView3D()->setHeightPercent(null);
897+
$this->resetPresentationFile();
898+
899+
$this->assertZipXmlElementNotExists('ppt/charts/' . $oShape->getIndexedFilename(), $element);
900+
}
883901
}

0 commit comments

Comments
 (0)