chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.call(yAxis_ticks);
const g = svg.selectAll(".vars")
.data(counts)
.join("g")
.attr("class", "vars")
.attr("transform", d => `translate(0,${y(d.variable) + y.bandwidth()/2})`);
g.each(function(d, i) {
const x = d3.scaleLinear()
.domain([0, 2]).nice()
.range([margin.left, width - margin.right]);
const xAxis = g => g
.call(d3.axisBottom(x).tickValues([0, 1, 2]).tickFormat(dd => x_lookup[d.variable][dd]).tickPadding(12))
.call(g => g.select(".domain").remove())
.call(g => g.selectAll(".tick line").remove())
.call(g => g.selectAll("text").attr("font-weight", "bold"))
.call(g => g.selectAll("text").attr("color", (dd, i) => highlight(d, i)))
.call(g => g.selectAll("text").style("mix-blend-mode", "multiply"));
d3.select(this).selectAll(".dots")
.data([0, 1, 2])
.join("circle")
.attr("class", "dots")
.style("mix-blend-mode", "multiply")
.attr("stroke", "#00695C")
.attr("stroke-width", 1)
.attr("fill", "#80CBC4")
.attr("fill-opacity", .5)
.attr("cy", 0)
.attr("cx", (d, i) => x(i))
.attr("r", dd => scale(d[dd.toString(16)]))
d3.select(this).selectAll(".points")
.data([0, 1, 2])
.join("circle")
.attr("class", "points")
.style("mix-blend-mode", "multiply")
.attr("fill", (dd, i) => highlight(d, i))
.attr("cy", 0)
.attr("cx", (d, i) => x(i))
.attr("r", 4)
d3.select(this).append("g").call(xAxis);
})
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
svg.selectAll("text").attr("font-size", 16).attr("font-family", "Open Sans")
return svg.node();
}