Compare commits

..

3 Commits

Author SHA1 Message Date
Florian Hartwich bacb350a18 lower height of chart 2017-09-24 13:03:21 +02:00
Florian Hartwich c1b9163b88 change stats date format to 2 digit year 2017-09-24 12:50:01 +02:00
Florian Hartwich 7cf71e43a5 clone object on init 2017-09-24 12:38:57 +02:00
2 changed files with 6 additions and 25 deletions

View File

@ -1,7 +1,7 @@
.slide-chart-container {
width: 90%;
min-width: 880px;
height: 750px;
height: 650px;
margin: auto;
padding-left: 6%;
}

View File

@ -21,9 +21,7 @@ export class StatisticOverviewComponent {
pointSumData: any[] = [];
playerData: any[] = [];
colorScheme = {
group: 'Ordinal',
domain: ['#0000FF', '#B22222']
};
gradient = false;
@ -57,7 +55,6 @@ export class StatisticOverviewComponent {
}
initWars(campaigns) {
let wars = [];
let itemsProcessed = 0;
campaigns = campaigns.filter(campaign => this.id === 'all' || campaign._id === this.id);
@ -92,32 +89,16 @@ export class StatisticOverviewComponent {
"name": "CSAT",
"series": []
}];
let pointsSumObj = [
{
"name": "NATO",
"series": []
},
{
"name": "CSAT",
"series": []
}];
let playersObj = [
{
"name": "NATO",
"series": []
},
{
"name": "CSAT",
"series": []
}
];
let pointsSumObj = JSON.parse(JSON.stringify(pointsObj));
let playersObj = JSON.parse(JSON.stringify(pointsObj));
for (let i = wars.length - 1; i >= 0; i--) {
let j = wars.length - i - 1;
// const warDateString = new Date(wars[i].date); TODO: use ngx-chart timeline
const isoDate = wars[i].date.slice(0, 10);
const dayDate = parseInt(isoDate.slice(8, 10)) + 1;
const warDateString = (dayDate < 10 ? "0" + dayDate : dayDate) + '.'
+ isoDate.slice(5, 7) + '.' + isoDate.slice(0, 4);
+ isoDate.slice(5, 7) + '.' + isoDate.slice(2, 4);
pointsObj[0].series.push({
name: warDateString,
@ -152,7 +133,7 @@ export class StatisticOverviewComponent {
this.pointData = pointsObj;
this.pointSumData = pointsSumObj;
this.playerData = playersObj;
Object.assign(this, [this.pointData, this.pointSumData, this.playerData])
Object.assign(this, [this.pointData, this.pointSumData, this.playerData]);
}
}