fix(cama): equilibrar centro y anillo de la dona
This commit is contained in:
@@ -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 }[] } };
|
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].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.data[0].values).toEqual([15, 2, 0, 0, 18, 0]);
|
||||||
expect(dona.layout.annotations[0].text).toBe('<b>35</b><br>mastografías');
|
expect(dona.layout.annotations.slice(0, 2).map(a => a.text)).toEqual(['<b>35</b>', 'mastografías']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -98,12 +98,12 @@ describe('Conteos pareados de CaMa: etiquetas de la dona', () => {
|
|||||||
it('mantiene las etiquetas con porcentaje fuera del sector', () => {
|
it('mantiene las etiquetas con porcentaje fuera del sector', () => {
|
||||||
const f = dona(), t = f.data[0];
|
const f = dona(), t = f.data[0];
|
||||||
expect(t['textinfo']).toBe('none');
|
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<br>(sin<br>subcategoría)<br>45.5 %', 'BI-RADS 5<br>54.5 %',
|
'BI-RADS 4<br>(sin<br>subcategoría)<br>45.5 %', 'BI-RADS 5<br>54.5 %',
|
||||||
]);
|
]);
|
||||||
expect(t['values']).toEqual([15, 0, 0, 0, 18, 0]);
|
expect(t['values']).toEqual([15, 0, 0, 0, 18, 0]);
|
||||||
expect(f.layout.showlegend).toBe(false);
|
expect(f.layout.showlegend).toBe(false);
|
||||||
expect(f.layout.annotations[0]['text']).toBe('<b>33</b><br>mastografías');
|
expect(f.layout.annotations.slice(0, 2).map(a => a['text'])).toEqual(['<b>33</b>', 'mastografías']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -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',
|
marker: { colors: m.examenes.map(c => c.color), line: { color: p.background, width: 2 } }, textinfo: 'none',
|
||||||
domain: { x: [0, 1], y: [.3, .7] },
|
domain: { x: [0, 1], y: [.3, .7] },
|
||||||
customdata: n.map((v, i) => [miles(v), porcentajes[i]]),
|
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 },
|
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 },
|
margin: { t: MARGEN_DONA, b: MARGEN_DONA, l: MARGEN_DONA, r: MARGEN_DONA },
|
||||||
shapes: llamadas.map(({ shape }) => shape),
|
shapes: llamadas.map(({ shape }) => shape),
|
||||||
annotations: [{ ...centro, font: { size: 16, color: p.text },
|
annotations: [
|
||||||
text: `<b>${miles(total)}</b><br>${par.unidades.examenes}` }, ...llamadas.map(({ annotation }) => annotation)] }, config: { displayModeBar: false } };
|
{ ...centro, yshift: 8, font: { size: 14, color: p.text }, text: `<b>${miles(total)}</b>` },
|
||||||
|
{ ...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. */
|
/** Per BI-RADS family: patients (in their most severe category) next to exams. No ratio between them is drawn. */
|
||||||
|
|||||||
Reference in New Issue
Block a user