chart = {
const svg = d3.create('svg')
.attr('viewBox', [0, 0, 960, 600])
.style('background-color', '#314d7a');
svg.append('path')
.datum(basemap)
.attr('d', path)
.attr('fill', '#357a31')
.attr('stroke', 'white')
.attr('stroke-width', '0.2px')
.attr('stroke-linejoin', 'round');
svg.append('path')
.datum(graticule)
.attr('d', path)
.attr('stroke', 'white')
.attr('stroke-width', '0.3px')
.attr('stroke-opacity', 0.5);
svg.append('path')
.datum(data)
.attr('d', path)
.attr('fill', 'none')
.attr('stroke', '#333333');
svg.append('g')
.selectAll('circle')
.data(data.coordinates)
.join('circle')
.attr('transform', d => `translate(${projection(d)})`)
.attr('r', 3)
.attr('fill', (d, i) => color(data.intensity[i]))
.append('title')
.text((d, i) => data.time[i] + '\n' + data.intensity[i] + ' kts');
svg.append('g')
.attr('transform', 'translate(20, 10)')
.attr('opacity', 0.8)
.append(() => legend({color,
title: 'Intensity (kts)',
tickSize: 0,
width: 180
}));
const xGraticuleG = svg.append('g')
.attr('font-size', 10)
.attr('font-family', 'sans-serif')
.attr('fill', 'white')
.attr('opacity', 0.25)
.attr('text-anchor', 'start');
longitude.map(x => {
xGraticuleG.append('text')
.attr('transform', `translate(${projection([x, -7]) + ""}) rotate(-90)`)
.text(formatLongitude(x))
.attr('y', 11)
})
return svg.node();
}