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("y", halfBandwidth + margin.top)
.attr("x", d => x(d.x0))
.style("fill", "#f2cc37")
.style("fill-opacity", d => d.believe ? 1 : 0.5)
.transition()
.duration(500)
.delay((d, i) => i % binThresholds.length * 100)
.attr("height", d => d.believe ?
halfBandwidth + margin.top - believers.scale(d.length):
deniers.scale(-d.length) - (halfBandwidth + margin.top))
.attr("y", d => d.believe ? believers.scale(d.length) : halfBandwidth + margin.top);
svg.append("g")
.call(xAxis);
return svg.node();
}