Public
Edited
Nov 18
Importers
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viz = require("geoviz@0.7.3")
Insert cell
Insert cell
Insert cell
viz.path({ data: world })
Insert cell
Insert cell
{
// On crée un container svg
let svg = viz.create({
domain: world
});
// On ajoute une couche
svg.path({ data: world, fill: "#02886F", tip: true });
// On retourne et affiche le svg
return svg.render();
}
Insert cell
Insert cell
Insert cell
{
// On crée un container svg
let svg = viz.create({ domain: world });
// On ajoute une couche
svg.path({ data: world, fill: "#02886F", tip: true });
// Code d3js
let moncercle = svg
.append("circle")
.attr("cx", 50)
.attr("cy", 200)
.attr("r", 25)
.attr("fill", "#e04a28")
.attr("fill-opacity", 0.7);
if (play) {
moncercle
.transition()
.duration(2000)
.attr("cx", 900)
.attr("r", 100)
.transition()
.delay(2000)
.duration(3000)
.attr("cx", 50)
.attr("r", 10)
.attr("fill", "blue")
.transition()
.attr("r", 25)
.attr("fill", "#e04a28");
}

// On retourne et affiche le svg
return svg.render();
}
Insert cell
Insert cell
Insert cell
{
// On crée un container svg
let svg = viz.create({ projection: d3.geoNaturalEarth1() });
// Outline
svg.outline();
// Graticule
svg.graticule({ stroke: "white" });
// On ajoute une couche
svg.path({ datum: world, fill: "white", fillOpacity: 0.5 });
// Titre
viz.tool.addfonts([
{
fontFamily: "Nosifer",
url: await FileAttachment("Nosifer-Regular.ttf").url()
}
]);
svg.header({
text: "Carte du Monde",
fontFamily: "Nosifer",
fontSize: 55,
fill: "#02886F",
//fillOpacity: 0.5,
rect_fillOpacity: 0
});
// On retourne et affiche le svg
return svg.render();
}
Insert cell
Insert cell
map = {
let svg = viz.create({
projection: d3.geoMercator(),
zoomable: true
});

svg.tile({
zoomDelta: 1,
increasetilesize: 1,
url: (x, y, z) =>
`https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/${z}/${y}/${x}.png`
});
svg.header({
text: "Carte du Monde",
fontFamily: "Nosifer",
fontSize: 55,
fill: "white",
stroke: "black",
//fillOpacity: 0.5,
rect_fillOpacity: 0
});
svg.path({ data: world, fill: "none", stroke: "white" });
return svg.render();
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viz.plot({
type: "prop",
data: world,
var: "pop",
k,
fill: "red",
fillOpacity: 0.6
})
Insert cell
Insert cell
viz.plot({
type: "choro",
data: world,
var: "gdppc",
leg_pos: [10, 100],
//leg_type: "horizontal",
tip: "$NAMEen"
})
Insert cell
Insert cell
viz.plot({
type: "typo",
data: world,
var: "region",
leg_pos: [10, 100]
})
Insert cell
Insert cell
viz.plot({
type: "propchoro",
data: world,
var1: "pop",
var2: "gdppc"
})
Insert cell
Insert cell
{
// On crée un container svg
let svg = viz.create({
projection: d3.geoNaturalEarth1(),
zoomable: true
});
// Outline
svg.outline();
// Graticule
svg.graticule({ stroke: "white", step: 40 });
// Pays
svg.path({ datum: world, fill: "white", fillOpacity: 0.5 });
// On ajoute une couche
svg.plot({
type: "propchoro",
symbol: "square",
data: world,
var1: "pop",
var2: "gdppc",
colors: "YlOrRd",
leg1_pos: [20, 320],
leg1_title: "Population",
leg1_subtitle: "(en millions)",
leg1_values_factor: 1 / 1000000,
leg1_values_round: 0,
leg2_title: "PIB par habitant",
leg2_values_round: 0,
leg2_type: "horizontal",
missing: false
});
// On retourne et affiche le svg
return svg.render();
}
Insert cell
Insert cell
Insert cell
radius = viz.tool.radius(
world.features.map((d) => d.properties.pop),
{ k: 50 }
)
Insert cell
viz.legend.circles_nested(radius)
Insert cell
viz.legend.circles_nested({
...radius,
nb: 6,
gap: 25,
title: "Population in inh.",
circle_fill: "#38896F",
circle_fillOpacity: 0.5,
circle_stroke: "white",
line_stroke: "#38896F",
line_width: 50,
line_length: 80,
values_dy: -5,
values_textAnchor: "end",
values_fill: "#38896F",
note: "Made with Geoviz",
note_dy: -15
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { demo } from "@neocartocnrs/geoviz"
Insert cell
import { documentation, gallery } from "@neocartocnrs/geoviz-appendix"
Insert cell
world = FileAttachment("world.json").json()
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