Published
Edited
Dec 4, 2019
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
dataMeta
Insert cell
//data.map(d => data.filter(e => e.x === d.x && e.y === d.y))
Insert cell
data
Insert cell
Insert cell
randomPoint = data[parseInt(Math.random()*data.length)]
Insert cell
randomPoint3 = data.find(d => d.id === "5ju0jhggagm31")
Insert cell
n = 1000
Insert cell
siblings = getSiblings(randomPoint, n)
Insert cell
//siblings.map(d => dataMeta.find(e => e.id === d.id)._layerId).toString()
Insert cell
function makeUrl(id){ return `https://vikusviewer.fh-potsdam.de/layers/data/png/128c/${id}.png`; }
Insert cell
Insert cell
distanceExtent = d3.extent(siblings, d => d.distance)
Insert cell
ra = d3.scaleLinear()
.domain(distanceExtent)
.range([30, 20]);
Insert cell
ra2 = d3.scaleLinear()
.domain(distanceExtent)
.range([50, 10]);
Insert cell
loadImage(makeUrl(randomPoint.id))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
md`# utils`
Insert cell
loadImage = src => {
return new Promise((resolve, error) => {
const image = new Image();
image.onload = _ => resolve(image)
image.onerror = _ => error()
image.src = src
})
}
Insert cell
import {fileInput} from "@mbostock/file-input"
Insert cell
Insert cell
d3 = require("d3", "d3-delaunay", "d3-polygon")
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