From a7020b3208062d651df6ebaa080278b839978f8b Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Fri, 6 Oct 2017 20:52:52 +0200 Subject: [PATCH] Rework stats overview style --- .../overview/stats-overview.component.css | 2 +- .../overview/stats-overview.component.html | 95 ++++++------------- .../overview/stats-overview.component.ts | 23 +++-- .../war-list/war-item.component.html | 2 +- .../war-list/war-list.component.html | 4 +- 5 files changed, 49 insertions(+), 77 deletions(-) diff --git a/static/src/app/statistic/overview/stats-overview.component.css b/static/src/app/statistic/overview/stats-overview.component.css index 7060d89..2666e75 100644 --- a/static/src/app/statistic/overview/stats-overview.component.css +++ b/static/src/app/statistic/overview/stats-overview.component.css @@ -3,7 +3,7 @@ min-width: 880px; height: 650px; margin: auto; - padding-left: 6%; + padding-left: 5%; } :host /deep/ .carousel-indicators { diff --git a/static/src/app/statistic/overview/stats-overview.component.html b/static/src/app/statistic/overview/stats-overview.component.html index 7ab2b59..7025dc8 100644 --- a/static/src/app/statistic/overview/stats-overview.component.html +++ b/static/src/app/statistic/overview/stats-overview.component.html @@ -1,71 +1,32 @@ -

{{title}}

+
+

{{title}}

-
Gesamtpunktzahl +
Gesamtpunktzahl +
+
Punkte je Schlacht +
+
Spielerzahlen +
-
Punkte je Schlacht -
-
Spielerzahlen +
+
+ + +
- - -
-

Gesamtpunktzahl

- - -
-
- -
-

Punkte je Schlacht

- > - -
-
- -
-

Spielerzahlen

- - -
-
-
diff --git a/static/src/app/statistic/overview/stats-overview.component.ts b/static/src/app/statistic/overview/stats-overview.component.ts index 0a01419..a390b79 100644 --- a/static/src/app/statistic/overview/stats-overview.component.ts +++ b/static/src/app/statistic/overview/stats-overview.component.ts @@ -16,11 +16,12 @@ export class StatisticOverviewComponent { id = ""; title = ""; - activeSlideIndex: number = 0; pointData: any[] = []; pointSumData: any[] = []; playerData: any[] = []; + currentData : any[]; + activeSlideIndex; colorScheme = { domain: ['#0000FF', '#B22222'] @@ -33,9 +34,11 @@ export class StatisticOverviewComponent { legendTitle = ''; showXAxisLabel = true; showYAxisLabel = true; + yAxisLabel = ""; autoscale = true; timeline = false; + constructor(private route: ActivatedRoute, private campaignService: CampaignService) { } @@ -63,10 +66,7 @@ export class StatisticOverviewComponent { if (this.id === 'all') { this.title = "Gesamtübersicht"; } else { - this.title = campaign.title - setTimeout(() => { - this.activeSlideIndex = 2; - }, 10) + this.title = campaign.title; } wars = wars.concat(campaign.wars); itemsProcessed++; @@ -77,7 +77,13 @@ export class StatisticOverviewComponent { } goToSlide(index: number) { + switch (index) { + case 0: this.currentData = this.pointSumData; this.yAxisLabel="Gesamtpunkte"; break; + case 1: this.currentData = this.pointData; this.yAxisLabel="Punkte"; break; + case 2: this.currentData = this.playerData; this.yAxisLabel="Anzahl Spieler"; break; + } this.activeSlideIndex = index; + } initChart(wars: any[]) { @@ -130,7 +136,12 @@ export class StatisticOverviewComponent { this.pointData = pointsObj; this.pointSumData = pointsSumObj; this.playerData = playersObj; - Object.assign(this, [this.pointData, this.pointSumData, this.playerData]); + if (this.id != 'all') { + this.goToSlide(0); + } else { + this.goToSlide(1); + } + Object.assign(this, this.currentData); } } diff --git a/static/src/app/statistic/war-list/war-item.component.html b/static/src/app/statistic/war-list/war-item.component.html index dd962b5..85ca722 100644 --- a/static/src/app/statistic/war-list/war-item.component.html +++ b/static/src/app/statistic/war-list/war-item.component.html @@ -3,7 +3,7 @@
- {{war.title}} + {{war.title}}
vom {{war.date | date: 'dd.MM.yyyy'}} diff --git a/static/src/app/statistic/war-list/war-list.component.html b/static/src/app/statistic/war-list/war-list.component.html index 1373b04..eee2b9f 100644 --- a/static/src/app/statistic/war-list/war-list.component.html +++ b/static/src/app/statistic/war-list/war-list.component.html @@ -25,7 +25,7 @@ @@ -47,7 +47,7 @@