simple example showing how to get
the width of a div and use it's value/number
var containerWidth = +d3.select('.some-div').style('width').slice(0, -2)
it's an easy way to size/re-size drawings based on the containing div:
selection.append('svg')
.attr('width', containerWidth)
...
https://d3js.org/d3.v4.min.js