MultiLevelPieChart.js icon indicating copy to clipboard operation
MultiLevelPieChart.js copied to clipboard

Extension chart for Chart.js for rendering nested or segmented pie charts.

MultiLevelPieChart.js

Extension chart for Chart.js for rendering nested or segmented pie charts. This is a useful graphic for rendering tree-like structures, for example disk usage on a file system. View a demo.

Example MultiLevelPieChart

Installing

You can install the extension using Bower with the following command.

$ bower install multilevelpiechart

Example

The source of the demo serves as a good example of how you might use the chart, though here's some sample code to demonstrate how to instantiate one of these pie charts.

(function(){
    var canvas = document.getElementById('demo'),
        ctx = canvas.getContext('2d');

    new Chart(ctx).MultiLevelPie([
        {
            label: "Foo",
            value: 10,
            children: [
                {
                    label: "A",
                    value: 4,
                    children: []
                },
                {
                    label: "B",
                    value: 6,
                    children: []
                }
            ]
        }
    ]);
}).call(this)