Reputation: 88
I am trying to draw a graph using D3 where the nodes are rectangular. Then, for some reason, I need to find out the coordinates of those drawn nodes to draw the edges between the nodes. How can I get the coordinates of these rectangular nodes? I have tried doing this:
var ID = d3.select("#node_1")
.getBoundingClientRect()
.data(graph.nodes);
Here, I am using d3.select("#node_1") for selecting the particular node with ID node_1. But this getBoundingClientRect() does not seem to work in this case. What should I do?
Upvotes: 0
Views: 198