Published
Edited
May 29, 2020
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = d3
.range(rawData.time.length)
.map(i => Object.fromEntries(properties.map(key => [key, rawData[key][i]])))
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
plateausTotalDuration = d3.sum(
plateaus.map(([startTime, endTime]) => endTime - startTime)
)
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
line = turf.lineString(rawData.latlng.map(flip))
Insert cell
Insert cell
Insert cell
segments = turf.lineSplit(line, splitters.exit);
Insert cell
Insert cell
outsideSegments = segments.features.filter(
f => !booleanCrosses(f, splitters.courseCenterLine)
)
Insert cell
Insert cell
Insert cell
flip = array => array.slice().reverse();
Insert cell
Insert cell
createX = width =>
d3
.scaleLinear()
.domain(poiBounds.surroundings.map(([lng]) => lng))
.range([0, width])
Insert cell
createY = height =>
d3
.scaleLinear()
.domain(poiBounds.surroundings.map(([lng, lat]) => lat))
.range([height, 0])
Insert cell
Insert cell
raceResult = ({
hours: 1,
minutes: 10,
seconds: 25
})
Insert cell
Insert cell
Insert cell
/**csv = {
const csv =
"lat,lng," +
properties.slice(1).join(",") +
"\n" +
data.map(d => Object.values(d).join(",")).join("\n");
console.log(csv);
return csv;
}*/
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { html, svg } from "@observablehq/htl"
Insert cell
Insert cell
plateauAnalysisInputData = data.map(d => ({
state_name: "",
year: d.time,
value: d.distance
}))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
plateauStyle
Insert cell
html`<style>
svg {
border: 1px solid #555;
box-sizing: border-box;
}
</styl>`
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