Public
Edited
Dec 7, 2023
2 forks
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
container = DOM.element("div", {
style: `width:${width}px;height:${width / 3}px`
})
Insert cell
Insert cell
map = new gridviz.Map(container, {
x: 4500000,
y: 2900000,
z: 3000
}).addZoomButtons()
Insert cell
Insert cell
dataset = new gridviz.CSVGrid(
map,
"https://raw.githubusercontent.com/eurostat/gridviz/master/assets/csv/Europe/pop_2018_10km.csv",
10000
)
Insert cell
Insert cell
colorFunction = (cell) => {
if (cell.population > 150000) return "#993404";
else if (cell.population > 60000) return "#d95f0e";
else if (cell.population > 20000) return "#fe9929";
else if (cell.population > 6000) return "#fec44f";
else if (cell.population > 1500) return "#fee391";
else return "#ffffd4";
}
Insert cell
Insert cell
style = new gridviz.ShapeColorSizeStyle({ color: colorFunction })
Insert cell
Insert cell
layer = new gridviz.GridLayer(dataset, [style])
Insert cell
Insert cell
{
map.layers = [layer];
}
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