This article will show how to create a simple area 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",348.25),
		array("Feb",338.75),
		array("Mar",395.50),
		array("Apr",330.50),
		array("May",326.80),
		array("Jun",400)),
	array(	
		array("Jan",300.25),
		array("Feb",225.75),
		array("Mar",440.50),
		array("Apr",259.50),
		array("May",350.80),
		array("Jun",360))	
	);

Step 3: Set Chart type

$p->chart_type = "area";

Step 4: Render Chart

$out = $p->render("c1");

For complete code, please visit live demo.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?