Published
Edited
Nov 22, 2020
Importers
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

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
Insert cell
Insert cell
import { select } from "@jashkenas/inputs"
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
async function getGeoData(regionID, subRegionType) {
const topojsonData = await getTopoJSONDataForRegion(subRegionType);
topojsonData.objects.data.geometries = topojsonData.objects.data.geometries.filter(
function(data) {
if (regionID === 'LK') {
return true;
}
return data.properties.id.includes(regionID);
}
);
return topojsonData;
}
Insert cell
async function drawRegionMap(svg, regionID, subRegionType, options = {}) {
const topojsonData = await getGeoData(regionID, subRegionType);
drawMap(svg, topojsonData, options);
}
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