Public
Edited
Sep 24, 2024
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
let svg = viz.create({ domain: world }); // we create a container
svg.path({ datum: world, fill: "#38896F" }); // we do stuffs
return svg.render(); // we render the container
}
Insert cell
Insert cell
{
let svg = viz.create({ projection: d3.geoNaturalEarth1() }); // we create a container
svg.path({ datum: world, fill: "#38896F" }); // we do stuffs
return svg.render(); // we render the container
}
Insert cell
Insert cell
Insert cell
svg = {
let svg = viz.create({ projection: d3.geoAlbers() });
svg.path({ datum: world, fill: "#38896F" });
return svg;
}
Insert cell
Insert cell
svg.projection
Insert cell
svg.height
Insert cell
svg.bbox
Insert cell
Insert cell
{
let svg = viz.create({ domain: world });
svg.path({ datum: world, fill: "#38896F", fillOpacity: 0.5 });
svg
.append("circle")
.attr("cx", svg.width / 2) // Centered in x
.attr("cy", svg.height / 2) // Centerd in y
.attr("r", 10)
.attr("fill", "none")
.attr("stroke", "#38896F")
.attr("stroke-width", 5);
return svg.render();
}
Insert cell
Insert cell
Insert cell
{
let svg = viz.create({ domain: world, zoomable: [0.5, 2] });
svg.path({ datum: world, fill: "#38896F" });
return svg.render();
}
Insert cell
Insert cell
Insert cell
{
let svg = viz.create({
margin: 40, // Or [40,40,40,40]
background: "#d9fcff",
width: 400,
domain: world
});
svg.path({ datum: world, fill: "#38896F" });
return svg.render();
}
Insert cell
Insert cell
Insert cell
Insert cell
{
let svg = viz.create({
domain: chn,
margin: 10,
width: 400
});
svg.path({ datum: world, fill: "#38896F", fillOpacity: 0.3 });
svg.path({ datum: chn, fill: "#38896F" });
return svg.render();
}
Insert cell
Insert cell
{
let svg = viz.create({
domain: [aus, chn],
margin: 10,
width: 400
});
svg.path({ datum: world, fill: "#38896F", fillOpacity: 0.3 });
svg.path({ datum: aus, fill: "#38896F" });
svg.path({ datum: chn, fill: "#38896F" });
return svg.render();
}
Insert cell
Insert cell
{
let svg = viz.create({
domain: [
[-12, 20],
[43, 65]
],

width: 400
});
svg.path({ datum: world, fill: "#38896F" });
return svg.render();
}
Insert cell
Insert cell
Insert cell
viz.tool.addfonts([
{
fontFamily: "Courgette",
url: await FileAttachment("Courgette-Regular.ttf").url()
}
])
Insert cell
{
let svg = viz.create({ fontFamily: "Courgette", domain: world });
svg.path({ datum: world, fill: "#38896F", fillOpacity: 0.2 });
svg.text({ data: world, text: "Courgette", fill: "#38896F" });
svg.header({ text: "Courgette" });
svg.footer({ text: "Courgette" });
return svg.render();
}
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require("d3", "d3-geo-projection@2", "d3-geo-polygon")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
let svg = viz.create({
projection: d3.geoNaturalEarth1().rotate([longitude, latitude]),
width: 700
});
svg.outline();
svg.graticule({ stroke: "white" });
svg.path({ datum: world, fill: "#38896F" });

return svg.render();
}
Insert cell
Insert cell
Insert cell
container = viz.create({
projection: d3.geoNaturalEarth1(),
width: 700
})
Insert cell
countries = container.path({ datum: world, fill: "#38896F" })
Insert cell
outline = container.outline({ id: "outline" })
Insert cell
graticule = container.graticule({ id: "toto", stroke: "white" })
Insert cell
container.render({ order: [outline, graticule, countries] })
Insert cell
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