Richtige Weg, um wählen Sie untergeordnete Knoten in D3

Habe ich eine SVG-element mit ein paar Knoten:

gnodes = svg.selectAll("g.node")
    .data(_nodes);   
var newNodes = gnodes.enter().append("g")
     .attr("class", "node")
     .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }) 
     .call(drag)
     .on('mouseover', onMouseOver)
     .on('mouseout', onMouseOut);

newNodes.append("circle")
    .attr("cx", 0)
    .attr("cy", 0)
    .attr("r", radius);

newNodes.append("image")
    .attr("xlink:href", getImage)
    .attr("x", -radius/2)
    .attr("y", -radius/2)
    .attr("width", radius + "px")
    .attr("height", radius + "px");

In das onMouseOver-ich will zum ändern der Farbe des hervorgehobenen Kreis, aber ich kann nicht diesen Artikel erhalten Sie von den Daten, die ich erhalten:

function onMouseOver(d, i) {
   var c1 = d.select("circle"); //error
   var c2 = i.select("circle"); //error
   var c3 = d.selectAll("circle"); //error
   var c4 = i.selectAll("circle"); //error 
}

Was ist ein Weg, um untergeordneten Knoten mit d3?

InformationsquelleAutor Dmitry | 2015-06-04
Schreibe einen Kommentar