I'm encountering a problem with the d3 tree layout while dynamically adding nodes.
When I add a path symbol to the node based on its type, I receive an error message "invalid path format" during updates.
Both the Enter and update methods utilize the same block of code:
nodeUpdate.select("path")
.attr("d", d3.svg.symbol().type(function(d)
{
return self.TypeToShape(d.Type);
})
.size(150))
.attr("transform", function(d)
{
var transform="translate(" + 2 + "," + -1 + ")"
if (d.Type==="e")
{
transform = transform+" rotate(30)";
}
return transform;
})
.style("fill", function(d){
return self.TypeToColour(d.Type);
});
The issue seems to occur only during updates and not when entering new nodes.
As a newcomer to D3, I suspect that I may have overlooked a fundamental concept in how d3 functions, leading to this issue.
You can view the fiddle here: http://jsfiddle.net/z15825qu/