mirror of
https://github.com/gauvainboiche/ketapk.git
synced 2026-09-02 11:13:11 +02:00
fix: Fixing dose calculus + small display changes
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user