chart = {
const svg = d3.create("svg")
.attr("viewBox", [-width/4, 0, width, height]);
svg.selectAll("rect")
.data(bins)
.join("rect")
.attr("class", d => d.correct ? "rect-correct" : "rect-incorrect")
.attr("transform", "translate(50,0)")
.attr("height", d => yScale(d.x0) - yScale(d.x1))
.attr("x", halfBandwidth)
.attr("y", d => yScale(d.x1))
.style("fill", "#f2cc37")
.style("fill-opacity", d => d.correct ? 1 : 0.5)
.transition()
.duration(500)
.delay((d, i) => i % binThresholds.length * 100)
.attr("width", d => d.correct ?
correctDist.scale(d.length) - halfBandwidth + offset :
halfBandwidth - (incorrectDist.scale(-d.length) + offset))
.attr("x", d => d.correct ? halfBandwidth : incorrectDist.scale(-d.length) + offset);
svg.append("g")
.call(yAxis);
return svg.node();
}