Public
Edited
Jun 18, 2023
Insert cell
Insert cell
resultsForEliteMenTokyo2020OlympicGames = file.sheet(0, { headers: true , typed: true})
Insert cell
file = FileAttachment("Results for Elite Men - Tokyo 2020 Olympic Games.numbers")

Insert cell
Results for Elite Men - Tokyo 2020 Olympic Games.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
t1 = Inputs.table(resultsForEliteMenTokyo2020OlympicGames)

Insert cell
Plot.plot({
width,
height: 320,
marks: [
Plot.rectY(resultsForEliteMenTokyo2020OlympicGames, Plot.binX({y: "Total"}, {x: "#", fill: "steelblue"})),
Plot.ruleY([0])
]
})
Insert cell
convertToStr(1500)
Insert cell
convertToStr(d3.deviation(resultsForEliteMenTokyo2020OlympicGames, d => convertToSeconds(d["Total Time"])))
Insert cell
d3.deviation(resultsForEliteMenTokyo2020OlympicGames, d => convertToSeconds(d.T2))
Insert cell
x = d3.timeParse("%H:%M:%S")



Insert cell
resultsForEliteMenTokyo2020OlympicGames[0].T1
Insert cell
end = x(resultsForEliteMenTokyo2020OlympicGames[0].T1)

Insert cell
start = x("00:00:00")
Insert cell
convertToSeconds("00:10:39")
Insert cell

function convertToSeconds(str) {
const [hours, minutes, seconds] = str.split(':');
return Number(hours) * 60 * 60 + Number(minutes) * 60 + Number(seconds);
}
Insert cell
function convertToStr(seconds) {
return new Date(seconds * 1000).toISOString().slice(11, 19)
}
Insert cell
function devTime(col){
return convertToStr(d3.deviation(resultsForEliteMenTokyo2020OlympicGames2, d => convertToSeconds(d[col])))
}
Insert cell
[devTime("Swim"), devTime("T1"), devTime("Bike"), devTime("T2"), devTime("Run"), devTime("Total Time")]
Insert cell
Results for Elite Men - Tokyo 2020 Olympic Games.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

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