Prepare fraction stats page select buttons for alternating data availability
parent
2d64c32598
commit
712071865f
|
@ -4,8 +4,8 @@
|
||||||
#group="matButtonToggleGroup"
|
#group="matButtonToggleGroup"
|
||||||
[(ngModel)]="activeChartSelect"
|
[(ngModel)]="activeChartSelect"
|
||||||
(change)="selectChart(group.value)">
|
(change)="selectChart(group.value)">
|
||||||
<mat-button-toggle *ngFor="let label of labelsAsString" value="{{label}}">
|
<mat-button-toggle *ngFor="let labelKey of labelsKeys" value="{{labels[labelKey]}}">
|
||||||
{{label | translate}}
|
{{labels[labelKey] | translate}}
|
||||||
</mat-button-toggle>
|
</mat-button-toggle>
|
||||||
</mat-button-toggle-group>
|
</mat-button-toggle-group>
|
||||||
|
|
||||||
|
|
|
@ -39,24 +39,15 @@ export class FractionStatsComponent implements OnInit, OnChanges {
|
||||||
tmpReviveData;
|
tmpReviveData;
|
||||||
tmpStabilizeData;
|
tmpStabilizeData;
|
||||||
tmpFlagCaptureData;
|
tmpFlagCaptureData;
|
||||||
|
tmpPlayerCountData;
|
||||||
|
|
||||||
colorScheme = {
|
colorScheme = {
|
||||||
domain: [Fraction.COLOR_BLUFOR, Fraction.COLOR_OPFOR, Fraction.COLOR_BLUFOR_LIGHT, Fraction.COLOR_OPFOR_LIGHT,
|
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]
|
Fraction.COLOR_BLUFOR_DARK, Fraction.COLOR_OPFOR_DARK, Fraction.COLOR_BLUFOR_GREY, Fraction.COLOR_OPFOR_GREY]
|
||||||
};
|
};
|
||||||
|
|
||||||
readonly labels = {
|
labels;
|
||||||
points: 'stats.fraction.select.points',
|
labelsKeys;
|
||||||
budget: 'stats.fraction.select.budget',
|
|
||||||
kill: 'stats.fraction.select.kills',
|
|
||||||
friendlyFire: 'stats.fraction.select.friendly.fire',
|
|
||||||
vehicle: 'stats.fraction.select.vehicle.kills',
|
|
||||||
transport: 'stats.fraction.select.air.transport',
|
|
||||||
revive: 'stats.fraction.select.revive',
|
|
||||||
stabilize: 'stats.fraction.select.stabilize',
|
|
||||||
flag: 'stats.fraction.select.flag'
|
|
||||||
};
|
|
||||||
readonly labelsAsString = Object.keys(this.labels).map((key) => this.labels[key]);
|
|
||||||
|
|
||||||
lineChartLabel: string;
|
lineChartLabel: string;
|
||||||
|
|
||||||
|
@ -87,8 +78,12 @@ export class FractionStatsComponent implements OnInit, OnChanges {
|
||||||
kill: false,
|
kill: false,
|
||||||
revive: false,
|
revive: false,
|
||||||
transport: false,
|
transport: false,
|
||||||
flag: false
|
flag: false,
|
||||||
|
playerCount: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.initializeToggleButtons();
|
||||||
|
|
||||||
Object.assign(this, [this.lineChartData, this.areaChartData]);
|
Object.assign(this, [this.lineChartData, this.areaChartData]);
|
||||||
this.activeChartSelect = this.labels.points;
|
this.activeChartSelect = this.labels.points;
|
||||||
|
|
||||||
|
@ -99,6 +94,42 @@ export class FractionStatsComponent implements OnInit, OnChanges {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* show only labels for for data that is available,
|
||||||
|
* to not end up with empty charts in old battles
|
||||||
|
*/
|
||||||
|
initializeToggleButtons() {
|
||||||
|
const newLabels = {};
|
||||||
|
if (this.logData.points && this.logData.points.length > 0) {
|
||||||
|
newLabels['points'] = 'stats.fraction.select.points';
|
||||||
|
}
|
||||||
|
if (this.logData.budget && this.logData.budget.length > 0) {
|
||||||
|
newLabels['budget'] = 'stats.fraction.select.budget';
|
||||||
|
}
|
||||||
|
if (this.logData.kill && this.logData.kill.length > 0) {
|
||||||
|
newLabels['kill'] = 'stats.fraction.select.kills';
|
||||||
|
newLabels['friendlyFire'] = 'stats.fraction.select.friendly.fire';
|
||||||
|
}
|
||||||
|
if (this.logData.vehicle && this.logData.vehicle.length > 0) {
|
||||||
|
newLabels['vehicle'] = 'stats.fraction.select.vehicle.kills';
|
||||||
|
}
|
||||||
|
if (this.logData.transport && this.logData.transport.length > 0) {
|
||||||
|
newLabels['transport'] = 'stats.fraction.select.air.transport';
|
||||||
|
}
|
||||||
|
if (this.logData.revive && this.logData.revive.length > 0) {
|
||||||
|
newLabels['revive'] = 'stats.fraction.select.revive';
|
||||||
|
newLabels['stabilize'] = 'stats.fraction.select.stabilize';
|
||||||
|
}
|
||||||
|
if (this.logData.flag && this.logData.flag.length > 0) {
|
||||||
|
newLabels['flag'] = 'stats.fraction.select.flag';
|
||||||
|
}
|
||||||
|
if (this.logData.playerCount && this.logData.playerCount.length > 0) {
|
||||||
|
newLabels['playerCount'] = 'stats.fraction.select.player.count';
|
||||||
|
}
|
||||||
|
this.labels = newLabels;
|
||||||
|
this.labelsKeys = Object.keys(this.labels);
|
||||||
|
}
|
||||||
|
|
||||||
selectChart(newSelection) {
|
selectChart(newSelection) {
|
||||||
this.activeChartSelect = newSelection;
|
this.activeChartSelect = newSelection;
|
||||||
if (this.activeChartSelect !== this.labels.flag) {
|
if (this.activeChartSelect !== this.labels.flag) {
|
||||||
|
@ -136,6 +167,10 @@ export class FractionStatsComponent implements OnInit, OnChanges {
|
||||||
this.initTransportData();
|
this.initTransportData();
|
||||||
this.lineChartData = this.tmpTransportData;
|
this.lineChartData = this.tmpTransportData;
|
||||||
break;
|
break;
|
||||||
|
case this.labels.playerCount:
|
||||||
|
this.initPlayerCountData();
|
||||||
|
this.lineChartData = this.tmpPlayerCountData;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.initFlagHoldData();
|
this.initFlagHoldData();
|
||||||
|
@ -347,6 +382,15 @@ export class FractionStatsComponent implements OnInit, OnChanges {
|
||||||
this.initialized.transport = true;
|
this.initialized.transport = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
initPlayerCountData() {
|
||||||
|
if (this.initialized.playerCount) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.addFinalTimeData(this.tmpPlayerCountData);
|
||||||
|
this.initialized.playerCount = true;
|
||||||
|
}
|
||||||
|
|
||||||
initFlagHoldData() {
|
initFlagHoldData() {
|
||||||
if (this.initialized.flag) {
|
if (this.initialized.flag) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -27,11 +27,12 @@
|
||||||
"stats.fraction.select.revive": "Revive",
|
"stats.fraction.select.revive": "Revive",
|
||||||
"stats.fraction.select.stabilize": "Stabilisiert",
|
"stats.fraction.select.stabilize": "Stabilisiert",
|
||||||
"stats.fraction.select.flag": "Flaggenbesitz",
|
"stats.fraction.select.flag": "Flaggenbesitz",
|
||||||
|
"stats.fraction.select.player.count": "Spieleranzahl",
|
||||||
|
|
||||||
"stats.performance.select.single.avg": "Spieler FPS Durchschnitt",
|
"stats.performance.select.single.avg": "Spieler FPS Durchschnitt",
|
||||||
"stats.performance.select.single.min": "Spieler FPS Minimum",
|
"stats.performance.select.single.min": "Spieler FPS Minimum",
|
||||||
"stats.performance.select.timeline.avg": "Verlauf Gesamt FPS",
|
"stats.performance.select.timeline.avg": "Verlauf FPS Durchschnitt",
|
||||||
"stats.performance.select.timeline.min": "Verlauf Minimum FPS",
|
"stats.performance.select.timeline.min": "Verlauf FPS Minimum",
|
||||||
"stats.performance.select.timeline.server": "Server FPS",
|
"stats.performance.select.timeline.server": "Server FPS",
|
||||||
|
|
||||||
"stats.player.detail.headline": "Kampagnendetails - {{name}}",
|
"stats.player.detail.headline": "Kampagnendetails - {{name}}",
|
||||||
|
|
|
@ -35,11 +35,12 @@
|
||||||
"stats.fraction.select.revive": "Revive",
|
"stats.fraction.select.revive": "Revive",
|
||||||
"stats.fraction.select.stabilize": "Stabilized",
|
"stats.fraction.select.stabilize": "Stabilized",
|
||||||
"stats.fraction.select.flag": "Flag Possession",
|
"stats.fraction.select.flag": "Flag Possession",
|
||||||
|
"stats.fraction.select.player.count": "Player Count",
|
||||||
|
|
||||||
"stats.performance.select.single.avg": "Player FPS Average",
|
"stats.performance.select.single.avg": "Player FPS Average",
|
||||||
"stats.performance.select.single.min": "Player FPS Minimum",
|
"stats.performance.select.single.min": "Player FPS Minimum",
|
||||||
"stats.performance.select.timeline.avg": "Timeline Overall FPS",
|
"stats.performance.select.timeline.avg": "Timeline FPS Average",
|
||||||
"stats.performance.select.timeline.min": "Timeline Minimum FPS",
|
"stats.performance.select.timeline.min": "Timeline FPS Minimum",
|
||||||
"stats.performance.select.timeline.server": "Server FPS",
|
"stats.performance.select.timeline.server": "Server FPS",
|
||||||
|
|
||||||
"stats.player.detail.headline": "Campaign Details - {{name}}",
|
"stats.player.detail.headline": "Campaign Details - {{name}}",
|
||||||
|
|
Loading…
Reference in New Issue