add class wise data for fraction stats vehicle kills (CC-35)

pull/37/head
HardiReady 2018-06-22 09:18:45 +02:00
parent ea20522524
commit 535c2c5b4f
2 changed files with 43 additions and 6 deletions

View File

@ -40,7 +40,8 @@ export class FractionStatsComponent implements OnInit, OnChanges {
tmpFlagCaptureData; tmpFlagCaptureData;
colorScheme = { colorScheme = {
domain: [Fraction.COLOR_BLUFOR, Fraction.COLOR_OPFOR] domain: [Fraction.COLOR_BLUFOR, Fraction.COLOR_OPFOR, Fraction.COLOR_BLUFOR_LIGHT, Fraction.COLOR_OPFOR_LIGHT,
Fraction.COLOR_BLUFOR_DARK, Fraction.COLOR_OPFOR_DARK, Fraction.COLOR_BLUFOR_GREY, Fraction.COLOR_OPFOR_GREY]
}; };
labelPoints = 'Punkte'; labelPoints = 'Punkte';
@ -259,7 +260,8 @@ export class FractionStatsComponent implements OnInit, OnChanges {
if (this.initialized.vehicle) { if (this.initialized.vehicle) {
return; return;
} }
let vehicleKillCountBlufor = 0, vehicleKillCountOpfor = 0; let vehicleKillCountBlufor = 0, vehicleKillCountOpfor = 0, vehicleLightCountBlufor = 0, vehicleHeavyCountBlufor = 0,
vehicleAirCountBlufor = 0, vehicleLightCountOpfor = 0, vehicleHeavyCountOpfor = 0, vehicleAirCountOpfor = 0;
for (const {transportEntry: vehicleEntry, index} of this.logData.vehicle.map((transport, pos) => ({ for (const {transportEntry: vehicleEntry, index} of this.logData.vehicle.map((transport, pos) => ({
transportEntry: transport, transportEntry: transport,
index: pos index: pos
@ -267,12 +269,40 @@ export class FractionStatsComponent implements OnInit, OnChanges {
const vehicleEntryDate = new Date(vehicleEntry.time); const vehicleEntryDate = new Date(vehicleEntry.time);
if (vehicleEntry.fraction === 'BLUFOR') { if (vehicleEntry.fraction === 'BLUFOR') {
vehicleKillCountBlufor++; vehicleKillCountBlufor++;
switch (vehicleEntry.vehicleClass) {
case 'LIGHT':
vehicleLightCountBlufor++;
break;
case 'HEAVY':
vehicleHeavyCountBlufor++;
break;
case 'AIR':
vehicleAirCountBlufor++;
break;
}
} else { } else {
vehicleKillCountOpfor++; vehicleKillCountOpfor++;
switch (vehicleEntry.vehicleClass) {
case 'LIGHT':
vehicleLightCountOpfor++;
break;
case 'HEAVY':
vehicleHeavyCountOpfor++;
break;
case 'AIR':
vehicleAirCountOpfor++;
break;
}
} }
if (this.isTwoMinutesAhead(vehicleEntryDate, this.tmpVehicleData) || index === this.logData.vehicle.length - 1) { if (this.isTwoMinutesAhead(vehicleEntryDate, this.tmpVehicleData) || index === this.logData.vehicle.length - 1) {
this.tmpVehicleData[0].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountBlufor)); this.tmpVehicleData[0].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountBlufor));
this.tmpVehicleData[1].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountOpfor)); this.tmpVehicleData[1].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountOpfor));
this.tmpVehicleData[2].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleLightCountBlufor));
this.tmpVehicleData[3].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleLightCountOpfor));
this.tmpVehicleData[4].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleHeavyCountBlufor));
this.tmpVehicleData[5].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleHeavyCountOpfor));
this.tmpVehicleData[6].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleAirCountBlufor));
this.tmpVehicleData[7].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleAirCountOpfor));
} }
} }
this.addFinalTimeData(this.tmpVehicleData); this.addFinalTimeData(this.tmpVehicleData);
@ -336,7 +366,9 @@ export class FractionStatsComponent implements OnInit, OnChanges {
this.tmpBudgetData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR); this.tmpBudgetData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpKillData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR); this.tmpKillData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpFrienlyFireData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR); this.tmpFrienlyFireData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpVehicleData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR); this.tmpVehicleData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR,
Fraction.BLUFOR.concat(' Leicht'), Fraction.OPFOR.concat(' Leicht'), Fraction.BLUFOR.concat(' Schwer'),
Fraction.OPFOR.concat(' Schwer'), Fraction.BLUFOR.concat(' Luft'), Fraction.OPFOR.concat(' Luft'));
this.tmpTransportData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR); this.tmpTransportData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpReviveData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR); this.tmpReviveData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpStabilizeData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR); this.tmpStabilizeData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
@ -358,7 +390,7 @@ export class FractionStatsComponent implements OnInit, OnChanges {
this.tmpBudgetData[0].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetBlufor)); this.tmpBudgetData[0].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetBlufor));
this.tmpBudgetData[1].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetOpfor)); this.tmpBudgetData[1].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetOpfor));
} else { } else {
for (const j in [0, 1]) { for (let j = 0; j < tmpCollection.length; j++) {
if (tmpCollection[j].series[tmpCollection[j].series.length - 1].name < endDate) { if (tmpCollection[j].series[tmpCollection[j].series.length - 1].name < endDate) {
tmpCollection[j].series.push( tmpCollection[j].series.push(
ChartUtils.getSeriesEntry(endDate, tmpCollection[j].series[tmpCollection[j].series.length - 1].value) ChartUtils.getSeriesEntry(endDate, tmpCollection[j].series[tmpCollection[j].series.length - 1].value)
@ -367,5 +399,4 @@ export class FractionStatsComponent implements OnInit, OnChanges {
} }
} }
} }
} }

View File

@ -2,5 +2,11 @@ export enum Fraction {
BLUFOR = 'NATO', BLUFOR = 'NATO',
OPFOR = 'CSAT', OPFOR = 'CSAT',
COLOR_BLUFOR = '#0000FF', COLOR_BLUFOR = '#0000FF',
COLOR_OPFOR = '#B22222' COLOR_BLUFOR_LIGHT = '#6666dd',
COLOR_BLUFOR_DARK = '#0C0CA6',
COLOR_BLUFOR_GREY = '#515179',
COLOR_OPFOR = '#B22222',
COLOR_OPFOR_DARK = '#890F0F',
COLOR_OPFOR_LIGHT = '#fb5555',
COLOR_OPFOR_GREY = '#955c5f'
} }