score:6

Accepted answer

You can use the csv file. In order to show a tree, you will need to create an array for the nodes and another for the edges:

d3.csv('url.csv', function(data) {

    var nodes = [], edges = [];

    for (var k = 0, n = data.length; k < n; k += 1) {
        nodes.push({name: data[k].name, size: data[k].size, id: data[k].id}),
        edges.push({source: data[k].id, target: data[k].parent});       
    }
});

with this structure, you will be able to use the force layout, or convert the nodes, edges arrays to a tree structure.


Related Query

More Query from same tag