It appends a 'g' element to the SVG. g
element is used to group SVG shapes together, so no it's not d3 specific.
I came here from a d3 learning curve as well. As already pointed out this is not specific to d3, it is specific to svg attributes. Here is a really good tutorial explaining the advantages of svg:g (grouping).
It is not that different from the use case of "grouping" in graphical drawings such as ones you would do in a powerpoint presentation.
http://tutorials.jenkov.com/svg/g-element.html
As pointed in above link: to translate you need to use translate(x,y):
The
<g>-element
doesn't have x and y attributes. To move the contents of a<g>-element
you can only do so using the transform attribute, using the "translate" function, like this: transform="translate(x,y)".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With