mirror of
https://github.com/gauvainboiche/ketapk.git
synced 2026-09-02 11:13:11 +02:00
feat: Creating the base of application
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user