{
const sortedPartners = countPartners.sort((a,b) => a.count - b.count)
const width = "100%";
const height = 600;
const marginBottom = 70;
const monSvg = d3.create("svg")
.attr("width", width)
.attr("height", height);
const barChart = monSvg
.selectAll("rect")
.data(sortedPartners)
.join(enter => enter
.append("rect")
.attr("x", (d, i) => (i + 1) * 120)
.attr("y", d => height - d.count * 10 - marginBottom)
.attr("width", 80)
.attr("height", d => d.count * 10));
const labels = monSvg.selectAll(".partners")
.data(sortedPartners)
.join(enter => enter.append("text")
.attr("class", "partners")
.attr("x", (d, i) => (i + 1) * 120 + 40)
.attr("y", d => height - d.count * 10 - marginBottom - 10)
.style("font-size", '12px')
.text(d => d.provider_name)
.attr("text-anchor", "middle"))
yield monSvg.node();
}