diff --git a/api/models/war.js b/api/models/war.js
index 82a3a86..8268982 100644
--- a/api/models/war.js
+++ b/api/models/war.js
@@ -24,6 +24,18 @@ const WarSchema = new Schema({
set: v => Math.round(v),
required: true
},
+ playersBlufor: {
+ type: Number,
+ get: v => Math.round(v),
+ set: v => Math.round(v),
+ required: true
+ },
+ playersOpfor: {
+ type: Number,
+ get: v => Math.round(v),
+ set: v => Math.round(v),
+ required: true
+ },
bestPlayerId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Player',
diff --git a/static/src/app/statistic/statistic.component.css b/static/src/app/statistic/statistic.component.css
index 0d0ba4a..4f5d11d 100644
--- a/static/src/app/statistic/statistic.component.css
+++ b/static/src/app/statistic/statistic.component.css
@@ -1,5 +1,9 @@
h3 {
width: 920px;
- margin-bottom: 50px;
- margin-left: 25%
+ margin-left: 25%;
+}
+
+.chart-container {
+ width: 1200px;
+ margin-left: 25%;
}
diff --git a/static/src/app/statistic/statistic.component.html b/static/src/app/statistic/statistic.component.html
index cd1de8f..dd6b180 100644
--- a/static/src/app/statistic/statistic.component.html
+++ b/static/src/app/statistic/statistic.component.html
@@ -1,11 +1,11 @@
-
Statistik
+Punkte
-
+
+
+
Spielerzahlen
+
+
+
+
+
+
+
diff --git a/static/src/app/statistic/statistic.component.ts b/static/src/app/statistic/statistic.component.ts
index ef9bcdb..186a6b9 100644
--- a/static/src/app/statistic/statistic.component.ts
+++ b/static/src/app/statistic/statistic.component.ts
@@ -10,10 +10,11 @@ import {WarService} from "../services/war-service/war.service";
})
export class StatisticComponent {
- chartData: any[] = [];
+ pointData: any[] = [];
+ playerData: any[] = [];
colorScheme = {
- domain: ['#0000FF', '#B22222', '#595DC7', '#B25D62']
+ domain: ['#0000FF', '#B22222']
};
constructor(private appComponent: AppComponent,
@@ -31,7 +32,7 @@ export class StatisticComponent {
}
initChart(wars: any[]) {
- let updateObj = [
+ let pointsObj = [
{
"name": "NATO",
"series": []
@@ -39,43 +40,49 @@ export class StatisticComponent {
{
"name": "CSAT",
"series": []
- },
- {
- "name": "Anz. Spieler NATO",
- "series": []
- },
- {
- "name": "Anz. Spieler CSAT",
- "series": []
}];
+ let playersObj = [
+ {
+ "name": "NATO",
+ "series": []
+ },
+ {
+ "name": "CSAT",
+ "series": []
+ }
+ ];
for (let i = wars.length - 1; i >= 0; i--) {
- let isoDate = wars[i].date.slice(0, 10);
- let dayDate = parseInt(isoDate.slice(8, 10)) + 1;
- let warDateString = (dayDate < 10 ? "0" + dayDate : dayDate) + '.'
+ const isoDate = wars[i].date.slice(0, 10);
+ const dayDate = parseInt(isoDate.slice(8, 10)) + 1;
+ const warDateString = (dayDate < 10 ? "0" + dayDate : dayDate) + '.'
+ isoDate.slice(5, 7) + '.' + isoDate.slice(0, 4);
- let bluforData = {
+
+ const bluforData = {
name: warDateString,
value: wars[i].ptBlufor
};
- updateObj[0].series.push(bluforData);
- let opforData = {
+ const opforData = {
name: warDateString,
value: wars[i].ptOpfor
};
- updateObj[1].series.push(opforData);
- let bluforPlayers = {
+ const bluforPlayers = {
name: warDateString,
- value: 13
+ value: wars[i].playersBlufor
};
- updateObj[2].series.push(bluforPlayers);
- let opforPlayers = {
+ const opforPlayers = {
name: warDateString,
- value: 13
+ value: wars[i].playersOpfor
};
- updateObj[3].series.push(opforPlayers);
+
+ playersObj[0].series.push(bluforData);
+ playersObj[1].series.push(opforData);
+ pointsObj[0].series.push(bluforPlayers);
+ pointsObj[1].series.push(opforPlayers);
}
- this.chartData = updateObj;
- Object.assign(this, this.chartData)
+
+ this.pointData = pointsObj;
+ this.playerData = playersObj;
+ Object.assign(this, [this.playerData, this.pointData])
}
onSelect(event) {