diff --git a/src/app/app.scss b/src/app/app.scss
index 91046ef..269e44e 100644
--- a/src/app/app.scss
+++ b/src/app/app.scss
@@ -21,10 +21,22 @@
.title {
flex: 1;
+ min-width: 0; // gives way to the switcher and the sections, on one line
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
font-size: 1.25rem;
font-weight: 500;
}
+// Nothing in the header wraps or shrinks: the title gives way first, then hides.
+.domain,
+.sections a,
+.user {
+ flex-shrink: 0;
+ white-space: nowrap;
+}
+
.domain {
--mat-button-filled-container-color: var(--color-primary);
--mat-button-filled-label-text-color: var(--color-text);
@@ -67,10 +79,35 @@
width: clamp(155px, 15vw, 185px);
}
-@media (max-width: 720px) {
+@media (max-width: 1100px) {
.title {
display: none;
}
+ .header {
+ justify-content: space-between;
+ gap: var(--space-3);
+ }
+ .sections {
+ gap: var(--space-3);
+ }
+ // the account by its icon alone; the switcher's name cut short if it must be
+ .user .who-name {
+ display: none;
+ }
+ .domain {
+ max-width: 15rem;
+ }
+ .domain ::ng-deep .mdc-button__label {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+}
+
+@media (max-width: 720px) {
+ .header {
+ flex-wrap: wrap;
+ padding-block: var(--space-2);
+ }
}
.user {
diff --git a/src/app/indicadores/figures.ts b/src/app/indicadores/figures.ts
index f6adafb..bd2fe5e 100644
--- a/src/app/indicadores/figures.ts
+++ b/src/app/indicadores/figures.ts
@@ -108,6 +108,8 @@ export function nestedDonut(r: Reading, catalog: Catalog, center: string): Figur
labels: catalog.categories.map((c) => c.label),
hole: 0.74,
domain: { x: [0, 1], y: [0, 1] },
+ // along the thin ring, so a label fits its slice
+ insidetextorientation: 'tangential',
text: values.map((n, i) => (total && n / total >= 0.05 ? catalog.categories[i].label : '')),
marker: {
colors: catalog.categories.map((c) => rgba(c.color, faded.has(c.code) ? 0.3 : 1)),
@@ -150,7 +152,8 @@ export function scenarioBars(
xaxis: {
title: { text: '% de pacientes del escenario con resultado' },
ticksuffix: ' %',
- range: [0, 100],
+ range: [0, 100.5],
+ dtick: 20,
},
yaxis: {
type: 'category',
@@ -159,7 +162,6 @@ export function scenarioBars(
categoryarray: y,
automargin: true,
},
- legend: { orientation: 'h', y: -0.25 },
},
};
}
diff --git a/src/app/indicadores/tab-indicadores.html b/src/app/indicadores/tab-indicadores.html
index 12362c8..ea42911 100644
--- a/src/app/indicadores/tab-indicadores.html
+++ b/src/app/indicadores/tab-indicadores.html
@@ -53,7 +53,13 @@
@if (reports.isLoading() && k.measure) {
} @else {
-
{{ kpiValue(k) }}
+
+ @let v = kpiParts(kpiValue(k));
+ {{ v[0] }}
+ @if (v[1]) {
+ {{ v[1] }}
+ }
+
{{ kpiNote(k) }}
}
@@ -177,7 +183,13 @@
{{ section.title }}
- {{ kpiValue(section) }}
+
+ @let w = kpiParts(kpiValue(section));
+ {{ w[0] }}
+ @if (w[1]) {
+ {{ w[1] }}
+ }
+
{{ kpiNote(section) }}
diff --git a/src/app/indicadores/tab-indicadores.scss b/src/app/indicadores/tab-indicadores.scss
index 1cb5d75..f641449 100644
--- a/src/app/indicadores/tab-indicadores.scss
+++ b/src/app/indicadores/tab-indicadores.scss
@@ -61,6 +61,14 @@ h2 {
font-size: 2rem;
font-weight: 500;
margin: var(--space-2) 0;
+ line-height: 1.15;
+}
+
+.kpi-qualifier {
+ display: block;
+ font-size: 14px;
+ font-weight: 400;
+ color: var(--color-text-secondary);
}
.kpi-detail {
diff --git a/src/app/indicadores/tab-indicadores.ts b/src/app/indicadores/tab-indicadores.ts
index f00806b..6537c83 100644
--- a/src/app/indicadores/tab-indicadores.ts
+++ b/src/app/indicadores/tab-indicadores.ts
@@ -202,6 +202,12 @@ export class TabIndicadores {
return this.byName().get(code);
}
/** A card's value and note, from its templates (a card with no measure: its words). */
+ /** "27 días (mediana)" as the value and its qualifier, shown smaller beneath it. */
+ protected kpiParts(text: string): [string, string] {
+ const found = /^(.*?)\s*(\([^)]*\))$/.exec(text);
+ return found ? [found[1], found[2]] : [text, ''];
+ }
+
protected kpiValue(k: Kpi): string {
if (!k.measure) return k.value ?? '';
const r = this.rd(k.measure);
diff --git a/src/app/indicadores/tab-riesgos.scss b/src/app/indicadores/tab-riesgos.scss
index d115658..ad492df 100644
--- a/src/app/indicadores/tab-riesgos.scss
+++ b/src/app/indicadores/tab-riesgos.scss
@@ -10,6 +10,11 @@
margin-bottom: var(--space-4);
}
+// a field as wide as its label ("Horizonte de la probabilidad")
+.filters mat-form-field {
+ min-width: 14.5rem;
+}
+
.table-wrap {
overflow-x: auto;
padding: 0;
@@ -43,6 +48,7 @@ a {
.worklist td small {
display: block;
+ white-space: nowrap;
color: var(--mat-sys-on-surface-variant);
font-size: 0.8em;
}
diff --git a/src/app/plot.ts b/src/app/plot.ts
index 9e9d520..d29743b 100644
--- a/src/app/plot.ts
+++ b/src/app/plot.ts
@@ -21,8 +21,45 @@ const LAYOUT: Partial = {
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;
+
+/** 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 = {}): Partial {
+ const axes = Object.fromEntries(
+ Object.entries(layout)
+ .filter(([k]) => /^[xy]axis\d*$/.test(k))
+ .map(([k, v]) => {
+ const axis = (v ?? {}) as Partial;
+ 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[] {
+ return data.map((d) => (d.type === 'pie' ? { automargin: true, ...d } : d)) as Plotly.Data[];
+}
const CONFIG: Partial = {
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);
});
}
diff --git a/src/styles.scss b/src/styles.scss
index edf2256..c8383de 100644
--- a/src/styles.scss
+++ b/src/styles.scss
@@ -103,7 +103,7 @@ table.plain td {
border-bottom: 1px solid var(--color-border);
padding: 6px 8px;
text-align: left;
- vertical-align: top;
+ vertical-align: middle;
}
table.plain th {