mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-16 04:56:34 +00:00
Check existing of PlotLabel before using its method getDataValue()
I'v got that: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\FatalError: "Error: Uncaught Error: Call to a member function getDataValue() on bool in .../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/JpGraphRendererBase.php:337 I've found that it's necessary to check existing of PlotLabel before using its method getDataValue().
This commit is contained in:
@@ -334,8 +334,9 @@ abstract class JpGraphRendererBase implements IRenderer
|
||||
// Set the appropriate plot marker
|
||||
$this->formatPointMarker($seriesPlot, $marker);
|
||||
}
|
||||
if ($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($index))
|
||||
if ($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($index)) {
|
||||
$dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($index)->getDataValue();
|
||||
}
|
||||
$seriesPlot->SetLegend($dataLabel);
|
||||
|
||||
$seriesPlots[] = $seriesPlot;
|
||||
|
||||
Reference in New Issue
Block a user