Mostrar confirmación con intervalo en barra y ajustar etiquetas de la ficha

This commit is contained in:
2026-12-02 23:43:18 -06:00
parent a3a100450b
commit 5d660b7043
9 changed files with 65 additions and 18 deletions
+35
View File
@@ -202,6 +202,41 @@ export function detail(measure: Measure, r: Reading | undefined, unit = 'pacient
const pct = (v?: number) => (v === undefined ? '—' : `${(v * 100).toFixed(1)} %`);
/** A proportion as one bar of 0 to 100 % with its published 95 % interval as the error bar. */
export function intervalBar(r: Reading, color?: string): Figure {
const score = r.score ?? 0;
const known = r.low !== undefined && r.high !== undefined;
return {
data: [
{
type: 'bar',
orientation: 'h',
x: [score],
y: [''],
width: [0.4],
marker: { color: color ?? PALETTE[0] },
hovertemplate: `${pct(r.score)}<br>IC 95 %: ${pct(r.low)}–${pct(r.high)}<extra></extra>`,
error_x: known
? {
type: 'data',
symmetric: false,
array: [r.high! - score],
arrayminus: [score - r.low!],
color: '#17324d',
thickness: 2,
width: 10,
}
: undefined,
},
],
layout: {
showlegend: false,
margin: { t: 16, r: 16, b: 32, l: 16 },
xaxis: { range: [0, 1], tickformat: '.0%' },
},
} as Figure;
}
/** A donut of one stratifier's counts (initial population), or of numerator vs the rest. */
export function donut(
measure: Measure,