Mike Robinson, il tuo esempio ha aiutato.
Per coloro che si stanno chiedendo, ecco quello che ho fatto:
ho rimosso:
svg.selectAll(".dot")
.data(data)
.enter().append("circle")
.attr("class", "dot")
.attr("cx", function(d) { return x(d.x); })
.attr("cy", function(d) { return y(d.y); })
.attr("r", 12);
e ha aggiunto:
var node = svg.selectAll("g")
.data(data)
.enter()
.append("g");
node.append("circle")
.attr("class", "dot")
.attr("cx", function(d) { return x(d.x); })
.attr("cy", function(d) { return y(d.y); })
.attr("r", 12);
node.append("text")
.attr("x", function(d) { return x(d.x); })
.attr("y", function(d) { return y(d.y); })
.text("fooLabelsOfScatterPoints");
ho allegato "testo" tag sui "g" tag, al contrario di aggiungere tag "testo" ai tag "circle". (?)
fonte
2012-09-04 20:01:54
Hai guardato questo esempio: http : //mbostock.github.com/d3/ex/bubble.html, ed è fonte: http://mbostock.github.com/d3/ex/bubble.js –
Mike, guardando il tuo esempio, penso di aggiungere tag su tag , anziché aggiungere tag su tag . Lo proverò ora. –