From 728f9e3d47a22012b67a7847710315f9d34bfb53 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Fri, 15 Dec 2017 17:38:59 +0000 Subject: [PATCH] fixed es5 compatibility --- src/app/dashboard/dashboard-customer.component.ts | 7 +++---- src/app/panels/pie-panel.component.ts | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index 5b84574..706db64 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -135,8 +135,7 @@ export class DashboardCustomerComponent implements OnInit { week_5: data.purchases[5], week_6: data.purchases[6], }; - //this.maxPurchase = Math.max(...this.weekPurchaseList); - this.maxPurchase = Object.values(this.weekPurchaseList).reduce((a,b) => { + this.maxPurchase = Object.keys(this.weekPurchaseList).map(key => this.weekPurchaseList[key]).reduce((a,b) => { if (! a) { a = 0 } if (! b) { b = 0 } return Math.max(a,b); @@ -144,8 +143,8 @@ export class DashboardCustomerComponent implements OnInit { } public setSectorList (data: any) { - this.sectorLetters = Object.values(data.sectors); - this.sectorPurchases = Object.values(data.purchases); + this.sectorLetters = Object.keys(data.sectors).map(key => data.sectors[key]); + this.sectorPurchases = Object.keys(data.purchases).map(key => data.purchases[key]); } ngOnInit(): void { diff --git a/src/app/panels/pie-panel.component.ts b/src/app/panels/pie-panel.component.ts index 3e8d2ac..bae839f 100644 --- a/src/app/panels/pie-panel.component.ts +++ b/src/app/panels/pie-panel.component.ts @@ -29,7 +29,7 @@ export class PiePanel implements OnInit { } private setData(data: any) { - this.doughnutChartData = Object.values(data); + this.doughnutChartData = Object.keys(data).map(key => data[key]); // setTimeout is currently a workaround for ng2-charts labels setTimeout(() => this.doughnutChartLabels = Object.keys(data), 0); }