chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.selectAll("rect")
.data(bins)
.join("rect")
.attr("class", d => d.believe ? "rect-believers" : "rect-deniers")
.attr("width", d => x(d.x1) - x(d.x0))
.attr("x", d => x(d.x0))
.attr("y", d => d.istot ? all.scale(d.length) : margin.top + y.bandwidth())
.attr("height", d => d.istot ? y.bandwidth() + margin.top - all.scale(d.length) : 0)
.style("fill", "#f2cc37")
.style("fill-opacity", d => d.istot ? 0.5 : 1)
.transition()
.duration(500)
.delay((d, i) => i % binThresholds.length * 100)
.attr("height", d => d.istot ?
y.bandwidth() + margin.top - all.scale(d.length) :
y.bandwidth() + margin.top - deniers.scale(d.length))
.attr("y", d => d.istot ? all.scale(d.length) : deniers.scale(d.length));
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
return svg.node();
}