D3.js - building a force directed hierachical tree from csv data D3.js - building a force directed hierachical tree from csv data json json

D3.js - building a force directed hierachical tree from csv data


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.