mirror of
https://github.com/mempool/mempool.git
synced 2025-09-27 22:47:05 +02:00
fix blank fee distribution graph bug
This commit is contained in:
@@ -60,6 +60,8 @@ export class FeeDistributionGraphComponent implements OnInit, OnChanges, OnDestr
|
|||||||
prepareChart(): void {
|
prepareChart(): void {
|
||||||
if (this.simple) {
|
if (this.simple) {
|
||||||
this.data = this.feeRange.map((rate, index) => [index * 10, rate]);
|
this.data = this.feeRange.map((rate, index) => [index * 10, rate]);
|
||||||
|
this.minValue = this.data.length ? this.data.reduce((min, val) => Math.min(min, val[1]), Infinity) : 0;
|
||||||
|
this.maxValue = this.data.length ? this.data.reduce((max, val) => Math.max(max, val[1]), 0) : 0;
|
||||||
this.labelInterval = 1;
|
this.labelInterval = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -69,8 +71,8 @@ export class FeeDistributionGraphComponent implements OnInit, OnChanges, OnDestr
|
|||||||
}
|
}
|
||||||
const samples = [];
|
const samples = [];
|
||||||
const txs = this.transactions.map(tx => { return { vsize: tx.vsize, rate: tx.rate ?? (tx.fee / tx.vsize) }; }).sort((a, b) => { return b.rate - a.rate; });
|
const txs = this.transactions.map(tx => { return { vsize: tx.vsize, rate: tx.rate ?? (tx.fee / tx.vsize) }; }).sort((a, b) => { return b.rate - a.rate; });
|
||||||
this.maxValue = txs.reduce((max, tx) => Math.max(max, tx.rate), 0);
|
this.maxValue = txs.length ? txs.reduce((max, tx) => Math.max(max, tx.rate), 0) : 0;
|
||||||
this.minValue = txs.reduce((min, tx) => Math.min(min, tx.rate), Infinity);
|
this.minValue = txs.length ? txs.reduce((min, tx) => Math.min(min, tx.rate), Infinity) : 0;
|
||||||
const maxBlockVSize = this.stateService.env.BLOCK_WEIGHT_UNITS / 4;
|
const maxBlockVSize = this.stateService.env.BLOCK_WEIGHT_UNITS / 4;
|
||||||
const sampleInterval = maxBlockVSize / this.numSamples;
|
const sampleInterval = maxBlockVSize / this.numSamples;
|
||||||
let cumVSize = 0;
|
let cumVSize = 0;
|
||||||
|
Reference in New Issue
Block a user