chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("rect")
.attr("width", "100%")
.attr("height", "100%")
.attr("class", "svgBackground");
const noun = svg.append("g")
.attr("class", "data")
.selectAll("text.noun")
.data(data)
.join("text")
.text(d => d.terms.map(m => m.text).join(" "))
.attr("x", margin.left + center.line)
.attr("y", (d, i) => (i+1) * textSpace + margin.top)
.attr("text-anchor", "end");
const adj = svg.append("g")
.attr("class", "data")
adj.selectAll("text.adj")
.data(data)
.join("text")
.attr("x", margin.left + center.line + center.padding)
.attr("y", (d, i) => (i+1) * textSpace + margin.top)
.selectAll("tspan")
.data(d => d.adj)
.join("tspan")
.text(d => d.reduced + " ")
.attr("font-weight", d => countScale(d.count));
adj.selectAll("text")
.selectAll("tspan")
.append("title")
.text((d, i) => `COUNT: ${d.count}\n${d.sentence.join("\n")}`);
svg.append("rect")
.attr("class", "svgBackground")
.attr("x", width - margin.right)
.attr("width", margin.right)
.attr("height", "100%");
yield svg.node();
const textWidth = adj.node().getBBox();
nounScale.range([margin.left + center.line + center.padding, textWidth.x + textWidth.width])
svg.append("g")
.call(xAxis);
svg.append("g")
.call(grid);
svg.call(xTitle)
svg.call(legend)
}