简体   繁体   English

PHPOffice/PHPPresentation (PowerPoint):如何使用 setDisplayBlankAs() 图表方法?

[英]PHPOffice/PHPPresentation (PowerPoint): how to use setDisplayBlankAs() Chart method?

I tried to use setDisplayBlankAs() method as shown in documentation at:我尝试使用setDisplayBlankAs()方法,如以下文档所示:

https://phpoffice.github.io/PHPPresentation/usage/shapes/chart.html#customization https://phpoffice.github.io/PHPPresentation/usage/shapes/chart.html#customization

but I got an error:但我得到一个错误:

PhpOffice\PhpPresentation\Shape\Chart\Type\Line::setDisplayBlankAs() {"exception":"[object] (Error(code: 0): Call to undefined method PhpOffice\PhpPresentation\Shape\Chart\Type\Line::setDisplayBlankAs() at... PhpOffice\PhpPresentation\Shape\Chart\Type\Line::setDisplayBlankAs() {"exception":"[object] (Error(code: 0): Call to undefined method PhpOffice\PhpPresentation\Shape\Chart\Type\Line:: setDisplayBlankAs() 在...

This error likely says the method is missing.此错误可能表示该方法丢失。 I wonder what is wrong with my code:我想知道我的代码有什么问题:

use PhpOffice\PhpPresentation\Shape\Chart;
// ...
$lineChart = new Chart\Type\Line();
$lineChart->setDisplayBlankAs(Chart::BLANKAS_GAP);
$lineChart->addSeries($series);
$oShape = $currentSlide->createChartShape();
$oShape->getPlotArea()->setType($lineChart);
// ... etc.

Without the line with setDisplayBlankAs() method my code works as expected.如果不使用 setDisplayBlankAs() 方法,我的代码将按预期工作。
Latest PHPOffice/PHPPresentation installed via Composer about a month ago.大约一个月前通过 Composer 安装的最新 PHPOffice/PHPPresentation。

Found it.找到了。 Method is inside the Shape:方法在形状内部:

$oShape->setDisplayBlankAs(Chart::BLANKAS_GAP);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM