Creating a Bubble Chart using PHP

Creating a Bubble Chart using PHP

This article will show how to create a simple bubble 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(11, 123, 1236, "Acura"), 
array(45, 92, 1067, "Alfa Romeo"), 
array(24, 104, 1176, "AM General"), 
array(50, 23, 610, "Aston Martin Lagonda"), 
array(18, 17, 539, "Audi"), array(7, 89, 864, "BMW"), 
array(2, 13, 1026, "Bugatti")
));

Step 3: Set Chart type

$p->chart_type = "bubble";

Step 4: Render Chart

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

For complete code, please visit live demo.