Published
Edited
Oct 2, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// The original data was in a different format, split into two files by distance, and contained a lot of information that I didn't want to or need to expose in this notebook. Here's the code I used to reformat the data, in case it is needed again at some point.
/* data = allResults
.slice()
.sort((a, b) => +a.participant.bibNumber - +b.participant.bibNumber)
.filter((d) => d.resultSplit.isFinish)
.map((d) => ({
bibNumber: d.participant.bibNumber,
name: d.participant.firstNameLastName,
gender: d.participant.genderText,
distance: d.resultSplit.distance,
cohort: d.participant.genderText + " " + d.resultSplit.distance,
club: d.participant.club || undefined,
timeMinutes: d.resultSplit.elapsedSinceStartMS / 1000 / 60
})) */
Insert cell
data = FileAttachment("Nåsten Trail 2021 results reduced@1.json").json()
Insert cell
initialSelection = {
if (location.search.length === 0) return undefined;

const searchParams = new URLSearchParams(location.search);
return data.filter((d) => {
for (let [key, value] of searchParams.entries()) {
if (!d[key]?.toString().toLowerCase().includes(value.toLowerCase())) {
return false;
}
}
return true;
});
}
Insert cell
minutesMax = d3.max(data, (d) => d.timeMinutes)
Insert cell
Insert cell
d3 = require("d3@6")
Insert cell
import { addTooltips } from "@mkfreeman/plot-tooltip"
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