From 00a1bcbe62403f2fd5eef8aa38b335001e611f72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de>
Date: Tue, 15 Jan 2019 14:12:02 +0100
Subject: [PATCH] Adjust maxLength of answer to innerWidth

---
 src/app/components/shared/statistic/statistic.component.ts | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/app/components/shared/statistic/statistic.component.ts b/src/app/components/shared/statistic/statistic.component.ts
index c8d7c3f5c..cb987060a 100644
--- a/src/app/components/shared/statistic/statistic.component.ts
+++ b/src/app/components/shared/statistic/statistic.component.ts
@@ -31,11 +31,14 @@ export class StatisticComponent implements OnInit {
   data: number[];
   contentId: string;
   subject: string;
+  maxLength: number;
 
   constructor(protected route: ActivatedRoute,
               private contentService: ContentService) { }
 
   ngOnInit() {
+    this.maxLength = innerWidth / 12;
+    console.log(this.maxLength);
     this.answers = new Array<string>();
     this.labels = new Array<string>();
     this.answerList = new Array<AnswerList>();
@@ -55,8 +58,8 @@ export class StatisticComponent implements OnInit {
       this.answerList[i] = new AnswerList(null, null);
       this.labels[i] = this.label.charAt(i);
       this.answerList[i].label = this.labels[i];
-      if (content.options[i].label.length > 20) {
-        this.answerList[i].answer = content.options[i].label.substr(0, 30) + '..';
+      if (content.options[i].label.length > this.maxLength) {
+        this.answerList[i].answer = content.options[i].label.substr(0, this.maxLength) + '..';
       } else {
         this.answerList[i].answer = content.options[i].label;
       }
-- 
GitLab