Files
WebApp/src/app/features/indicadores/indicadores-figure-labels.ts
T

18 lines
792 B
TypeScript

// Presentation labels for representations confirmed in the published catalog.
// Exact IDs remain the option values and HTTP identities; never infer a type
// from a prefix. Unknown options keep a neutral label in publication order.
const FIGURE_LABELS: Readonly<Record<string, string>> = {
fig_c1_grupos: 'Grupos',
fig_c1_puntos: 'Puntos',
fig_c2_apiladas: 'Barras apiladas',
fig_c2_barras: 'Barras',
fig_c2_donas: 'Donas',
fig_c3r_caja: 'Caja de cuartiles',
};
export function figureDisplayName(figureId: string, publishedFigures: readonly string[]): string {
if (Object.hasOwn(FIGURE_LABELS, figureId)) return FIGURE_LABELS[figureId];
const index = publishedFigures.indexOf(figureId);
return index >= 0 ? `Representación ${index + 1}` : 'Representación adicional';
}