From 7ee0b6435188fc9168fb7c3d22e6fdad72e8da0a Mon Sep 17 00:00:00 2001 From: Tom Slater Date: Wed, 7 Aug 2019 16:21:40 +0100 Subject: [PATCH] Chart Labels and clean up Added axis labels and cleaned up charts a little. --- .../dashboard/dashboard-customer.component.ts | 15 +++++-- src/app/dashboard/dashboard.component.html | 41 ++++++++++--------- src/app/dashboard/dashboard.component.ts | 25 ++++++++--- .../more-graphs-and-tables.component.html | 2 +- .../more-graphs-and-tables.component.ts | 31 ++++++++++++-- src/app/panels/pie-panel.component.html | 1 + src/app/panels/pie-panel.component.ts | 13 ++++++ 7 files changed, 96 insertions(+), 32 deletions(-) diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index 94fa180..d4eaa54 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -35,7 +35,7 @@ export class DashboardCustomerComponent implements OnInit { public bootstrapColours: string[] = ['bg-primary', 'bg-secondary', 'bg-success', 'bg-danger', 'bg-warning', 'bg-info']; - public chartType = 'doughnut'; + public chartType = 'bar'; public chartLegend = true; public doughnutChartDataCategory: any[] = []; public doughnutChartLabelsCategory: string[] = []; @@ -69,10 +69,19 @@ export class DashboardCustomerComponent implements OnInit { responsive: true, scales:{ xAxes:[{ - stacked:true + scaleLabel: { + display:true, + labelString: 'Category' + }, + stacked:true, + }], yAxes:[{ - stacked:true + scaleLabel: { + display:true, + labelString: 'Organisation purchase amount' + }, + stacked:true, }] } }; diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index 0c580c0..6f5c516 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -11,25 +11,6 @@ -
-
-
-
-

Spend by company and Industrial sector

-
-
-
- -
-
-
@@ -51,6 +32,28 @@
+
+
+
+
+
+

All Organisation Purchases by Category

+
+
+
+ +
+
+
+
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 8ecad53..ee10b2b 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_365_days', + name: 'sales_all', icon: 'icon-diamond', - title: 'Sales Last Year', + title: 'All Sales', dataType: DataType.currency, }, { @@ -65,8 +65,8 @@ export class DashboardComponent { }, { type: 'graph', - name: 'purchases_last_365_days;', - title: 'Purchases Last Year', + name: 'purchases_all;', + title: 'All Purchases', dataType: DataType.currency, }, ]; @@ -76,7 +76,7 @@ export class DashboardComponent { public bootstrapColours: string[] = ['bg-primary', 'bg-secondary', 'bg-success', 'bg-danger', 'bg-warning', 'bg-info']; - public chartType = 'doughnut'; + public chartType = 'pie'; public chartLegend = true; public doughnutChartDataCategory: any[] = []; public doughnutChartLabelsCategory: string[] = []; @@ -118,6 +118,21 @@ export class DashboardComponent { } }; public barChartTypeEssential:string = 'horizontalBar'; + public barChartColoursCategory: any[] = [ + { + backgroundColor:[ + 'red', + 'green', + 'blue', + 'purple', + 'yellow', + 'brown', + 'magenta', + 'cyan', + 'orange', + 'pink' + ] + }]; public barChartOptionsCategory:any = { scaleShowVerticalLines: false, diff --git a/src/app/dashboard/more-graphs-and-tables.component.html b/src/app/dashboard/more-graphs-and-tables.component.html index d4e5e2d..4181e96 100644 --- a/src/app/dashboard/more-graphs-and-tables.component.html +++ b/src/app/dashboard/more-graphs-and-tables.component.html @@ -3,7 +3,7 @@
-

Spend by Company Type

+

Spend amount and number of purchases by supplier name

diff --git a/src/app/dashboard/more-graphs-and-tables.component.ts b/src/app/dashboard/more-graphs-and-tables.component.ts index 92c0c30..10785c5 100644 --- a/src/app/dashboard/more-graphs-and-tables.component.ts +++ b/src/app/dashboard/more-graphs-and-tables.component.ts @@ -85,9 +85,18 @@ export class MoreStuffComponent implements OnInit { type: 'time', time: { unit: 'month' + }, + scaleLabel:{ + display:true, + labelString:'Date' } }], - yAxes: [] + yAxes: [{ + scaleLabel: { + display:true, + labelString:'Number of purchases' + } + }] }, tooltips: { callbacks: { @@ -133,7 +142,7 @@ export class MoreStuffComponent implements OnInit { public yearSpendChartData: any[] = [ { data: [], - label: ["Value"], + label: ["Value £"], fill: false, borderColor: 'red', hoverBackgroundColor: '#ffa1b5', @@ -157,6 +166,10 @@ export class MoreStuffComponent implements OnInit { type: 'time', time: { unit: 'month' + }, + scaleLabel: { + display:true, + labelString: 'Date' } }], yAxes: [ @@ -238,8 +251,18 @@ export class MoreStuffComponent implements OnInit { //maintainAspectRatio: false, responsive: true, scales: { - xAxes: [], - yAxes: [] + xAxes: [{ + scaleLabel: { + display:true, + labelString: 'Spend amount £' + } + }], + yAxes: [{ + scaleLabel: { + display:true, + labelString: 'Supplier Names' + } + }] }, }; public supplierMonthChartLabels: string[] = []; diff --git a/src/app/panels/pie-panel.component.html b/src/app/panels/pie-panel.component.html index 0ddfafb..da2417e 100644 --- a/src/app/panels/pie-panel.component.html +++ b/src/app/panels/pie-panel.component.html @@ -9,6 +9,7 @@