Public
Edited
Feb 6, 2024
Insert cell
Insert cell
svg.node()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//viewof colorBST = Inputs.color({ label: "Brest", value: "#b26633" })
Insert cell
//viewof colorTLN = Inputs.color({ label: "Toulon", value: "#ff3399" })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
svg
.append("text")
.attr("x", 5)
.attr("y", 32)
.style("font-size", 30)
.style("font-weight", "bold")
.style("font-family", "Arial")
.text("CP 2024 du SID en Métropole");
svg
.append("text")
.attr("x", 5)
.attr("y", 70)
.style("font-size", 30)
.style("font-weight", "bold")
.style("font-family", "Arial")
.text("(provisions pour risques incluses)");
svg
.append("text")
.attr("x", 5)
.attr("y", 98)
.style("font-size", 20)
.style("font-family", "Arial")
.text("par commune de France métropolitaine");
svg
.append("text")
.attr("x", 5)
.attr("y", height - 5)
.style("font-size", 12)
.style("font-family", "Arial")
.text("Données extraites de COSI / GP0 2024");
// "Ludovic Claudel, 7 janvier 2024"
}
Insert cell
Insert cell
Insert cell
Insert cell
regions = regions1
Insert cell
regions1 = FileAttachment("regions.geojson").json()
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
Insert cell
Insert cell
projection = d3
.geoConicConformal() // projection Lambert-93
.center([2.454071, 46.279229]) // On centre sur la France NE : 48,622745 4,80505 // NO : 48,16871 -1,004775 // SO 44,976635 0,40995 // SE 44,083015 4,616075 // IDF 48,6772 2,50145 // France 2.454071, 46.279229
.translate([width / 2, height / 2])
.scale(5800) //on zoome; 5800 = France ; 9500=NE ; 11000 = NO ou SO ; 8500 SE ; 40000 IDF
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
Insert cell
data = pointsCommRaw.map((e, i) => {
const out = {
cgeom: projection([+e.lon, +e.lat]),
code: e.INSEE_COM,
name: e.NOM
};
//const out = {lon:e.lon, lat:e.lat, code:e.INSEE_COM};
const res = resCommRawI.get(out.code);
//if (!res) console.log(e.NOM);

//percentages
out.valeur = res["Total"];
out.perc1 = 100;
out.perc2 = res
? [
(100 * res["IDF"]) / res["Total"],
(100 * res["SE"]) / res["Total"],
(100 * res["SO"]) / res["Total"],
(100 * res["NE"]) / res["Total"],
(100 * res["NO"]) / res["Total"]
]
: undefined;

//out.perc1 = res ? [res["MACRON.exp"], res["LE PEN.exp"]] : undefined;
//out.perc2 = res
// ? [
// res["MACRON.ins"],
// 100 - res["MACRON.ins"] - res["LE PEN.ins"],
// res["LE PEN.ins"]
// ]
// : undefined;

//radius
out.r1 = res ? toRadius(res["Total"]) : 0;
out.r2 = res ? toRadius(res["Total"]) : 0;

//departement
out.dep = res ? res.CodeDepartement : undefined;

return out;
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
ne = FileAttachment("NE.geojson").json()
Insert cell
idf = FileAttachment("IDF.geojson").json()
Insert cell
no = FileAttachment("NO.geojson").json()
Insert cell
se = FileAttachment("SE.geojson").json()
Insert cell
so = FileAttachment("SO.geojson").json()
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