I just stuck on a problem when trying to select an attribute of a rect object within a svg. This is the rectangle I want to get a value from:
<rect id="2" x="13.761467889908257" y="50" width="49.31192660550459" height="50" fill="rgb(43,0,0)"></rect>
in order to calculate the x-position of another rectangle I need the x-value.
I tried some different ideas like:
svg.selectAll("rect")
.select("id",2); // 1st version
.select("id","2"); // 2nd version
.select("#2"); // found in another d3 tutorial -> not working for me
and a lot more. Is there any way to do this?
// If you need more of my code just write it in a comment I wasnt sure how much to write in order to NOT write too much