Since the x
attribute is not valid for an svg g
element, transitioning it will not work as intended. You can, however, transition the transform
attribute to transition the position of a group of elements, or transition styles that cascade to it's children.
i.e.:
myGroup.transition()
.attr("transform", "translate(320, 0)")
.style("fill", "red");