Files
ketapk/frontend/js/chartManager.js
T
2026-08-01 17:34:23 +02:00

30 lines
835 B
JavaScript

import { CLINICAL_THRESHOLDS } from '../pkCore.js';
export function createChartAnnotations(mode) {
const thresholds = CLINICAL_THRESHOLDS[mode];
const annotations = {};
thresholds.zones.forEach((zone, index) => {
// Évite d'étendre la dernière zone à l'infini sur le graphe
const yMax = zone.max === Infinity ? thresholds.maxScale : zone.max;
if (zone.min < thresholds.maxScale) {
annotations[`zone_${index}`] = {
type: 'box',
yMin: zone.min,
yMax: Math.min(yMax, thresholds.maxScale),
backgroundColor: zone.color,
borderWidth: 0,
label: {
display: true,
content: zone.name,
color: zone.textHex,
font: { size: 14, weight: 'bold' },
position: 'center'
}
};
}
});
return annotations;
}