add vehicle kill stats for cmpaign player view

pull/29/head
HardiReady 2018-03-03 13:40:15 +01:00
parent 840695bf0e
commit 40931645d1
2 changed files with 37 additions and 4 deletions

View File

@ -81,6 +81,26 @@
</ngx-charts-line-chart>
</div>
<div class="chart-container">
<ngx-charts-line-chart
[results]="vehicleKillData"
[showRefLines]="showRefLines"
[showRefLabels]="showRefLabels"
[referenceLines]="killRefLines"
[scheme]="colorScheme"
[gradient]="gradient"
[xAxis]="xAxis"
[yAxis]="yAxis"
[legend]="legend"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[yAxisLabel]="yAxisVehicleKill"
[autoScale]="autoscale"
[timeline]="timeline"
[roundDomains]="roundDomains">
</ngx-charts-line-chart>
</div>
<div class="chart-container">
<ngx-charts-line-chart
[results]="deathData"

View File

@ -25,6 +25,7 @@ export class CampaignPlayerDetailComponent {
sumData: any[] = [];
killData: any[] = [];
friendlyFireData: any[] = [];
vehicleKillData: any[] = [];
deathData: any[] = [];
respawnData: any[] = [];
reviveData: any[] = [];
@ -32,6 +33,7 @@ export class CampaignPlayerDetailComponent {
yAxisKill = 'Kills';
yAxisFriendlyFire = 'FriendlyFire';
yAxisVehicleKill = 'Farzeug-Kills';
yAxisDeath = 'Tode';
yAxisRespawn = 'Respawn';
yAxisRevive = 'Revive';
@ -49,6 +51,7 @@ export class CampaignPlayerDetailComponent {
showRefLines = true;
showRefLabels = true;
killRefLines = [];
vehicleKillRefLines = [];
deathRefLines = [];
captureRefLines = [];
friendlyFireRefLines = [];
@ -67,6 +70,7 @@ export class CampaignPlayerDetailComponent {
totalKills;
totalFriendlyFire;
totalVehicleKills;
totalDeath;
totalRespawn;
totalRevive;
@ -87,6 +91,7 @@ export class CampaignPlayerDetailComponent {
.subscribe(campaignPlayer => {
this.campaignPlayer = campaignPlayer;
this.killData = this.assignData(this.yAxisKill, "kill");
this.vehicleKillData = this.assignData(this.yAxisVehicleKill, "vehicle");
this.friendlyFireData = this.assignData(this.yAxisFriendlyFire, "friendlyFire");
this.deathData = this.assignData(this.yAxisDeath, "death");
this.respawnData = this.assignData(this.yAxisRespawn, "respawn");
@ -107,6 +112,10 @@ export class CampaignPlayerDetailComponent {
name: this.yAxisFriendlyFire,
value: this.totalFriendlyFire
},
{
name: this.yAxisVehicleKill,
value: this.totalVehicleKills
},
{
name: this.yAxisDeath,
value: this.totalDeath
@ -125,7 +134,7 @@ export class CampaignPlayerDetailComponent {
}
];
Object.assign(this, [this.sumData, this.killData, this.friendlyFireData, this.deathData, this.respawnData, this.reviveData, this.captureData]);
Object.assign(this, [this.sumData, this.killData, this.friendlyFireData, this.vehicleKillData, this.deathData, this.respawnData, this.reviveData, this.captureData]);
});
}
@ -138,12 +147,12 @@ export class CampaignPlayerDetailComponent {
let total = 0;
for (let i = 0; i < playerLength; i++) {
const warDateString = ChartUtils.getShortDateString(this.campaignPlayer.players[i].warId.date);
const warKills = this.campaignPlayer.players[i][field];
const value = this.campaignPlayer.players[i][field];
killObj.series.push({
name: warDateString,
value: warKills
value: value
});
total += warKills;
total += value;
}
switch (field) {
case 'kill':
@ -154,6 +163,10 @@ export class CampaignPlayerDetailComponent {
this.friendlyFireRefLines.push({value: total / playerLength, name: this.avgLabel});
this.totalFriendlyFire = total;
break;
case 'vehicle':
this.vehicleKillRefLines.push({value: total / playerLength, name: this.avgLabel});
this.totalVehicleKills = total;
break;
case 'death':
this.deathRefLines.push({value: total / playerLength, name: this.avgLabel});
this.totalDeath = total;