carto = (e) => {
if (e[0] == "Travail" && e[1] == "Etudes") {
return bertin.draw({
params: {
background: "#E8F8FF",
margin: 10,
projection: "user",
extent: COM_FLUX_CACP
},
layers: [
{
type: "header",
text:
choix_direction.nom +
" à " +
choix_com +
" : " +
total_travail_com +
" travailleurs et " +
total_etudes_com +
" étudiants",
background: "#24637a",
fill: "white",
fontSize: 24,
anchor: "start"
},
{
geojson: links_travail_com,
strokeWidth: {
type: "linear",
values: "stock",
k: 20,
fixmax: d3.max(flux_travail.map((d) => +d.stock)),
leg_x: 850,
leg_y: 20,
leg_w: 110,
leg_title: "Nombre de travailleurs"
},
stroke: "#cf429d",
strokeOpacity: 0.8,
strokeLinecap: "round",
tooltip: ["$nom_origin", "$stock", "travailleurs"]
},
{
geojson: links_etudes_com,
strokeWidth: {
type: "linear",
values: "stock",
k: 20,
fixmax: d3.max(flux_etudes.map((d) => +d.stock)),
leg_x: 850,
leg_y: 100,
leg_w: 110,
leg_title: "Nombre d'étudiants"
},
stroke: "#42CE42",
strokeOpacity: 0.8,
strokeLinecap: "round",
tooltip: ["$nom_origin", "$stock", "étudiants"]
},
{
type: "footer",
text:
`↑ Nord ↑ | Source: INSEE ` +
input_annee +
` | EPSG:2154 RGF93/ Lambert-93 | Erwan Vinot, 2024
D3.JS, Bertin.js`
},
{ geojson: commune_select, fill: "#E14A88", stroke: "E8F8FF" },
{ geojson: CACP_DECO, fill: "#A4AFE8", stroke: "#E8F8FF" },
{ geojson: COM_FLUX_CACP, fill: "#A4D5EA" },
{ geojson: COMMUNES_DECO, fill: "none", stroke: "#A4D5EA" }
]
});
}
if (e[0] == "Travail") {
return bertin.draw({
params: {
background: "#E8F8FF",
margin: 10,
projection: "user",
extent: COM_FLUX_CACP
},
layers: [
{
type: "header",
text:
choix_direction.nom +
" à " +
choix_com +
" : " +
total_travail_com +
" travailleurs",
background: "#24637a",
fill: "white",
fontSize: 24,
anchor: "start"
},
{
geojson: links_travail_com,
strokeWidth: {
type: "linear",
values: "stock",
k: 20,
fixmax: d3.max(flux_travail.map((d) => +d.stock)),
leg_x: 850,
leg_y: 20,
leg_w: 110,
leg_title: "Nombre de travailleurs"
},
stroke: "#cf429d",
strokeOpacity: 0.8,
strokeLinecap: "round",
tooltip: ["$nom_origin", "$stock", "travailleurs"]
},
{
type: "footer",
text:
`↑ Nord ↑ | Source: INSEE ` +
input_annee +
` | EPSG:2154 RGF93/ Lambert-93 | Erwan Vinot, 2024
D3.JS, Bertin.js`
},
{ geojson: commune_select, fill: "#E14A88", stroke: "E8F8FF" },
{ geojson: CACP_DECO, fill: "#A4AFE8", stroke: "#E8F8FF" },
{ geojson: COM_FLUX_CACP, fill: "#A4D5EA" },
{ geojson: COMMUNES_DECO, fill: "none", stroke: "#A4D5EA" }
]
});
}
if (e[0] == "Etudes") {
return bertin.draw({
params: {
background: "#E8F8FF",
margin: 10,
projection: "user",
extent: COM_FLUX_CACP
},
layers: [
{
type: "header",
text:
choix_direction.nom +
" à " +
choix_com +
" : " +
total_etudes_com +
" étudiants",
background: "#24637a",
fill: "white",
fontSize: 24,
anchor: "start"
},
{
geojson: links_etudes_com,
strokeWidth: {
type: "linear",
values: "stock",
k: 20,
fixmax: d3.max(flux_etudes.map((d) => +d.stock)),
leg_x: 850,
leg_y: 20,
leg_w: 110,
leg_title: "Nombre d'étudiants"
},
stroke: "#42CE42",
strokeOpacity: 0.8,
strokeLinecap: "round",
tooltip: ["$nom_origin", "$stock", "étudiants"]
},
{
type: "footer",
text:
`↑ Nord ↑ | Source: INSEE ` +
input_annee +
` | EPSG:2154 RGF93/ Lambert-93 | Erwan Vinot, 2024
D3.JS, Bertin.js`
},
{ geojson: commune_select, fill: "#E14A88", stroke: "E8F8FF" },
{ geojson: CACP_DECO, fill: "#A4AFE8", stroke: "#E8F8FF" },
{ geojson: COM_FLUX_CACP, fill: "#A4D5EA" },
{ geojson: COMMUNES_DECO, fill: "none", stroke: "#A4D5EA" }
]
});
} else {
return md`Sélectionnez des données`;
}
}