fix: range dynamique pour l'axe y du diagramme

wip-related-pages
Sébastien Arod 2024-12-10 10:11:37 +01:00
parent 2afbfec36e
commit d4bf181836
2 changed files with 11 additions and 1 deletions

View File

@ -8,6 +8,16 @@ export function mermaidDiagramStatsGeneralesMensuelles(
statsEntries.length - 15, statsEntries.length - 15,
statsEntries.length 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 periods = entriesToDisplay.map(([p]) => {
const comp = p.split("-"); const comp = p.split("-");
// Reformat month as MM/yy // Reformat month as MM/yy
@ -22,7 +32,7 @@ config:
xychart-beta xychart-beta
title "Familles: Résist.(bleu), Ex-Résist (gris), Entrées (vert), Sorties (rouge)" title "Familles: Résist.(bleu), Ex-Résist (gris), Entrées (vert), Sorties (rouge)"
x-axis "Mois" [${periods}] 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.nbFamillesResistantes)}]
line [${entriesToDisplay.map(([, s]) => s.nbFamillesExResistantes)}] line [${entriesToDisplay.map(([, s]) => s.nbFamillesExResistantes)}]
line [${entriesToDisplay.map(([, s]) => s.nbEntrees)}] line [${entriesToDisplay.map(([, s]) => s.nbEntrees)}]