diff --git a/backend/src/repositories/BlocksRepository.ts b/backend/src/repositories/BlocksRepository.ts index 9c7e9b778..235dc9ebd 100644 --- a/backend/src/repositories/BlocksRepository.ts +++ b/backend/src/repositories/BlocksRepository.ts @@ -274,7 +274,7 @@ class BlocksRepository { } query += ` GROUP BY difficulty - ORDER BY blockTimestamp DESC`; + ORDER BY blockTimestamp`; const [rows]: any[] = await connection.query(query); connection.release(); diff --git a/backend/src/repositories/HashratesRepository.ts b/backend/src/repositories/HashratesRepository.ts index 0e8f1477e..fd4340d4e 100644 --- a/backend/src/repositories/HashratesRepository.ts +++ b/backend/src/repositories/HashratesRepository.ts @@ -41,7 +41,7 @@ class HashratesRepository { query += ` WHERE hashrate_timestamp BETWEEN DATE_SUB(NOW(), INTERVAL ${interval}) AND NOW()`; } - query += ` ORDER by hashrate_timestamp DESC`; + query += ` ORDER by hashrate_timestamp`; const [rows]: any[] = await connection.query(query); connection.release(); diff --git a/frontend/src/app/components/difficulty-chart/difficulty-chart.component.html b/frontend/src/app/components/difficulty-chart/difficulty-chart.component.html index ca005f2d4..eb34d4075 100644 --- a/frontend/src/app/components/difficulty-chart/difficulty-chart.component.html +++ b/frontend/src/app/components/difficulty-chart/difficulty-chart.component.html @@ -1,10 +1,5 @@
-
-
-
-
-
@@ -30,6 +25,11 @@
+
+
+
+
+ diff --git a/frontend/src/app/components/difficulty-chart/difficulty-chart.component.scss b/frontend/src/app/components/difficulty-chart/difficulty-chart.component.scss index c3a63e9fa..4205c9db7 100644 --- a/frontend/src/app/components/difficulty-chart/difficulty-chart.component.scss +++ b/frontend/src/app/components/difficulty-chart/difficulty-chart.component.scss @@ -8,3 +8,20 @@ text-align: center; padding-bottom: 3px; } + +.formRadioGroup { + margin-top: 6px; + display: flex; + flex-direction: column; + @media (min-width: 830px) { + flex-direction: row; + float: right; + margin-top: 0px; + } + .btn-sm { + font-size: 9px; + @media (min-width: 830px) { + font-size: 14px; + } + } +} diff --git a/frontend/src/app/components/difficulty-chart/difficulty-chart.component.ts b/frontend/src/app/components/difficulty-chart/difficulty-chart.component.ts index d9056633d..4bbc9520a 100644 --- a/frontend/src/app/components/difficulty-chart/difficulty-chart.component.ts +++ b/frontend/src/app/components/difficulty-chart/difficulty-chart.component.ts @@ -1,5 +1,5 @@ import { Component, Inject, Input, LOCALE_ID, OnInit } from '@angular/core'; -import { EChartsOption } from 'echarts'; +import { EChartsOption, graphic } from 'echarts'; import { Observable } from 'rxjs'; import { map, share, startWith, switchMap, tap } from 'rxjs/operators'; import { ApiService } from 'src/app/services/api.service'; @@ -47,13 +47,6 @@ export class DifficultyChartComponent implements OnInit { } ngOnInit(): void { - const powerOfTen = { - terra: Math.pow(10, 12), - giga: Math.pow(10, 9), - mega: Math.pow(10, 6), - kilo: Math.pow(10, 3), - } - this.difficultyObservable$ = this.radioGroupForm.get('dateSpan').valueChanges .pipe( startWith('1y'), @@ -70,9 +63,9 @@ export class DifficultyChartComponent implements OnInit { ) / 3600 / 24; const tableData = []; - for (let i = 0; i < data.adjustments.length - 1; ++i) { + for (let i = data.adjustments.length - 1; i > 0; --i) { const selectedPowerOfTen: any = selectPowerOfTen(data.adjustments[i].difficulty); - const change = (data.adjustments[i].difficulty / data.adjustments[i + 1].difficulty - 1) * 100; + const change = (data.adjustments[i].difficulty / data.adjustments[i - 1].difficulty - 1) * 100; tableData.push(Object.assign(data.adjustments[i], { change: change, @@ -94,6 +87,13 @@ export class DifficultyChartComponent implements OnInit { prepareChartOptions(data) { this.chartOptions = { + color: new graphic.LinearGradient(0, 0, 0, 0.65, [ + { offset: 0, color: '#D81B60' }, + { offset: 0.25, color: '#8E24AA' }, + { offset: 0.5, color: '#5E35B1' }, + { offset: 0.75, color: '#3949AB' }, + { offset: 1, color: '#1E88E5' } + ]), title: { text: this.widget? '' : $localize`:@@mining.difficulty:Difficulty`, left: 'center', @@ -104,6 +104,17 @@ export class DifficultyChartComponent implements OnInit { tooltip: { show: true, trigger: 'axis', + backgroundColor: 'rgba(17, 19, 31, 1)', + borderRadius: 4, + shadowColor: 'rgba(0, 0, 0, 0.5)', + textStyle: { + color: '#b1b1b1', + }, + borderColor: '#000', + formatter: params => { + return `${params[0].axisValueLabel}
+ ${params[0].marker} ${formatNumber(params[0].value[1], this.locale, '1.0-0')}` + } }, axisPointer: { type: 'line', @@ -137,10 +148,32 @@ export class DifficultyChartComponent implements OnInit { lineStyle: { width: 2, }, - areaStyle: { - opacity: 0.25 - }, }, + dataZoom: this.widget ? null : [{ + type: 'inside', + realtime: true, + zoomLock: true, + zoomOnMouseWheel: true, + moveOnMouseMove: true, + maxSpan: 100, + minSpan: 10, + }, { + showDetail: false, + show: true, + type: 'slider', + brushSelect: false, + realtime: true, + bottom: 0, + selectedDataBackground: { + lineStyle: { + color: '#fff', + opacity: 0.45, + }, + areaStyle: { + opacity: 0, + } + }, + }], }; } 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 3e3e353fe..9a202b69a 100644 --- a/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts +++ b/frontend/src/app/components/hashrate-chart/hashrate-chart.component.ts @@ -1,5 +1,5 @@ import { Component, Inject, Input, LOCALE_ID, OnInit } from '@angular/core'; -import { EChartsOption } from 'echarts'; +import { EChartsOption, graphic } from 'echarts'; import { Observable } from 'rxjs'; import { map, share, startWith, switchMap, tap } from 'rxjs/operators'; import { ApiService } from 'src/app/services/api.service'; @@ -78,6 +78,13 @@ export class HashrateChartComponent implements OnInit { prepareChartOptions(data) { this.chartOptions = { + color: new graphic.LinearGradient(0, 0, 0, 0.65, [ + { offset: 0, color: '#F4511E' }, + { offset: 0.25, color: '#FB8C00' }, + { offset: 0.5, color: '#FFB300' }, + { offset: 0.75, color: '#FDD835' }, + { offset: 1, color: '#7CB342' } + ]), grid: { right: this.right, left: this.left, @@ -92,6 +99,17 @@ export class HashrateChartComponent implements OnInit { tooltip: { show: true, trigger: 'axis', + backgroundColor: 'rgba(17, 19, 31, 1)', + borderRadius: 4, + shadowColor: 'rgba(0, 0, 0, 0.5)', + textStyle: { + color: '#b1b1b1', + }, + borderColor: '#000', + formatter: params => { + return `${params[0].axisValueLabel}
+ ${params[0].marker} ${formatNumber(params[0].value[1], this.locale, '1.0-0')} H/s` + } }, axisPointer: { type: 'line', @@ -125,9 +143,6 @@ export class HashrateChartComponent implements OnInit { lineStyle: { width: 2, }, - areaStyle: { - opacity: 0.25 - }, }, dataZoom: this.widget ? null : [{ type: 'inside', diff --git a/frontend/src/app/components/mining-dashboard/mining-dashboard.component.html b/frontend/src/app/components/mining-dashboard/mining-dashboard.component.html index 35a26099b..43c5c378c 100644 --- a/frontend/src/app/components/mining-dashboard/mining-dashboard.component.html +++ b/frontend/src/app/components/mining-dashboard/mining-dashboard.component.html @@ -4,9 +4,9 @@
-
Mining Pools Share (1w)
+
Mining Pools Share (1w)
@@ -16,9 +16,9 @@
-
Hashrate (1y)
+
Hashrate (1y)
@@ -28,9 +28,9 @@
-
Difficulty (1y)
+
Difficulty (1y)
diff --git a/frontend/src/app/components/mining-dashboard/mining-dashboard.component.scss b/frontend/src/app/components/mining-dashboard/mining-dashboard.component.scss index 98e4e7d4d..c2fb37e8c 100644 --- a/frontend/src/app/components/mining-dashboard/mining-dashboard.component.scss +++ b/frontend/src/app/components/mining-dashboard/mining-dashboard.component.scss @@ -15,6 +15,11 @@ height: 100%; } +.card-title { + color: #4a68b9; + font-size: 1rem; +} + .card-wrapper { .card { height: auto !important; diff --git a/frontend/src/app/components/pool-ranking/pool-ranking.component.ts b/frontend/src/app/components/pool-ranking/pool-ranking.component.ts index 9cebb6574..8c1f809dc 100644 --- a/frontend/src/app/components/pool-ranking/pool-ranking.component.ts +++ b/frontend/src/app/components/pool-ranking/pool-ranking.component.ts @@ -121,21 +121,24 @@ export class PoolRankingComponent implements OnInit { value: pool.share, name: pool.name + (this.isMobile() ? `` : ` (${pool.share}%)`), label: { - color: '#FFFFFF', + color: '#b1b1b1', overflow: 'break', }, tooltip: { - backgroundColor: '#282d47', + backgroundColor: 'rgba(17, 19, 31, 1)', + borderRadius: 4, + shadowColor: 'rgba(0, 0, 0, 0.5)', textStyle: { - color: '#FFFFFF', + color: '#b1b1b1', }, + borderColor: '#000', formatter: () => { if (this.poolsWindowPreference === '24h') { - return `${pool.name} (${pool.share}%)
` + + return `${pool.name} (${pool.share}%)
` + pool.lastEstimatedHashrate.toString() + ' PH/s' + `
` + pool.blockCount.toString() + ` blocks`; } else { - return `${pool.name} (${pool.share}%)
` + + return `${pool.name} (${pool.share}%)
` + pool.blockCount.toString() + ` blocks`; } }