fixed chart legend labels

This commit is contained in:
Edi Cziszter 2022-02-10 13:49:53 +02:00
parent d53b3b9952
commit 2b3638a97d
2 changed files with 8 additions and 4 deletions

View File

@ -38,7 +38,7 @@
[radius]="80"
[strokeWidth]="15"
[subtitle]="'dossier-states-listing.chart.dossier-states' | translate"
[totalType]="'count'"
[totalType]="'simpleLabel'"
></redaction-simple-doughnut-chart>
</div>
</div>

View File

@ -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 {