add size per weight graph and ts type for getHistoricalBlockSizesAndWeights
This commit is contained in:
parent
ae9f98f26c
commit
a897aebbc1
@ -90,6 +90,7 @@ export class BlockSizesWeightsGraphComponent implements OnInit {
|
|||||||
this.prepareChartOptions({
|
this.prepareChartOptions({
|
||||||
sizes: data.sizes.map(val => [val.timestamp * 1000, val.avgSize / 1000000, val.avgHeight]),
|
sizes: data.sizes.map(val => [val.timestamp * 1000, val.avgSize / 1000000, val.avgHeight]),
|
||||||
weights: data.weights.map(val => [val.timestamp * 1000, val.avgWeight / 1000000, val.avgHeight]),
|
weights: data.weights.map(val => [val.timestamp * 1000, val.avgWeight / 1000000, val.avgHeight]),
|
||||||
|
sizePerWeight: data.weights.map((val, i) => [val.timestamp * 1000, data.sizes[i].avgSize / (val.avgWeight / 4), val.avgHeight]),
|
||||||
});
|
});
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
}),
|
}),
|
||||||
@ -124,6 +125,7 @@ export class BlockSizesWeightsGraphComponent implements OnInit {
|
|||||||
color: [
|
color: [
|
||||||
'#FDD835',
|
'#FDD835',
|
||||||
'#D81B60',
|
'#D81B60',
|
||||||
|
'#14EDF5',
|
||||||
],
|
],
|
||||||
grid: {
|
grid: {
|
||||||
top: 30,
|
top: 30,
|
||||||
@ -153,6 +155,8 @@ export class BlockSizesWeightsGraphComponent implements OnInit {
|
|||||||
tooltip += `${tick.marker} ${tick.seriesName}: ${formatNumber(tick.data[1], this.locale, '1.2-2')} MB`;
|
tooltip += `${tick.marker} ${tick.seriesName}: ${formatNumber(tick.data[1], this.locale, '1.2-2')} MB`;
|
||||||
} else if (tick.seriesIndex === 1) { // Weight
|
} else if (tick.seriesIndex === 1) { // Weight
|
||||||
tooltip += `${tick.marker} ${tick.seriesName}: ${formatNumber(tick.data[1], this.locale, '1.2-2')} MWU`;
|
tooltip += `${tick.marker} ${tick.seriesName}: ${formatNumber(tick.data[1], this.locale, '1.2-2')} MWU`;
|
||||||
|
} else if (tick.seriesIndex === 2) { // Size per weight
|
||||||
|
tooltip += `${tick.marker} ${tick.seriesName}: ${formatNumber(tick.data[1], this.locale, '1.2-2')} B/vB`;
|
||||||
}
|
}
|
||||||
tooltip += `<br>`;
|
tooltip += `<br>`;
|
||||||
}
|
}
|
||||||
@ -192,10 +196,19 @@ export class BlockSizesWeightsGraphComponent implements OnInit {
|
|||||||
},
|
},
|
||||||
icon: 'roundRect',
|
icon: 'roundRect',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: $localize`Size per weight`,
|
||||||
|
inactiveColor: 'rgb(110, 112, 121)',
|
||||||
|
textStyle: {
|
||||||
|
color: 'white',
|
||||||
|
},
|
||||||
|
icon: 'roundRect',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
selected: JSON.parse(this.storageService.getValue('sizes_weights_legend')) ?? {
|
selected: JSON.parse(this.storageService.getValue('sizes_weights_legend')) ?? {
|
||||||
'Size': true,
|
'Size': true,
|
||||||
'Weight': true,
|
'Weight': true,
|
||||||
|
'Size per weight': true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
yAxis: data.sizes.length === 0 ? undefined : [
|
yAxis: data.sizes.length === 0 ? undefined : [
|
||||||
@ -262,6 +275,18 @@ export class BlockSizesWeightsGraphComponent implements OnInit {
|
|||||||
lineStyle: {
|
lineStyle: {
|
||||||
width: 2,
|
width: 2,
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
zlevel: 1,
|
||||||
|
yAxisIndex: 0,
|
||||||
|
name: $localize`Size per weight`,
|
||||||
|
showSymbol: false,
|
||||||
|
symbol: 'none',
|
||||||
|
data: data.sizePerWeight,
|
||||||
|
type: 'line',
|
||||||
|
lineStyle: {
|
||||||
|
width: 2,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
dataZoom: [{
|
dataZoom: [{
|
||||||
|
@ -151,6 +151,19 @@ export interface RewardStats {
|
|||||||
totalTx: number;
|
totalTx: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface BlockSizesAndWeights {
|
||||||
|
sizes: {
|
||||||
|
timestamp: number;
|
||||||
|
avgHeight: number;
|
||||||
|
avgSize: number;
|
||||||
|
}[];
|
||||||
|
weights: {
|
||||||
|
timestamp: number;
|
||||||
|
avgHeight: number;
|
||||||
|
avgWeight: number;
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface AuditScore {
|
export interface AuditScore {
|
||||||
hash: string;
|
hash: string;
|
||||||
matchRate?: number;
|
matchRate?: number;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http';
|
||||||
import { CpfpInfo, OptimizedMempoolStats, AddressInformation, LiquidPegs, ITranslators,
|
import { CpfpInfo, OptimizedMempoolStats, AddressInformation, LiquidPegs, ITranslators,
|
||||||
PoolStat, BlockExtended, TransactionStripped, RewardStats, AuditScore } from '../interfaces/node-api.interface';
|
PoolStat, BlockExtended, TransactionStripped, RewardStats, AuditScore, BlockSizesAndWeights } from '../interfaces/node-api.interface';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { StateService } from './state.service';
|
import { StateService } from './state.service';
|
||||||
import { WebsocketResponse } from '../interfaces/websocket.interface';
|
import { WebsocketResponse } from '../interfaces/websocket.interface';
|
||||||
@ -222,8 +222,8 @@ export class ApiService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getHistoricalBlockSizesAndWeights$(interval: string | undefined) : Observable<any> {
|
getHistoricalBlockSizesAndWeights$(interval: string | undefined) : Observable<HttpResponse<BlockSizesAndWeights>> {
|
||||||
return this.httpClient.get<any[]>(
|
return this.httpClient.get<BlockSizesAndWeights>(
|
||||||
this.apiBaseUrl + this.apiBasePath + `/api/v1/mining/blocks/sizes-weights` +
|
this.apiBaseUrl + this.apiBasePath + `/api/v1/mining/blocks/sizes-weights` +
|
||||||
(interval !== undefined ? `/${interval}` : ''), { observe: 'response' }
|
(interval !== undefined ? `/${interval}` : ''), { observe: 'response' }
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user