Merge origin/rebuild into parity/T1-merge (WebApp)
rebuild's shell, auth and non-TEA pages; tea/parity's TEA pages on tea/parity's API. - Routes: rebuild's signed-in tree; the TEA risk page joins it (domainAllowed reads the route's data domain when the path has no :domain). - Indicadores: rebuild's header and its generic Resumen/Trazabilidad/Definiciones tabs (TEA as the reference page, fed by tea/parity's measures); TEA Seguimiento and Análisis de riesgo render tea/parity's tea-list inside rebuild's tab-seguimiento/tab-riesgos, which keep rebuild's CaCu/CaMa lists and patient search. rebuild's tab-riesgos-tea read rebuild's TEA Patient extensions, which are gone with its backend; tea-list already shows that list from tea/parity's FHIR search, so it is deleted rather than ported (its look is the base for T8/T9). - Paciente: rebuild's record for CaCu/CaMa; TEA delegates to tea/parity's TeaRecord. rebuild's inline TEA sections read its EEG detail endpoint and are removed. - Gobernanza: tea/parity's page (execution, models with checks/lineage, bundles, training, studies, preview) until T13; model headings use rebuild's model titles. figures.ts: rebuild's scenarios (drawn in the record) plus tea/parity's association forest. - plot.ts: rebuild's layout helpers on tea/parity's partial Plotly bundle. - Conectar: rebuild's KINDS/HELP with an entry for tea/parity's edf node. - Dead code removed: measures boxes/sankey (tea/parity's old TEA tab), eeg-labels headMap/byDeviation/LEVEL_NAMES/METRIC_NAMES (rebuild's TEA record), e2e/layout.ts. - e2e: tea/parity's TEA cases, signed in; rebuild's CaCu/CaMa/site cases need their hospitals loaded and come back with the page suite (T16). - openapi.json and src/app/api: regenerated in the next commit.
This commit is contained in:
+39
-7
@@ -21,8 +21,45 @@ const LAYOUT: Partial<Plotly.Layout> = {
|
||||
margin: { t: 24, r: 16, b: 48, l: 56 },
|
||||
paper_bgcolor: 'rgba(0,0,0,0)',
|
||||
plot_bgcolor: 'rgba(0,0,0,0)',
|
||||
legend: { orientation: 'h', y: -0.2 },
|
||||
// Above the plot, left-aligned: Plotly reserves its room, so it never meets an axis title.
|
||||
legend: { orientation: 'h', x: 0, xanchor: 'left', y: 1.02, yanchor: 'bottom' },
|
||||
hoverlabel: { font: { family: 'Roboto, Arial, sans-serif', size: 13 } },
|
||||
};
|
||||
// Axes make room for their labels and titles; a title keeps clear of the tick labels.
|
||||
// (`ticklabelstandoff` is Plotly's, newer than its published types.)
|
||||
const AXIS = {
|
||||
automargin: true,
|
||||
title: { standoff: 12 },
|
||||
ticklabelstandoff: 4, // the lowest y label and the first x label never touch
|
||||
} as Partial<Plotly.LayoutAxis>;
|
||||
|
||||
/** The platform's layout under a figure's own: legend, margins and axes merged key by key,
|
||||
* so a figure that sets one of their keys keeps the others. */
|
||||
export function layoutOf(layout: Partial<Plotly.Layout> = {}): Partial<Plotly.Layout> {
|
||||
const axes = Object.fromEntries(
|
||||
Object.entries(layout)
|
||||
.filter(([k]) => /^[xy]axis\d*$/.test(k))
|
||||
.map(([k, v]) => {
|
||||
const axis = (v ?? {}) as Partial<Plotly.LayoutAxis>;
|
||||
const title = typeof axis.title === 'string' ? { text: axis.title } : axis.title;
|
||||
return [k, { ...AXIS, ...axis, title: { ...AXIS.title, ...title } }];
|
||||
}),
|
||||
);
|
||||
return {
|
||||
...LAYOUT,
|
||||
xaxis: AXIS,
|
||||
yaxis: AXIS,
|
||||
...layout,
|
||||
...axes,
|
||||
legend: { ...LAYOUT.legend, ...layout.legend },
|
||||
margin: { ...LAYOUT.margin, ...layout.margin },
|
||||
};
|
||||
}
|
||||
|
||||
/** Pie labels that sit outside take the room they need instead of being clipped. */
|
||||
function withRoom(data: Partial<Plotly.Data>[]): Plotly.Data[] {
|
||||
return data.map((d) => (d.type === 'pie' ? { automargin: true, ...d } : d)) as Plotly.Data[];
|
||||
}
|
||||
const CONFIG: Partial<Plotly.Config> = {
|
||||
responsive: true,
|
||||
displaylogo: false,
|
||||
@@ -43,12 +80,7 @@ export class Plot implements OnDestroy {
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const { data, layout } = this.figure();
|
||||
void plotly.react(
|
||||
this.host().nativeElement,
|
||||
data as Plotly.Data[],
|
||||
{ ...LAYOUT, ...layout },
|
||||
CONFIG,
|
||||
);
|
||||
void plotly.react(this.host().nativeElement, withRoom(data), layoutOf(layout), CONFIG);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user