I've been attempting to craft a stunning tree using D3.
For the nodes, I have an SVG "template" tucked away in a hidden div. Despite my efforts with various D3 functions to replicate the "template," none were successful.
The latest JavaScript snippet is:
...
var node = svg.selectAll("g.node")
.data(nodes)
.enter()
.append("svg:g")
.attr("transform",
function(d)
{
return "translate(" + d.y + "," + d.x + ")";
}
);
var template_box = d3.select("#layer1");
console.log(template_box);
node.insert(template_box);
...
And here's a piece of the HTML:
...
<body>
<svg width="400" height="400">
<g
id="layer1"
transform="translate(-208.375,-410.5)">
<rect
...
Best regards.