From 886d8a8c9b25ecf5ca2009a5e84a1b2235644268 Mon Sep 17 00:00:00 2001 From: kiswa Date: Wed, 8 Jun 2016 20:09:05 +0000 Subject: [PATCH] Dashboard mock-up additions --- src/app/dashboard/charts/charts.component.ts | 33 ++++++++++--- src/app/dashboard/charts/charts.template.html | 19 +++++++ src/app/dashboard/dashboard.template.html | 49 ++++++++++++++++++- 3 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 src/app/dashboard/charts/charts.template.html diff --git a/src/app/dashboard/charts/charts.component.ts b/src/app/dashboard/charts/charts.component.ts index 6fad0d2..33b2186 100644 --- a/src/app/dashboard/charts/charts.component.ts +++ b/src/app/dashboard/charts/charts.component.ts @@ -2,26 +2,43 @@ import { Component, Input, AfterViewInit } from '@angular/core'; @Component({ selector: 'tb-charts', - template: '
' + templateUrl: 'app/dashboard/charts/charts.template.html' }) export class Charts implements AfterViewInit { @Input('chart-name') chartName: string; @Input('series') series: string; @Input('labels') labels: string; + @Input('table-head') tableHead: string; + + private percentages: number[]; + private data: number[]; + private words: string[]; + + constructor() { + this.percentages = []; + this.data = []; + this.words = []; + } ngAfterViewInit() { + this.data = this.convertToNumberArray(this.series.split(',')); + this.words = this.labels.split(','); + let data = { - series: this.convertToNumberArray(this.series.split(',')), - labels: this.labels.split(',') + series: this.data, + labels: this.words }, options = { donut: true, - donutWidth: 150, - labelInterpolationFnc: function(label, index) { - let value = data.series[index]; + donutWidth: 100, + labelInterpolationFnc: (label, index) => { + let value = data.series[index], + percent = Math.round(value / + data.series.reduce(Chartist.sum) * 100); - return label + ' ' + Math.round(value / - data.series.reduce(Chartist.sum) * 100) + '%'; + this.percentages.push(percent); + + return label + ' ' + percent + '%'; } }; diff --git a/src/app/dashboard/charts/charts.template.html b/src/app/dashboard/charts/charts.template.html new file mode 100644 index 0000000..9ba4fc6 --- /dev/null +++ b/src/app/dashboard/charts/charts.template.html @@ -0,0 +1,19 @@ +
+ + + + + + + + + + + + + + + + +
{{ tableHead }}Task CountPercentage
{{ words[i] }}{{ data[i] }}{{ percent }}%
+ diff --git a/src/app/dashboard/dashboard.template.html b/src/app/dashboard/dashboard.template.html index 20b88b8..e736840 100644 --- a/src/app/dashboard/dashboard.template.html +++ b/src/app/dashboard/dashboard.template.html @@ -100,13 +100,58 @@

Task Distribution by User

+ labels="admin,tester,user,another" + table-head="User">

Task Distribution by Column

+ labels="To Do,Doing,Done" + table-head="Column">
+ +
+

Activity Log

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
UserActionTimestamp
adminadmin added task Mockup Dashboard.5/22/2016 1:31:53 PMView Task
adminadmin added board Test.5/13/2016 4:16:46 PMView Board
adminadmin removed board Demo.5/11/2016 9:21:39 AM
adminadmin added board Demo.5/11/2016 9:18:26 AM
+
+