From 9fbe36e401f9cf942216c822085e3a35d44a3632 Mon Sep 17 00:00:00 2001 From: Tom Slater Date: Tue, 20 Aug 2019 16:47:20 +0100 Subject: [PATCH] Misc chart work --- src/app/dashboard/add-data.component.html | 4 ++-- src/app/dashboard/category-month.component.html | 8 ++++---- .../dashboard/dashboard-customer.component.html | 12 ++++++------ .../dashboard/dashboard-customer.component.ts | 17 ++++++++++++++++- src/app/dashboard/dashboard.component.html | 2 +- src/app/dashboard/dashboard.component.ts | 8 ++++---- .../more-graphs-and-tables.component.html | 10 +++------- .../more-graphs-and-tables.component.ts | 10 +++++----- src/app/panels/org-pie-panel.component.ts | 10 +++++----- src/app/panels/pie-panel.component.html | 15 +-------------- src/environments/environment.ts | 2 +- 11 files changed, 48 insertions(+), 50 deletions(-) diff --git a/src/app/dashboard/add-data.component.html b/src/app/dashboard/add-data.component.html index 59a1cfc..a6e52a6 100644 --- a/src/app/dashboard/add-data.component.html +++ b/src/app/dashboard/add-data.component.html @@ -156,14 +156,14 @@
- + Enter the amount of employees the organisation has for the entry month.
- + Enter the amount of employees that live locally to the organisation for the entry month.
diff --git a/src/app/dashboard/category-month.component.html b/src/app/dashboard/category-month.component.html index f7501d9..0cd885b 100644 --- a/src/app/dashboard/category-month.component.html +++ b/src/app/dashboard/category-month.component.html @@ -1,6 +1,6 @@
-
+
@@ -42,7 +42,7 @@
-
+
@@ -84,7 +84,7 @@
-
+
@@ -126,7 +126,7 @@
-
+
diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html index 5ca8c43..708724e 100644 --- a/src/app/dashboard/dashboard-customer.component.html +++ b/src/app/dashboard/dashboard-customer.component.html @@ -17,10 +17,10 @@
-->
-
-
+ -
+ -
-
+
diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index a17bf0c..358cc0a 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -35,10 +35,25 @@ export class DashboardCustomerComponent implements OnInit { public bootstrapColours: string[] = ['bg-primary', 'bg-secondary', 'bg-success', 'bg-danger', 'bg-warning', 'bg-info']; - public chartType = 'bar'; + public chartType = 'doughnut'; public chartLegend = true; public doughnutChartDataCategory: any[] = []; public doughnutChartLabelsCategory: string[] = []; + public doughnutChartColoursCategory: any[] = [ + { + backgroundColor:[ + 'red', + 'green', + 'blue', + 'purple', + 'yellow', + 'brown', + 'magenta', + 'cyan', + 'orange', + 'pink' + ] + }]; public doughnutChartOptionsCategory:any = { tooltips: { diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index 8520235..1169a33 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -60,7 +60,7 @@
-

Spending by Category

+

Last week's spending by Category

diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index ddd479b..099c65a 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -46,9 +46,9 @@ export class DashboardComponent { }, { type: 'graph', - name: 'sales_last_year', + name: 'sales_last_quart', icon: 'icon-diamond', - title: 'Sales Last Year', + title: 'Sales Last Quart', dataType: DataType.currency, }, { @@ -65,8 +65,8 @@ export class DashboardComponent { }, { type: 'graph', - name: 'purchases_last_year;', - title: 'Purchases Last Year', + name: 'purchases_last_quart;', + title: 'Purchases Last Quart', dataType: DataType.currency, }, ]; diff --git a/src/app/dashboard/more-graphs-and-tables.component.html b/src/app/dashboard/more-graphs-and-tables.component.html index cf3adcc..300926c 100644 --- a/src/app/dashboard/more-graphs-and-tables.component.html +++ b/src/app/dashboard/more-graphs-and-tables.component.html @@ -5,12 +5,12 @@

Supplier spend amount and number of purchases

-
+
-
+
@@ -30,10 +30,6 @@

Spend amount and number of organisations

-
- - -
-
\ No newline at end of file +
diff --git a/src/app/dashboard/more-graphs-and-tables.component.ts b/src/app/dashboard/more-graphs-and-tables.component.ts index 9f8ce6c..a346283 100644 --- a/src/app/dashboard/more-graphs-and-tables.component.ts +++ b/src/app/dashboard/more-graphs-and-tables.component.ts @@ -41,7 +41,7 @@ export class MoreStuffComponent implements OnInit { backgroundColor: [ 'red', 'green', - 'blue', + '#52afed', 'purple', 'yellow', 'brown', @@ -66,7 +66,7 @@ export class MoreStuffComponent implements OnInit { passed_graph_data.data.map(item=> { let is_item_in_range = (new Date(item.date.substring(0, 10)) >= new Date(start_range) && new Date(item.date.substring(0, 10)) <= new Date(end_range)); // there are a lot of `new Date(blah)` but that is what works for some reason. - + // console.log("item.date : " + (item.date)); // console.log("Date(item.date) : " + new Date(item.date)); // console.log("Date(item.date.substring(0, 10)) : " + new Date(item.date.substring(0, 10))); @@ -78,11 +78,11 @@ export class MoreStuffComponent implements OnInit { // console.log("item.date <= end_range: " + (new Date(item.date) <= new Date(end_range))); // console.log("is_item_in_range: " + is_item_in_range); // console.log("----------------------"); - + if (is_item_in_range) { graph_data.push({ t: new Date(item.date.substring(0, 10)), - r: item.value > 1000000 ? (item.value / 1000000) + 10 : (item.value / 100000) + 5, + r: item.value > 1000000 ? (item.value / 100000) : (item.value / 100000) + 5, supplier: item.seller, y: item.count, value: item.value, @@ -96,7 +96,7 @@ export class MoreStuffComponent implements OnInit { passed_graph_data.data.map(item => { graph_data.push({ t: item.date, - r: item.value > 1000000 ? (item.value / 1000000) + 10 : (item.value / 100000) + 5, + r: item.value > 1000000 ? (item.value / 200000) : (item.value / 100000) + 5, supplier: item.seller, y: item.count, value: item.value, diff --git a/src/app/panels/org-pie-panel.component.ts b/src/app/panels/org-pie-panel.component.ts index 84feb57..ad2807d 100644 --- a/src/app/panels/org-pie-panel.component.ts +++ b/src/app/panels/org-pie-panel.component.ts @@ -18,30 +18,30 @@ export class OrgPiePanel implements OnInit { public doughnutChartColors: any[] = [ { backgroundColor: [ - 'red', + '#ffa1b5', 'green', - 'pink', + '#52afed', 'purple', 'yellow', 'brown', 'magenta', 'cyan', 'orange', - 'blue' + 'pink' ] }, { borderColor: [ 'red', 'green', - 'pink', + 'blue', 'purple', 'yellow', 'brown', 'magenta', 'cyan', 'orange', - 'blue' + 'pink' ] }, { borderWidth: [100] diff --git a/src/app/panels/pie-panel.component.html b/src/app/panels/pie-panel.component.html index 1a900f4..0a3846d 100644 --- a/src/app/panels/pie-panel.component.html +++ b/src/app/panels/pie-panel.component.html @@ -1,22 +1,9 @@
-
+

All Purchases by Category

-
- -