Add translations for server stats charts (CC-80)
parent
1f176e0256
commit
24fcb05f70
|
@ -5,10 +5,10 @@ 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.css', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
|
styleUrls: ['./server-stats.component.css', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
|
||||||
})
|
})
|
||||||
export class ServerStatsComponent implements OnInit, OnChanges {
|
export class ServerStatsComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
@ViewChild('overview') private overviewContainer: ElementRef;
|
@ViewChild('overview') private overviewContainer: ElementRef;
|
||||||
|
@ -42,6 +42,7 @@ 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;
|
||||||
|
|
||||||
gradient = false;
|
gradient = false;
|
||||||
yAxis = true;
|
yAxis = true;
|
||||||
|
@ -53,7 +54,7 @@ export class ServerStatsComponent implements OnInit, OnChanges {
|
||||||
autoscale = true;
|
autoscale = true;
|
||||||
timeline = false;
|
timeline = false;
|
||||||
roundDomains = true;
|
roundDomains = true;
|
||||||
colorScheme = {
|
colorScheme = {
|
||||||
name: 'nightLights',
|
name: 'nightLights',
|
||||||
selectable: false,
|
selectable: false,
|
||||||
group: 'Ordinal',
|
group: 'Ordinal',
|
||||||
|
@ -72,7 +73,13 @@ export class ServerStatsComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if ((changes.war || changes.performanceData) && this.performanceData) {
|
if ((changes.war || changes.performanceData) && this.performanceData) {
|
||||||
this.initializeChartData();
|
this.translate.get([
|
||||||
|
'stats.performance.select.timeline.label.minimum',
|
||||||
|
'stats.performance.select.timeline.label.average',
|
||||||
|
'stats.performance.select.timeline.label.maximum']).subscribe((res) => {
|
||||||
|
const resValues = Object.keys(res).map(val => res[val]);
|
||||||
|
this.initializeChartData(resValues[2], resValues[0], resValues[1]);
|
||||||
|
});
|
||||||
Object.assign(this, [this.barChartData]);
|
Object.assign(this, [this.barChartData]);
|
||||||
this.activeChartSelect = this.labels.singleAvg;
|
this.activeChartSelect = this.labels.singleAvg;
|
||||||
}
|
}
|
||||||
|
@ -107,10 +114,10 @@ export class ServerStatsComponent implements OnInit, OnChanges {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeChartData() {
|
initializeChartData(labelMax: string, labelMin: string, labelAvg: string) {
|
||||||
this.tmpAvgTimeline = ChartUtils.getMultiDataArray('min', 'avg', 'max');
|
this.tmpAvgTimeline = ChartUtils.getMultiDataArray(labelMax, labelAvg, labelMin);
|
||||||
this.tmpMinTimeline = ChartUtils.getMultiDataArray('min', 'avg', 'max');
|
this.tmpMinTimeline = ChartUtils.getMultiDataArray(labelMax, labelAvg, labelMin);
|
||||||
this.tmpServerTimeline = ChartUtils.getMultiDataArray('min', 'avg');
|
this.tmpServerTimeline = ChartUtils.getMultiDataArray(labelAvg, labelMin);
|
||||||
|
|
||||||
const diffMs = (new Date(this.war.endDate).getTime() - new Date(this.war.date).getTime());
|
const diffMs = (new Date(this.war.endDate).getTime() - new Date(this.war.date).getTime());
|
||||||
const warDurationMinutes = Math.round(diffMs / 60000);
|
const warDurationMinutes = Math.round(diffMs / 60000);
|
||||||
|
@ -150,33 +157,33 @@ export class ServerStatsComponent implements OnInit, OnChanges {
|
||||||
// SERVER TIMELINE DATA
|
// SERVER TIMELINE DATA
|
||||||
for (let i = 0; i < entry.avgFps.length && i < warDurationMinutes; i++) {
|
for (let i = 0; i < entry.avgFps.length && i < warDurationMinutes; i++) {
|
||||||
const currDate = new Date(dateObj.getTime() + i * 60000);
|
const currDate = new Date(dateObj.getTime() + i * 60000);
|
||||||
this.tmpServerTimeline[0].series.push(ChartUtils.getSeriesEntry(currDate, entry.minFps[i]));
|
this.tmpServerTimeline[0].series.push(ChartUtils.getSeriesEntry(currDate, entry.avgFps[i]));
|
||||||
this.tmpServerTimeline[1].series.push(ChartUtils.getSeriesEntry(currDate, entry.avgFps[i]));
|
this.tmpServerTimeline[1].series.push(ChartUtils.getSeriesEntry(currDate, entry.minFps[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.tmpSingleAvg.push({
|
this.tmpSingleAvg.push({
|
||||||
name: entry.entityName,
|
name: entry.entityName,
|
||||||
value: entry.singleAvgFps
|
value: entry.singleAvgFps
|
||||||
});
|
});
|
||||||
this.tmpSingleMin.push({
|
this.tmpSingleMin.push({
|
||||||
name: entry.entityName,
|
name: entry.entityName,
|
||||||
value: entry.singleMinFps
|
value: entry.singleMinFps
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
tmpAvgArray = tmpAvgArray.map(x => Math.round(x / this.performanceData.length));
|
tmpAvgArray = tmpAvgArray.map(x => Math.round(x / this.performanceData.length));
|
||||||
for (let i = 0; i < tmpAvgArray.length; i++) {
|
for (let i = 0; i < tmpAvgArray.length; i++) {
|
||||||
const currDate = new Date(dateObj.getTime() + i * 60000);
|
const currDate = new Date(dateObj.getTime() + i * 60000);
|
||||||
this.tmpAvgTimeline[0].series.push(ChartUtils.getSeriesEntry(currDate, tmpAvgMin[i]));
|
this.tmpAvgTimeline[0].series.push(ChartUtils.getSeriesEntry(currDate, tmpAvgMax[i]));
|
||||||
this.tmpAvgTimeline[1].series.push(ChartUtils.getSeriesEntry(currDate, tmpAvgArray[i]));
|
this.tmpAvgTimeline[1].series.push(ChartUtils.getSeriesEntry(currDate, tmpAvgArray[i]));
|
||||||
this.tmpAvgTimeline[2].series.push(ChartUtils.getSeriesEntry(currDate, tmpAvgMax[i]));
|
this.tmpAvgTimeline[2].series.push(ChartUtils.getSeriesEntry(currDate, tmpAvgMin[i]));
|
||||||
}
|
}
|
||||||
tmpMinArray = tmpMinArray.map(x => Math.round(x / this.performanceData.length));
|
tmpMinArray = tmpMinArray.map(x => Math.round(x / this.performanceData.length));
|
||||||
for (let i = 0; i < tmpMinArray.length; i++) {
|
for (let i = 0; i < tmpMinArray.length; i++) {
|
||||||
const currDate = new Date(dateObj.getTime() + i * 60000);
|
const currDate = new Date(dateObj.getTime() + i * 60000);
|
||||||
this.tmpMinTimeline[0].series.push(ChartUtils.getSeriesEntry(currDate, tmpMinMin[i]));
|
this.tmpMinTimeline[0].series.push(ChartUtils.getSeriesEntry(currDate, tmpMinMax[i]));
|
||||||
this.tmpMinTimeline[1].series.push(ChartUtils.getSeriesEntry(currDate, tmpMinArray[i]));
|
this.tmpMinTimeline[1].series.push(ChartUtils.getSeriesEntry(currDate, tmpMinArray[i]));
|
||||||
this.tmpMinTimeline[2].series.push(ChartUtils.getSeriesEntry(currDate, tmpMinMax[i]));
|
this.tmpMinTimeline[2].series.push(ChartUtils.getSeriesEntry(currDate, tmpMinMin[i]));
|
||||||
}
|
}
|
||||||
this.tmpSingleAvg.sort((a, b) => a.value - b.value);
|
this.tmpSingleAvg.sort((a, b) => a.value - b.value);
|
||||||
this.tmpSingleMin.sort((a, b) => a.value - b.value);
|
this.tmpSingleMin.sort((a, b) => a.value - b.value);
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
"stats.performance.select.timeline.avg": "Verlauf FPS Durchschnitt",
|
"stats.performance.select.timeline.avg": "Verlauf FPS Durchschnitt",
|
||||||
"stats.performance.select.timeline.min": "Verlauf FPS Minimum",
|
"stats.performance.select.timeline.min": "Verlauf FPS Minimum",
|
||||||
"stats.performance.select.timeline.server": "Server FPS",
|
"stats.performance.select.timeline.server": "Server FPS",
|
||||||
|
"stats.performance.select.timeline.label.minimum": "Minimum",
|
||||||
|
"stats.performance.select.timeline.label.average": "Mittelwert",
|
||||||
|
"stats.performance.select.timeline.label.maximum": "Maximum",
|
||||||
|
|
||||||
|
|
||||||
"stats.player.detail.headline": "Kampagnendetails - {{name}}",
|
"stats.player.detail.headline": "Kampagnendetails - {{name}}",
|
||||||
"stats.player.detail.button.back": "Zurück",
|
"stats.player.detail.button.back": "Zurück",
|
||||||
|
|
|
@ -42,6 +42,9 @@
|
||||||
"stats.performance.select.timeline.avg": "Timeline FPS Average",
|
"stats.performance.select.timeline.avg": "Timeline FPS Average",
|
||||||
"stats.performance.select.timeline.min": "Timeline FPS Minimum",
|
"stats.performance.select.timeline.min": "Timeline FPS Minimum",
|
||||||
"stats.performance.select.timeline.server": "Server FPS",
|
"stats.performance.select.timeline.server": "Server FPS",
|
||||||
|
"stats.performance.select.timeline.label.minimum": "Minimum",
|
||||||
|
"stats.performance.select.timeline.label.average": "Average",
|
||||||
|
"stats.performance.select.timeline.label.maximum": "Maximum",
|
||||||
|
|
||||||
"stats.player.detail.headline": "Campaign Details - {{name}}",
|
"stats.player.detail.headline": "Campaign Details - {{name}}",
|
||||||
"stats.player.detail.button.back": "Back",
|
"stats.player.detail.button.back": "Back",
|
||||||
|
|
Loading…
Reference in New Issue