fix: Fixing dose calculus + small display changes

This commit is contained in:
gauvainboiche
2026-08-02 17:28:06 +02:00
parent abe44eca1d
commit 165935521a
2 changed files with 8 additions and 10 deletions
+3 -5
View File
@@ -30,19 +30,17 @@ export function updateChartAnnotations(chart, mode, currentYMax) {
}
export function adjustChartYScale(chart, mode, datasets) {
const defaultMax = CLINICAL_THRESHOLDS[mode].maxScale;
let highestValue = 0;
// Recherche de la valeur maximale atteinte parmi tous les modèles affichés
datasets.forEach(ds => {
ds.data.forEach(val => {
if (val > highestValue) highestValue = val;
});
});
let targetYMax = defaultMax;
if (highestValue > defaultMax) {
targetYMax = Math.ceil(highestValue * 1.1);
}
// Ajustement dynamique à 110 % de la valeur pic (ou plancher à 50 ng/mL si vide)
let targetYMax = highestValue > 0 ? Math.ceil(highestValue * 1.1) : 50;
chart.options.scales.y.max = targetYMax;
updateChartAnnotations(chart, mode, targetYMax);