D3 Selecting an element inside an SVG

When creating your data container with append(), you can save it as a selection to a variable.

var dataContainer = graph.append("svg:g")
    .attr("id","data");

If done in this way, you won't ever need to make the d3 selection again (in a similar way you have done with var graph on the 1st line of the code in your question), because a reference to this selection is already stored in your var dataContainer.


Let's try this code.

d3.select("#Graph svg").selectAll("g")

"g" means to select all node "g" under svg node.