From e0c458eb0e471995ef6b0c525496685ebb6a959d Mon Sep 17 00:00:00 2001 From: Swagata Prateek Date: Fri, 7 Apr 2017 17:14:35 +0200 Subject: [PATCH] Adding a dummy datamap --- src/app/data/data.service.ts | 16 ++++++++++++++-- .../widget-layout/widget-layout.component.ts | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/app/data/data.service.ts b/src/app/data/data.service.ts index 2d432bb..6e4625f 100644 --- a/src/app/data/data.service.ts +++ b/src/app/data/data.service.ts @@ -39,7 +39,7 @@ export class DataService { } // INFO: Temporary test method to test out how a widget could have behaved. - getSampleWidgetConfig(): WidgetConfig { + getSampleWidgetConfig(): any { // INLINE query, these needs to be saved in the database of course let aggDocument: any = { 'aggregate': [ @@ -131,7 +131,19 @@ export class DataService { query: aggDocument, connectionId: connectionId, collectionName: collectionName, - type: 'bar-chart' + type: 'bar-chart', + datamap: { + 'labels': { + path: 'entry._id.CreateDate.$date', // Can be JSONPath? + type: 'datestring', + }, + 'datasets': [ + { + label: 'Orders', + path: 'count' + } + ] + } }; } diff --git a/src/app/ui-toolbox/widget-layout/widget-layout.component.ts b/src/app/ui-toolbox/widget-layout/widget-layout.component.ts index 786b35f..0936945 100644 --- a/src/app/ui-toolbox/widget-layout/widget-layout.component.ts +++ b/src/app/ui-toolbox/widget-layout/widget-layout.component.ts @@ -27,6 +27,7 @@ export class WidgetLayoutComponent implements OnInit { if (result) { // Need to parse this crap here let res: any[] = result; + console.log(res); for (let entry of res) { barChartLabels.push(new Date(entry._id.CreateDate.$date).toDateString()); jobCountArray.push(entry.count);