From d4bf18183698701f1a4db3d168df43b4d1a77ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Arod?= Date: Tue, 10 Dec 2024 10:11:37 +0100 Subject: [PATCH] fix: range dynamique pour l'axe y du diagramme --- src/notion/publish/v2/publishStatsV2.ts | 0 .../mermaidDiagramStatsGeneralesMensuelles.ts | 12 +++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) delete mode 100644 src/notion/publish/v2/publishStatsV2.ts diff --git a/src/notion/publish/v2/publishStatsV2.ts b/src/notion/publish/v2/publishStatsV2.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/statistiques/v2/generales/mermaidDiagramStatsGeneralesMensuelles.ts b/src/statistiques/v2/generales/mermaidDiagramStatsGeneralesMensuelles.ts index 6c3b50f..1b7e3bd 100644 --- a/src/statistiques/v2/generales/mermaidDiagramStatsGeneralesMensuelles.ts +++ b/src/statistiques/v2/generales/mermaidDiagramStatsGeneralesMensuelles.ts @@ -8,6 +8,16 @@ export function mermaidDiagramStatsGeneralesMensuelles( statsEntries.length - 15, statsEntries.length ); + const maxY = Math.max( + ...entriesToDisplay.map(([, s]) => + Math.max( + s.nbFamillesResistantes, + s.nbFamillesExResistantes, + s.nbEntrees, + s.nbSorties + ) + ) + ); const periods = entriesToDisplay.map(([p]) => { const comp = p.split("-"); // Reformat month as MM/yy @@ -22,7 +32,7 @@ config: xychart-beta title "Familles: Résist.(bleu), Ex-Résist (gris), Entrées (vert), Sorties (rouge)" x-axis "Mois" [${periods}] - y-axis "Nb Familles" 0 --> 110 + y-axis "Nb Familles" 0 --> ${maxY + 10} line [${entriesToDisplay.map(([, s]) => s.nbFamillesResistantes)}] line [${entriesToDisplay.map(([, s]) => s.nbFamillesExResistantes)}] line [${entriesToDisplay.map(([, s]) => s.nbEntrees)}]