From 535c2c5b4febb37bd58bfb4a9f95cb1841664163 Mon Sep 17 00:00:00 2001 From: HardiReady Date: Fri, 22 Jun 2018 09:18:45 +0200 Subject: [PATCH] add class wise data for fraction stats vehicle kills (CC-35) --- .../fraction-stats.component.ts | 41 ++++++++++++++++--- static/src/app/utils/fraction.enum.ts | 8 +++- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/static/src/app/statistic/war/fraction-stats/fraction-stats.component.ts b/static/src/app/statistic/war/fraction-stats/fraction-stats.component.ts index 3aa902f..9109b05 100644 --- a/static/src/app/statistic/war/fraction-stats/fraction-stats.component.ts +++ b/static/src/app/statistic/war/fraction-stats/fraction-stats.component.ts @@ -40,7 +40,8 @@ export class FractionStatsComponent implements OnInit, OnChanges { tmpFlagCaptureData; 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'; @@ -259,7 +260,8 @@ export class FractionStatsComponent implements OnInit, OnChanges { if (this.initialized.vehicle) { 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) => ({ transportEntry: transport, index: pos @@ -267,12 +269,40 @@ export class FractionStatsComponent implements OnInit, OnChanges { const vehicleEntryDate = new Date(vehicleEntry.time); if (vehicleEntry.fraction === 'BLUFOR') { vehicleKillCountBlufor++; + switch (vehicleEntry.vehicleClass) { + case 'LIGHT': + vehicleLightCountBlufor++; + break; + case 'HEAVY': + vehicleHeavyCountBlufor++; + break; + case 'AIR': + vehicleAirCountBlufor++; + break; + } } else { 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) { this.tmpVehicleData[0].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountBlufor)); 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); @@ -336,7 +366,9 @@ export class FractionStatsComponent implements OnInit, OnChanges { this.tmpBudgetData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR); this.tmpKillData = 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.tmpReviveData = 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[1].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetOpfor)); } 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) { tmpCollection[j].series.push( ChartUtils.getSeriesEntry(endDate, tmpCollection[j].series[tmpCollection[j].series.length - 1].value) @@ -367,5 +399,4 @@ export class FractionStatsComponent implements OnInit, OnChanges { } } } - } diff --git a/static/src/app/utils/fraction.enum.ts b/static/src/app/utils/fraction.enum.ts index 83b0825..23aa8c1 100644 --- a/static/src/app/utils/fraction.enum.ts +++ b/static/src/app/utils/fraction.enum.ts @@ -2,5 +2,11 @@ export enum Fraction { BLUFOR = 'NATO', OPFOR = 'CSAT', 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' } -- 2.25.1