Published
Edited
Feb 22, 2020
1 fork
Insert cell
md`# Contour`
Insert cell
viewof data = html`<input type=file accept="csv/*">`
Insert cell
Input = d3.csvParse(await Files.text(data))
Insert cell
//Convert to array
dem_Orig = Input.map( Object.values )
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
ramplinear(d3.interpolateYlGnBu, contRange, 512)
Insert cell
mutable currentZoom = ({k: 1, x: 0, y: 0})
Insert cell
shape = ({x: dem[0].length, y: dem.length})
Insert cell
flatDem = [].concat.apply([], dem)
Insert cell
// min/max elevation
contRange = [MinCont, MaxCont]
Insert cell
Insert cell
Insert cell
// Color scale with elevation normalization
color = d => d3.interpolateViridis(Math.min(Math.max((d-contRange[0])/(contRange[1]-contRange[0]),0),1))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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