[英]How to set position of Data Labels in phpspreadsheet chart
I want to generate chart using phpspreadsheet library.我想使用 phpspreadsheet 库生成图表。 Below is my requirement that I am not able to fulfill right now using phpspreadsheet.以下是我现在无法使用 phpspreadsheet 满足的要求。
please check below images and suggest me options for below points.请检查下面的图片并建议我以下几点的选项。
How can I do that.我怎样才能做到这一点。 I have searched whole Chart.php writer file but not found any usefull function.我搜索了整个 Chart.php 编写器文件,但没有找到任何有用的功能。
Help me guys if possible or any other alternate Library also there...如果可能,请帮助我,或者那里还有其他任何替代图书馆...
Current Output:电流输出:
Thanks in Advance.提前致谢。
I have searched lot off and finally got idea, That Chart is XML code and loaded in Excel.我已经搜索了很多,终于有了想法,该图表是 XML 代码并加载到 Excel 中。 So phpspreadsheet is already doing same for chart, phpspreadsheet itself generates xml code.所以 phpspreadsheet 已经对图表做了同样的事情,phpspreadsheet 本身生成了 xml 代码。
$objWriter->startElement('c:dLblPos');
$showVal = (empty($chartLayout)) ? 0 : $chartLayout->getShowVal();
$objWriter->writeAttribute('val', 't');
$objWriter->endElement();
We just need to add this lines in Phpspreadsheet/Writer/Xlsx/Chart.php on Line No : 361我们只需要在第 361 行的 Phpspreadsheet/Writer/Xlsx/Chart.php 中添加这一行
Here You can set position of label for values.您可以在此处设置值的标签位置。
"t" : Top "t" : 顶部
"b" : Below "b" : 下面
Thanks谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.