This article will show how to create a simple pie 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('Heavy Industry', 12),
array('Retail', 9), 
array('Light Industry', 14), 
array('Out of home', 16),
array('Commuting', 7), 
array('Orientation', 9)
));

Step 3: Set Chart type

$p->chart_type = "pie";

Step 4: Render Chart

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

For complete code, please visit live demo.

This feature is currently supported in paid version only.

 

Whats Next:

  • To download latest free version (with limited features), please visit our Download page.
  • To buy full functional paid version with technical support, please visit our Pricing page.
  • For existing paid customers who want to renew/upgrade, please visit Upgrade page.