Resize svg when window is resized in d3.js

I’m drawing a scatterplot with d3.js. With the help of this question : Get the size of the screen, current web page and browser window I’m using this answer : var w = window, d = document, e = d.documentElement, g = d.getElementsByTagName(‘body’)[0], x = w.innerWidth || e.clientWidth || g.clientWidth, y = w.innerHeight|| e.clientHeight|| g.clientHeight; … Read more