diff --git a/libs/portal-integration-angular/src/lib/core/components/group-by-count-diagram/group-by-count-diagram.component.ts b/libs/portal-integration-angular/src/lib/core/components/group-by-count-diagram/group-by-count-diagram.component.ts index 1d0a047f..6d1c6fe4 100644 --- a/libs/portal-integration-angular/src/lib/core/components/group-by-count-diagram/group-by-count-diagram.component.ts +++ b/libs/portal-integration-angular/src/lib/core/components/group-by-count-diagram/group-by-count-diagram.component.ts @@ -64,17 +64,15 @@ export class GroupByCountDiagramComponent implements OnInit { ? (acc.find((e: { label: any }) => e.label === current).value++, acc) : [...acc, { label: current, value: 1 }] }, []) - if (columnType === ColumnType.TRANSLATION_KEY) { - return this.translateService - .get(occurrences.map((o: { label: any }) => o.label)) - .pipe( - map((translations: { [x: string]: any }) => - occurrences.map((o: { label: string; value: any }) => ({ - label: translations[o.label], - value: o.value, - })) - ) + if (columnType === ColumnType.TRANSLATION_KEY && occurrences.length > 0) { + return this.translateService.get(occurrences.map((o: { label: any }) => o.label)).pipe( + map((translations: { [x: string]: any }) => + occurrences.map((o: { label: string; value: any }) => ({ + label: translations[o.label], + value: o.value, + })) ) + ) } else { return of(occurrences) } diff --git a/libs/portal-integration-angular/src/lib/model/column-type.model.ts b/libs/portal-integration-angular/src/lib/model/column-type.model.ts index 142dc802..4181cbda 100644 --- a/libs/portal-integration-angular/src/lib/model/column-type.model.ts +++ b/libs/portal-integration-angular/src/lib/model/column-type.model.ts @@ -1,4 +1,4 @@ -export const enum ColumnType { +export enum ColumnType { STRING = 'STRING', NUMBER = 'NUMBER', DATE = 'DATE',