A bubble chart is a type of chart that displays three dimensions of data. Here in this sample the third dimension is the market share of a product.
To display a bubble chart, template "bubble.php" is used. This template expects the bubble data to be set in variable $bubble_data.
Variables $min and $max are to be set for the minumum and maximum value, and $max_size is used for the maximum diameter of the bubbles.
<?php

include_once "environment.php";

// rgraph chart
$template = "bubble.php";
$draw_option = "draw();";
$width = "650";
$height = "350";

// scatter data
$data = array(
   array(1,12200,'red','15% market share'),
   array(2,60000,'blue','33% market share'),
   array(3,32000,'purple','42% market share'),
   array(4,24400,'blue','20% market share'),
);

// data for bubbles in relation to scatter data
$bubble_data = array(15,33,42,20);
$min = 0;
$max = max($bubble_data);
$max_size = 50;

$chart = new rgraph_chart("cvs", $data, "Scatter");

$options = new rgraph_options("default.ini");
$options->set_option("marginLeft", 100);
$options->set_option("title","Industry Market Share Study\n");
$options->set_option("xaxisScaleMax", 5);
$options->set_option("yaxisScaleMax", 70000);
$options->set_option("xaxisLabels", array('1','2','3','4'));
$options->set_option("xaxisTitle", "Product Number");
$options->set_option("yaxisTitle", "Revenue");
$options->set_option("yaxisTitlePos", 0.25);
$options->set_option("yaxisScaleUnitsPost"," €");
$options->set_option("tooltipsHotspot",15);
$options->set_option("tooltipsEvent", "onclick");

$chart->set_options($options);
$rgraph_json = $chart->toString();

$chart_script = "";
$event_script = "";

include_once ($templates . $template);
?>