I did not see what you were looking for before, but this is a combination of creating a tree from flat data (which requires a bit of manipulation of the data to improve it in the correct structure), and the standard loading of data and an external source using d3.
Unfortunately, I cannot configure bl.ock to demonstrate live code, EDIT: Here is a live version of the executable code on bl.ocks.org, and the next one is the html file, which is a combination of two methods;
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Collapsible Tree Example</title> <style> .node circle { fill: #fff; stroke: steelblue; stroke-width: 3px; } .node text { font: 12px sans-serif; } .link { fill: none; stroke: #ccc; stroke-width: 2px; } </style> </head> <body> <script src="http://d3js.org/d3.v3.min.js"></script> <script> </script> </body> </html>
And the next csv file that I tested is with it (named treedata.csv in the html file);
name,parent Level 2: A,Top Level Top Level,null Son of A,Level 2: A Daughter of A,Level 2: A Level 2: B,Top Level
Kudos should go to nrabinowitz to describe data conversion here .
source share