Public
Edited
Jun 30, 2024
1 fork
3 stars
Also listed in…
Political Issues
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// The visualizations above consumes this simplified version of the data.

background_check_data = {
let background_check_data = await FileAttachment("gun_checks.csv").csv({
typed: true
});
background_check_data.max = d3.max(background_check_data, (o) => o.total);
background_check_data.extent = d3.extent(
background_check_data.map((o) => o.month)
);

return background_check_data;
}
Insert cell
Insert cell
Insert cell
// This is the data. Just download it as CSV from the three dot menu.
{
if (get_it == 1) {
return Array.from(
d3
.rollup(
data,
function (a) {
let month = a[0].month;
let total = d3.sum(a, (a) => a.totals);
return { month, total };
},
(o) => o.month
)
.values()
);
}
}
Insert cell
data = {
if (get_it == 1) {
return fetch(
"https://raw.githubusercontent.com/BuzzFeedNews/nics-firearm-background-checks/master/data/nics-firearm-background-checks.csv"
).then(async function (r) {
return d3.csvParse(await r.text(), d3.autoType);
});
}
}
Insert cell
Insert cell
tippy = require("tippy.js")
Insert cell
<link rel="stylesheet" href="${await require.resolve(
`tippy.js/themes/light-border.css`
)}">
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