diff --git a/server/i18n/de.json b/server/i18n/de.json index d98ee2e..e062121 100644 --- a/server/i18n/de.json +++ b/server/i18n/de.json @@ -1,5 +1,5 @@ { - "total-difficulty" : "Gesamtschwierigkeit", + "difficulty" : "Schwierigkeit", "transactions-by-time" : "Transaktionen im Zeitverlauf", "blocks" : "Blöcke", "transaction-fees" : "Transkationsgebühren", diff --git a/server/i18n/en.json b/server/i18n/en.json index fe05d36..73ad174 100644 --- a/server/i18n/en.json +++ b/server/i18n/en.json @@ -1,5 +1,5 @@ { - "total-difficulty" : "Total Difficulty", + "difficulty" : "Difficulty", "transactions-by-time" : "Transactions over time", "blocks" : "Blocks", "transaction-fees" : "Transaction Fees", diff --git a/src/app/view/graph-view/graph-detail/graph-detail.component.html b/src/app/view/graph-view/graph-detail/graph-detail.component.html index 43feb74..92821bd 100644 --- a/src/app/view/graph-view/graph-detail/graph-detail.component.html +++ b/src/app/view/graph-view/graph-detail/graph-detail.component.html @@ -8,7 +8,7 @@
-

{{this.chartType | translate}}

+

{{this.title=='Total Difficulty' ? 'Target Difficulty' : this.chartType | translate}}

@@ -32,7 +32,7 @@ ChartFromView('', '', '3 months', comp.Type); selectedItem = 5; comp.difficultyRange = '3 months' " id="5" #item5 [ngClass]="{ active: selectedItem == item5.id, day3m_txt: true }">3 {{'home.MONTHS' | translate}}
- +
diff --git a/src/app/view/graph-view/graph-detail/graph-detail.component.ts b/src/app/view/graph-view/graph-detail/graph-detail.component.ts index 95f9e6d..decea01 100644 --- a/src/app/view/graph-view/graph-detail/graph-detail.component.ts +++ b/src/app/view/graph-view/graph-detail/graph-detail.component.ts @@ -25,13 +25,16 @@ export class GraphDetailComponent implements OnInit { public selectedItem8: Number = 2; public selectedItem12: Number = 1; public Type: any = ''; - + public selectedTarget: Number = 3; + public selectedTarget12: Number = 1; public GraphtInput: any; public GraphtOutput: any; public GraphtKernal: any; public GraphtDate: any; public GraphtHour: any; + public linearTotalGraphData: any = []; + public TdifficultyRange: any = '1 day'; constructor( private route: ActivatedRoute, @@ -41,9 +44,7 @@ export class GraphDetailComponent implements OnInit { public translate: TransServiceService ) {} ngOnInit() { - if(this.title=='Total Difficulty'){ - this.selectedItem = 6; - } + var self = this; var x = setInterval(function() { self.TimeArr = self.chartService.GetTimer() @@ -54,11 +55,14 @@ export class GraphDetailComponent implements OnInit { this.chartType = params['hashid']; //console.log(this.chartType); switch(this.chartType){ - case 'total-difficulty': + case 'difficulty': + this.totalDifficultyreq(); this.comp.Difficultyreq().then(res => { this.hashdata = this.comp.linearGraphData; this.hashdata.layout.height = 500; this.title = 'Total Difficulty'; + this.selectedItem = 6; + this.selectedTarget = 6; this.titleService.setTitle( this.route.snapshot.data.title + ' - ' + this.title, ); @@ -199,7 +203,7 @@ export class GraphDetailComponent implements OnInit { this.comp.Type = p4 != '' ? p4 : this.comp.Type == '' ? 'cuckatoo' : this.comp.Type; switch (this.chartType) { - case 'total-difficulty': + case 'difficulty': this.comp.Difficultyreq(p1, p2, p3, p4).then(res => { this.hashdata = this.comp.linearGraphData; this.hashdata.layout.height = 500; @@ -291,4 +295,75 @@ export class GraphDetailComponent implements OnInit { break; } } + + totalDifficultyreq( + fromDate = '', + ToDate = '', + interval = '', + type = '' + ) { + this.Type = type != '' ? type : this.Type == '' ? 'cuckatoo' : this.Type; + return new Promise((resolve, reject) => { + let params = new HttpParams(); + params = params.append('FromDate', fromDate); + params = params.append('ToDate', ToDate); + params = params.append('Interval', interval); + params = params.append('Type', this.Type); + params = params.append('Difftype', 'total'); + this.chartService + .apiGetRequest(params, '/blockchain_block/totaldiff') + .subscribe( + res => { + if (res['status'] == 200) { + let DifficultychartDate = res.response.Date; + let TargetDifficulty = res.response.TargetDifficulty; + + this.totaldifficultyChartFunc( + DifficultychartDate, + TargetDifficulty, + this.Type + ); + resolve(); + } + }, + error => {}, + ); + }); + } + + totaldifficultyChartFunc(DifficultychartDate, TargetDifficulty, Type) { + this.linearTotalGraphData = { + data: [ + { + x: DifficultychartDate, + y: TargetDifficulty, + text: TargetDifficulty, + mode: 'lines+markers', + type: 'scatter', + name: '', + line: { color: '#ac3333' }, + hovertemplate: '%{x}
Difficulty : %{text:,}', + }, + ], + layout: { + hovermode: 'closest', + height: 250, + autosize: true, + showlegend: false, + xaxis: { + tickangle: -45, + tickformat: '%m-%d', + }, + yaxis: { + title: 'Diff', + }, + margin: { + l: 50, + r: 50, + b: 50, + t: 50, + }, + }, + }; + } } diff --git a/src/app/view/home/graph-list/graph-list.component.html b/src/app/view/home/graph-list/graph-list.component.html index 8ab895e..8837c8f 100644 --- a/src/app/view/home/graph-list/graph-list.component.html +++ b/src/app/view/home/graph-list/graph-list.component.html @@ -23,7 +23,7 @@ -
+
1 Day @@ -45,7 +45,7 @@
-
+
Cuckoo @@ -56,7 +56,7 @@ Difficultyreq('', '', difficultyRange,'randomx'); selectedItem12 = 3 " id="3" #item123 [ngClass]="{ active: selectedItem12 == item123.id, txt_primay: true }">RandomX
- {{'home.EXPLORE_IT' | translate}} {{'home.EXPLORE_IT' | translate}}
diff --git a/src/assets/css/style.css b/src/assets/css/style.css index 7a8d886..45934d5 100644 --- a/src/assets/css/style.css +++ b/src/assets/css/style.css @@ -644,3 +644,4 @@ body.dark_theme { .dark_theme .tab_hdng{color: #ffffff;} .dark_theme .view_content table{border-color: #384566;} .dark_theme .card-body{background-color: #1c2437;} +.diff_margin{margin-bottom: -10px !important; margin-top: -10px !important;} \ No newline at end of file