fixed es5 compatibility

This commit is contained in:
piratefinn 2017-12-15 17:38:59 +00:00
parent e16cf3e801
commit 728f9e3d47
2 changed files with 4 additions and 5 deletions

View file

@ -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 {

View file

@ -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);
}