diff --git a/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts b/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts index c4bd04f..fde4874 100644 --- a/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts +++ b/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts @@ -87,7 +87,7 @@ describe('Conteos pareados de CaMa: lo que se puede sumar', () => { const dona = donaConteos(m, PAR, 'claro') as unknown as { data: { labels: string[]; values: number[] }[]; layout: { annotations: { text: string }[] } }; expect(dona.data[0].labels).toEqual(['BI-RADS 4 (sin subcategoría)', 'BI-RADS 4A', 'BI-RADS 4B', 'BI-RADS 4C', 'BI-RADS 5', 'BI-RADS 6']); expect(dona.data[0].values).toEqual([15, 2, 0, 0, 18, 0]); - expect(dona.layout.annotations[0].text).toBe('35
mastografías'); + expect(dona.layout.annotations.slice(0, 2).map(a => a.text)).toEqual(['35', 'mastografías']); }); }); @@ -98,12 +98,12 @@ describe('Conteos pareados de CaMa: etiquetas de la dona', () => { it('mantiene las etiquetas con porcentaje fuera del sector', () => { const f = dona(), t = f.data[0]; expect(t['textinfo']).toBe('none'); - expect(f.layout.annotations.slice(1).map(a => a['text']).sort()).toEqual([ + expect(f.layout.annotations.slice(2).map(a => a['text']).sort()).toEqual([ 'BI-RADS 4
(sin
subcategoría)
45.5 %', 'BI-RADS 5
54.5 %', ]); expect(t['values']).toEqual([15, 0, 0, 0, 18, 0]); expect(f.layout.showlegend).toBe(false); - expect(f.layout.annotations[0]['text']).toBe('33
mastografías'); + expect(f.layout.annotations.slice(0, 2).map(a => a['text'])).toEqual(['33', 'mastografías']); }); }); diff --git a/src/app/features/indicadores/indicadores-conteos-pareados.ts b/src/app/features/indicadores/indicadores-conteos-pareados.ts index 4a6484a..8dd08d8 100644 --- a/src/app/features/indicadores/indicadores-conteos-pareados.ts +++ b/src/app/features/indicadores/indicadores-conteos-pareados.ts @@ -142,7 +142,7 @@ export function donaConteos(m: ModeloConteos, par: ParConteos, tema: Tema): Plot }; }); }); - return { data: [{ type: 'pie', hole: .6, sort: false, direction: 'clockwise', values: n, labels: etiquetas, + return { data: [{ type: 'pie', hole: .54, sort: false, direction: 'clockwise', values: n, labels: etiquetas, marker: { colors: m.examenes.map(c => c.color), line: { color: p.background, width: 2 } }, textinfo: 'none', domain: { x: [0, 1], y: [.3, .7] }, customdata: n.map((v, i) => [miles(v), porcentajes[i]]), @@ -150,8 +150,11 @@ export function donaConteos(m: ModeloConteos, par: ParConteos, tema: Tema): Plot layout: { autosize: true, height: ALTO_DONA, showlegend: false, paper_bgcolor: p.background, font: { color: p.text }, margin: { t: MARGEN_DONA, b: MARGEN_DONA, l: MARGEN_DONA, r: MARGEN_DONA }, shapes: llamadas.map(({ shape }) => shape), - annotations: [{ ...centro, font: { size: 16, color: p.text }, - text: `${miles(total)}
${par.unidades.examenes}` }, ...llamadas.map(({ annotation }) => annotation)] }, config: { displayModeBar: false } }; + annotations: [ + { ...centro, yshift: 8, font: { size: 14, color: p.text }, text: `${miles(total)}` }, + { ...centro, yshift: -8, font: { size: 11, color: p.text }, text: par.unidades.examenes }, + ...llamadas.map(({ annotation }) => annotation), + ] }, config: { displayModeBar: false } }; } /** Per BI-RADS family: patients (in their most severe category) next to exams. No ratio between them is drawn. */