mirror of
https://github.com/gauvainboiche/ketapk.git
synced 2026-09-02 11:13:11 +02:00
30 lines
835 B
JavaScript
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;
|
|
} |