...
 
Commits (2)
......@@ -47,6 +47,8 @@ import { RewardsChartComponent } from "./components/charts/rewards/rewards.compo
import { RewardsCardComponent } from "./components/cards/rewards/rewards.component";
import { ActiveUsersChartComponent } from "./components/charts/active-users/active-users.component";
import { Graph } from "./graph.component";
import { PageviewsCardComponent } from "./components/cards/pageviews/pageviews.component";
import { PageviewsChartComponent } from "./components/charts/pageviews/pageviews.component";
PlotlyModule.plotlyjs = PlotlyJS;
......@@ -130,6 +132,8 @@ const routes: Routes = [
UserSegmentsChartComponent,
UserSegmentsCardComponent,
EngagementCardComponent,
PageviewsChartComponent,
PageviewsCardComponent,
Graph,
],
providers: [],
......
......@@ -6,36 +6,36 @@
<ng-container *ngIf="card.selectedOption=='hourly'">
<div class="m-analytics__average">
<h6>AVG HAU (Unique)</h6>
<h6>AVG Hourly Unique Visits</h6>
<h5>{{hauUnique | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>AVG HAU (Logged In)</h6>
<h6>AVG Hourly Active Users</h6>
<h5>{{hauLoggedIn | number : '1.0-0'}}</h5>
</div>
</ng-container>
<ng-container *ngIf="card.selectedOption=='daily'">
<div class="m-analytics__average">
<h6>AVG DAU (Unique)</h6>
<h6>AVG Daily Unique Visits</h6>
<h5>{{dauUnique | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>AVG DAU (Logged In)</h6>
<h6>AVG Daily Active Users</h6>
<h5>{{dauLoggedIn | number : '1.0-0'}}</h5>
</div>
</ng-container>
<ng-container *ngIf="card.selectedOption=='monthly'">
<div class="m-analytics__average">
<h6>AVG MAU (Unique)</h6>
<h6>AVG Monthly Unique Vists</h6>
<h5>{{mauUnique | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>AVG MAU (Logged In)</h6>
<h6>AVG Monthly Active Users</h6>
<h5>{{mauLoggedIn | number : '1.0-0'}}</h5>
</div>
......@@ -46,7 +46,14 @@
</ng-container>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currents">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__activeusers [timespan]="card.selectedOption"></m-analyticscharts__activeusers>
<m-analyticscharts__activeusers [timespan]="card.selectedOption" (loaded)="currents = $event"></m-analyticscharts__activeusers>
</div>
</m-analytics__card>
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { AnalyticsCardComponent } from "../card/card.component";
import { Subscription } from "rxjs";
@Component({
selector: 'm-analyticsactiveusers__card',
......@@ -7,6 +9,10 @@ import { Client } from "../../../../../services/api/client";
})
export class ActiveUsersCardComponent implements OnInit {
@ViewChild('card', { static: true }) card: AnalyticsCardComponent;
subscription: Subscription;
hauUnique: number = 0;
hauLoggedIn: number = 0;
mauUnique: number = 0;
......@@ -14,37 +20,47 @@ export class ActiveUsersCardComponent implements OnInit {
dauUnique: number = 0;
dauLoggedIn: number = 0;
total: number = 0;
currents: { name: string, value: number }[];
constructor(private client: Client) { }
constructor(private client: Client) {
}
ngOnInit() {
this.getAvgData();
this.subscription = this.card.selectedOptionChange.subscribe(() => {
this.getAvgData();
});
}
private async getAvgData() {
try {
let avgs: Array<any> = await Promise.all([
this.client.get('api/v2/analytics/avgpageviews', { key: 'mau_unique' }),
this.client.get('api/v2/analytics/avgpageviews', { key: 'mau_loggedin' }),
this.client.get('api/v2/analytics/avgpageviews', { key: 'dau_loggedin' }),
this.client.get('api/v2/analytics/avgpageviews', { key: 'dau_unique' }),
this.client.get('api/v2/analytics/avgpageviews', { key: 'hau_unique' }),
this.client.get('api/v2/analytics/avgpageviews', { key: 'hau_loggedin' }),
this.client.get('api/v2/analytics/activeusers', {
key: 'avg',
timespan: 'hourly',
}),
this.client.get('api/v2/analytics/activeusers', {
key: 'avg',
timespan: 'daily',
}),
this.client.get('api/v2/analytics/activeusers', {
key: 'avg',
timespan: 'monthly',
}),
this.client.get('api/v2/analytics/avgpageviews', { key: 'total_pageviews' })
]);
this.mauUnique = avgs[0].data;
this.mauLoggedIn = avgs[1].data;
this.dauLoggedIn = avgs[2].data;
this.dauUnique = avgs[3].data;
this.hauUnique = avgs[0].data.uniqueHAU;
this.hauLoggedIn = avgs[0].data.loggedInHAU;
this.hauUnique = avgs[4].data;
this.dauUnique = avgs[1].data.uniqueDAU;
this.dauLoggedIn = avgs[1].data.loggedInDAU;
this.hauLoggedIn = avgs[5].data;
this.mauUnique = avgs[2].data.uniqueMAU;
this.mauLoggedIn = avgs[2].data.loggedInMAU;
this.total = avgs[6].data;
this.total = avgs[3].data;
} catch (e) {
console.error(e);
}
......
......@@ -3,8 +3,27 @@
[options]="['hourly', 'daily', 'monthly']"
#posts>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Posts</h6>
<h5>{{avgPosts | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Posting Users</h6>
<h5>{{avgPostingUsers | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentPosts">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__posts [timespan]="posts.selectedOption"></m-analyticscharts__posts>
<m-analyticscharts__posts [timespan]="posts.selectedOption" (loaded)="currentPosts = $event"></m-analyticscharts__posts>
</div>
</m-analytics__card>
......@@ -13,8 +32,27 @@
[options]="['hourly', 'daily', 'monthly']"
#comments>
<div class="m-analyticsCard__charts">
<m-analyticscharts__comments [timespan]="comments.selectedOption"></m-analyticscharts__comments>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Comments</h6>
<h5>{{avgComments | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Commenting Users</h6>
<h5>{{avgCommentingUsers | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentComments">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__comments [timespan]="comments.selectedOption" (loaded)="currentComments = $event"></m-analyticscharts__comments>
</div>
</m-analytics__card>
......@@ -23,8 +61,27 @@
[options]="['hourly', 'daily', 'monthly']"
#votes>
<div class="m-analyticsCard__charts">
<m-analyticscharts__votes [timespan]="votes.selectedOption"></m-analyticscharts__votes>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Votes</h6>
<h5>{{avgVotes | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Voting Users</h6>
<h5>{{avgVotingUsers | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentVotes">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__votes [timespan]="votes.selectedOption" (loaded)="currentVotes = $event"></m-analyticscharts__votes>
</div>
</m-analytics__card>
......@@ -33,7 +90,26 @@
[options]="['hourly', 'daily', 'monthly']"
#reminds>
<div class="m-analyticsCard__charts">
<m-analyticscharts__reminds [timespan]="reminds.selectedOption"></m-analyticscharts__reminds>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Reminds</h6>
<h5>{{avgReminds | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Reminding Users</h6>
<h5>{{avgRemindingUsers | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentReminds">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__reminds [timespan]="reminds.selectedOption" (loaded)="currentReminds = $event"></m-analyticscharts__reminds>
</div>
</m-analytics__card>
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewChild } from '@angular/core';
import { AnalyticsCardComponent } from "../card/card.component";
import { Client } from "../../../../../services/api/client";
@Component({
selector: 'm-analyticsengagement__card',
......@@ -6,9 +8,104 @@ import { Component, OnInit } from '@angular/core';
})
export class EngagementCardComponent implements OnInit {
constructor() {
@ViewChild('posts', { static: true }) posts: AnalyticsCardComponent;
@ViewChild('comments', { static: true }) comments: AnalyticsCardComponent;
@ViewChild('votes', { static: true }) votes: AnalyticsCardComponent;
@ViewChild('reminds', { static: true }) reminds: AnalyticsCardComponent;
avgPosts: number = 0;
avgPostingUsers: number = 0;
currentPosts: { name: string, value: number }[];
avgComments: number = 0;
avgCommentingUsers: number = 0;
currentComments: { name: string, value: number }[];
avgVotes: number = 0;
avgVotingUsers: number = 0;
currentVotes: { name: string, value: number }[];
avgReminds: number = 0;
avgRemindingUsers: number = 0;
currentReminds: { name: string, value: number }[];
constructor(private client: Client) {
}
ngOnInit() {
this.getAvgPosts();
this.getAvgComments();
this.getAvgVotes();
this.getAvgReminds();
this.posts.selectedOptionChange.subscribe(() => {
this.getAvgPosts();
});
this.comments.selectedOptionChange.subscribe(() => {
this.getAvgComments();
});
this.votes.selectedOptionChange.subscribe(() => {
this.getAvgVotes();
});
this.reminds.selectedOptionChange.subscribe(() => {
this.getAvgReminds();
});
}
private async getAvgPosts() {
try {
const response: any = await this.client.get('api/v2/analytics/posts', {
key: 'avg',
timespan: this.posts.selectedOption,
});
this.avgPosts = response.data.posts;
this.avgPostingUsers = response.data.postingUsers;
} catch (e) {
console.error(e);
}
}
private async getAvgComments() {
try {
const response: any = await this.client.get('api/v2/analytics/comments', {
key: 'avg',
timespan: this.comments.selectedOption,
});
this.avgComments = response.data.comments;
this.avgCommentingUsers = response.data.commentingUsers;
} catch (e) {
console.error(e);
}
}
private async getAvgVotes() {
try {
const response: any = await this.client.get('api/v2/analytics/votes', {
key: 'avg',
timespan: this.votes.selectedOption,
});
this.avgVotes = response.data.votes;
this.avgVotingUsers = response.data.votingUsers;
} catch (e) {
console.error(e);
}
}
private async getAvgReminds() {
try {
const response: any = await this.client.get('api/v2/analytics/reminds', {
key: 'avg',
timespan: this.reminds.selectedOption,
});
this.avgReminds = response.data.reminds;
this.avgRemindingUsers = response.data.remindingUsers;
} catch (e) {
console.error(e);
}
}
}
......@@ -3,8 +3,27 @@
[options]="['daily', 'monthly']"
#completed
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Newsfeed</h6>
<h5>{{avgNewsfeedCompleted | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Content</h6>
<h5>{{avgContentCompleted | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentCompleted">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__offchainboosts [analytics]="'completed'" [timespan]="completed.selectedOption"></m-analyticscharts__offchainboosts>
<m-analyticscharts__offchainboosts [analytics]="'completed'" [timespan]="completed.selectedOption" (loaded)="currentCompleted = $event"></m-analyticscharts__offchainboosts>
</div>
</m-analytics__card>
......@@ -13,8 +32,27 @@
[options]="['daily', 'monthly']"
#notcompleted
>
<div class="m-analyticsCard__charts">
<m-analyticscharts__offchainboosts [analytics]="'not_completed'" [timespan]="notcompleted.selectedOption"></m-analyticscharts__offchainboosts>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Newsfeed</h6>
<h5>{{avgNewsfeedNotCompleted | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Content</h6>
<h5>{{avgContentNotCompleted | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentNotCompleted">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__offchainboosts [analytics]="'not_completed'" [timespan]="notcompleted.selectedOption" (loaded)="currentNotCompleted = $event"></m-analyticscharts__offchainboosts>
</div>
</m-analytics__card>
......@@ -23,8 +61,27 @@
[options]="['daily', 'monthly']"
#revoked
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Newsfeed</h6>
<h5>{{avgNewsfeedRevoked | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Content</h6>
<h5>{{avgContentRevoked | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentRevoked">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__offchainboosts [analytics]="'revoked'" [timespan]="revoked.selectedOption"></m-analyticscharts__offchainboosts>
<m-analyticscharts__offchainboosts [analytics]="'revoked'" [timespan]="revoked.selectedOption" (loaded)="currentRevoked = $event"></m-analyticscharts__offchainboosts>
</div>
</m-analytics__card>
......@@ -33,8 +90,27 @@
[options]="['daily', 'monthly']"
#rejected
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Newsfeed</h6>
<h5>{{avgNewsfeedRejected | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Content</h6>
<h5>{{avgContentRejected | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentRejected">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__offchainboosts [analytics]="'rejected'" [timespan]="rejected.selectedOption"></m-analyticscharts__offchainboosts>
<m-analyticscharts__offchainboosts [analytics]="'rejected'" [timespan]="rejected.selectedOption" (loaded)="currentRejected = $event"></m-analyticscharts__offchainboosts>
</div>
</m-analytics__card>
......@@ -42,19 +118,58 @@
[title]="'Offchain Boosts: Users (Completed)'"
[options]="['daily', 'monthly']"
#userscompleted
>
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Newsfeed</h6>
<h5>{{avgNewsfeedUsersCompleted | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Content</h6>
<h5>{{avgContentUsersCompleted | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentUsersCompleted">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__offchainboosts [analytics]="'users_who_completed'" [timespan]="userscompleted.selectedOption"></m-analyticscharts__offchainboosts>
<m-analyticscharts__offchainboosts [analytics]="'users_who_completed'" [timespan]="userscompleted.selectedOption" (loaded)="currentUsersCompleted = $event"></m-analyticscharts__offchainboosts>
</div>
</m-analytics__card>
<m-analytics__card
[title]="'Offchain Boosts: Users (Pending)'"
[options]="['daily', 'monthly']"
[options]="['daily']"
[defaultOption]="'daily'"
#userspending
>
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Newsfeed</h6>
<h5>{{avgNewsfeedUsersAwaitingCompletion | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Content</h6>
<h5>{{avgContentUsersAwaitingCompletion | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentUsersAwaitingCompletion">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__offchainboosts [analytics]="'users_waiting_for_completion'" [timespan]="userspending.selectedOption"></m-analyticscharts__offchainboosts>
<m-analyticscharts__offchainboosts [analytics]="'users_waiting_for_completion'" [timespan]="userspending.selectedOption" (loaded)="currentUsersAwaitingCompletion = $event"></m-analyticscharts__offchainboosts>
</div>
</m-analytics__card>
......@@ -62,9 +177,28 @@
[title]="'Offchain Boosts: Reclaimed Tokens'"
[options]="['daily', 'monthly']"
#reclaimedtokens
>
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Newsfeed</h6>
<h5>{{avgNewsfeedReclaimed | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Content</h6>
<h5>{{avgContentReclaimed | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentReclaimed">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__offchainboosts [analytics]="'reclaimed_tokens'" [timespan]="reclaimedtokens.selectedOption"></m-analyticscharts__offchainboosts>
<m-analyticscharts__offchainboosts [analytics]="'reclaimed_tokens'" [timespan]="reclaimedtokens.selectedOption" (loaded)="currentReclaimed = $event"></m-analyticscharts__offchainboosts>
</div>
</m-analytics__card>
......@@ -72,8 +206,26 @@
[title]="'Offchain Boosts: Impressions Served'"
[options]="['daily', 'monthly']"
#impressions
>
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Newsfeed</h6>
<h5>{{avgNewsfeedImpressions | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Content</h6>
<h5>{{avgContentImpressions | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentImpressions">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__offchainboosts [analytics]="'impressions_served'" [timespan]="impressions.selectedOption"></m-analyticscharts__offchainboosts>
<m-analyticscharts__offchainboosts [analytics]="'impressions_served'" [timespan]="impressions.selectedOption" (loaded)="currentImpressions = $event"></m-analyticscharts__offchainboosts>
</div>
</m-analytics__card>
import { Component } from '@angular/core';
import { Component, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { AnalyticsCardComponent } from "../card/card.component";
@Component({
selector: 'm-analyticsoffchainboosts__card',
......@@ -6,5 +8,203 @@ import { Component } from '@angular/core';
})
export class OffChainBoostsCardComponent {
@ViewChild('completed', { static: true }) completed: AnalyticsCardComponent;
@ViewChild('notcompleted', { static: true }) notcompleted: AnalyticsCardComponent;
@ViewChild('revoked', { static: true }) revoked: AnalyticsCardComponent;
@ViewChild('rejected', { static: true }) rejected: AnalyticsCardComponent;
@ViewChild('userscompleted', { static: true }) userscompleted: AnalyticsCardComponent;
@ViewChild('userspending', { static: true }) userspending: AnalyticsCardComponent;
@ViewChild('reclaimedtokens', { static: true }) reclaimedtokens: AnalyticsCardComponent;
@ViewChild('impressions', { static: true }) impressions: AnalyticsCardComponent;
avgNewsfeedCompleted: number = 0;
avgContentCompleted: number = 0;
avgNewsfeedNotCompleted: number = 0;
avgContentNotCompleted: number = 0;
avgNewsfeedRevoked: number = 0;
avgContentRevoked: number = 0;
avgNewsfeedRejected: number = 0;
avgContentRejected: number = 0;
avgNewsfeedUsersCompleted: number = 0;
avgContentUsersCompleted: number = 0;
avgNewsfeedUsersAwaitingCompletion: number = 0;
avgContentUsersAwaitingCompletion: number = 0;
avgNewsfeedReclaimed: number = 0;
avgContentReclaimed: number = 0;
avgNewsfeedImpressions: number = 0;
avgContentImpressions: number = 0;
currentCompleted: { name: string, value: number }[];
currentNotCompleted: { name: string, value: number }[];
currentRevoked: { name: string, value: number }[];
currentRejected: { name: string, value: number }[];
currentUsersCompleted: { name: string, value: number }[];
currentUsersAwaitingCompletion: { name: string, value: number }[];
currentReclaimed: { name: string, value: number }[];
currentImpressions: { name: string, value: number }[];
constructor(private client: Client) {
}
ngOnInit() {
this.getAvgCompleted();
this.getAvgNotCompleted();
this.getAvgRevoked();
this.getAvgRejected();
this.getAvgUsersCompleted();
this.getAvgUsersAwaitingCompletion();
this.getAvgReclaimed();
this.getAvgImpressions();
this.completed.selectedOptionChange.subscribe(() => {
this.getAvgCompleted();
});
this.notcompleted.selectedOptionChange.subscribe(() => {
this.getAvgNotCompleted();
});
this.revoked.selectedOptionChange.subscribe(() => {
this.getAvgRevoked();
});
this.rejected.selectedOptionChange.subscribe(() => {
this.getAvgRejected();
});
this.userscompleted.selectedOptionChange.subscribe(() => {
this.getAvgUsersCompleted();
});
this.userspending.selectedOptionChange.subscribe(() => {
this.getAvgUsersAwaitingCompletion();
});
this.reclaimedtokens.selectedOptionChange.subscribe(() => {
this.getAvgReclaimed();
});
this.impressions.selectedOptionChange.subscribe(() => {
this.getAvgImpressions();
});
}
private async getAvgCompleted() {
try {
const response: any = await this.client.get('api/v2/analytics/offchainboosts', {
key: 'completed_avg',
timespan: this.completed.selectedOption,
});
this.avgNewsfeedCompleted = response.data.newsfeed;
this.avgContentCompleted = response.data.content;
} catch (e) {
console.error(e);
}
}
private async getAvgNotCompleted() {
try {
const response: any = await this.client.get('api/v2/analytics/offchainboosts', {
key: 'not_completed_avg',
timespan: this.notcompleted.selectedOption,
});
this.avgNewsfeedNotCompleted = response.data.newsfeed;
this.avgContentNotCompleted = response.data.content;
} catch (e) {
console.error(e);
}
}
private async getAvgRevoked() {
try {
const response: any = await this.client.get('api/v2/analytics/offchainboosts', {
key: 'revoked_avg',
timespan: this.revoked.selectedOption,
});
this.avgNewsfeedRevoked = response.data.newsfeed;
this.avgContentRevoked = response.data.content;
} catch (e) {
console.error(e);
}
}
private async getAvgRejected() {
try {
const response: any = await this.client.get('api/v2/analytics/offchainboosts', {
key: 'rejected_avg',
timespan: this.rejected.selectedOption,
});
this.avgNewsfeedRejected = response.data.newsfeed;
this.avgContentRejected = response.data.content;
} catch (e) {
console.error(e);
}
}
private async getAvgUsersCompleted() {
try {
const response: any = await this.client.get('api/v2/analytics/offchainboosts', {
key: 'users_who_completed_avg',
timespan: this.userscompleted.selectedOption,
});
this.avgNewsfeedUsersCompleted = response.data.newsfeed;
this.avgContentUsersCompleted = response.data.content;
} catch (e) {
console.error(e);
}
}
private async getAvgUsersAwaitingCompletion() {
try {
const response: any = await this.client.get('api/v2/analytics/offchainboosts', {
key: 'users_waiting_for_completion_avg',
timespan: this.userspending.selectedOption,
});
this.avgNewsfeedUsersAwaitingCompletion = response.data.newsfeed;
this.avgContentUsersAwaitingCompletion = response.data.content;
} catch (e) {
console.error(e);
}
}
private async getAvgReclaimed() {
try {
const response: any = await this.client.get('api/v2/analytics/offchainboosts', {
key: 'reclaimed_tokens_avg',
timespan: this.reclaimedtokens.selectedOption,
});
this.avgNewsfeedReclaimed = response.data.newsfeed;
this.avgContentReclaimed = response.data.content;
} catch (e) {
console.error(e);
}
}
private async getAvgImpressions() {
try {
const response: any = await this.client.get('api/v2/analytics/offchainboosts', {
key: 'impressions_served_avg',
timespan: this.impressions.selectedOption,
});
this.avgNewsfeedImpressions = response.data.newsfeed;
this.avgContentImpressions = response.data.content;
} catch (e) {
console.error(e);
}
}
}
......@@ -4,24 +4,28 @@
#card
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Overall Avg Reclaimed Tokens</h6>
<h5>{{reclaimedTokens | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Number of Plus Users</h6>
<h6>Avg Plus Users</h6>
<h5>{{users | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Plus Transactions</h6>
<h5>{{transactions | number : '1.0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currents">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__offchainplus [timespan]="card.selectedOption"></m-analyticscharts__offchainplus>
<m-analyticscharts__offchainplus [timespan]="card.selectedOption" (loaded)="currents = $event"></m-analyticscharts__offchainplus>
</div>
</m-analytics__card>
......@@ -13,6 +13,7 @@ export class OffChainPlusCardComponent {
reclaimedTokens: number = 0;
users: number = 0;
transactions: number = 0;
currents: { name: string, value: number }[];
constructor(private client: Client) {
}
......@@ -23,24 +24,14 @@ export class OffChainPlusCardComponent {
private async getAvgData() {
try {
let avgs: Array<any> = await Promise.all([
this.client.get('api/v2/analytics/offchainplus', {
key: 'average_reclaimed_tokens',
timespan: this.card.selectedOption
}),
this.client.get('api/v2/analytics/offchainplus', {
key: 'average_plus_users',
timespan: this.card.selectedOption
}),
this.client.get('api/v2/analytics/offchainplus', {
key: 'average_plus_tx',
timespan: this.card.selectedOption
}),
]);
this.reclaimedTokens = avgs[0].data;
this.users = avgs[1].data;
this.transactions = avgs[2].data;
const response: any = await this.client.get('api/v2/analytics/offchainplus', {
key: 'avg',
timespan: this.card.selectedOption
});
this.reclaimedTokens = response.data.tokens;
this.users = response.data.users;
this.transactions = response.data.transactions;
} catch (e) {
console.error(e);
}
......
......@@ -3,29 +3,34 @@
[options]="['daily', 'monthly']"
#card>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Wired Tokens</h6>
<h5>{{tokens | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Number of Transactions</h6>
<h6>Avg Transactions</h6>
<h5>{{transactions | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Number of Wire Receivers</h6>
<h6>Avg Wire Receivers</h6>
<h5>{{receivers | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Number of Wire Senders</h6>
<h6>Avg Wire Senders</h6>
<h5>{{senders | number : '1.0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currents">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__offchainwire [timespan]="card.selectedOption"></m-analyticscharts__offchainwire>
<m-analyticscharts__offchainwire [timespan]="card.selectedOption" (loaded)="currents = $event"></m-analyticscharts__offchainwire>
</div>
</m-analytics__card>
......@@ -17,6 +17,7 @@ export class OffchainWireCardComponent implements OnInit {
transactions: number = 0;
receivers: number = 0;
senders: number = 0;
currents: { name: string, value: number }[];
constructor(private client: Client) {
}
......@@ -35,29 +36,15 @@ export class OffchainWireCardComponent implements OnInit {
private async getAvgData() {
try {
let avgs: Array<any> = await Promise.all([
this.client.get('api/v2/analytics/offchainwire', {
key: 'average_tokens',
timespan: this.card.selectedOption
}),
this.client.get('api/v2/analytics/offchainwire', {
key: 'average',
timespan: this.card.selectedOption
}),
this.client.get('api/v2/analytics/offchainwire', {
key: 'average_receivers',
timespan: this.card.selectedOption
}),
this.client.get('api/v2/analytics/offchainwire', {
key: 'average_senders',
timespan: this.card.selectedOption
}),
]);
this.tokens = avgs[0].data;
this.transactions = avgs[1].data;
this.receivers = avgs[2].data;
this.senders = avgs[3].data;
const response: any = await this.client.get('api/v2/analytics/offchainwire', {
key: 'avg',
timespan: this.card.selectedOption
});
this.tokens = response.data.tokens;
this.transactions = response.data.transactions;
this.receivers = response.data.receivers;
this.senders = response.data.senders;
} catch (e) {
console.error(e);
}
......
......@@ -4,23 +4,30 @@
#card
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>AVG Boosts</h6>
<h6>Avg Boosts</h6>
<h5>{{average | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>AVG Reclaimed Tokens Boosts</h6>
<h6>Avg Reclaimed Tokens</h6>
<h5>{{averageReclaimedTokens | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>AVG Users that Used Boosts</h6>
<h6>Avg Users that Used Boosts</h6>
<h5>{{averageUsers | number : '1.0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currents">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__onchainboosts [timespan]="card.selectedOption"></m-analyticscharts__onchainboosts>
<m-analyticscharts__onchainboosts [timespan]="card.selectedOption" (loaded)="currents = $event"></m-analyticscharts__onchainboosts>
</div>
</m-analytics__card>
......@@ -18,6 +18,7 @@ export class OnChainBoostsCardComponent {
average: number = 0;
averageReclaimedTokens: number = 0;
averageUsers: number = 0;
currents: { name: string, value: number }[];
constructor(private client: Client) {
}
......@@ -37,17 +38,16 @@ export class OnChainBoostsCardComponent {
private async getAvgData() {
try {
let avgs: Array<any> = await Promise.all([
this.client.get('api/v2/analytics/onchainboosts', { key: 'average', timespan: this.timespan }),
this.client.get('api/v2/analytics/onchainboosts', { key: 'average_reclaimed_tokens', timespan: this.timespan }),
this.client.get('api/v2/analytics/onchainboosts', { key: 'average_users', timespan: this.timespan }),
]);
const response: any = await this.client.get('api/v2/analytics/onchainboosts', {
key: 'avg',
timespan: this.timespan
});
this.average = avgs[0].data;
this.average = response.data.transactions;
this.averageReclaimedTokens = avgs[1].data;
this.averageReclaimedTokens = response.data.reclaimedTokens;
this.averageUsers = avgs[2].data;
this.averageUsers = response.data.users;
} catch (e) {
console.error(e);
}
......
......@@ -4,24 +4,29 @@
#card
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Overall Avg Reclaimed Tokens</h6>
<h5>{{reclaimedTokens | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Number of Plus Users</h6>
<h6>Avg Plus Users</h6>
<h5>{{users | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Plus Transactions</h6>
<h5>{{transactions | number : '1.0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currents">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__onchainplus [timespan]="card.selectedOption"></m-analyticscharts__onchainplus>
<m-analyticscharts__onchainplus [timespan]="card.selectedOption" (loaded)="currents = $event"></m-analyticscharts__onchainplus>
</div>
</m-analytics__card>
......@@ -13,6 +13,7 @@ export class OnChainPlusCardComponent {
reclaimedTokens: number = 0;
users: number = 0;
transactions: number = 0;
currents: { name: string, value: number }[];
constructor(private client: Client) {
}
......@@ -23,24 +24,14 @@ export class OnChainPlusCardComponent {
private async getAvgData() {
try {
let avgs: Array<any> = await Promise.all([
this.client.get('api/v2/analytics/onchainplus', {
key: 'average_reclaimed_tokens',
timespan: this.card.selectedOption
}),
this.client.get('api/v2/analytics/onchainplus', {
key: 'average_plus_users',
timespan: this.card.selectedOption
}),
this.client.get('api/v2/analytics/onchainplus', {
key: 'average_plus_tx',
timespan: this.card.selectedOption
}),
]);
this.reclaimedTokens = avgs[0].data;
this.users = avgs[1].data;
this.transactions = avgs[2].data;
const response: any = await this.client.get('api/v2/analytics/onchainplus', {
key: 'avg',
timespan: this.card.selectedOption
});
this.reclaimedTokens = response.data.tokens;
this.users = response.data.users;
this.transactions = response.data.transactions;
} catch (e) {
console.error(e);
}
......
<m-analytics__card
[title]="'OnChain Wire'"
[options]="['daily', 'monthly']"
#card>
#card
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Wired Tokens</h6>
<h5>{{tokens | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Number of Transactions</h6>
<h6>Avg Transactions</h6>
<h5>{{transactions | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Number of Wire Receivers</h6>
<h6>Avg Wire Receivers</h6>
<h5>{{receivers | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Number of Wire Senders</h6>
<h6>Avg Wire Senders</h6>
<h5>{{senders | number : '1.0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currents">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__onchainwire [timespan]="card.selectedOption"></m-analyticscharts__onchainwire>
<m-analyticscharts__onchainwire [timespan]="card.selectedOption" (loaded)="currents = $event"></m-analyticscharts__onchainwire>
</div>
</m-analytics__card>
......@@ -17,6 +17,7 @@ export class OnchainWireCardComponent implements OnInit {
transactions: number = 0;
receivers: number = 0;
senders: number = 0;
currents: { name: string, value: number }[];
constructor(private client: Client) {
}
......@@ -35,29 +36,15 @@ export class OnchainWireCardComponent implements OnInit {
private async getAvgData() {
try {
let avgs: Array<any> = await Promise.all([
this.client.get('api/v2/analytics/onchainwire', {
key: 'average_tokens',
timespan: this.card.selectedOption
}),
this.client.get('api/v2/analytics/onchainwire', {
key: 'average',
timespan: this.card.selectedOption
}),
this.client.get('api/v2/analytics/onchainwire', {
key: 'average_receivers',
timespan: this.card.selectedOption
}),
this.client.get('api/v2/analytics/onchainwire', {
key: 'average_senders',
timespan: this.card.selectedOption
}),
]);
this.tokens = avgs[0].data;
this.transactions = avgs[1].data;
this.receivers = avgs[2].data;
this.senders = avgs[3].data;
const response: any = await this.client.get('api/v2/analytics/onchainwire', {
key: 'avg',
timespan: this.card.selectedOption
});
this.tokens = response.data.tokens;
this.transactions = response.data.transactions;
this.receivers = response.data.receivers;
this.senders = response.data.senders;
} catch (e) {
console.error(e);
}
......
<m-analytics__card
[title]="'Pageviews'"
[options]="['daily', 'monthly']"
#card
>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currents">
<h6>Avg Pageviews</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average" *ngFor="let current of currents">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__pageviews [timespan]="card.selectedOption" (loaded)="currents = $event"></m-analyticscharts__pageviews>
<m-analyticscharts__pageviews [timespan]="card.selectedOption" [pie]="true"></m-analyticscharts__pageviews>
</div>
</m-analytics__card>
import { Component, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { AnalyticsCardComponent } from "../card/card.component";
@Component({
selector: 'm-analyticspageviews__card',
templateUrl: 'pageviews.component.html'
})
export class PageviewsCardComponent {
@ViewChild('card', { static: true }) card: AnalyticsCardComponent;
currents: { name: string, value: number }[];
avgPageviews: number = 0;
constructor(private client: Client) {
}
ngOnInit() {
this.getAvgData();
this.card.selectedOptionChange.subscribe(() => {
this.getAvgData();
});
}
private async getAvgData() {
try {
const response: any = await this.client.get('api/v2/analytics/pageviews', {
key: 'avg',
timespan: this.card.selectedOption,
});
this.avgPageviews = response.data.pageviews;
} catch (e) {
console.error(e);
}
}
}
<m-analytics__card
[title]="'Rewards'"
[options]="['daily', 'monthly']"
#card>
#card
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Transactions</h6>
<h5>{{avgTransactions | number : '1.0-0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Rewarded Tokens</h6>
<h5>{{avgRewardedTokens | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currents">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__rewards [timespan]="card.selectedOption"></m-analyticscharts__rewards>
<m-analyticscharts__rewards [timespan]="card.selectedOption" (loaded)="currents = $event"></m-analyticscharts__rewards>
</div>
</m-analytics__card>
import { Component } from '@angular/core';
import { Component, ViewChild } from '@angular/core';
import { AnalyticsCardComponent } from "../card/card.component";
import { Client } from "../../../../../services/api/client";
import { Subscription } from "rxjs";
@Component({
selector: 'm-analyticsrewards__card',
......@@ -6,5 +9,41 @@ import { Component } from '@angular/core';
})
export class RewardsCardComponent {
@ViewChild('card', { static: true }) card: AnalyticsCardComponent;
subscription: Subscription;
avgTransactions: number = 0;
avgRewardedTokens: number = 0;
currents: { name: string, value: number }[];
constructor(private client: Client) {
}
ngOnInit() {
this.getAvgData();
this.subscription = this.card.selectedOptionChange.subscribe(() => {
this.getAvgData();
});
}
ngOnDestroy() {
this.subscription.unsubscribe();
}
private async getAvgData() {
try {
const response: any = await this.client.get('api/v2/analytics/rewards', {
key: 'avg',
timespan: this.card.selectedOption
});
this.avgTransactions = response.data.tokens;
this.avgRewardedTokens = response.data.transactions;
} catch (e) {
console.error(e);
}
}
}
<m-analytics__card
[title]="'Token Sales'"
[options]="['daily', 'monthly']"
#card>
#card
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Sold Tokens</h6>
<h5>{{tokens | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Number of Sales Tx</h6>
<h6>Avg Sales Tx</h6>
<h5>{{sales | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Number of Token Buyers</h6>
<h6>Avg Token Buyers</h6>
<h5>{{buyers | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Eth Earned</h6>
<h5>{{ethEarned | number : '1.0'}}</h5>
<h6>Avg Eth Value</h6>
<h5>{{ethValue | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Avg Eth/Usd Rate</h6>
<h5>{{ethUsdRate | number : '1.0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentSales">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__tokensales [analytics]="'sales'" [timespan]="card.selectedOption" (loaded)="currentSales = $event"></m-analyticscharts__tokensales>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currentRates">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__tokensales [analytics]="'sales'" [timespan]="card.selectedOption"></m-analyticscharts__tokensales>
<m-analyticscharts__tokensales [analytics]="'rates'" [timespan]="card.selectedOption"></m-analyticscharts__tokensales>
<m-analyticscharts__tokensales [analytics]="'rates'" [timespan]="card.selectedOption" (loaded)="currentRates = $event"></m-analyticscharts__tokensales>
</div>
</m-analytics__card>
......@@ -16,8 +16,10 @@ export class TokenSalesCardComponent implements OnInit {
tokens: number = 0;
sales: number = 0;
buyers: number = 0;
ethEarned: number = 0;
ethValue: number = 0;
ethUsdRate: number = 0;
currentSales: { name: string, value: number }[];
currentRates: { name: string, value: number }[];
constructor(private client: Client) {
}
......@@ -37,21 +39,24 @@ export class TokenSalesCardComponent implements OnInit {
private async getAvgData() {
try {
let avgs: Array<any> = await Promise.all([
this.client.get('api/v2/analytics/tokensales', { key: 'average_sold' }),
this.client.get('api/v2/analytics/tokensales', { key: 'average_sales' }),
this.client.get('api/v2/analytics/tokensales', { key: 'average_buyers' }),
this.client.get('api/v2/analytics/tokensales', { key: 'average_eth_earned' }),
this.client.get('api/v2/analytics/tokensales', { key: 'average_eth_usd_rate' }),
this.client.get('api/v2/analytics/tokensales', {
key: '_avg',
timespan: this.card.selectedOption
}),
this.client.get('api/v2/analytics/tokensales', {
key: 'monthly_rate_avg',
timespan: this.card.selectedOption
}),
]);
this.tokens = avgs[0].data;
this.tokens = avgs[0].data.tokens;
this.sales = avgs[1].data;
this.sales = avgs[0].data.transactions;
this.buyers = avgs[2].data;
this.buyers = avgs[0].data.buyers;
this.ethEarned = avgs[3].data;
this.ethValue = avgs[1].data.ethValue;
this.ethUsdRate = avgs[4].data;
this.ethUsdRate = avgs[1].data.ethUsdRate;
} catch (e) {
console.error(e);
......
<m-analytics__card
[title]="'User Segments'"
[options]="['daily', 'monthly']"
#card>
[options]="['daily']"
defaultOption="daily"
#card
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Resurrected (Avg)</h6>
<h5>{{resurrected | number : '1.0'}}</h5>
<h6>Curious (Avg)</h6>
<h5>{{curious | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>New (Avg)</h6>
<h5>{{new | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Curious (Avg)</h6>
<h5>{{curious | number : '1.0'}}</h5>
<h6>Casual (Avg)</h6>
<h5>{{casual | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Core (Avg)</h6>
<h5>{{core | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Cold (Avg)</h6>
<h5>{{cold | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>Casual (Avg)</h6>
<h5>{{casual | number : '1.0'}}</h5>
<h6>Resurrected (Avg)</h6>
<h5>{{resurrected | number : '1.0'}}</h5>
</div>
<div class="m-analytics__average">
<h6>New (Avg)</h6>
<h5>{{new | number : '1.0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currents">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__usersegments [timespan]="card.selectedOption"></m-analyticscharts__usersegments>
<m-analyticscharts__usersegments [timespan]="card.selectedOption" (loaded)="currents = $event"></m-analyticscharts__usersegments>
</div>
</m-analytics__card>
......@@ -19,6 +19,7 @@ export class UserSegmentsCardComponent implements OnInit {
core: number = 0;
cold: number = 0;
casual: number = 0;
currents: { name: string, value: number }[];
constructor(private client: Client) {
}
......@@ -32,7 +33,8 @@ export class UserSegmentsCardComponent implements OnInit {
}
ngOnDestroy() {
this.subscription.unsubscribe();
if (this.subscription)
this.subscription.unsubscribe();
}
private async getAvgData() {
......
<m-analytics__card
[title]="'Withdraw'"
[options]="['daily', 'monthly']"
#card>
#card
>
<div class="m-analytics__averages">
<div class="m-analytics__average">
<h6>Avg Withdrawn Tokens</h6>
<h5>{{tokens | number : '1.0'}}</h5>
......@@ -17,10 +17,16 @@
<h6>Avg of Withdrawing Users</h6>
<h5>{{users | number : '1.0'}}</h5>
</div>
</div>
<div class="m-analytics__averages">
<div class="m-analytics__average" *ngFor="let current of currents">
<h6>Current {{current.name}}</h6>
<h5>{{current.value | number : '1.0-0'}}</h5>
</div>
</div>
<div class="m-analyticsCard__charts">
<m-analyticscharts__withdraw [timespan]="card.selectedOption"></m-analyticscharts__withdraw>
<m-analyticscharts__withdraw [timespan]="card.selectedOption" (loaded)="currents = $event"></m-analyticscharts__withdraw>
</div>
</m-analytics__card>
......@@ -16,6 +16,7 @@ export class WithdrawCardComponent implements OnInit {
tokens: number = 0;
transactions: number = 0;
users: number = 0;
currents: { name: string, value: number }[];
constructor(private client: Client) {
}
......@@ -34,17 +35,16 @@ export class WithdrawCardComponent implements OnInit {
private async getAvgData() {
try {
let avgs: Array<any> = await Promise.all([
this.client.get('api/v2/analytics/withdraw', { key: 'average_tokens', timespan: this.card.selectedOption }),
this.client.get('api/v2/analytics/withdraw', { key: 'average', timespan: this.card.selectedOption }),
this.client.get('api/v2/analytics/withdraw', { key: 'average_users', timespan: this.card.selectedOption }),
]);
const response: any = await this.client.get('api/v2/analytics/withdraw', {
key: 'avg',
timespan: this.card.selectedOption
});
this.tokens = avgs[0].data;
this.tokens = response.data.tokens;
this.transactions = avgs[1].data;
this.transactions = response.data.transactions;
this.users = avgs[2].data;
this.users = response.data.users;
} catch (e) {
console.error(e);
}
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__activeusers',
......@@ -19,6 +20,7 @@ import { timespanOption } from "../timespanOption";
export class ActiveUsersChartComponent implements OnInit {
@Input() total: boolean = false;
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
timespan: timespanOption;
......@@ -67,7 +69,6 @@ export class ActiveUsersChartComponent implements OnInit {
}
ngOnInit() {
//this.layout.title = this.total ? 'Total Pageviews' : 'Active Users';
this.applyDimensions();
this.getData();
this.init = true;
......@@ -80,7 +81,10 @@ export class ActiveUsersChartComponent implements OnInit {
try {
const response: any = await this.client.get(url, { timespan: this.timespan });
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
} catch (e) {
console.error(e);
}
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__channelboosts',
......@@ -18,6 +19,7 @@ import { Client } from "../../../../../services/api/client";
export class ChannelBoostsComponent implements OnInit {
@Input() analytics: 'totals' | 'monthly';
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
......@@ -60,7 +62,11 @@ export class ChannelBoostsComponent implements OnInit {
switch (this.analytics) {
case 'monthly':
this.layout.title = 'Percentage of Interactions from Boosts';
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
for (let i = 0; i < this.data.length; i++) {
this.data[i].stackgroup = 'one';
this.data[i].groupnorm = 'percent';
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__offchainboosts',
......@@ -18,6 +19,8 @@ import { timespanOption } from "../timespanOption";
export class OffChainBoostsChartComponent implements OnInit {
@Input() analytics: 'completed' | 'not_completed' | 'revoked' | 'rejected' | 'users_who_completed' | 'users_waiting_for_completion' | 'reclaimed_tokens' | 'impressions_served';
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
timespan: timespanOption;
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
......@@ -75,7 +78,10 @@ export class OffChainBoostsChartComponent implements OnInit {
key: this.analytics,
timespan: this.timespan
});
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
}
@HostListener('window:resize')
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__onchainboosts',
......@@ -17,6 +18,8 @@ import { timespanOption } from "../timespanOption";
})
export class OnChainBoostsChartComponent implements OnInit {
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
timespan: timespanOption;
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
......@@ -70,7 +73,10 @@ export class OnChainBoostsChartComponent implements OnInit {
async getData() {
const response: any = await this.client.get(`api/v2/analytics/onchainboosts`, { timespan: this.timespan });
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
}
@HostListener('window:resize')
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { MindsUser } from "../../../../../interfaces/entities";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__comments',
......@@ -19,9 +20,10 @@ import { timespanOption } from "../timespanOption";
})
export class CommentsChartComponent implements OnInit {
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
@Input() user: MindsUser;
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
init: boolean = false;
timespan: timespanOption;
......@@ -84,8 +86,10 @@ export class CommentsChartComponent implements OnInit {
try {
const response: any = await this.client.get(url, opts);
this.data = response.data;
} catch (e) {
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current); } catch (e) {
console.error(e);
}
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__channelinteractions',
......@@ -18,6 +19,7 @@ import { Client } from "../../../../../services/api/client";
export class ChannelInteractionsComponent implements OnInit {
@Input() analytics: 'totals' | 'monthly';
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
......@@ -55,8 +57,10 @@ export class ChannelInteractionsComponent implements OnInit {
async getData() {
const response: any = await this.client.get(`api/v2/analytics/interactions/`, { key: this.analytics });
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
switch (this.analytics) {
case 'monthly':
this.layout.title = 'Interactions';
......
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__pageviews',
template: `
<div class="m-chart" #chartContainer>
<div class="mdl-spinner mdl-js-spinner is-active" [mdl] *ngIf="inProgress"></div>
<m-graph
[data]="data"
[layout]="layout"
*ngIf="!inProgress && !!data"
></m-graph>
</div>
`
})
export class PageviewsChartComponent implements OnInit {
@Input() pie: boolean = false;
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
timespan: timespanOption;
init: boolean = false;
inProgress: boolean = false;
data: any;
layout: any = {
width: 0,
height: 0,
title: '',
font: {
family: 'Roboto'
},
titlefont: {
family: 'Roboto',
size: 24,
weight: 'bold'
},
xaxis: {
type: '-',
},
yaxis: {
type: 'log',
dtick: 1,
},
margin: {
t: 16,
b: 32,
l: 32,
},
};
@Input('timespan') set _timespan(value: timespanOption) {
this.timespan = value;
if (this.init) {
this.getData();
}
}
constructor(private client: Client) {
}
ngOnInit() {
this.applyDimensions();
this.getData();
this.init = true;
}
async getData() {
const opts = { timespan: this.timespan };
if (this.pie) {
opts['key'] = 'routes';
}
const response: any = await this.client.get(`api/v2/analytics/pageviews`, opts);
if (this.pie) {
this.data = response.data;
this.data[0].type = 'pie';
} else {
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
}
}
@HostListener('window:resize')
applyDimensions() {
this.layout = {
...this.layout,
width: this.chartContainer.nativeElement.clientWidth,
height: this.chartContainer.nativeElement.clientHeight - 35,
};
}
}
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__offchainplus',
......@@ -18,6 +19,8 @@ import { timespanOption } from "../timespanOption";
})
export class OffchainPlusChartComponent implements OnInit {
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
timespan: timespanOption;
......@@ -70,8 +73,10 @@ export class OffchainPlusChartComponent implements OnInit {
async getData() {
const response: any = await this.client.get(`api/v2/analytics/offchainplus`, { timespan: this.timespan });
this.data = response.data;
}
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current); }
@HostListener('window:resize')
applyDimensions() {
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__onchainplus',
......@@ -18,6 +19,8 @@ import { timespanOption } from "../timespanOption";
})
export class OnchainPlusChartComponent implements OnInit {
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
timespan: timespanOption;
......@@ -69,8 +72,11 @@ export class OnchainPlusChartComponent implements OnInit {
}
async getData() {
const response: any = await this.client.get(`api/v2/analytics/offchainplus`, { timespan: this.timespan });
this.data = response.data;
const response: any = await this.client.get(`api/v2/analytics/onchainplus`, { timespan: this.timespan });
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
}
@HostListener('window:resize')
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { MindsUser } from "../../../../../interfaces/entities";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__posts',
......@@ -20,6 +21,7 @@ import { timespanOption } from "../timespanOption";
export class PostsChartComponent implements OnInit {
@Input() user: MindsUser;
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
......@@ -83,7 +85,10 @@ export class PostsChartComponent implements OnInit {
try {
const response: any = await this.client.get(url, opts);
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
this.data[0].type = 'lines';
} catch (e) {
console.error(e);
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { MindsUser } from "../../../../../interfaces/entities";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__reminds',
......@@ -20,6 +21,7 @@ import { timespanOption } from "../timespanOption";
export class RemindsChartComponent implements OnInit {
@Input() user: MindsUser;
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
......@@ -83,7 +85,10 @@ export class RemindsChartComponent implements OnInit {
try {
const response: any = await this.client.get(url, opts);
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
this.data[0].type = 'lines';
} catch (e) {
console.error(e);
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__rewards',
......@@ -18,6 +19,8 @@ import { timespanOption } from "../timespanOption";
})
export class RewardsChartComponent implements OnInit {
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
timespan: timespanOption;
......@@ -70,7 +73,10 @@ export class RewardsChartComponent implements OnInit {
async getData() {
const response: any = await this.client.get(`api/v2/analytics/rewards`, { timespan: this.timespan });
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
}
@HostListener('window:resize')
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__tokensales',
......@@ -19,6 +20,8 @@ import { timespanOption } from "../timespanOption";
export class TokenSalesChartComponent implements OnInit {
@Input() analytics: 'rates' | 'sales';
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
timespan: timespanOption;
......@@ -77,7 +80,10 @@ export class TokenSalesChartComponent implements OnInit {
}
const response: any = await this.client.get(`api/v2/analytics/tokensales`, opts);
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
}
@HostListener('window:resize')
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__usersegments',
......@@ -18,6 +19,8 @@ import { timespanOption } from "../timespanOption";
})
export class UserSegmentsChartComponent implements OnInit {
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
timespan: timespanOption;
......@@ -76,7 +79,10 @@ export class UserSegmentsChartComponent implements OnInit {
try {
const response: any = await this.client.get(url, opts);
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
this.data[0].type = 'lines';
} catch (e) {
console.error(e);
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { MindsUser } from "../../../../../interfaces/entities";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__votes',
......@@ -19,6 +20,8 @@ import { MindsUser } from "../../../../../interfaces/entities";
})
export class VotesChartComponent implements OnInit {
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
@Input() user: MindsUser;
......@@ -83,7 +86,10 @@ export class VotesChartComponent implements OnInit {
try {
const response: any = await this.client.get(url, opts);
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
this.data[0].type = 'lines';
} catch (e) {
console.error(e);
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__offchainwire',
......@@ -18,6 +19,8 @@ import { timespanOption } from "../timespanOption";
})
export class OffchainWireChartComponent implements OnInit {
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
timespan: timespanOption;
......@@ -70,7 +73,10 @@ export class OffchainWireChartComponent implements OnInit {
async getData() {
const response: any = await this.client.get(`api/v2/analytics/offchainwire`, { timespan: this.timespan });
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
}
@HostListener('window:resize')
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__onchainwire',
......@@ -18,6 +19,8 @@ import { timespanOption } from "../timespanOption";
})
export class OnchainWireChartComponent implements OnInit {
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
timespan: timespanOption;
......@@ -64,7 +67,10 @@ export class OnchainWireChartComponent implements OnInit {
async getData() {
const response: any = await this.client.get(`api/v2/analytics/onchainwire`, { timespan: this.timespan });
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
}
@HostListener('window:resize')
......
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Client } from "../../../../../services/api/client";
import { timespanOption } from "../timespanOption";
import { removeCurrentUnits } from "../../../util";
@Component({
selector: 'm-analyticscharts__withdraw',
......@@ -18,6 +19,8 @@ import { timespanOption } from "../timespanOption";
})
export class WithdrawChartComponent implements OnInit {
@Output() loaded: EventEmitter<Array<any>> = new EventEmitter<Array<any>>();
@ViewChild('chartContainer', { static: true }) chartContainer: ElementRef;
timespan: timespanOption;
......@@ -69,7 +72,10 @@ export class WithdrawChartComponent implements OnInit {
async getData() {
const response: any = await this.client.get(`api/v2/analytics/withdraw`, { timespan: this.timespan });
this.data = response.data;
const [data, current] = removeCurrentUnits(response.data);
this.data = data;
this.loaded.emit(current);
}
@HostListener('window:resize')
......
......@@ -4,6 +4,7 @@ import { Component, OnInit } from '@angular/core';
selector: 'm-analyticssite__networkactivity',
template: `
<m-analyticsactiveusers__card></m-analyticsactiveusers__card>
<m-analyticspageviews__card></m-analyticspageviews__card>
<m-analyticsusersegments__card></m-analyticsusersegments__card>
<m-analyticsengagement__card></m-analyticsengagement__card>
`
......
export function removeCurrentUnits(data: Array<any>): Array<any> {
let currents = [];
for (let series of data) {
currents.push({
'name': series.name,
'value': series.y[series.y.length - 1]
});
series.x.pop();
series.y.pop();
}
return [data, currents];
}