I\'m using D3 for drawing on the SVG. What I want is to append DOM element or HTML to the D3, like:
task.append(function(model){
//here return html or dom
};
This is how used this information to create dynamic "shapes" in my force-directed chart using a function inside append().
shape = svg.append("g")
.selectAll("rect") // only a placeholder - does not control the shape
.data(force.nodes())
.enter()
.append(function(d){
return setshvape(d)
})
function setshape(d){
if(d.type == "start"){
var shape = document.createElementNS(d3.ns.prefix.svg, "circle");
}else{
var shape = document.createElementNS(d3.ns.prefix.svg, "rect");
}
return shape
}