Compare commits
No commits in common. "b05f227a103eb16652aea3ee7d59d15e6f0a3771" and "5d94be1c097568c458646034f8c02169991c1ddf" have entirely different histories.
b05f227a10
...
5d94be1c09
|
@ -4,8 +4,6 @@ import {CampaignService} from '../../../services/logs/campaign.service';
|
||||||
import {ChartUtils} from '../../../utils/chart-utils';
|
import {ChartUtils} from '../../../utils/chart-utils';
|
||||||
import {Fraction} from '../../../utils/fraction.enum';
|
import {Fraction} from '../../../utils/fraction.enum';
|
||||||
import {WarService} from '../../../services/logs/war.service';
|
import {WarService} from '../../../services/logs/war.service';
|
||||||
import {FractionHelpers} from '../../../utils/global.helpers';
|
|
||||||
import {War} from '../../../models/model-interfaces';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -24,7 +22,9 @@ export class StatisticOverviewComponent implements OnInit {
|
||||||
playerData: any[] = [];
|
playerData: any[] = [];
|
||||||
currentData: any[] = [];
|
currentData: any[] = [];
|
||||||
|
|
||||||
colorScheme;
|
colorScheme = {
|
||||||
|
domain: [Fraction.COLOR_BLUFOR, Fraction.COLOR_OPFOR]
|
||||||
|
};
|
||||||
gradient = false;
|
gradient = false;
|
||||||
xAxis = true;
|
xAxis = true;
|
||||||
yAxis = true;
|
yAxis = true;
|
||||||
|
@ -81,71 +81,44 @@ export class StatisticOverviewComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initChart(wars: War[]) {
|
initChart(wars: any[]) {
|
||||||
const fractions: string[] = [];
|
const pointsObj = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||||
this.colorScheme = {
|
const pointsSumObj = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||||
domain: []
|
const playersObj = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||||
};
|
|
||||||
|
|
||||||
if (wars.find(war => war.fractionMappingBlufor === 'BLUFOR' || war.fractionMappingOpfor === 'BLUFOR')) {
|
|
||||||
fractions.push(Fraction.BLUFOR);
|
|
||||||
this.colorScheme.domain.push(FractionHelpers.getFractionColor('BLUFOR'));
|
|
||||||
}
|
|
||||||
if (wars.find(war => war.fractionMappingBlufor === 'OPFOR' || war.fractionMappingOpfor === 'OPFOR')) {
|
|
||||||
fractions.push(Fraction.OPFOR);
|
|
||||||
this.colorScheme.domain.push(FractionHelpers.getFractionColor('OPFOR'));
|
|
||||||
}
|
|
||||||
if (wars.find(war => war.fractionMappingBlufor === Fraction.ARF || war.fractionMappingOpfor === Fraction.ARF)) {
|
|
||||||
fractions.push(Fraction.ARF);
|
|
||||||
this.colorScheme.domain.push(FractionHelpers.getFractionColor(Fraction.ARF));
|
|
||||||
}
|
|
||||||
if (wars.find(war => war.fractionMappingBlufor === Fraction.SWORD || war.fractionMappingOpfor === Fraction.SWORD)) {
|
|
||||||
fractions.push(Fraction.SWORD);
|
|
||||||
this.colorScheme.domain.push(FractionHelpers.getFractionColor(Fraction.SWORD));
|
|
||||||
}
|
|
||||||
|
|
||||||
const pointsObj = ChartUtils.getMultiDataArray(...fractions);
|
|
||||||
const pointsSumObj = ChartUtils.getMultiDataArray(...fractions);
|
|
||||||
const playersObj = ChartUtils.getMultiDataArray(...fractions);
|
|
||||||
|
|
||||||
for (let i = wars.length - 1; i >= 0; i--) {
|
for (let i = wars.length - 1; i >= 0; i--) {
|
||||||
const war = wars[i];
|
const war = wars[i];
|
||||||
if (!war) {
|
if (!war) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bluforIndex = fractions.findIndex(fraction =>
|
|
||||||
fraction === FractionHelpers.getFractionName(war, 'BLUFOR'));
|
|
||||||
const opforIndex = fractions.findIndex(
|
|
||||||
fraction => fraction === FractionHelpers.getFractionName(war, 'OPFOR'));
|
|
||||||
|
|
||||||
const j = wars.length - i - 1;
|
const j = wars.length - i - 1;
|
||||||
const warDate = (this.id === 'all') ? new Date(war.date) : ChartUtils.getShortDateString(war.date);
|
const warDate = (this.id === 'all') ? new Date(war.date) : ChartUtils.getShortDateString(war.date);
|
||||||
pointsObj[bluforIndex].series.push({
|
|
||||||
|
pointsObj[0].series.push({
|
||||||
name: warDate,
|
name: warDate,
|
||||||
value: war.ptBlufor
|
value: war.ptBlufor
|
||||||
});
|
});
|
||||||
pointsObj[opforIndex].series.push({
|
pointsObj[1].series.push({
|
||||||
name: warDate,
|
name: warDate,
|
||||||
value: war.ptOpfor
|
value: war.ptOpfor
|
||||||
});
|
});
|
||||||
pointsSumObj[bluforIndex].series.push({
|
pointsSumObj[0].series.push({
|
||||||
name: warDate,
|
name: warDate,
|
||||||
value: pointsSumObj[bluforIndex].series[j - 1] ?
|
value: pointsSumObj[0].series[j - 1] ?
|
||||||
pointsSumObj[bluforIndex].series[j - 1].value + war.ptBlufor :
|
pointsSumObj[0].series[j - 1].value + war.ptBlufor :
|
||||||
war.ptBlufor
|
war.ptBlufor
|
||||||
});
|
});
|
||||||
pointsSumObj[opforIndex].series.push({
|
pointsSumObj[1].series.push({
|
||||||
name: warDate,
|
name: warDate,
|
||||||
value: pointsSumObj[opforIndex].series[j - 1]
|
value: pointsSumObj[1].series[j - 1]
|
||||||
? pointsSumObj[opforIndex].series[j - 1].value + war.ptOpfor :
|
? pointsSumObj[1].series[j - 1].value + war.ptOpfor :
|
||||||
war.ptOpfor
|
war.ptOpfor
|
||||||
});
|
});
|
||||||
playersObj[bluforIndex].series.push({
|
playersObj[0].series.push({
|
||||||
name: warDate,
|
name: warDate,
|
||||||
value: war.playersBlufor
|
value: war.playersBlufor
|
||||||
});
|
});
|
||||||
playersObj[opforIndex].series.push({
|
playersObj[1].series.push({
|
||||||
name: warDate,
|
name: warDate,
|
||||||
value: war.playersOpfor
|
value: war.playersOpfor
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="fractionMappingOpfor">{{'stats.war.submit.mapping.opfor' | translate}}</label>
|
<label for="fractionMappingOpfor">{{'stats.war.submit.mapping.blufor' | translate}}</label>
|
||||||
<select id="fractionMappingOpfor" name="fractionMappingOpfor" class="form-control btn dropdown-toggle"
|
<select id="fractionMappingOpfor" name="fractionMappingOpfor" class="form-control btn dropdown-toggle"
|
||||||
required
|
required
|
||||||
[(ngModel)]="war.fractionMappingOpfor">
|
[(ngModel)]="war.fractionMappingOpfor">
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
<option value="OPFOR">{{fraction.OPFOR}}</option>
|
<option value="OPFOR">{{fraction.OPFOR}}</option>
|
||||||
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
|
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
|
||||||
</select>
|
</select>
|
||||||
<show-error displayName="{{'stats.war.submit.mapping.opfor' | translate}}" controlPath="fraction"></show-error>
|
<show-error displayName="{{'stats.war.submit.mapping.blufor' | translate}}" controlPath="fraction"></show-error>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
export enum Fraction {
|
export enum Fraction {
|
||||||
COLOR_NEUTRAL = '#222222',
|
|
||||||
ARF = 'ARF',
|
ARF = 'ARF',
|
||||||
COLOR_ARF = '#336699',
|
COLOR_ARF = '#336699',
|
||||||
COLOR_ARF_LIGHT = '#6666dd',
|
COLOR_ARF_GREY = '#336699',
|
||||||
COLOR_ARF_DARK = '#0C0CA6',
|
COLOR_ARF_DARK = '#336699',
|
||||||
COLOR_ARF_GREY = '#515179',
|
COLOR_ARF_LIGHT = '#336699',
|
||||||
SWORD = 'SWORD',
|
SWORD = 'SWORD',
|
||||||
COLOR_SWORD = '#8b8b8b',
|
COLOR_SWORD = '#8b8b8b',
|
||||||
COLOR_SWORD_GREY = '#282828',
|
COLOR_SWORD_GREY = '#8b8b8b',
|
||||||
COLOR_SWORD_DARK = '#101010',
|
COLOR_SWORD_DARK = '#8b8b8b',
|
||||||
COLOR_SWORD_LIGHT = '#b8b8b8',
|
COLOR_SWORD_LIGHT = '#8b8b8b',
|
||||||
BLUFOR = 'NATO',
|
BLUFOR = 'NATO',
|
||||||
|
OPFOR = 'CSAT',
|
||||||
COLOR_BLUFOR = '#3c5fa1',
|
COLOR_BLUFOR = '#3c5fa1',
|
||||||
COLOR_BLUFOR_LIGHT = '#6666dd',
|
COLOR_BLUFOR_LIGHT = '#6666dd',
|
||||||
COLOR_BLUFOR_DARK = '#0C0CA6',
|
COLOR_BLUFOR_DARK = '#0C0CA6',
|
||||||
COLOR_BLUFOR_GREY = '#515179',
|
COLOR_BLUFOR_GREY = '#515179',
|
||||||
OPFOR = 'CSAT',
|
|
||||||
COLOR_OPFOR = '#a90100',
|
COLOR_OPFOR = '#a90100',
|
||||||
COLOR_OPFOR_DARK = '#890F0F',
|
COLOR_OPFOR_DARK = '#890F0F',
|
||||||
COLOR_OPFOR_LIGHT = '#fb5555',
|
COLOR_OPFOR_LIGHT = '#fb5555',
|
||||||
COLOR_OPFOR_GREY = '#955c5f',
|
COLOR_OPFOR_GREY = '#955c5f',
|
||||||
|
COLOR_NEUTRAL = '#222222',
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue