diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts index 51f4444..62617c0 100644 --- a/static/src/app/app.module.ts +++ b/static/src/app/app.module.ts @@ -35,11 +35,11 @@ import {WarService} from "./services/war-service/war.service"; import {DataTableModule} from "angular2-datatable"; import {NgxChartsModule} from "@swimlane/ngx-charts"; import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; -import {AccordionModule} from "ngx-bootstrap"; +import {AccordionModule, CarouselModule} from "ngx-bootstrap"; @NgModule({ imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule, ClipboardModule, DataTableModule, - BrowserAnimationsModule, NgxChartsModule, AccordionModule.forRoot()], + BrowserAnimationsModule, NgxChartsModule, AccordionModule.forRoot(), CarouselModule.forRoot()], providers: [ HttpClient, LoginService, diff --git a/static/src/app/statistic/overview/stats-overview.component.css b/static/src/app/statistic/overview/stats-overview.component.css index ef060c6..03f8265 100644 --- a/static/src/app/statistic/overview/stats-overview.component.css +++ b/static/src/app/statistic/overview/stats-overview.component.css @@ -1,3 +1,9 @@ -.chart-container { +.slide-chart-container { width: 1200px; + margin: auto; +} + +:host /deep/ .carousel-control { + width: 5%; + cursor: pointer; } diff --git a/static/src/app/statistic/overview/stats-overview.component.html b/static/src/app/statistic/overview/stats-overview.component.html index 0f8cfcb..3db46c1 100644 --- a/static/src/app/statistic/overview/stats-overview.component.html +++ b/static/src/app/statistic/overview/stats-overview.component.html @@ -1,69 +1,71 @@ -

{{title}}

- -

Gesamtpunktzahl

- -
- - - +

{{title}}

+
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 0d5e17a..b943d7e 100644 --- a/static/src/app/statistic/overview/stats-overview.component.ts +++ b/static/src/app/statistic/overview/stats-overview.component.ts @@ -1,17 +1,21 @@ import {Component} from "@angular/core"; import {WarService} from "../../services/war-service/war.service"; import {ActivatedRoute} from "@angular/router"; +import {CarouselConfig} from "ngx-bootstrap"; @Component({ selector: 'stats-overview', templateUrl: './stats-overview.component.html', styleUrls: ['./stats-overview.component.css'], - inputs: ['campaigns'] + inputs: ['campaigns'], + providers: [{provide: CarouselConfig, useValue: {interval: false}}] }) export class StatisticOverviewComponent { + id = ""; title = ""; + activeSlideIndex: number = 0; pointData: any[] = []; pointSumData: any[] = []; @@ -29,24 +33,25 @@ export class StatisticOverviewComponent { this.route.params .map(params => params['id']) .subscribe((id) => { + this.id = id; if (this.warService.campaigns) { - this.initWars(this.warService.campaigns, id); + this.initWars(this.warService.campaigns); } else { this.warService.getAllCampaigns().subscribe(campaigns => { - this.initWars(campaigns, id); + this.initWars(campaigns); }) } }); } - initWars(campaigns, id) { + initWars(campaigns) { let wars = []; let itemsProcessed = 0; - campaigns = campaigns.filter(campaign => id === 'all' || campaign._id === id); + campaigns = campaigns.filter(campaign => this.id === 'all' || campaign._id === this.id); campaigns.forEach(campaign => { - if (id === 'all') { - this.title = "Gesamtübersicht" + if (this.id === 'all') { + this.title = "Gesamtübersicht"; } else { this.title = campaign.title } @@ -58,6 +63,10 @@ export class StatisticOverviewComponent { }) } + goToSlide(index: number) { + this.activeSlideIndex = index; + } + initChart(wars: any[]) { let pointsObj = [ {