CaMa patient survival figure: the legend claims an interval only when one is drawn
This commit is contained in:
@@ -6,7 +6,7 @@ import { tieneIntervalo } from '../paciente-riesgo.validation';
|
|||||||
export const ETIQUETAS_PACIENTE = {
|
export const ETIQUETAS_PACIENTE = {
|
||||||
titulo: 'Supervivencia de la paciente desde el primer reporte de biopsia con carcinoma invasor',
|
titulo: 'Supervivencia de la paciente desde el primer reporte de biopsia con carcinoma invasor',
|
||||||
eje_x: 'Meses desde el reporte de biopsia', eje_y: 'Probabilidad de supervivencia',
|
eje_x: 'Meses desde el reporte de biopsia', eje_y: 'Probabilidad de supervivencia',
|
||||||
curva: 'Supervivencia estimada', puntos: 'Modelo (LR + red bayesiana) con IC 95 %',
|
curva: 'Supervivencia estimada', puntos: 'Modelo (LR + red bayesiana)', puntosConIntervalo: 'Modelo (LR + red bayesiana) con IC 95 %',
|
||||||
} as const;
|
} as const;
|
||||||
export const COLOR_MODELO = '#6a3d9a';
|
export const COLOR_MODELO = '#6a3d9a';
|
||||||
/** The curve runs to this many months, as the cohort's does. */
|
/** The curve runs to this many months, as the cohort's does. */
|
||||||
@@ -48,7 +48,7 @@ export function figuraSupervivenciaPaciente(horizontes: readonly HorizonteRiesgo
|
|||||||
const data: Record<string, unknown>[] = [
|
const data: Record<string, unknown>[] = [
|
||||||
{ type: 'scatter', mode: 'lines', x: curva.meses, y: curva.S, name: ETIQUETAS_PACIENTE.curva, line: { color: COLOR_MODELO, width: 2.6 },
|
{ type: 'scatter', mode: 'lines', x: curva.meses, y: curva.S, name: ETIQUETAS_PACIENTE.curva, line: { color: COLOR_MODELO, width: 2.6 },
|
||||||
hovertemplate: '%{x} meses: %{y:.1%}<extra></extra>' },
|
hovertemplate: '%{x} meses: %{y:.1%}<extra></extra>' },
|
||||||
{ type: 'scatter', mode: 'markers', name: ETIQUETAS_PACIENTE.puntos, x: puntos.map(p => p.meses), y: puntos.map(p => p.S),
|
{ type: 'scatter', mode: 'markers', name: conIntervalo ? ETIQUETAS_PACIENTE.puntosConIntervalo : ETIQUETAS_PACIENTE.puntos, x: puntos.map(p => p.meses), y: puntos.map(p => p.S),
|
||||||
marker: { symbol: 'diamond', size: 12, color: COLOR_MODELO, line: { color: 'white', width: 1 } },
|
marker: { symbol: 'diamond', size: 12, color: COLOR_MODELO, line: { color: 'white', width: 1 } },
|
||||||
...(conIntervalo ? { error_y: { type: 'data', symmetric: false, visible: true, color: COLOR_MODELO, thickness: 1.8, width: 5,
|
...(conIntervalo ? { error_y: { type: 'data', symmetric: false, visible: true, color: COLOR_MODELO, thickness: 1.8, width: 5,
|
||||||
array: puntos.map(p => p.alto! - p.S), arrayminus: puntos.map(p => p.S - p.bajo!) } } : {}),
|
array: puntos.map(p => p.alto! - p.S), arrayminus: puntos.map(p => p.S - p.bajo!) } } : {}),
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ describe('Supervivencia individual de la paciente CaMa', () => {
|
|||||||
expect(rombos(con).marker.symbol).toBe('diamond');
|
expect(rombos(con).marker.symbol).toBe('diamond');
|
||||||
expect(rombos(con).error_y).toBeDefined();
|
expect(rombos(con).error_y).toBeDefined();
|
||||||
expect(rombos(sin).error_y).toBeUndefined();
|
expect(rombos(sin).error_y).toBeUndefined();
|
||||||
|
// The legend claims an interval only when one is drawn.
|
||||||
|
expect(rombos(con).name).toContain('IC 95 %');
|
||||||
|
expect(rombos(sin).name).not.toContain('IC');
|
||||||
expect(figuraSupervivenciaPaciente([])).toBeNull();
|
expect(figuraSupervivenciaPaciente([])).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user