I follow this guide: http://bl.ocks.org/2206529
I want to define the central region of each state, but I have two problems:
- How to iterate over each element of an SVG state?
- How to determine the average coordinate of this particular SVG element?
My g element contains many paths where each path represents a state. It seems that when I use the following code:
states.selectAll("path")
I want to find the center of the path using:
states.selectAll("path").attr("d", function(d) {
But the function parameter does nothing.
source share