D3.js group element expands over svg

Hey guys, not sure why my <g> expands over my svg although the width and height is smaller than the container svg.

You will notice it when you hit inspect elements.



The problem was that there were still more bar graphs inside <g> element. But they were just being hidden away from the view as if svg had overflow:none attribute.

Therefore giving more width to svg worked.