{
const svg = d3.create('svg')
.attr('width', totalWidth).attr('height', totalHeight);
const x = d3.scaleTime()
.domain(d3.extent(injuriesByMonth, d => d.date))
.range([0, visWidth]);
const y = d3.scaleLinear()
.domain([0, d3.max(injuriesByMonth, d => d.injuries)]).nice()
.range([visHeight, 0]);
const line = d3.line()
.x(d => x(d.date))
.y(d => y(d.injuries));
const g = svg.append("g")
.attr('transform', `translate(${margin.left}, ${margin.top})`);
const xAxis = d3.axisBottom(x).tickFormat(d3.timeFormat('%B'));
const yAxis = d3.axisLeft(y);
g.append('g')
.attr('transform', `translate(0, ${visHeight})`)
.call(xAxis);
g.append('g').call(yAxis)
.append('text')
.attr('fill', 'black')
.attr('text-anchor', 'start')
.attr('dominant-baseline', 'hanging')
.attr('font-weight', 'bold')
.attr('y', -margin.top + 5)
.attr('x', -margin.left)
.text('Collision Injuries, 2019');
g.append('path')
.attr('stroke', 'steelblue')
.attr('stroke-width', 2)
.attr('fill', 'none')
.attr('d', line(injuriesByMonth));
return svg.node();
}