|
20 | 20 | use PhpOffice\PhpPresentation\PhpPresentation;
|
21 | 21 | use PhpOffice\PhpPresentation\Shape\Chart\Series;
|
22 | 22 | use PhpOffice\PhpPresentation\Shape\Chart\Type\Bar3D;
|
| 23 | +use PhpOffice\PhpPresentation\Shape\Chart\Type\Bar; |
23 | 24 | use PhpOffice\PhpPresentation\Shape\Chart\Type\Line;
|
24 | 25 | use PhpOffice\PhpPresentation\Shape\Chart\Type\Pie;
|
25 | 26 | use PhpOffice\PhpPresentation\Shape\Chart\Type\Pie3D;
|
26 | 27 | use PhpOffice\PhpPresentation\Shape\Chart\Type\Scatter;
|
27 | 28 | use PhpOffice\PhpPresentation\Style\Color;
|
28 | 29 | use PhpOffice\PhpPresentation\Style\Fill;
|
| 30 | +use PhpOffice\PhpPresentation\Style\Font; |
29 | 31 | use PhpOffice\PhpPresentation\Writer\ODPresentation;
|
30 | 32 | use PhpOffice\PhpPresentation\Tests\TestHelperDOCX;
|
31 | 33 |
|
@@ -84,6 +86,45 @@ public function testTitleVisibility()
|
84 | 86 | $this->assertFalse($oXMLDoc->elementExists($elementStyle, 'Object 1/content.xml'));
|
85 | 87 | }
|
86 | 88 |
|
| 89 | + public function testAxisFont() |
| 90 | + { |
| 91 | + |
| 92 | + $phpPresentation = new PhpPresentation(); |
| 93 | + $oSlide = $phpPresentation->getActiveSlide(); |
| 94 | + $oShape = $oSlide->createChartShape(); |
| 95 | + $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2)); |
| 96 | + $oBar = new Bar(); |
| 97 | + $oBar->addSeries($oSeries); |
| 98 | + $oShape->getPlotArea()->setType($oBar); |
| 99 | + $oShape->getPlotArea()->getAxisX()->getFont()->getColor()->setRGB('AABBCC'); |
| 100 | + $oShape->getPlotArea()->getAxisX()->getFont()->setItalic(true); |
| 101 | + |
| 102 | + $oShape->getPlotArea()->getAxisY()->getFont()->getColor()->setRGB('00FF00'); |
| 103 | + $oShape->getPlotArea()->getAxisY()->getFont()->setSize(16); |
| 104 | + $oShape->getPlotArea()->getAxisY()->getFont()->setName('Arial'); |
| 105 | + |
| 106 | + $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation'); |
| 107 | + |
| 108 | + $element = '/office:document-content/office:body/office:chart/chart:chart'; |
| 109 | + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); |
| 110 | + $this->assertEquals('chart:bar', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml')); |
| 111 | + |
| 112 | + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleAxisX\']/style:text-properties'; |
| 113 | + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); |
| 114 | + $this->assertEquals('#AABBCC', $pres->getElementAttribute($element, 'fo:color', 'Object 1/content.xml'));//Color XAxis |
| 115 | + $this->assertEquals('italic', $pres->getElementAttribute($element, 'fo:font-style', 'Object 1/content.xml'));//Italic XAxis |
| 116 | + $this->assertEquals('10pt', $pres->getElementAttribute($element, 'fo:font-size', 'Object 1/content.xml'));//Size XAxis |
| 117 | + $this->assertEquals('Calibri', $pres->getElementAttribute($element, 'fo:font-family', 'Object 1/content.xml'));//Size XAxis |
| 118 | + |
| 119 | + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleAxisY\']/style:text-properties'; |
| 120 | + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); |
| 121 | + $this->assertEquals('#00FF00', $pres->getElementAttribute($element, 'fo:color', 'Object 1/content.xml'));//Color YAxis |
| 122 | + $this->assertEquals('normal', $pres->getElementAttribute($element, 'fo:font-style', 'Object 1/content.xml'));//Italic YAxis |
| 123 | + $this->assertEquals('16pt', $pres->getElementAttribute($element, 'fo:font-size', 'Object 1/content.xml'));//Size YAxis |
| 124 | + $this->assertEquals('Arial', $pres->getElementAttribute($element, 'fo:font-family', 'Object 1/content.xml'));//Size YAxis |
| 125 | + |
| 126 | + } |
| 127 | + |
87 | 128 | public function testChartBar3D()
|
88 | 129 | {
|
89 | 130 | $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2));
|
|
0 commit comments