php - PHPSPREADSHEET:在 Excel 图表中显示隐藏的数据行
问题描述
我使用phpspreadsheet
包含图表导出的 excel 在 libre office 上运行良好,但是当我使用 MS 打开时有空白区域图表。Excel。
问题是,我用来构建图表的数据范围是使用此代码隐藏的。
$spreadsheet->getActiveSheet()->getRowDimension($rowNow)->setVisible(false);
我使用这段代码来构建图表:
// Build the dataseries
$series = new PhpOffice\PhpSpreadsheet\Chart\DataSeries(
PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_PIECHART, // plotType
NULL, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
$dataSeriesValues // plotValues
);
// Set the series in the plot area
$plotArea = new PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
$legend = new PhpOffice\PhpSpreadsheet\Chart\Legend(PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
$title = new PhpOffice\PhpSpreadsheet\Chart\Title($t);
$yAxisLabel = new PhpOffice\PhpSpreadsheet\Chart\Title('Value');
// create chart
$chart = new PhpOffice\PhpSpreadsheet\Chart\Chart(
'chart1', // name
$title, // title
$legend, // legend
$plotArea, // plotArea
true, // plotVisibleOnly
0, // displayBlanksAs
null, // xAxisLabel
$yAxisLabel // yAxisLabel
);
$chart->setTopLeftPosition($pos[0]);
$chart->setBottomRightPosition($pos[1]);
我应该向我的图表构建器添加什么属性来表示我之前提供的设置?
解决方案
推荐阅读
- r - 将 writeOGR 与 rpy2 一起使用
- dbt - DBT 将支持创建临时表,例如 create table #temp1 as select * from tab1 还是仅适用于 CTE 方式
- flutter - 如何在颤动中绘制圆形对角线?
- c++ - 使用 SDL2_mixer 效果时访问冲突?
- django - 为什么我在 Django 中的 ManyToManyField 只返回一个值?
- ios - 在 iOS 13 中更改 ImagePicker 导航标题
- c# - C# Xamarin 没有收到来自 HttpClient 的响应
- reactjs - 输入值在 setState 上不会改变
- html - 当孩子依赖父母,父母依赖孩子时,浏览器如何计算宽度
- r - R矩阵:如何根据所有列的总和进行子集化?