This article will show how to create a simple line 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("Jan",48.25),
array("Feb",238.75),
array("Mar",95.50),
array("Apr",300.50),
array("May",286.80),
array("Jun",400)),
array(
array("Jan",300.25),
array("Feb",225.75),
array("Mar",44.50),
array("Apr",259.50),
array("May",250.80),
array("Jun",300))
);
Step 3: Set Chart type
$p->chart_type = "line";
Step 4: Render Chart
$out = $p->render("c1");
For complete code, please visit live demo.