From 45b00739571bd07a22553372db10768a09c4f0f9 Mon Sep 17 00:00:00 2001 From: johc Date: Wed, 24 Apr 2024 16:01:21 +0200 Subject: [PATCH] Readded App Init over time --- .../user-session/user-session.component.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/fmd-telemetry/src/app/pages/stats/user-session/user-session.component.ts b/fmd-telemetry/src/app/pages/stats/user-session/user-session.component.ts index 47a00c5..2948230 100644 --- a/fmd-telemetry/src/app/pages/stats/user-session/user-session.component.ts +++ b/fmd-telemetry/src/app/pages/stats/user-session/user-session.component.ts @@ -97,6 +97,13 @@ export class UserSessionComponent implements OnInit { xField: 'day', yField: 'count' }); + + this.createLineChart(this.chartContainer6, this.groupSessionsByDate(), { + title: 'App Initializations Over Time', + xLabel: 'Date', + yLabel: 'Number of Sessions' + }); + } } @@ -234,6 +241,21 @@ export class UserSessionComponent implements OnInit { } + private groupSessionsByDate() { + const sessionCountsByDate: { [key: string]: Set } = {}; + + this.userData.forEach(session => { + const dateString = this.extractDateString(session._created_at); + if (dateString) { + const formattedDate = this.formatDate(dateString); + sessionCountsByDate[formattedDate] = sessionCountsByDate[formattedDate] || new Set(); + sessionCountsByDate[formattedDate].add(session.fmd_id); + } + }); + + return this.transformData(sessionCountsByDate); + } + private extractDateString(created_at: any): string | null { if (created_at && created_at.$date) { return created_at.$date; @@ -257,4 +279,8 @@ export class UserSessionComponent implements OnInit { })); } + + } + +