chart22 = {
let svg = d3
.create("svg")
.attr("width", width)
.attr("height", height)
.style("border", "1px solid black");
let text = svg
.append("text")
.attr("x", 50)
.attr("y", 20)
.style("font", "12px Arial")
.html("Chart Title here");
drawAxis(svg, yScale, "left", margin.left - 3, "Percent College Graduates");
drawAxis(svg, xScale, "bottom", height - margin.bottom + 3, "States");
let bars = svg
.selectAll("rect")
.data(data, (r) => r.Abbrev)
.join("rect")
.attr("x", (r) => xScale(r.Abbrev))
.attr("width", xScale.bandwidth() - 1)
.attr("y", (r) => yScale(r.PercentCollegeGrad))
.attr("height", (r) => yScale(0) - yScale(r.PercentCollegeGrad) + 1)
.style("fill", (r) => cScale(r.IncomePerCapita));
bars
.append("title")
.text((r) => r.Name + " " + r.PercentCollegeGrad);
return svg.node();
}