Add player transport stats to campaign detail view (CC-83)
parent
2f0a07beab
commit
006555617a
|
@ -37,7 +37,8 @@
|
||||||
[xAxis]="xAxis"
|
[xAxis]="xAxis"
|
||||||
[yAxis]="yAxis"
|
[yAxis]="yAxis"
|
||||||
[showXAxisLabel]="showXAxisLabel"
|
[showXAxisLabel]="showXAxisLabel"
|
||||||
[showYAxisLabel]="showYAxisLabel">
|
[showYAxisLabel]="showYAxisLabel"
|
||||||
|
[animations]="animations">
|
||||||
</ngx-charts-bar-horizontal>
|
</ngx-charts-bar-horizontal>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,6 +60,7 @@
|
||||||
[yAxisLabel]="category.label"
|
[yAxisLabel]="category.label"
|
||||||
[autoScale]="autoscale"
|
[autoScale]="autoscale"
|
||||||
[timeline]="timeline"
|
[timeline]="timeline"
|
||||||
|
[animations]="animations"
|
||||||
[roundDomains]="roundDomains">
|
[roundDomains]="roundDomains">
|
||||||
</ngx-charts-line-chart>
|
</ngx-charts-line-chart>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {TranslateService} from '@ngx-translate/core';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'campaign-player-detail',
|
selector: 'campaign-player-detail',
|
||||||
templateUrl: './campaign-player-detail.component.html',
|
templateUrl: './campaign-player-detail.component.html',
|
||||||
styleUrls: ['./campaign-player-detail.component.css', '../../../style/list-entry.css',
|
styleUrls: ['./campaign-player-detail.component.scss', '../../../style/list-entry.css',
|
||||||
'../../../style/hide-scrollbar.css', '../../../style/overview.css']
|
'../../../style/hide-scrollbar.css', '../../../style/overview.css']
|
||||||
})
|
})
|
||||||
export class CampaignPlayerDetailComponent implements OnInit {
|
export class CampaignPlayerDetailComponent implements OnInit {
|
||||||
|
@ -46,6 +46,7 @@ export class CampaignPlayerDetailComponent implements OnInit {
|
||||||
autoscale = false;
|
autoscale = false;
|
||||||
timeline = false;
|
timeline = false;
|
||||||
roundDomains = true;
|
roundDomains = true;
|
||||||
|
animations = false;
|
||||||
|
|
||||||
kdRatio = 0;
|
kdRatio = 0;
|
||||||
maxKd = 1.7;
|
maxKd = 1.7;
|
||||||
|
@ -53,7 +54,7 @@ export class CampaignPlayerDetailComponent implements OnInit {
|
||||||
respawnDeathRatio = 0;
|
respawnDeathRatio = 0;
|
||||||
maxRespawnDeathRatio = 1;
|
maxRespawnDeathRatio = 1;
|
||||||
|
|
||||||
playerAttributeNameMap = PlayerUtils.tmpAttributeDisplayNames.slice(2, PlayerUtils.tmpAttributeDisplayNames.length);
|
playerAttributeNameMap = PlayerUtils.attributeDisplayNames.slice(2, PlayerUtils.attributeDisplayNames.length);
|
||||||
|
|
||||||
constructor(private playerService: PlayerService,
|
constructor(private playerService: PlayerService,
|
||||||
private translate: TranslateService) {
|
private translate: TranslateService) {
|
||||||
|
@ -81,18 +82,18 @@ export class CampaignPlayerDetailComponent implements OnInit {
|
||||||
|
|
||||||
this.initDataArray();
|
this.initDataArray();
|
||||||
|
|
||||||
const totalDeathDiv = this.graphData[7].total === 0 ? 1 : this.graphData[7].total;
|
const totalDeathDiv = this.graphData[9].total === 0 ? 1 : this.graphData[9].total;
|
||||||
this.kdRatio = parseFloat((this.graphData[0].total / totalDeathDiv).toFixed(2));
|
this.kdRatio = parseFloat((this.graphData[0].total / totalDeathDiv).toFixed(2));
|
||||||
if (this.kdRatio > 1) {
|
if (this.kdRatio > 1) {
|
||||||
this.maxKd = this.kdRatio * 1.7;
|
this.maxKd = this.kdRatio * 1.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.respawnDeathRatio = parseFloat((this.graphData[8].total / totalDeathDiv).toFixed(2));
|
this.respawnDeathRatio = parseFloat((this.graphData[10].total / totalDeathDiv).toFixed(2));
|
||||||
|
|
||||||
// we can not directly push to target array, since only full reference changes trigger the refresh of data
|
// we can not directly push to target array, since only full reference changes trigger the refresh of data
|
||||||
const tmpSumData = [];
|
const tmpSumData = [];
|
||||||
this.graphData.forEach(dataSet => {
|
this.graphData.forEach(dataSet => {
|
||||||
tmpSumData.push({name: dataSet.label, value: dataSet.total});
|
tmpSumData.push({name: dataSet.label, value: dataSet.total ? dataSet.total : 0});
|
||||||
});
|
});
|
||||||
this.sumData = tmpSumData;
|
this.sumData = tmpSumData;
|
||||||
});
|
});
|
||||||
|
@ -100,7 +101,7 @@ export class CampaignPlayerDetailComponent implements OnInit {
|
||||||
|
|
||||||
private initDataArray() {
|
private initDataArray() {
|
||||||
this.graphData.forEach(dataSet => {
|
this.graphData.forEach(dataSet => {
|
||||||
const killObj = {
|
const dataObj = {
|
||||||
name: dataSet.label,
|
name: dataSet.label,
|
||||||
series: []
|
series: []
|
||||||
};
|
};
|
||||||
|
@ -108,15 +109,21 @@ export class CampaignPlayerDetailComponent implements OnInit {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
for (let i = 0; i < playerLength; i++) {
|
for (let i = 0; i < playerLength; i++) {
|
||||||
const warDateString = ChartUtils.getShortDateString(this.campaignPlayer.players[i].warId.date);
|
const warDateString = ChartUtils.getShortDateString(this.campaignPlayer.players[i].warId.date);
|
||||||
const value = this.campaignPlayer.players[i][dataSet.key];
|
|
||||||
killObj.series.push({
|
const valueField = this.campaignPlayer.players[i][dataSet.key];
|
||||||
|
let value = valueField ? valueField : 0;
|
||||||
|
if (dataSet.key === 'travelDistance' || dataSet.key === 'driverDistance') {
|
||||||
|
value = Math.round(value / 1000); // meters to km
|
||||||
|
}
|
||||||
|
|
||||||
|
dataObj.series.push({
|
||||||
name: warDateString,
|
name: warDateString,
|
||||||
value: value
|
value: value
|
||||||
});
|
});
|
||||||
total += value;
|
total += value;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataSet.data = [killObj];
|
dataSet.data = [dataObj];
|
||||||
dataSet.refLine = [{value: total / playerLength, name: this.translations['stats.player.detail.graph.average']}];
|
dataSet.refLine = [{value: total / playerLength, name: this.translations['stats.player.detail.graph.average']}];
|
||||||
dataSet.total = total;
|
dataSet.total = total;
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {TranslateService} from '@ngx-translate/core';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'war-detail-fraction',
|
selector: 'war-detail-fraction',
|
||||||
templateUrl: './fraction-stats.component.html',
|
templateUrl: './fraction-stats.component.html',
|
||||||
styleUrls: ['./fraction-stats.component.scss']
|
styleUrls: ['./fraction-stats.component.scss', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
|
||||||
})
|
})
|
||||||
export class FractionStatsComponent implements OnInit, OnChanges {
|
export class FractionStatsComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
[showXAxisLabel]="showXAxisLabel"
|
[showXAxisLabel]="showXAxisLabel"
|
||||||
[showYAxisLabel]="showYAxisLabel"
|
[showYAxisLabel]="showYAxisLabel"
|
||||||
[yAxisLabel]="barChartLabel"
|
[yAxisLabel]="barChartLabel"
|
||||||
[animations]="barAnimations"
|
|
||||||
[barPadding]="barPadding"
|
[barPadding]="barPadding"
|
||||||
[roundDomains]="roundDomains">
|
[roundDomains]="roundDomains">
|
||||||
</ngx-charts-bar-vertical>
|
</ngx-charts-bar-vertical>
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {ChartUtils} from '../../../utils/chart-utils';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'cc-server-statistics',
|
selector: 'cc-server-statistics',
|
||||||
templateUrl: './server-stats.component.html',
|
templateUrl: './server-stats.component.html',
|
||||||
styleUrls: ['./server-stats.component.scss']
|
styleUrls: ['./server-stats.component.scss', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
|
||||||
})
|
})
|
||||||
export class ServerStatsComponent implements OnInit, OnChanges {
|
export class ServerStatsComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@ export class ServerStatsComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
@Input() performanceData: any;
|
@Input() performanceData: any;
|
||||||
|
|
||||||
startDateObj: Date;
|
|
||||||
|
|
||||||
public activeChartSelect: string;
|
public activeChartSelect: string;
|
||||||
|
|
||||||
showBarChart = true;
|
showBarChart = true;
|
||||||
|
@ -42,7 +40,6 @@ export class ServerStatsComponent implements OnInit, OnChanges {
|
||||||
};
|
};
|
||||||
readonly labelsAsString = Object.keys(this.labels)
|
readonly labelsAsString = Object.keys(this.labels)
|
||||||
.map((key) => this.labels[key]);
|
.map((key) => this.labels[key]);
|
||||||
lineChartSeriesLabels: string[];
|
|
||||||
|
|
||||||
gradient = false;
|
gradient = false;
|
||||||
yAxis = true;
|
yAxis = true;
|
||||||
|
@ -54,7 +51,6 @@ export class ServerStatsComponent implements OnInit, OnChanges {
|
||||||
autoscale = true;
|
autoscale = true;
|
||||||
timeline = false;
|
timeline = false;
|
||||||
roundDomains = true;
|
roundDomains = true;
|
||||||
barAnimations = false;
|
|
||||||
barPadding = 2;
|
barPadding = 2;
|
||||||
colorScheme = {
|
colorScheme = {
|
||||||
name: 'nightLights',
|
name: 'nightLights',
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {ScoreboardComponent} from '../scoreboard/scoreboard.component';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'war-detail',
|
selector: 'war-detail',
|
||||||
templateUrl: './war-header.component.html',
|
templateUrl: './war-header.component.html',
|
||||||
styleUrls: ['./war-header.component.scss']
|
styleUrls: ['./war-header.component.scss', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
|
||||||
})
|
})
|
||||||
export class WarHeaderComponent implements OnInit {
|
export class WarHeaderComponent implements OnInit {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue