This commit is contained in:
Ben
2023-08-03 16:44:27 -04:00
7 changed files with 767 additions and 12 deletions
@@ -35,12 +35,11 @@ export class DashboardComponent {
this.chartData$ = this.clientInfo$.pipe(
map((workerInfo: any) => {
this.chartData$ = this.clientService.getClientInfoChart(this.address).pipe(
map((chartData) => {
const GROUP_SIZE = 12; //6 = 1 hour
let chartData: any[] = workerInfo.chartData;
let hourlyData = [];
@@ -54,10 +53,10 @@ export class DashboardComponent {
}
const data = workerInfo.chartData.map((d: any) => { return { y: d.data, x: d.label } });
const data = chartData.map((d: any) => { return { y: d.data, x: d.label } });
return {
labels: workerInfo.chartData.map((d: any) => d.label),
labels: chartData.map((d: any) => d.label),
datasets: [
{
type: 'line',
@@ -136,7 +135,7 @@ export class DashboardComponent {
public getTotalHashRate(name: string, workers: any[]) {
const workersByName = workers.filter(w => w.name == name);
const sum = workersByName.reduce((pre, cur, idx, arr) => {
return pre += cur.hashRate;
return pre += Math.floor(cur.hashRate);
}, 0);
return Math.floor(sum);
}
@@ -57,6 +57,7 @@
<div *ngIf="chartData$ | async as chartData">
<div class="card">
<p-chart type="line" [data]="chartData" [options]="chartOptions"></p-chart>
</div>
</div>
@@ -24,16 +24,18 @@ export class SplashComponent {
constructor(private appService: AppService) {
const info$ = this.appService.getInfo().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.blockData$ = info$.pipe(map(info => info.blockData));
this.userAgents$ = info$.pipe(map(info => info.userAgents));
this.chartData$ = info$.pipe(
map((info: any) => {
this.chartData$ = this.appService.getInfoChart().pipe(
map((chartData: any) => {
return {
labels: info.chartData.map((d: any) => d.label),
labels: chartData.map((d: any) => d.label),
datasets: [
{
label: 'Public-Pool Hashrate',
data: info.chartData.map((d: any) => d.data),
data: chartData.map((d: any) => d.data),
fill: false,
backgroundColor: documentStyle.getPropertyValue('--primary-color'),
borderColor: documentStyle.getPropertyValue('--primary-color'),