From 2b3638a97d3468ee3358fa08e6ddda57a4c15895 Mon Sep 17 00:00:00 2001 From: Edi Cziszter Date: Thu, 10 Feb 2022 13:49:53 +0200 Subject: [PATCH] fixed chart legend labels --- .../dossier-states-listing-screen.component.html | 2 +- .../simple-doughnut-chart.component.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-listing-screen.component.html index 84a706e27..21f948e7f 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-listing-screen.component.html @@ -38,7 +38,7 @@ [radius]="80" [strokeWidth]="15" [subtitle]="'dossier-states-listing.chart.dossier-states' | translate" - [totalType]="'count'" + [totalType]="'simpleLabel'" > diff --git a/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.ts b/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.ts index ec11bf6e7..bbe3ff3d9 100644 --- a/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.ts @@ -23,7 +23,7 @@ export class SimpleDoughnutChartComponent implements OnChanges, OnInit { @Input() radius = 85; @Input() strokeWidth = 20; @Input() direction: 'row' | 'column' = 'column'; - @Input() totalType: 'sum' | 'count' = 'sum'; + @Input() totalType: 'sum' | 'count' | 'simpleLabel' = 'sum'; @Input() counterText: string; @Input() filterKey = 'statusFilters'; filtersEnabled: boolean; @@ -51,7 +51,7 @@ export class SimpleDoughnutChartComponent implements OnChanges, OnInit { } get displayedDataTotal() { - return this.totalType === 'sum' ? this.dataTotal : this.config.length; + return this.totalType === 'count' ? this.config.length : this.dataTotal; } ngOnInit() { @@ -96,7 +96,11 @@ export class SimpleDoughnutChartComponent implements OnChanges, OnInit { } getLabel({ label, value }: DoughnutChartConfig): string { - return this.totalType === 'sum' ? `${value} ${label}` : `${label} (${value} ${this.counterText})`; + return this.totalType === 'simpleLabel' + ? `${label}` + : this.totalType === 'sum' + ? `${value} ${label}` + : `${label} (${value} ${this.counterText})`; } selectValue(key: string): void {