In this example we will be exploring the Sunburst Chart using the php-d3-lib.
*renders chart into element with id="chart"
// if not already included, include the autoloader
include('../PhpD3/autoloader.php');
$data = array(
'data_file'=>'flare.json',
'dimensions'=>array(
'height'=>500,
'width'=>950
),
'render_element'=>array(
'value'=>'chart',
'type'=>'id'
),
'file_type'=>'json',
'autosize'=>true
);
$chart = new PhpD3\Draw('sunburst_chart',$data);
$chart_render = $chart->render();
echo $chart_render;
*renders chart into element with id="chart_2"
// if not already included, include the autoloader
include('../PhpD3/autoloader.php');
$data = array(
'data_file'=>'flare.json',
'dimensions'=>array(
'height'=>500,
'width'=>950
),
'render_element'=>array(
'value'=>'chart_2',
'type'=>'id'
),
'file_type'=>'json',
);
$chart = new PhpD3\Draw('sunburst_chart',$data);
$chart_render = $chart->render();
echo $chart_render;