node = vis.selectAll("circle.node").data(json.nodes).enter().append(function (e) {if (e.blah === "text") {return ("svg:text");} else {return ("svg:circle");}});
node = vis.selectAll("g.node")
.data(json.nodes)
.enter().append("svg:g");
The nice thing about svg:g is that you can position all nodes
(regardless of how they are displayed) using the "transform"
attribute, translate(x,y). Then, use the filter operator to add
different contents:
node.filter(function(d) { return d.blah == "text"; }).append("svg:text")…
node.filter(function(d) { return d.blah != "text"; }).append("svg:circle")…
Mike