Public
Edited
Jan 10, 2024
1 star
Hello gridviz
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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more