Welcome to the Sunburst Chart Example

In this example we will be exploring the Sunburst Chart using the php-d3-lib.

Sunburst Chart 1 (Autosized)

Sunburst Chart 1 PHP Code

*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;
        


Sunburst Chart 2

Sunburst Chart 2 PHP Code

*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;