F1b: user fixes

Use the existing Plotly card and registered Sankey trace. Build transition totals from the remaining stages and omit zero-flow links. Build the prevalence donut from the report counts, with a grey slice for missing sex and controls to highlight each recorded sex. Use grouped bars for M23 and separate age and sex stacks for M24. Use the existing stacked history style for M31 and put the M30 figure behind one page flag. Cover the builders and the existing TEA page case.
This commit is contained in:
2026-12-01 11:33:06 -06:00
parent 7c98566579
commit c4920ed7eb
7 changed files with 451 additions and 57 deletions
+17 -3
View File
@@ -18,6 +18,10 @@ import {
routeFigure,
scenarioBars,
shareDonut,
sexCountBars,
teaAlterations,
teaSankey,
teaSexDonut,
} from './figures';
import { FigureSpec, Kpi, PAGES, Section } from './pages';
import { name, periods, PeriodType, reading, Reading } from './measures';
@@ -45,6 +49,8 @@ export class TabIndicadores {
protected readonly type = signal<PeriodType>('semester');
protected readonly options = computed(() => periods(this.type()));
protected readonly chosen = signal<string | undefined>(undefined);
protected readonly bySex = signal(false);
protected readonly prevalenceSex = signal<string | undefined>(undefined);
protected readonly applied = signal<string | undefined>(undefined);
protected readonly page = computed(() => PAGES[this.domain()]);
@@ -173,7 +179,7 @@ export class TabIndicadores {
const steps = section.steps.map((s) => ({ label: s.label, r: this.rd(s.measure) }));
return steps.some((s) => s.r?.score !== undefined) ? routeFigure(steps) : undefined;
}
protected figureOf(spec: FigureSpec): Figure | undefined {
protected figureOf(spec: FigureSpec, stratum?: 'sex'): Figure | undefined {
const r = this.rd(spec.measure);
if (!r || !(r.populations['initial-population'] ?? 0)) return undefined;
switch (spec.kind) {
@@ -182,9 +188,17 @@ export class TabIndicadores {
case 'share-donut':
return shareDonut(r, spec.catalog, spec.center);
case 'counts':
return countBars(r, spec.catalog, spec.axis, this.applied() ?? '');
return spec.bySex && this.bySex()
? sexCountBars(r, spec.catalog, spec.axis, this.applied() ?? '')
: countBars(r, spec.catalog, spec.axis, this.applied() ?? '');
case 'sankey':
return teaSankey(r);
case 'sex-donut':
return teaSexDonut(r, this.prevalenceSex());
case 'alterations':
return teaAlterations(r);
case 'age-stack':
return ageStack(r, spec.names);
return ageStack(r, spec.names, stratum);
case 'age-share':
return ageShare(r, spec.names[0]);
case 'scenario-bars':