This article will show how to create a simple bar chart using Charts 4 PHP Framework.
Step 1: Include Charts 4 PHP Library
include("../../lib/inc/chartphp_dist.php");
$p = new chartphp();
Step 2: Configure Data array
$p->data = array(
array(
array("2010/12",48.25),
array("2011/01",238.75),
array("2011/02",95.50),
array("2011/03",300.50),
array("2011/04",286.80),
array("2011/05",148.25),
array("2011/06",128.75),
array("2011/07",95.50)
)
);
Step 3: Set Chart type
$p->chart_type = "bar";
Step 4: Render Chart
$out = $p->render("c1");
For complete code, please visit live demo.