Index weekly hashrates using last Monday midnight - Fix charts tooltip

This commit is contained in:
nymkappa
2022-03-10 11:48:21 +01:00
parent f62146a649
commit 9ccb23f651
3 changed files with 11 additions and 6 deletions

View File

@@ -182,8 +182,9 @@ export class HashrateChartComponent implements OnInit {
difficulty = Math.round(data[1].data[1] / difficultyPowerOfTen.divider);
}
const date = new Date(data[0].data[0]).toLocaleDateString(this.locale, { year: 'numeric', month: 'short', day: 'numeric' });
return `
<b style="color: white; margin-left: 18px">${data[0].axisValueLabel}</b><br>
<b style="color: white; margin-left: 18px">${date}</b><br>
<span>${data[0].marker} ${data[0].seriesName}: ${formatNumber(hashrate, this.locale, '1.0-0')} ${hashratePowerOfTen.unit}H/s</span><br>
<span>${data[1].marker} ${data[1].seriesName}: ${formatNumber(difficulty, this.locale, '1.2-2')} ${difficultyPowerOfTen.unit}</span>
`;

View File

@@ -160,7 +160,8 @@ export class HashrateChartPoolsComponent implements OnInit {
},
borderColor: '#000',
formatter: function (data) {
let tooltip = `<b style="color: white; margin-left: 18px">${data[0].axisValueLabel}</b><br>`;
const date = new Date(data[0].data[0]).toLocaleDateString(this.locale, { year: 'numeric', month: 'short', day: 'numeric' });
let tooltip = `<b style="color: white; margin-left: 18px">${date}</b><br>`;
data.sort((a, b) => b.data[1] - a.data[1]);
for (const pool of data) {
if (pool.data[1] > 0) {