{
const margin = {top: 50, right: 120, bottom: 50 , left: 120};
const svg = d3.create('svg')
.attr('width', ajWidth + margin.left + margin.right)
.attr('height', ajHeight + margin.top + margin.bottom);
const g = svg.append("g")
.attr("transform", `translate(${margin.left}, ${margin.top})`);
const circlesGroup = g.append('g');
circlesGroup.selectAll("rect")
.data(unemploymentWithGrid)
.join("rect")
.attr("y", d => ajY(d.col))
.attr("x", d => ajX(d.row))
.attr("width", maxRadius*2)
.attr("height",maxRadius*2)
.attr("fill", d => color(d.rate))
for (let i = 0; i < unemploymentWithGrid.length; i++){
var item = unemploymentWithGrid[i]
g.append("text")
.text(stateToAbbr[item.state])
.attr("x", ajX(item.row))
.attr("y", ajY(item.col)+maxRadius+5)
.attr('font-family', 'sans-serif')
.attr('font-size', '15px')
}
return svg.node();
}