chart = {
const margin = ({top: 40, right: 30, bottom: 30, left: 60})
const height = 400
const svg = d3.create("svg")
.attr("viewBox", [0,0,width,height]);
const dateParse = d3.timeParse("%-m/%-d/%y 0:00")
const monthYearFormat = d3.timeFormat("%Y-%m")
const monthYearParse = d3.timeParse("%Y-%m")
const dayCounts = d3.nest()
.key(d => monthYearFormat(dateParse(d.Flight_Date)))
.rollup(d => d.length)
.entries(data)
const x = d3.scaleUtc()
.domain(d3.extent(dayCounts, d => monthYearParse(d.key)))
.range([margin.left, width - margin.right])
const y = d3.scaleLinear()
.domain([0, d3.max(dayCounts, d => d.value)])
.range([height - margin.bottom, margin.top])
.nice()
const xAxis = g => g
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(d3.axisBottom(x).ticks(width / 80).tickSizeOuter(0))
.call(g => g.selectAll(".tick line").clone()
.attr("stroke-opacity", 0.1)
.attr("y1", margin.top + margin.bottom - height))
const yAxis = g => g
.attr("transform", `translate(${margin.left},0)`)
.call(d3.axisLeft(y))
.call(g => g.selectAll(".tick line").clone()
.attr("stroke-opacity", 0.1)
.attr("x1", width - margin.left - margin.right + 12))
svg.append("g")
.call(xAxis)
svg.append("g")
.call(yAxis)
svg.append("path")
.datum(dayCounts)
.attr("fill", "none")
.attr("stroke", "steelblue")
.attr("stroke-width", 2)
.attr("d", d3.line()
.x(d => x(monthYearParse(d.key)))
.y(d => y(d.value)))
svg.append("text")
.attr("transform", `translate(${margin.left + width / 2.0},${margin.top / 2})`)
.attr("text-anchor", "middle")
.attr("alignment-baseline", "center")
.attr("font-weight", "bold")
.text("Count of Bird Strikes at All Airports")
svg.append("text")
.attr("transform", "rotate(-90)")
.attr("alignment-baseline", "center")
.attr("text-anchor", "middle")
.attr("x", -height/2.0)
.attr("y", margin.left - 40)
.text("Count of Bird Strikes")
return svg.node();
}