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 fcff0dddb..d562375b8 100644 --- a/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts +++ b/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts @@ -109,6 +109,14 @@ export class HashrateChartComponent implements OnInit { tap((response: any) => { const data = response.body; + // always include the latest difficulty + if (data.difficulty.length && data.difficulty[data.difficulty.length - 1].difficulty !== data.currentDifficulty) { + data.difficulty.push({ + timestamp: Date.now() / 1000, + difficulty: data.currentDifficulty + }); + } + // We generate duplicated data point so the tooltip works nicely const diffFixed = []; let diffIndex = 1; @@ -137,6 +145,14 @@ export class HashrateChartComponent implements OnInit { ++diffIndex; } + while (diffIndex <= data.difficulty.length) { + diffFixed.push({ + timestamp: data.difficulty[diffIndex - 1].time, + difficulty: data.difficulty[diffIndex - 1].difficulty + }); + diffIndex++; + } + let maResolution = 15; const hashrateMa = []; for (let i = maResolution - 1; i < data.hashrates.length; ++i) {