chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, 700]);
svg.append("rect")
.attr("width", "100%")
.attr("height", "100%")
.attr("fill", "black");
svg.append("g")
.selectAll("path")
.data(topojson.feature(vr, vr.objects.veiligheidsregio_2021).features)
.join("path")
.attr("fill", "black")
.attr("stroke", "white")
.attr("stroke-width", 1.7)
.attr("d", path)
svg.append("path")
.attr("fill", "none")
.attr("stroke", "white")
.attr("stroke-width", 1.7)
.attr("stroke-linejoin", "round")
.attr("d", path(topojson.mesh(vr, vr.objects.veiligheidsregio_2021, (a, b) => a !== b)))
const footer = svg.append("text")
.attr("y", 630)
.attr("x", width/2)
.style('fill', 'white')
.style("font-size", "30px")
.style('font-weight', '1000')
.style("text-anchor", "middle")
.text("Stormschade Eunice");
const Title = svg.append("text")
.attr("y", 650)
.attr("x", width/2)
.style('fill', 'white')
.style("font-size", "12px")
.style("text-anchor", "middle")
.text("Stormschademeldingen verzonden via het p2000 netwerk");
const g = svg.append("g")
.attr("fill", "red")
.attr('stroke-width', 7)
.attr("stroke-opacity", 0.3)
.attr("stroke", "red");
;
const dot = g.selectAll("circle")
.data(data)
.join("circle")
.attr("transform", d => `translate(${d})`);
let previousDate = -Infinity;
return Object.assign(svg.node(), {
update(date) {
const t = d3.transition()
.duration(200)
.ease(d3.easeLinear);
dot
.filter(d => d.date.getTime() == date.getTime())
.transition(t)
.attr("r", 3);
dot
.filter(d => d.date.getTime() !== date.getTime())
.transition(t)
.delay(200)
.attr("r", 0)
previousDate = date;
}
});
}