chart = {
const svg = d3.create("svg").attr("viewBox", [0, 0, width, height]);
const updateBars = bars(svg);
const updateAxis = axis(svg);
const updateLabels = labels(svg);
const updateTicker = ticker(svg);
svg
.append("text")
.style("font", `bold 12px var(--sans-serif)`)
.style("font-variant-numeric", "tabular-nums")
.attr("text-anchor", "end")
.attr('fill', 'lightgrey')
.attr("x", width - 6)
.attr("y", margin.top + barSize * n + 10)
.attr("dy", "0.32em")
.text("Autor: @velimirgasp");
svg
.append("text")
.style("font", `bold 12px var(--sans-serif)`)
.style("font-variant-numeric", "tabular-nums")
.attr("text-anchor", "end")
.attr('fill', 'lightgrey')
.attr("x", width - 6)
.attr("y", margin.top + barSize * n + 22)
.attr("dy", "0.32em")
.text("Podaci: koronavirus.hr");
yield svg.node();
for (const keyframe of keyframes) {
const transition = svg
.transition()
.duration(duration)
.ease(d3.easeLinear);
x.domain([0, keyframe[1][0].value]);
updateAxis(keyframe, transition);
updateBars(keyframe, transition);
updateLabels(keyframe, transition);
updateTicker(keyframe, transition);
invalidation.then(() => svg.interrupt());
await transition.end();
}
}