diff --git a/client/src/pages/atlas/charts/map-with-polygon-and-bubbles.tsx b/client/src/pages/atlas/charts/map-with-polygon-and-bubbles.tsx index c9e91b0d..65b5b6ba 100644 --- a/client/src/pages/atlas/charts/map-with-polygon-and-bubbles.tsx +++ b/client/src/pages/atlas/charts/map-with-polygon-and-bubbles.tsx @@ -23,11 +23,11 @@ export default function MapWithPolygonAndBubbles({ }) { const [searchParams] = useSearchParams(); const geoId = searchParams.get("geo_id") || ""; - + if (isLoading) { return ; } - + const mapOptions = { chart: { map: "countries/ie/ie-all", @@ -137,7 +137,7 @@ export default function MapWithPolygonAndBubbles({ } // special case : France but idToFocus === Saint-Martin - if (geoId === "PAYS_100" && currentId === "978") { + if (geoId === "PAYS_100" && currentId === "D978") { mapOptions.mapView["center"] = [-63.1, 18.1]; mapOptions.mapView["zoom"] = 9; mapOptions.chart["height"] = "150"; @@ -152,6 +152,36 @@ export default function MapWithPolygonAndBubbles({ mapOptions.chart["width"] = "130"; } + // special case : collectivités + if (geoId === "R00") { + mapOptions.chart["height"] = "130"; + mapOptions.chart["width"] = "250"; + } + + // special case : collectivités but idToFocus === Nouvelle-Calédonie + if (geoId === "R00" && currentId === "D988") { + mapOptions.mapView["center"] = [165.7, -21]; + mapOptions.mapView["zoom"] = 5.5; + } + + // special case : collectivités but idToFocus === Polynésie française + if (geoId === "R00" && currentId === "D987") { + mapOptions.mapView["center"] = [-149.5, -17.5]; + mapOptions.mapView["zoom"] = 7; + } + + // special case : collectivités but idToFocus === Saint-Martin + if (geoId === "R00" && currentId === "D978") { + mapOptions.mapView["center"] = [-63.1, 18.1]; + mapOptions.mapView["zoom"] = 9; + } + + // special case : collectivités but idToFocus === Wallis et Futuna + if (geoId === "R00" && currentId === "D986") { + mapOptions.mapView["center"] = [-178, -13.3]; + mapOptions.mapView["zoom"] = 6; + } + return ( { let polygon; switch (item.geo_id) { - case "D988": + // Nouvelle-Calédonie + case "D988": + case "A40": mapbubbleData.push({ z: item.data.find((d) => d.annee_universitaire === currentYear) @@ -134,7 +136,9 @@ export function General() { }); break; + // Polynésie française case "D987": + case "A41": mapbubbleData.push({ z: item.data.find((d) => d.annee_universitaire === currentYear) @@ -145,7 +149,9 @@ export function General() { }); break; + // Saint-Martin case "978": + case "D978": mapbubbleData.push({ z: item.data.find((d) => d.annee_universitaire === currentYear) @@ -156,6 +162,19 @@ export function General() { }); break; + // Wallis et Futuna + case "D986": + case "A42": + mapbubbleData.push({ + z: + item.data.find((d) => d.annee_universitaire === currentYear) + ?.effectif || 0, + name: item.geo_nom, + lat: -13.3, + lon: -178, + }); + break; + default: polygon = polygonsData.find((d) => d.originalId === item.geo_id) @@ -226,7 +245,7 @@ export function General() {
+ + + + <span + className="fr-icon-pie-chart-2-fill fr-mr-1w" + aria-hidden="true" + /> + Répartition des effectifs étudiants dans les collectivités + d'outre-mer + + + + + + + +
+ +
Nouvelle-Calédonie
+
+ + +
+ +
Polynésie française
+
+ + +
+ +
Saint-Martin
+
+ + +
+ +
Wallis et Futuna
+
+ +
+ + + + +
+ + ); + } + if (polygonsData.length > 1) { return ( <> diff --git a/client/src/pages/atlas/components/main/tabs/styles.scss b/client/src/pages/atlas/components/main/tabs/styles.scss index a0295d70..63c268ec 100644 --- a/client/src/pages/atlas/components/main/tabs/styles.scss +++ b/client/src/pages/atlas/components/main/tabs/styles.scss @@ -1,3 +1,23 @@ + .standard-item{ + border: 1px solid var(--border-default-grey); + position: relative; + border-radius: 5px; + + .item-label { + position: absolute; + padding: 2px; + font-size: 10px; + font-weight: 500; + text-align: center; + background-color: var(--border-default-grey); + border-bottom: 1px solid var(--border-default-grey); + border-radius: 5px 5px 0 0; + top: 0; + width: 100%; + line-height: normal; + } + } + .atlas-map { .item { width: 150px; diff --git a/client/src/pages/atlas/components/main/tabs/sub-list.tsx b/client/src/pages/atlas/components/main/tabs/sub-list.tsx index 8d9568fe..acc60369 100644 --- a/client/src/pages/atlas/components/main/tabs/sub-list.tsx +++ b/client/src/pages/atlas/components/main/tabs/sub-list.tsx @@ -53,6 +53,13 @@ export default function SubList() { ) ); + // Special case "Saint-Martin" (geo_id = 978) + dataHistoric.data.forEach(item => { + if (item.geo_id === '978') { + item.geo_id = 'D978'; + } + }); + return ( diff --git a/client/src/utils.tsx b/client/src/utils.tsx index 01e40ddd..d1a42ffe 100644 --- a/client/src/utils.tsx +++ b/client/src/utils.tsx @@ -49,6 +49,10 @@ function getParentFromLevel(parents, geoId) { if (geoId === "PAYS_100") { return null; } + if (geoId === "D978") { + return { geo_nom: parents.reg_nom, geo_id: parents.reg_id }; + + } if (geoId.startsWith("R")) { return { geo_nom: "France", geo_id: "PAYS_100" }; } @@ -61,6 +65,8 @@ function getParentFromLevel(parents, geoId) { if (geoId.startsWith("U")) { return { geo_nom: parents.reg_nom, geo_id: parents.reg_id }; } + + // default = communes return { geo_nom: parents.dep_nom, geo_id: parents.dep_id }; } diff --git a/server/src/routes/tableaux/atlas/index.js b/server/src/routes/tableaux/atlas/index.js index a6cff2d8..b263d2d6 100644 --- a/server/src/routes/tableaux/atlas/index.js +++ b/server/src/routes/tableaux/atlas/index.js @@ -126,13 +126,13 @@ router.route("/atlas/get-geo-polygons").get(async (req, res) => { } if (geoId.startsWith("R") || geoId.startsWith("A") || geoId.startsWith("P")) { const ids = await db.collection("atlas2024").distinct("geo_id", filters); - if (geoId.startsWith("P")) { + if (geoId.startsWith("P") || geoId === "R00") { ids.push("D988"); //Nouvelle-Caledonie ids.push("D987"); //Polynesie-Francaise ids.push("D986"); //Wallis-et-Futuna ids.push("D985"); //Saint-Pierre-et-Miquelon ids.push("D984"); //Saint-Barthelemy - ids.push("978"); //Saint-Martin + ids.push("D978"); //Saint-Martin } const polygons = []; for (let i = 0; i < ids.length; i++) { @@ -355,7 +355,7 @@ router.route("/atlas/number-of-students-historic-by-level").get(async (req, res) query = { geo_id: { $ne: "R99" }, // français à l'etrangers $or: [ - { geo_id: "978" }, + { geo_id: "D978" }, { geo_id: "D986" }, { geo_id: "D987" }, { geo_id: "D988" },