dataRecentGrowth = {
const plotData = _.chain(summaryData)
.map((d) => {
d.growth =
d.record_1weekAgo &&
+d.record_current.new_cases_smoothed_per_million /
+d.record_1weekAgo.new_cases_smoothed_per_million;
return d;
})
.filter(
(d) =>
+d.record_current.new_cases_smoothed_per_million > 500 &&
d.population > 1000000 &&
d.growth > 1.3
)
.sortBy((d) => -d.growth)
.value();
return plotData;
return Plot.plot({
marginLeft: 100,
marginRight: 100,
marks: [
Plot.lineY(
plotData,
Plot.map(
{ y: rollsum },
{
x: (d) => new Date(d["date"]),
y: "new_deaths",
interval: d3.utcDay,
stroke: "lightgrey"
}
)
),
Plot.text(
plotData,
Plot.selectLast(
Plot.map(
{ y: rollsum, text: rollsum },
{
x: (d) => new Date(d["date"]),
y: "new_deaths",
text: (d) => `${d["new_deaths"]}`,
textAnchor: "start",
frameAnchor: "bottom",
dy: -3
}
)
)
),
Plot.ruleY([0])
]
});
}