You could try and use window.resizeTo(w, h) but it won't work reliably cross-browser (it actually won't work most of the time). There isn't a reliable way to resize browser windows using javascript.

Are you assigning w and h to these values because your graph needs to be exactly that big ? If your graph can fit in different dimensions, you could instead initialize w and h based on the browser window size with something like

var w = window.innerWidth;
var h = window.innerHeight;

If you're looking to fill your div exactly :

var w = document.getElementsByClassName('.graph-container')[0].clientWidth;
var h = document.getElementsByClassName('.graph-container')[0].clientHeight;

Related Query