Skip to content
Snippets Groups Projects
Commit ad6f5a6d authored by Benoît Courty's avatar Benoît Courty Committed by benoit-cty
Browse files

comment

parent 5ee03595
Branches
No related tags found
1 merge request!6Ajout de la section Education
......@@ -2,14 +2,12 @@ import {
type DataEducation,
type EducationInfo,
} from "$lib/education_data"
// import { getContext } from "svelte"
// import type { Writable } from "svelte/store"
// const Plotly = getContext("Plotly") as Writable<unknown>
interface ColorMap {
[key: string]: string;
}
// Correspondance entre les couleurs et les valeurs HTML
const color_map: ColorMap = {
cyan: "#00E0D7",
blue: "#1132FC",
......@@ -47,7 +45,29 @@ function getColorFromIps(ips: number | null): string {
}
return color_map[color];
}
function getColorFromEffectif(effectifs: number | null): string {
if (effectifs === null) {
return "grey";
}
effectifs = Number(effectifs || 0);
let color: string;
if (effectifs < 100) {
color = "goldenrod";
} else if (effectifs < 200) {
color = "orange";
} else if (effectifs < 300) {
color = "red";
} else if (effectifs < 500) {
color = "fushia";
} else if (effectifs < 800) {
color = "violet";
} else if (effectifs < 1000) {
color = "blue";
} else {
color = "cyan";
}
return color_map[color];
}
export function plot_map(
div_name: string,
customdata: EducationInfo[],
......@@ -66,6 +86,7 @@ export function plot_map(
marker: {
size: 20,
color: color,
//symbol: "triangle-up",
},
},
]
......@@ -98,29 +119,7 @@ export function plot_map(
// }
}
function getColorFromEffectif(effectifs: number | null): string {
if (effectifs === null) {
return "grey";
}
effectifs = Number(effectifs || 0);
let color: string;
if (effectifs < 100) {
color = "goldenrod";
} else if (effectifs < 200) {
color = "orange";
} else if (effectifs < 300) {
color = "red";
} else if (effectifs < 500) {
color = "fushia";
} else if (effectifs < 800) {
color = "violet";
} else if (effectifs < 1000) {
color = "blue";
} else {
color = "cyan";
}
return color_map[color];
}
export function plot_ips(dataEducation: DataEducation, Plotly) {
/*Carte de l'IPS des écoles primaires et secondaires*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment