From 92c946fc4d2967158ec4251e569b9b1eb4505177 Mon Sep 17 00:00:00 2001 From: SuriyaR Date: Wed, 7 Aug 2019 20:23:30 +0530 Subject: [PATCH 1/2] Changes --- server/controllers/BlockchainBlock.ts | 2 +- server/i18n/de.json | 5 +- server/i18n/en.json | 4 +- .../components/plotly/plotly.component.ts | 6 + .../graph-detail/graph-detail.component.html | 282 ++++++++++-------- .../graph-detail/graph-detail.component.ts | 150 +++++----- .../home/graph-list/graph-list.component.html | 91 +++++- .../home/graph-list/graph-list.component.ts | 100 ++++++- 8 files changed, 417 insertions(+), 223 deletions(-) diff --git a/server/controllers/BlockchainBlock.ts b/server/controllers/BlockchainBlock.ts index 9d83e8f..a05a04a 100644 --- a/server/controllers/BlockchainBlock.ts +++ b/server/controllers/BlockchainBlock.ts @@ -1232,7 +1232,7 @@ export class BlockchainBlockController { // DifficultyCuckatoo: DifficultyCuckatoo, // DifficultyProgpow: DifficultyProgpow, Maxrange: Maxrange, - Minrange: (Minrange * 0.3), + Minrange: (Minrange * 0.2), TargetDifficulty: TargetDifficulty }, }); diff --git a/server/i18n/de.json b/server/i18n/de.json index e062121..5f94735 100644 --- a/server/i18n/de.json +++ b/server/i18n/de.json @@ -7,7 +7,9 @@ "blocks-mined" : "Blöcke abgebaut", "hashrate-growth-chart" : "HashRate-Wachstumstabelle", "block-interval" : "Sperrintervall", - "transactions-vs-date" : "Transaktionen nach Datum", + "transactions-vs-date" : "Transaktionen nach Datum", + "total-difficulty" : "Gesamtschwierigkeit", + "target-difficulty" : "Zielschwierigkeit", "home": { "HEADER_TEXT": "Sie befinden sich in Beta", "COUNTDOWN": "Mainnet-Countdown", @@ -62,7 +64,6 @@ "SEARCH_RESULT1" : "Ihr Suchbegriff", "SEARCH_RESULT2" : "ist zu kurz", "SEARCH_RESULT3" : "Bitte geben Sie mindestens sechs Zeichen ein, wenn Sie nach Hash suchen", - "total-difficulty" : "Gesamtschwierigkeit", "PEERS" : "Gleichaltrigen", "CAPABILITIES" : "Fähigkeiten", "USER_AGENT" : "User Agent", diff --git a/server/i18n/en.json b/server/i18n/en.json index 73ad174..dfa128f 100644 --- a/server/i18n/en.json +++ b/server/i18n/en.json @@ -7,7 +7,9 @@ "blocks-mined" : "Blocks Mined", "hashrate-growth-chart" : "HashRate Growth Chart", "block-interval" : "Block Interval", - "transactions-vs-date" : "Transactions by Date", + "transactions-vs-date" : "Transactions by Date", + "total-difficulty" : "Total Difficulty", + "target-difficulty" : "Target Difficulty", "home": { "HEADER_TEXT": "You are on Beta", "COUNTDOWN": "Mainnet Countdown", diff --git a/src/app/shared/components/plotly/plotly.component.ts b/src/app/shared/components/plotly/plotly.component.ts index 08f70ed..b446b13 100644 --- a/src/app/shared/components/plotly/plotly.component.ts +++ b/src/app/shared/components/plotly/plotly.component.ts @@ -36,6 +36,9 @@ import { } @Input() set layout(layout: any) { this._layout = layout; + if(this._plotlyJs){ + this.showChart(); + } } get layout(): any { @@ -46,6 +49,9 @@ import { } @Input() set options(options: any) { this._options = options; + if(this._plotlyJs){ + this.showChart(); + } } get options(): any { return this._options; 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 92821bd..ab6e86e 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 @@ -1,66 +1,145 @@
- -
-
- - - -
- - + \ No newline at end of file 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 decea01..2557319 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 @@ -55,20 +55,35 @@ export class GraphDetailComponent implements OnInit { this.chartType = params['hashid']; //console.log(this.chartType); switch(this.chartType){ - case 'difficulty': - this.totalDifficultyreq(); - this.comp.Difficultyreq().then(res => { - this.hashdata = this.comp.linearGraphData; + case 'total-difficulty': + // this.totalDifficultyreq(); + this.comp.Difficultyreq('total').then(res => { + this.hashdata = this.comp.linearTotalGraphData; + console.log('this.comp.linearTotalGraphData',this.comp.linearTotalGraphData); 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, ); //console.log(this.hashdata); }); break; + case 'target-difficulty': + // this.totalDifficultyreq(); + this.comp.Difficultyreq('target').then(res => { + this.hashdata = this.comp.linearGraphData; + console.log('this.comp.linearGraphData',this.comp.linearGraphData); + this.hashdata.layout.height = 500; + this.title = 'Target Difficulty'; + this.selectedItem = 6; + this.titleService.setTitle( + this.route.snapshot.data.title + ' - ' + this.title, + ); + //console.log(this.hashdata); + }); + break; + case 'transactions-by-time': this.comp.Transactionheatmapreq().then(res => { this.hashdata = this.comp.heatMapGrowthData; @@ -200,13 +215,20 @@ export class GraphDetailComponent implements OnInit { ) { // (p1, p2, p3, p4, p5) for (fromDate, ToDate, interval, fordifficult, forblocks) for difficult and nar chart // AND For heatmap and others - It will change - this.comp.Type = p4 != '' ? p4 : this.comp.Type == '' ? 'cuckatoo' : this.comp.Type; + this.comp.Type = p4 != '' && (p4 == 'cuckatoo' || p4 == 'progpow' || p4 == 'randomx') ? p4 : this.comp.Type == '' ? 'cuckatoo' : this.comp.Type; switch (this.chartType) { - case 'difficulty': - this.comp.Difficultyreq(p1, p2, p3, p4).then(res => { + case 'target-difficulty': + this.comp.Difficultyreq('target',p1, p2, p3, p4).then(res => { this.hashdata = this.comp.linearGraphData; this.hashdata.layout.height = 500; + this.title = 'Target Difficulty'; + }); + break; + case 'total-difficulty': + this.comp.Difficultyreq('total',p1, p2, p3, p4).then(res => { + this.hashdata = this.comp.linearTotalGraphData; + this.hashdata.layout.height = 500; this.title = 'Total Difficulty'; }); break; @@ -221,7 +243,7 @@ export class GraphDetailComponent implements OnInit { }); break; case 'blocks': - this.comp.Difficultyreq(p1, p2, p3).then(res => { + this.comp.blockreq(p1, p2, p3).then(res => { this.hashdata = this.comp.barGraphData; this.hashdata.layout.height = 500; this.title = 'Blocks'; @@ -296,74 +318,46 @@ export class GraphDetailComponent implements OnInit { } } - 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, - }, - }, - }; - } + // totaldifficultyChartFunc(DifficultychartDate, TargetDifficulty, Type, range) { + // 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: 500, + // autosize: true, + // showlegend: false, + // xaxis: { + // tickangle: -45, + // tickformat: '%m-%d', + // fixedrange: true, + // showgrid: true + // }, + // yaxis: { + // title: 'Diff', + // fixedrange: true, + // showgrid: true, + // range: range + // }, + // 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 8837c8f..f142f31 100644 --- a/src/app/view/home/graph-list/graph-list.component.html +++ b/src/app/view/home/graph-list/graph-list.component.html @@ -25,42 +25,113 @@
1 Day 1 {{'home.WEEK' | translate}} 15 {{'home.DAYS' | translate}} 30 {{'home.DAYS' | translate}} 60 {{'home.DAYS' | translate}} 3 {{'home.MONTHS' | translate}}
- {{'home.EXPLORE_IT' | translate}} {{'home.EXPLORE_IT' | translate}}
+
diff --git a/src/app/view/home/graph-list/graph-list.component.ts b/src/app/view/home/graph-list/graph-list.component.ts index ed6ea07..260cb53 100644 --- a/src/app/view/home/graph-list/graph-list.component.ts +++ b/src/app/view/home/graph-list/graph-list.component.ts @@ -24,7 +24,8 @@ export class GraphListComponent implements OnInit { public transcationGraphData: any = []; public stackGraphData: any = []; public pieGraphData: any = []; - + public linearTotalGraphData: any = []; + public lg_last: any; public ag_last: any = ''; public dg_last: any = ''; @@ -49,6 +50,8 @@ export class GraphListComponent implements OnInit { public selectedItem10: Number = 3; public selectedItem11: Number = 3; public selectedItem12: Number = 1; + public selectedTarget: Number = 6; + public selectedTarget12: Number = 1; public tInput: any; public tOutput: any; @@ -57,7 +60,8 @@ export class GraphListComponent implements OnInit { public tHour: any; public Type: any = ''; public difficultyRange: any = '1 day'; - + public TdifficultyRange: any = '1 day'; + viewchartvar: boolean; constructor(private chartService: ChartService, private http: HttpClient,public translate: TransServiceService, private router: Router, @@ -71,8 +75,8 @@ export class GraphListComponent implements OnInit { ngOnInit() { /* Total Difficulty and blocks chart fetching */ - this.Difficultyreq(); - + this.Difficultyreq('target'); + this.Difficultyreq('total'); this.blockreq(); /* Transcation fee chart fetching */ @@ -376,6 +380,7 @@ export class GraphListComponent implements OnInit { } Difficultyreq( + difftype = '', fromDate = '', ToDate = '', interval = '', @@ -388,6 +393,7 @@ export class GraphListComponent implements OnInit { params = params.append('ToDate', ToDate); params = params.append('Interval', interval); params = params.append('Type', this.Type); + params = params.append('Difftype', difftype); this.chartService .apiGetRequest(params, '/blockchain_block/totaldiff') .subscribe( @@ -396,13 +402,28 @@ export class GraphListComponent implements OnInit { let DifficultychartDate = res.response.Date; let BlocksChartDate = res.response.blockDate; let TargetDifficulty = res.response.TargetDifficulty; + let range = [res.response.Minrange, res.response.Maxrange] this.lg_last = TargetDifficulty[TargetDifficulty.length - 1]; - this.difficultyChartFunc( - DifficultychartDate, - TargetDifficulty, - this.Type - ); + + switch(difftype){ + case 'total': + this.totaldifficultyChartFunc( + DifficultychartDate, + TargetDifficulty, + this.Type, + range + ); + break; + case 'target': + this.difficultyChartFunc( + DifficultychartDate, + TargetDifficulty, + this.Type, + range + ); + break; + } resolve(); } }, @@ -439,7 +460,8 @@ export class GraphListComponent implements OnInit { }); } - difficultyChartFunc(DifficultychartDate, TargetDifficulty, Type) { + difficultyChartFunc(DifficultychartDate, TargetDifficulty, Type, range) { + console.log('range rangerangerange@@@@@@@22444',range); this.linearGraphData = { data: [ { @@ -491,9 +513,14 @@ export class GraphListComponent implements OnInit { xaxis: { tickangle: -45, tickformat: '%m-%d', + showgrid: true, + fixedrange: true }, yaxis: { title: 'Diff', + showgrid: true, + fixedrange: true, + range: range }, margin: { l: 50, @@ -574,7 +601,7 @@ export class GraphListComponent implements OnInit { title: 'Blocks', rangemode: 'nonnegative', fixedrange: true, - showgrid: true, + showgrid: true }, margin: { l: 50, @@ -607,9 +634,13 @@ export class GraphListComponent implements OnInit { xaxis: { tickangle: -45, tickformat: '%m-%d', + showgrid: true, + fixedrange: true }, yaxis: { title: 'Blocks', + showgrid: true, + fixedrange: true }, margin: { l: 50, @@ -647,9 +678,13 @@ export class GraphListComponent implements OnInit { xaxis: { tickangle: -45, tickformat: '%m-%d', + showgrid: true, + fixedrange: true }, yaxis: { title: 'Blocks', + showgrid: true, + fixedrange: true }, margin: { l: 50, @@ -1032,10 +1067,13 @@ export class GraphListComponent implements OnInit { showgrid: false, zeroline: false, tickformat: '%m-%d', + fixedrange: true }, yaxis: { showline: false, title: 'Estimated Hashrate (GH/s)', + showgrid: true, + fixedrange: true }, margin: { l: 50, @@ -1048,4 +1086,44 @@ export class GraphListComponent implements OnInit { options: null, }; } + totaldifficultyChartFunc(DifficultychartDate, TargetDifficulty, Type, range) { + 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', + fixedrange: true, + showgrid: true + }, + yaxis: { + title: 'Diff', + fixedrange: true, + showgrid: true, + range: range + }, + margin: { + l: 50, + r: 50, + b: 50, + t: 50, + }, + }, + }; + } } From ec5c30d14c4fd23b5c826723648c55c8aded317e Mon Sep 17 00:00:00 2001 From: Prema Date: Thu, 8 Aug 2019 11:47:54 +0530 Subject: [PATCH 2/2] UI changes --- .../components/header/header.component.html | 31 ++++++++++--------- .../siteheader/siteheader.component.html | 27 +++++++++------- src/app/view/home/home-worksapce.component.ts | 11 ++++--- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/src/app/shared/components/header/header.component.html b/src/app/shared/components/header/header.component.html index c2ede9d..27d9453 100755 --- a/src/app/shared/components/header/header.component.html +++ b/src/app/shared/components/header/header.component.html @@ -2,20 +2,9 @@