phpword:更改图表的字体样式的数据和标题
我们的团队正在使用phpword库( https://github.com/phpoffice/phpoffice/phpword )。我们使用一个模板,其中插入正确的元素,其中包括饼图,数据和标题需要具有特定的字体样式。但是,似乎在
public function createPieChart($cats,$values,$title){
$chart = new Chart('pie',$cats,$values);
$chart->getStyle()
->setTitle($title)
->setShowLegend(true)
->setLegendPosition('b')
->setColors($this->colors)
->setWidth(Converter::inchToEmu(3))
->setHeight(Converter::inchToEmu(3))
->setDataLabelOptions([
'showCatName'=>false,
'showVal'=>false,
'showPercent'=>true
]);
return $chart;
}
Our team is using the PhpWord library (https://github.com/PHPOffice/PhpWord). We use a template in which we insert the correct elements, among which are pie charts, and the data and title need to have a specific font style. However, it seems that a way to change the style of the title and data, or to write them using a preset style, is not documented in https://phpword.readthedocs.io/en/latest/styles.html#chart. Is there a way to change the font style of a chart's data and title? Thank you.
public function createPieChart($cats,$values,$title){
$chart = new Chart('pie',$cats,$values);
$chart->getStyle()
->setTitle($title)
->setShowLegend(true)
->setLegendPosition('b')
->setColors($this->colors)
->setWidth(Converter::inchToEmu(3))
->setHeight(Converter::inchToEmu(3))
->setDataLabelOptions([
'showCatName'=>false,
'showVal'=>false,
'showPercent'=>true
]);
return $chart;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论