Published
Edited
Sep 30, 2022
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Write your code to get the data here
{
var month_crash_totals = d3.rollups(
data,
d => d3.sum(d, (d) => 1),
(d) => d.dateTime.getMonth()
)
.map(([month, crashes]) => ({month: month, crashes: crashes }))
return month_crash_totals
}

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Write the code to get the data here .
{
var cause_crash_totals = d3.rollups(
data,
d => d3.sum(d, (d) => 1),
(d) => d.cause
)
.map(([cause, crashes]) => ({date: cause, crashes: crashes }))
return cause_crash_totals
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more