Horizontal Bar Graph using BarDiagram() in FPDF

Generated Horizontal Bar Graph (mysql data) using BarDiagram()…Bar Diagram in first A4 page ok…but after the pagebreak each data appears at the bottom of the next page, then after that it becomes unpredictable to the extent that it can print multiple empty pages, or throw individual cells down the pages…How to solve this issue:mad:

Sharing link which may be helpful For Bar charts


I just added more data in the main array and received the messed up output. But then I added the header columns i.e

$pdf->Cell(30, 5, ‘Number of men:’);
$pdf->Cell(15, 5, $data[‘Men’], 0, 0, ‘R’);

I added above set of code for newly added array values. and then the graph and legends were all good.