From e16cf3e801fba5150c5af811b3c96f60de3dda8d Mon Sep 17 00:00:00 2001 From: piratefinn Date: Fri, 15 Dec 2017 17:20:18 +0000 Subject: [PATCH] sector list code fully working --- .../dashboard-customer.component.html | 56 +++++++++--------- .../dashboard/dashboard-customer.component.ts | 59 ++++++++++++++++++- 2 files changed, 84 insertions(+), 31 deletions(-) diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html index 1278c05..5be3628 100644 --- a/src/app/dashboard/dashboard-customer.component.html +++ b/src/app/dashboard/dashboard-customer.component.html @@ -117,80 +117,80 @@
diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index f404496..5b84574 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -29,6 +29,55 @@ export class DashboardCustomerComponent implements OnInit { week_6: 0, }; + sectorNames = { + A: 'Agriculture, Forestry & Fishing', + B: 'Mining & Quarrying', + C: 'Manufacturing', + D: 'Electricity, Gas, Steam & Air Conditioning', + E: 'Water & Waste Management', + F: 'Construction', + G: 'Wholesale & Retail Trade', + H: 'Transportation & Storage', + I: 'Accomodation & Food Services', + J: 'Information & Communication', + K: 'Financial & Insurance Activities', + L: 'Real Estate', + M: 'Professional, Scientfic & Technical', + N: 'Administrative & Support Services', + O: 'Public Administration, Defence & Social Security', + P: 'Education', + Q: 'Human Health & Social Work', + R: 'Arts, Entertainment & Recreation', + S: 'Other Service Activities', + T: 'Household Domestic Business', + } + + sectorIcons = { + A: 'icon-drop', + B: 'icon-diamond', + C: 'icon-settings', + D: 'icon-energy', + E: 'icon-trash', + F: 'icon-wrench', + G: 'icon-tag', + H: 'icon-speedometer', + I: 'icon-cup', + J: 'icon-globe', + K: 'icon-credit-card', + L: 'icon-graph', + M: 'icon-chemistry', + N: 'icon-drawer', + O: 'icon-pie-chart', + P: 'icon-graduation', + Q: 'icon-support', + R: 'icon-film', + S: 'icon-calendar', + T: 'icon-home', + } + + sectorLetters: string[] = []; + sectorPurchases: number[] = []; + sectorList: any; // Graph widgets @@ -66,8 +115,8 @@ export class DashboardCustomerComponent implements OnInit { ) { this.api.basicStats().subscribe( result => { - this.setWeekPurchaseList(result.data); - + this.setWeekPurchaseList(result.weeks); + this.setSectorList(result.sectors); }, error => { console.log('Retrieval Error'); @@ -92,7 +141,11 @@ export class DashboardCustomerComponent implements OnInit { if (! b) { b = 0 } return Math.max(a,b); }); - console.log(this.maxPurchase); + } + + public setSectorList (data: any) { + this.sectorLetters = Object.values(data.sectors); + this.sectorPurchases = Object.values(data.purchases); } ngOnInit(): void {