167
rated 0 times
[
168]
[
1]
/ answers: 1 / hits: 16595
/ 12 Years ago, sat, september 1, 2012, 12:00:00
I'm having an issue trying to put a circle and a text inside a group (same level, not inside each other) in the .enter() context
var categorized = g1.selectAll(g.node).data(dataset, function(d){return d.id})
categorized
.enter()
.append(g)
.attr(id, function(d,i){return d.id;});
categorized
.enter().append(circle)
.style(fill, #ddd);
// throws an error
categorized
.append('text')
.text(function(d,i){return d.count});
// this is working but is an update so I have to remove the text on exit
Is there a way to get back to the parent, sg like this:
categorized
.enter()
.append(g)
.append(circle)
.getBackToParent // the g
.append(text);
More From » d3.js