stateUnemploymentDecade = {
const {visWidth, visHeight, margin} = dimensions;
const svg = d3.create('svg')
.attr('width', visWidth + margin.left + margin.right)
.attr('height', visHeight + margin.top + margin.bottom);
const g = svg.append('g')
.attr('font-family', 'sans-serif')
.attr('transform', `translate(${margin.left}, ${margin.top})`);
const format = d3.timeFormat('%B %Y');
g.append('text')
.text(`Unemployment Rate, ${format(dateExtent[0])} - ${format(dateExtent[1])}`)
const cells = g.selectAll('g')
.data(unemploymentData)
.join('g')
.attr('transform', (d, i) => {
const r = Math.floor(i / numCols);
const c = i % numCols;
return `translate(${col(c)}, ${row(r)})`;
});
cells.append('path')
.attr('d', d => area(d.rates))
.attr('fill', 'steelblue');
cells.append('text')
.attr('font-size', 12)
.attr('dominant-baseline', 'middle')
.attr('x', 5)
.attr('y', y(20))
.text(d => stateToAbbr[d.state])
const xAxes = cells.append('g')
.attr('transform', d => `translate(0,${row.bandwidth()})`)
.call(xAxis)
.call(g => g.select('.domain').remove())
.call(g => g.selectAll('line').attr('stroke', '#c0c0c0'));
xAxes.filter((d, i) => i < unemploymentData.length - numCols)
.selectAll('text')
.remove();
const yAxes = cells.append('g')
.call(yAxis)
.call(g => g.select('.domain').remove())
.call(g => g.selectAll('line').attr('stroke', '#c0c0c0'));
yAxes.filter((d, i) => i % numCols !== 0)
.selectAll('text')
.remove();
return svg.node();
}