Public
Edited
Nov 7
Insert cell
Insert cell
Insert cell
Insert cell
data = FileAttachment("Balance_departements_2010_2023interpolate@2.csv").csv()
Insert cell
region
Insert cell
Insert cell
Insert cell
variations = {
let dept_list = Array.from(d3.union(data_plot.map((d) => d.NDEPT))).sort(
(a, b) => b.NDEPT - a.NDEPT
);
let temp = [];

for (let x of dept_list) {
let n = data_plot.filter((d) => d.NDEPT == x).length;
let Min = data_plot
.filter((d) => d.NDEPT == x)
.sort((a, b) => b.EXER - a.EXER)[n - 1].Dépense;
let Max = data_plot
.filter((d) => d.NDEPT == x)
.sort((a, b) => b.EXER - a.EXER)[0].Dépense;

temp.push({
valeur_periode: ((Max / Min - 1) * 100).toFixed(0).toString() + "%",
valeur_annuelle:
"soit : " +
((Math.pow(Max / Min, 1 / (n - 1)) - 1) * 100).toFixed(1).toString() +
"%/an",
N: n,
nom_dept: data_plot
.filter((d) => d.NDEPT == x)
.sort((a, b) => b.EXER - a.EXER)[0].nom_dept,
NDEPT: data_plot
.filter((d) => d.NDEPT == x)
.sort((a, b) => b.EXER - a.EXER)[0].NDEPT,
Max: Max,
Min: Min
});
}
return temp.sort((a, b) => b.Max - a.Max);
}
Insert cell
Insert cell
//html`<disco><style> text { font-size: 11px; } </style></disco>`
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