phppdffpdf

Is it possible to create a vertical column chart with FPDF


I want to know that is it possible to create a vertical column chart in FPDF as shown in the diagram below:

enter image description here

Infact i want to display a sigle vertical bar divided into sub parts to represent different percentage for different categories.

Is it possible with FPDF and if it is possible give me some tips how to draw it in a pdf file created with FPDF.

Any help will be appreciated.


Solution

  • Insertion as an image

    // Insert a chart in the top-left corner at 300 dpi
    $pdf->Image('my-vertical-column-chart.php',10,10,-300);
    // Insert a chart as dynamic image from a URL
    $pdf->Image('http://www.myhost.com/mysite/my-vertical-column-chart.php?chartparam=value',60,30,90,0,'PNG');
    

    File my-vertical-column-chart.php might be any type of bar chart image generator, like:

    I did it in Google Drive and shared as image. It is the fastest way to do the job;