map = (us, data) => {
const width = 960;
const height = 600;
const path = d3.geoPath();
const spike_location = [-112.5475, 41.618611]
const svg = d3.select(DOM.svg(width, height))
.style("width", "100%")
.style("height", "auto")
.style("font-family", "Verlag-Light")
.style("font-size", "16px")
.attr("stroke-width", "1")
svg.append("path")
.datum(topojson.merge(us, us.objects.lower48.geometries))
.attr("fill", "#FFF7ED")
.attr("stroke", "#6aa8ca")
.attr("d", path);
svg.append("path")
.datum(topojson.mesh(us, us.objects.lower48, (a, b) => a !== b))
.attr("fill", "none")
.attr("stroke", "#6aa8ca")
.attr("stroke-linejoin", "round")
.attr("d", path);
let g = svg.append('g')
.attr("transform", `translate(${projection(spike_location)})`)
let spike = g.append('g');
spike.attr("transform", 'scale(0.2)').html(`${spike_svg.svg}`)
.attr("opacity", 0);
spike.transition()
.delay(1000)
.duration(2000)
.attr("opacity", 1)
for (const key of Object.keys(data)) {
for (const d of data[key]) {
let g = svg.append('g')
.attr("transform", `translate(${projection(spike_location)})`)
.attr("opacity", 0)
g.append("image")
.attr("width", 16)
.attr("height", 16)
.attr("xlink:href", avatar[key].src)
g.transition()
.delay(1000)
.duration(2000)
.attr("opacity", 1)
.attr("transform", `translate(${projection(d)})`);
}
}
return svg.node();
}