135
rated 0 times
[
138]
[
3]
/ answers: 1 / hits: 128361
/ 11 Years ago, mon, february 24, 2014, 12:00:00
I need to know exactly the width and height for an arbitrary g
element in my SVG
because I need to draw a selection marker around it once the user has clicked it.
What I've seen in the internet is something like: d3.select(myG).style(width)
. The problem is that the element will not always have an explicit width attribute set. For instance, when I create a circle inside the g
, it will have the radious (r
) set instead of the width. Even if I use the window.getComputedStyle
method on a circle
, it will return auto.
Is there a way to calculate the width of an arbitrary svg
selement in D3
?
Thank you.
More From » d3.js