Public
Edited
Oct 30, 2023
Paused
4 stars
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
// Lambert-93 as per https://geodesie.ign.fr/contenu/fichiers/Lambert93_ConiquesConformes.pdf, p.2.
proj = d3.geoConicConformal()
.parallels([44, 49])
.rotate([-3, -46.5])
.scale(3200)
.translate([width / 2, height / 2])
Insert cell
Insert cell
function draw (context) {
context.save();
context.clearRect(0, 0, width, height);
context.translate(transform.x, transform.y);
context.scale(transform.k, transform.k);
context.strokeStyle = "#fff";
context.lineWidth = communePathWidth / transform.k;
for (let i = 0, n = data.communes.length; i < n; i++) {
const d = data.communes[i];
context.fillStyle = d.properties.color;
context.beginPath();
path(d);
context.fill();
if (communePathWidth > 0) context.stroke();
}
context.strokeStyle = color_dep;
context.lineWidth = depPathWidth / transform.k;

for (let i = 0, n = data.dep_borders.length; i < n; i++) {
const d = data.dep_borders[i];
context.beginPath();
path(d);
context.stroke();
}
context.restore();
// context.fillStyle = "#000";
// context.font = '24px sans-serif';
// context.fillText('Population Density', 80, 20);
// context.fillText('French Metropolitan', 80, 80);
// context.fillText('Municipalities (2016)', 80, 110);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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