diff --git a/frontend/src/app/bitcoin.utils.ts b/frontend/src/app/bitcoin.utils.ts
index c4af730f6..d5b5122fa 100644
--- a/frontend/src/app/bitcoin.utils.ts
+++ b/frontend/src/app/bitcoin.utils.ts
@@ -225,7 +225,7 @@ const witnessSize = (vin: Vin) => vin.witness ? vin.witness.reduce((S, w) => S +
const scriptSigSize = (vin: Vin) => vin.scriptsig ? vin.scriptsig.length / 2 : 0;
// Power of ten wrapper
-export function selectPowerOfTen(val: number): { divider: number, unit: string } {
+export function selectPowerOfTen(val: number, multiplier = 1): { divider: number, unit: string } {
const powerOfTen = {
exa: Math.pow(10, 18),
peta: Math.pow(10, 15),
@@ -236,17 +236,17 @@ export function selectPowerOfTen(val: number): { divider: number, unit: string }
};
let selectedPowerOfTen: { divider: number, unit: string };
- if (val < powerOfTen.kilo) {
+ if (val < powerOfTen.kilo * multiplier) {
selectedPowerOfTen = { divider: 1, unit: '' }; // no scaling
- } else if (val < powerOfTen.mega) {
+ } else if (val < powerOfTen.mega * multiplier) {
selectedPowerOfTen = { divider: powerOfTen.kilo, unit: 'k' };
- } else if (val < powerOfTen.giga) {
+ } else if (val < powerOfTen.giga * multiplier) {
selectedPowerOfTen = { divider: powerOfTen.mega, unit: 'M' };
- } else if (val < powerOfTen.tera) {
+ } else if (val < powerOfTen.tera * multiplier) {
selectedPowerOfTen = { divider: powerOfTen.giga, unit: 'G' };
- } else if (val < powerOfTen.peta) {
+ } else if (val < powerOfTen.peta * multiplier) {
selectedPowerOfTen = { divider: powerOfTen.tera, unit: 'T' };
- } else if (val < powerOfTen.exa) {
+ } else if (val < powerOfTen.exa * multiplier) {
selectedPowerOfTen = { divider: powerOfTen.peta, unit: 'P' };
} else {
selectedPowerOfTen = { divider: powerOfTen.exa, unit: 'E' };
diff --git a/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts b/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts
index 62c6961ce..9858807a6 100644
--- a/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts
+++ b/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts
@@ -249,8 +249,8 @@ export class HashrateChartComponent implements OnInit {
for (const tick of ticks) {
if (tick.seriesIndex === 0) { // Hashrate
let hashrate = tick.data[1];
- hashratePowerOfTen = selectPowerOfTen(tick.data[1]);
- hashrate = Math.round(tick.data[1] / hashratePowerOfTen.divider);
+ hashratePowerOfTen = selectPowerOfTen(tick.data[1], 10);
+ hashrate = tick.data[1] / hashratePowerOfTen.divider;
hashrateString = `${tick.marker} ${tick.seriesName}: ${formatNumber(hashrate, this.locale, '1.0-0')} ${hashratePowerOfTen.unit}H/s
`;
} else if (tick.seriesIndex === 1) { // Difficulty
let difficultyPowerOfTen = hashratePowerOfTen;
@@ -264,8 +264,8 @@ export class HashrateChartComponent implements OnInit {
}
} else if (tick.seriesIndex === 2) { // Hashrate MA
let hashrate = tick.data[1];
- hashratePowerOfTen = selectPowerOfTen(tick.data[1]);
- hashrate = Math.round(tick.data[1] / hashratePowerOfTen.divider);
+ hashratePowerOfTen = selectPowerOfTen(tick.data[1], 10);
+ hashrate = tick.data[1] / hashratePowerOfTen.divider;
hashrateStringMA = `${tick.marker} ${tick.seriesName}: ${formatNumber(hashrate, this.locale, '1.0-0')} ${hashratePowerOfTen.unit}H/s`;
}
}
diff --git a/frontend/src/app/components/pool/pool.component.ts b/frontend/src/app/components/pool/pool.component.ts
index e3dd55fa1..e52abe433 100644
--- a/frontend/src/app/components/pool/pool.component.ts
+++ b/frontend/src/app/components/pool/pool.component.ts
@@ -163,8 +163,8 @@ export class PoolComponent implements OnInit {
let hashratePowerOfTen: any = selectPowerOfTen(1);
let hashrate = ticks[0].data[1];
- hashratePowerOfTen = selectPowerOfTen(ticks[0].data[1]);
- hashrate = Math.round(ticks[0].data[1] / hashratePowerOfTen.divider);
+ hashratePowerOfTen = selectPowerOfTen(ticks[0].data[1], 10);
+ hashrate = ticks[0].data[1] / hashratePowerOfTen.divider;
return `
${ticks[0].axisValueLabel}