I'm trying to create
elements foreach datapoint I have and add in a couple different
elements to each
element based on the current datapoint. I've tried something like:
var g = vis.selectAll("g").data(dd,function(d){ return d.data.name+d.x+d.y+d.s; });
var gs = g.enter().append("g");
g.exit().remove();
var t = gs.selectAll("text").data(function(d) { console.log(d); return d; });
t.enter().append("text").attr("x",function(d){ return d.x+d.s/2; })
.attr("y",function(d){ return d.y+d.s/4; })
.attr("font-family","Verdana")
.attr("font-size","9")
.attr("text-anchor","middle")
.text(function(d){ return d.data.name; });
t.attr("x",function(d){ return d.x+d.s/2; })
.attr("y",function(d){ return d.y+d.s/4; })
.attr("font-family","Verdana")
.attr("font-size","9")
.attr("text-anchor","middle")
.text(function(d){ return d.data.name; });
t.exit().remove();
But all I get are a set of empty
elements. Am I doing something obviously wrong?