Libchart : Howto Create Bar Chart and Pie Chart Easily with PHP
Jon Moffet
Libchart is a lightweight PHP class library which can be use to create charts. It support creating Horizontal Bar , Vertical Bar, Pie chart and Line graph which is useful for data representation on your PHP scripts.
Here's a sample of Libchart output :


Sample Code
PHP:
-
include "libchart/libchart.php";
-
-
-
$chart = new VerticalChart(500,250);
-
-
$chart->addPoint(new Point("Jan 2005", 273));
-
$chart->addPoint(new Point("Feb 2005", 321));
-
$chart->addPoint(new Point("March 2005", 442));
-
$chart->addPoint(new Point("April 2005", 711));
-
-
$chart->setTitle("Monthly usage for www.example.com");
-
$chart->render();
You can download Libchart from its author's website.
Alternatively you can use JpGraph to produce chart with PHP. However Libchart is much simpler to use and it can be used freely in commercial applications without requiring you to pay extra licensing fees.
Posted in Uncategorized |







