CaCu: show screening rounds and restore category palettes
This commit is contained in:
@@ -2,7 +2,7 @@ import { Component, computed, input, signal } from '@angular/core';
|
||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||
import { Loading } from '../loading';
|
||||
import { Figure, Plot } from '../plot';
|
||||
import { bars, Mode } from './bars';
|
||||
import { bars, Mode, unavailable } from './bars';
|
||||
import { Reading } from './measures';
|
||||
|
||||
/** A card read one mode at a time: its title, its headline, the toggle and the bars. */
|
||||
@@ -33,8 +33,10 @@ import { Reading } from './measures';
|
||||
}
|
||||
@if (loading()) {
|
||||
<app-loading what="la figura" [figure]="true" />
|
||||
} @else if (missing(); as why) {
|
||||
<p class="state" role="status">{{ why }}</p>
|
||||
} @else if (figure(); as f) {
|
||||
<app-plot [figure]="f" [height]="300" />
|
||||
<app-plot [figure]="f" [height]="height()" />
|
||||
} @else if (table(); as t) {
|
||||
<table [attr.aria-label]="mode().label">
|
||||
<thead>
|
||||
@@ -50,6 +52,9 @@ import { Reading } from './measures';
|
||||
<tr>
|
||||
<th scope="row">
|
||||
{{ row.label }}
|
||||
@if (row.hint) {
|
||||
<span class="hint">{{ row.hint }}</span>
|
||||
}
|
||||
<span class="track" aria-hidden="true">
|
||||
<span
|
||||
class="bar"
|
||||
@@ -57,7 +62,7 @@ import { Reading } from './measures';
|
||||
[style.background]="row.color"
|
||||
></span>
|
||||
@for (m of row.marks; track $index) {
|
||||
<span class="mark" [style.left.%]="m"></span>
|
||||
<span class="mark" [style.left.%]="m" [style.background]="t.markColor"></span>
|
||||
}
|
||||
</span>
|
||||
</th>
|
||||
@@ -68,6 +73,9 @@ import { Reading } from './measures';
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
@if (t.note) {
|
||||
<p class="state">{{ t.note }}</p>
|
||||
}
|
||||
} @else {
|
||||
<p class="state">Sin datos en el periodo.</p>
|
||||
}
|
||||
@@ -103,6 +111,11 @@ import { Reading } from './measures';
|
||||
white-space: normal;
|
||||
width: 60%;
|
||||
}
|
||||
.hint {
|
||||
color: var(--mat-sys-on-surface-variant, #5f6368);
|
||||
display: block;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.track {
|
||||
background: rgba(0, 0, 0, 0.06);
|
||||
display: block;
|
||||
@@ -138,6 +151,13 @@ export class Readings {
|
||||
() => this.modes().find((m) => m.label === this.chosen()) ?? this.modes()[0],
|
||||
);
|
||||
protected readonly table = computed(() => bars(this.mode(), this.read()));
|
||||
/** The bars of a scenarios figure need more room than a donut. */
|
||||
protected readonly height = computed(() => {
|
||||
const m = this.mode();
|
||||
return m.kind === 'figure' && m.figure === 'scenarios' ? 360 : 300;
|
||||
});
|
||||
/** Patients in the period but no classification published: say it, do not draw nothing. */
|
||||
protected readonly missing = computed(() => unavailable(this.mode(), this.read()));
|
||||
protected readonly figure = computed(() =>
|
||||
this.mode().kind === 'figure' ? this.draw()(this.mode()) : undefined,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user