diff --git a/src/app/components/shared/statistic/statistic.component.ts b/src/app/components/shared/statistic/statistic.component.ts index a41f01f6f4ff54ac335be9afd330cec4eebdc1cd..0f32279f443a93bdf1fee94f7403ff1902a52d14 100644 --- a/src/app/components/shared/statistic/statistic.component.ts +++ b/src/app/components/shared/statistic/statistic.component.ts @@ -133,14 +133,16 @@ export class StatisticComponent implements OnInit { this.ccolors[i] = 'rgba(76,175,80, 0.8)'; } } - this.ccolors.push('rgba(189,189,189, 0.8)'); - this.colors.push('rgba(189,189,189, 0.8)'); - this.translateService.get('statistic.abstentions').subscribe(label => { - this.labels.push(label); - }); this.contentService.getAnswer(content.id).subscribe(answer => { this.data = answer.roundStatistics[0].independentCounts; this.data.push(answer.roundStatistics[0].abstentionCount); + if (this.data[this.data.length - 1] > 0) { + this.ccolors.push('rgba(189,189,189, 0.8)'); + this.colors.push('rgba(189,189,189, 0.8)'); + this.translateService.get('statistic.abstentions').subscribe(label => { + this.labels.push(label); + }); + } this.createChart(this.colors); }); }