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 {Fraction} from '../../../utils/fraction.enum';
|
||||
import {WarService} from '../../../services/logs/war.service';
|
||||
import {FractionHelpers} from '../../../utils/global.helpers';
|
||||
import {War} from '../../../models/model-interfaces';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -24,7 +22,9 @@ export class StatisticOverviewComponent implements OnInit {
|
|||
playerData: any[] = [];
|
||||
currentData: any[] = [];
|
||||
|
||||
colorScheme;
|
||||
colorScheme = {
|
||||
domain: [Fraction.COLOR_BLUFOR, Fraction.COLOR_OPFOR]
|
||||
};
|
||||
gradient = false;
|
||||
xAxis = true;
|
||||
yAxis = true;
|
||||
|
@ -81,71 +81,44 @@ export class StatisticOverviewComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
initChart(wars: War[]) {
|
||||
const fractions: string[] = [];
|
||||
this.colorScheme = {
|
||||
domain: []
|
||||
};
|
||||
|
||||
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);
|
||||
initChart(wars: any[]) {
|
||||
const pointsObj = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||
const pointsSumObj = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||
const playersObj = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||
|
||||
for (let i = wars.length - 1; i >= 0; i--) {
|
||||
const war = wars[i];
|
||||
if (!war) {
|
||||
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 warDate = (this.id === 'all') ? new Date(war.date) : ChartUtils.getShortDateString(war.date);
|
||||
pointsObj[bluforIndex].series.push({
|
||||
|
||||
pointsObj[0].series.push({
|
||||
name: warDate,
|
||||
value: war.ptBlufor
|
||||
});
|
||||
pointsObj[opforIndex].series.push({
|
||||
pointsObj[1].series.push({
|
||||
name: warDate,
|
||||
value: war.ptOpfor
|
||||
});
|
||||
pointsSumObj[bluforIndex].series.push({
|
||||
pointsSumObj[0].series.push({
|
||||
name: warDate,
|
||||
value: pointsSumObj[bluforIndex].series[j - 1] ?
|
||||
pointsSumObj[bluforIndex].series[j - 1].value + war.ptBlufor :
|
||||
value: pointsSumObj[0].series[j - 1] ?
|
||||
pointsSumObj[0].series[j - 1].value + war.ptBlufor :
|
||||
war.ptBlufor
|
||||
});
|
||||
pointsSumObj[opforIndex].series.push({
|
||||
pointsSumObj[1].series.push({
|
||||
name: warDate,
|
||||
value: pointsSumObj[opforIndex].series[j - 1]
|
||||
? pointsSumObj[opforIndex].series[j - 1].value + war.ptOpfor :
|
||||
value: pointsSumObj[1].series[j - 1]
|
||||
? pointsSumObj[1].series[j - 1].value + war.ptOpfor :
|
||||
war.ptOpfor
|
||||
});
|
||||
playersObj[bluforIndex].series.push({
|
||||
playersObj[0].series.push({
|
||||
name: warDate,
|
||||
value: war.playersBlufor
|
||||
});
|
||||
playersObj[opforIndex].series.push({
|
||||
playersObj[1].series.push({
|
||||
name: warDate,
|
||||
value: war.playersOpfor
|
||||
});
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
|
||||
<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"
|
||||
required
|
||||
[(ngModel)]="war.fractionMappingOpfor">
|
||||
|
@ -48,7 +48,7 @@
|
|||
<option value="OPFOR">{{fraction.OPFOR}}</option>
|
||||
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
|
||||
</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>
|
||||
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
export enum Fraction {
|
||||
COLOR_NEUTRAL = '#222222',
|
||||
ARF = 'ARF',
|
||||
COLOR_ARF = '#336699',
|
||||
COLOR_ARF_LIGHT = '#6666dd',
|
||||
COLOR_ARF_DARK = '#0C0CA6',
|
||||
COLOR_ARF_GREY = '#515179',
|
||||
COLOR_ARF_GREY = '#336699',
|
||||
COLOR_ARF_DARK = '#336699',
|
||||
COLOR_ARF_LIGHT = '#336699',
|
||||
SWORD = 'SWORD',
|
||||
COLOR_SWORD = '#8b8b8b',
|
||||
COLOR_SWORD_GREY = '#282828',
|
||||
COLOR_SWORD_DARK = '#101010',
|
||||
COLOR_SWORD_LIGHT = '#b8b8b8',
|
||||
COLOR_SWORD_GREY = '#8b8b8b',
|
||||
COLOR_SWORD_DARK = '#8b8b8b',
|
||||
COLOR_SWORD_LIGHT = '#8b8b8b',
|
||||
BLUFOR = 'NATO',
|
||||
OPFOR = 'CSAT',
|
||||
COLOR_BLUFOR = '#3c5fa1',
|
||||
COLOR_BLUFOR_LIGHT = '#6666dd',
|
||||
COLOR_BLUFOR_DARK = '#0C0CA6',
|
||||
COLOR_BLUFOR_GREY = '#515179',
|
||||
OPFOR = 'CSAT',
|
||||
COLOR_OPFOR = '#a90100',
|
||||
COLOR_OPFOR_DARK = '#890F0F',
|
||||
COLOR_OPFOR_LIGHT = '#fb5555',
|
||||
COLOR_OPFOR_GREY = '#955c5f',
|
||||
COLOR_NEUTRAL = '#222222',
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue