block by eesur 909c6a83a1d969918a5389966c5f431a

d3 | width of div container

Full Screen

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)
    ...

index.html