use PhpOffice\PhpSpreadsheet\Chart\Chart; use PhpOffice\PhpSpreadsheet\Chart\Title; use PhpOffice\PhpSpreadsheet\Chart\PlotArea; use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\Axis; $graph = new Chart( 'sample_graph', new Title('Test Graph'), new Legend(Legend::POSITION_RIGHT, null, false), new PlotArea(null, null, null, null), true, 0, null, new Axis('bottom'), new Axis('left') ); $graph->setbackgroundimage('images/my_background_image.png');
require_once ('./vendor/autoload.php'); use PhpOffice\PhpSpreadsheet\Chart\Chart; use PhpOffice\PhpSpreadsheet\Chart\Title; $graph = new Chart( 'sample_graph', new Title('Test Graph') ); $graph->setbackgroundimage('images/my_background_image.png');In this example, we create a new graph object using the PhpSpreadsheet package. We then set the background image for the graph using the SetBackgroundImage function. It is important to note that the SetBackgroundImage function is a part of the PhpSpreadsheet package.