chart = {
const svg = d3.select(DOM.svg(width, height));
svg.append("g")
.selectAll("g")
.data(diamondData)
.join("g")
.attr("transform", d => `translate(${x0(d["color"])},0)`)
.selectAll("rect")
.data(d => cutTypes.map(cut => ({cut, count: d[cut], color: d.color})))
.join("rect")
.attr("x", d => x1(d.cut))
.attr("y", d => y(d.count))
.attr("width", x1.bandwidth())
.attr("height", d => y(0) - y(d.count))
.attr("fill", d => color(d.cut))
.append("title")
.text(d => `For ${d.color}, ${d.cut} = ${d.count}`);
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
svg.append("g")
.call(legend);
svg.append("g")
.call(legendTitle);
return svg.node();
}