mirror of
https://github.com/mempool/mempool.git
synced 2024-12-27 08:44:26 +01:00
Show current indexing progress in charts without data
This commit is contained in:
parent
ba3a737ab9
commit
18f3018170
@ -92,7 +92,8 @@ export class HashrateChartComponent implements OnInit {
|
||||
|
||||
this.prepareChartOptions({
|
||||
hashrates: data.hashrates.map(val => [val.timestamp * 1000, val.avgHashrate]),
|
||||
difficulty: diffFixed.map(val => [val.timestamp * 1000, val.difficulty])
|
||||
difficulty: diffFixed.map(val => [val.timestamp * 1000, val.difficulty]),
|
||||
timestamp: data.oldestIndexedBlockTimestamp,
|
||||
});
|
||||
this.isLoading = false;
|
||||
}),
|
||||
@ -125,16 +126,20 @@ export class HashrateChartComponent implements OnInit {
|
||||
}
|
||||
|
||||
prepareChartOptions(data) {
|
||||
let title = undefined;
|
||||
let title: object;
|
||||
if (data.hashrates.length === 0) {
|
||||
const lastBlock = new Date(data.timestamp * 1000);
|
||||
const dd = String(lastBlock.getDate()).padStart(2, '0');
|
||||
const mm = String(lastBlock.getMonth() + 1).padStart(2, '0'); // January is 0!
|
||||
const yyyy = lastBlock.getFullYear();
|
||||
title = {
|
||||
textStyle: {
|
||||
color: "grey",
|
||||
color: 'grey',
|
||||
fontSize: 15
|
||||
},
|
||||
text: "Indexing in progress...",
|
||||
left: "center",
|
||||
top: "center"
|
||||
text: `Indexing in progess - ${yyyy}-${mm}-${dd}`,
|
||||
left: 'center',
|
||||
top: 'center'
|
||||
};
|
||||
}
|
||||
|
||||
@ -190,11 +195,11 @@ export class HashrateChartComponent implements OnInit {
|
||||
`;
|
||||
}.bind(this)
|
||||
},
|
||||
xAxis: {
|
||||
xAxis: data.hashrates.length === 0 ? undefined : {
|
||||
type: 'time',
|
||||
splitNumber: (this.isMobile() || this.widget) ? 5 : 10,
|
||||
},
|
||||
legend: {
|
||||
legend: data.hashrates.length === 0 ? undefined : {
|
||||
data: [
|
||||
{
|
||||
name: 'Hashrate',
|
||||
@ -220,7 +225,7 @@ export class HashrateChartComponent implements OnInit {
|
||||
},
|
||||
],
|
||||
},
|
||||
yAxis: [
|
||||
yAxis: data.hashrates.length === 0 ? undefined : [
|
||||
{
|
||||
min: function (value) {
|
||||
return value.min * 0.9;
|
||||
@ -259,7 +264,7 @@ export class HashrateChartComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
],
|
||||
series: [
|
||||
series: data.hashrates.length === 0 ? [] : [
|
||||
{
|
||||
name: 'Hashrate',
|
||||
showSymbol: false,
|
||||
|
@ -105,7 +105,8 @@ export class HashrateChartPoolsComponent implements OnInit {
|
||||
|
||||
this.prepareChartOptions({
|
||||
legends: legends,
|
||||
series: series
|
||||
series: series,
|
||||
timestamp: data.oldestIndexedBlockTimestamp,
|
||||
});
|
||||
this.isLoading = false;
|
||||
}),
|
||||
@ -124,16 +125,20 @@ export class HashrateChartPoolsComponent implements OnInit {
|
||||
}
|
||||
|
||||
prepareChartOptions(data) {
|
||||
let title = undefined;
|
||||
let title: object;
|
||||
if (data.series.length === 0) {
|
||||
const lastBlock = new Date(data.timestamp * 1000);
|
||||
const dd = String(lastBlock.getDate()).padStart(2, '0');
|
||||
const mm = String(lastBlock.getMonth() + 1).padStart(2, '0'); // January is 0!
|
||||
const yyyy = lastBlock.getFullYear();
|
||||
title = {
|
||||
textStyle: {
|
||||
color: "grey",
|
||||
color: 'grey',
|
||||
fontSize: 15
|
||||
},
|
||||
text: "Indexing in progress...",
|
||||
left: "center",
|
||||
top: this.widget ? 115 : this.isMobile() ? 'center' : 225,
|
||||
text: `Indexing in progess - ${yyyy}-${mm}-${dd}`,
|
||||
left: 'center',
|
||||
top: 'center',
|
||||
};
|
||||
}
|
||||
|
||||
@ -171,14 +176,14 @@ export class HashrateChartPoolsComponent implements OnInit {
|
||||
return tooltip;
|
||||
}.bind(this)
|
||||
},
|
||||
xAxis: {
|
||||
xAxis: data.series.length === 0 ? undefined : {
|
||||
type: 'time',
|
||||
splitNumber: (this.isMobile() || this.widget) ? 5 : 10,
|
||||
},
|
||||
legend: (this.isMobile() || this.widget) ? undefined : {
|
||||
legend: (this.isMobile() || this.widget || data.series.length === 0) ? undefined : {
|
||||
data: data.legends
|
||||
},
|
||||
yAxis: {
|
||||
yAxis: data.series.length === 0 ? undefined : {
|
||||
position: 'right',
|
||||
axisLabel: {
|
||||
color: 'rgb(110, 112, 121)',
|
||||
|
Loading…
Reference in New Issue
Block a user