This commit is contained in:
SuriyaR 2019-08-01 13:08:45 +05:30
parent 9685d87d7e
commit 7c1be252f4
6 changed files with 101 additions and 97 deletions

View File

@ -1048,13 +1048,14 @@ export class BlockchainBlockController {
DifficultyRandomx = [],
blocks = [];
TotalDifficultyNBlockQuery.forEach(e => {
//date.indexOf(moment(e.date).format('YYYY-MM-DD')) < 0 ?
date.push(moment(e.date).format('YYYY-MM-DD'));
DifficultyCuckaroo.push(parseInt(e.total_difficulty_cuckaroo));
DifficultyCuckatoo.push(parseInt(e.total_difficulty_cuckatoo));
DifficultyProgpow.push(parseInt(e.total_difficulty_progpow));
DifficultyRandomx.push(parseInt(e.total_difficulty_randomx));
});
BlockQuery.forEach(e => {
date.indexOf(moment(e.date).format('YYYY-MM-DD')) < 0 ? date.push(moment(e.date).format('YYYY-MM-DD')) : ''
blocks.push(parseInt(e.blocks));
});
response.status(200).json({
@ -1120,8 +1121,7 @@ export class BlockchainBlockController {
"select 1 as hash, date(DATE_TRUNC('day', timestamp at time zone '" +
process.env.TIME_ZONE +
"')) as date, Count( CASE WHEN proof = 'RandomX' THEN 1 ELSE NULL END) AS RandomX, \
Count( CASE WHEN proof = 'Cuckaroo' THEN 1 ELSE NULL END) AS Cuckaroo,\
Count( CASE WHEN proof = 'Cuckatoo' THEN 1 ELSE NULL END) AS Cuckatoo,\
Count( CASE WHEN proof = 'Cuckoo' THEN 1 ELSE NULL END) AS Cuckoo,\
Count( CASE WHEN proof = 'ProgPow' THEN 1 ELSE NULL END) AS ProgPow \
from blockchain_block where " +
timeIntervalQry +
@ -1134,15 +1134,13 @@ export class BlockchainBlockController {
});
let date = [],
Blocks = [],
Cuckaroo = [],
Cuckatoo = [],
Cuckoo = [],
ProgPow = [],
RandomX = [];
stackNBlockQuery.forEach(e => {
date.push(moment(e.date).format('YYYY-MM-DD'));
// Blocks.push({Cuckaroo: parseInt(e.cuckaroo), Cuckatoo : parseInt(e.cuckatoo), ProgPow : parseInt(e.progpow), RandomX : parseInt(e.randomx)})
Cuckaroo.push(parseInt(e.cuckaroo));
Cuckatoo.push(parseInt(e.cuckatoo));
Cuckoo.push(parseInt(e.cuckoo));
ProgPow.push(parseInt(e.progpow));
RandomX.push(parseInt(e.randomx));
});
@ -1152,8 +1150,7 @@ export class BlockchainBlockController {
message: 'Stack Data fetched Successfully',
response: {
Date: date,
Cuckaroo:Cuckaroo,
Cuckatoo:Cuckatoo,
Cuckoo:Cuckoo,
ProgPow:ProgPow,
RandomX:RandomX
},
@ -1205,10 +1202,9 @@ export class BlockchainBlockController {
}
const stackNBlockQuery = await getConnection()
.query(
"SELECT hash,total_edge_bits, RandomX, Cuckaroo, Cuckatoo, ProgPow, Round(RandomX * 100.0 / total_edge_bits,2) AS RandomXper, Round(Cuckaroo * 100.0 / total_edge_bits,2) AS Cuckarooper, Round(Cuckatoo * 100.0 / total_edge_bits,2) AS Cuckatooper, Round(ProgPow * 100.0 / total_edge_bits,2) AS ProgPowper from (select 1 as hash, COUNT(edge_bits) AS total_edge_bits, \
"SELECT hash,total_edge_bits, RandomX, Cuckoo, ProgPow, Round(RandomX * 100.0 / total_edge_bits,2) AS RandomXper, Round(Cuckoo * 100.0 / total_edge_bits,2) AS Cuckooper, Round(ProgPow * 100.0 / total_edge_bits,2) AS ProgPowper from (select 1 as hash, COUNT(edge_bits) AS total_edge_bits, \
Count( CASE WHEN proof = 'RandomX' THEN 1 ELSE NULL END) AS RandomX,\
Count( CASE WHEN proof = 'Cuckaroo' THEN 1 ELSE NULL END) AS Cuckaroo,\
Count( CASE WHEN proof = 'Cuckatoo' THEN 1 ELSE NULL END) AS Cuckatoo,\
Count( CASE WHEN proof = 'Cuckoo' THEN 1 ELSE NULL END) AS Cuckoo,\
Count( CASE WHEN proof = 'ProgPow' THEN 1 ELSE NULL END) AS ProgPow \
from blockchain_block where " +
timeIntervalQry +
@ -1221,8 +1217,8 @@ export class BlockchainBlockController {
value = [];
stackNBlockQuery.forEach(e => {
label.push("Cuckaroo","Cuckatoo","ProgPow","RandomX");
value.push(parseInt(e.cuckaroo),parseInt(e.cuckatoo),parseInt(e.progpow),parseInt(e.randomx));
label.push("Cuckoo","ProgPow","RandomX");
value.push(parseInt(e.cuckoo),parseInt(e.progpow),parseInt(e.randomx));
});
response.status(200).json({
status: 200,
@ -1685,15 +1681,14 @@ export class BlockchainBlockController {
}
const BlockMineChartQuery = await getConnection()
.query(
"SELECT hash, date , total_edge_bits, RandomX, Cuckaroo, Cuckatoo, ProgPow, Round(RandomX * 100.0 / total_edge_bits,2) AS RandomXper, Round(Cuckaroo * 100.0 / total_edge_bits,2) AS Cuckarooper, Round(Cuckatoo * 100.0 / total_edge_bits,2) AS Cuckatooper, Round(ProgPow * 100.0 / total_edge_bits,2) AS ProgPowper \
"SELECT hash, date , total_edge_bits, RandomX, Cuckoo, ProgPow, Round(RandomX * 100.0 / total_edge_bits,2) AS RandomXper, Round(Cuckoo * 100.0 / total_edge_bits,2) AS Cuckooper, Round(ProgPow * 100.0 / total_edge_bits,2) AS ProgPowper \
FROM (SELECT 1 as hash, \
date(DATE_TRUNC('day', timestamp at time zone '" +
process.env.TIME_ZONE +
"')) as date, \
COUNT(edge_bits) AS total_edge_bits, \
Count( CASE WHEN proof = 'RandomX' THEN 1 ELSE NULL END) AS RandomX, \
Count( CASE WHEN proof = 'Cuckaroo' THEN 1 ELSE NULL END) AS Cuckaroo,\
Count( CASE WHEN proof = 'Cuckatoo' THEN 1 ELSE NULL END) AS Cuckatoo,\
Count( CASE WHEN proof = 'Cuckoo' THEN 1 ELSE NULL END) AS Cuckoo,\
Count( CASE WHEN proof = 'ProgPow' THEN 1 ELSE NULL END) AS ProgPow \
FROM blockchain_block \
where " +
@ -1707,23 +1702,19 @@ export class BlockchainBlockController {
});
let date = [],
RandomXper = [],
Cuckarooper = [],
Cuckatooper = [],
Cuckooper = [],
ProgPowper = [],
RandomX = [],
Cuckatoo = [],
Cuckaroo = [],
Cuckoo = [],
ProgPow = [];
BlockMineChartQuery.forEach(e => {
date.push(moment(e.date).format('YYYY-MM-DD'));
RandomXper.push(parseFloat(e.randomxper));
Cuckarooper.push(parseFloat(e.cuckarooper));
Cuckatooper.push(parseFloat(e.cuckatooper));
Cuckooper.push(parseFloat(e.cuckarooper));
ProgPowper.push(parseFloat(e.progpowper));
RandomX.push(parseInt(e.randomx));
Cuckatoo.push(parseInt(e.cuckatoo));
Cuckaroo.push(parseInt(e.cuckaroo));
Cuckoo.push(parseInt(e.cuckatoo));
ProgPow.push(parseInt(e.progpow));
});
@ -1734,13 +1725,11 @@ export class BlockchainBlockController {
response: {
date,
RandomXper,
Cuckarooper,
Cuckatooper,
Cuckooper,
ProgPowper,
RandomX,
Cuckatoo,
Cuckaroo,
ProgPow,
Cuckoo,
ProgPow
},
});
} catch (error) {

View File

@ -38,7 +38,7 @@
"BLOCKS" : "Blocks",
"BLOCK" : "Block",
"BLOCKS_MINED" : "Blocks Mined",
"TRANSACTION_FEES" : "Transcation Fees",
"TRANSACTION_FEES" : "Transaction Fees",
"SUPPLY_GROWTH" : "Supply Growth",
"HASHRATE_GROWTH_CHART" : "HashRate Growth Chart",
"BLOCK_INTERVAL" : "Block Interval",

View File

@ -70,7 +70,7 @@
<div class="d-inline-block align-middle ml-2">
<span class="">{{'home.DIFFICULTY' | translate}}</span>
</div>
<h6 class="view_txt">{{(hashdata.BlockchainBlockFetchQuery.Proof == 'Cuckoo') ? ((hashvalue.target_difficulty_cuckatoo + hashvalue.target_difficulty_cuckaroo) | number) : (hashdata.BlockchainBlockFetchQuery.Proof == 'RandomX') ? (hashvalue.target_difficulty_randomx | number) : (hashdata.BlockchainBlockFetchQuery.Proof == 'ProgPow') ? (hashvalue.target_difficulty_progpow | number) : 0}}</h6>
<h6 class="view_txt">{{(hashdata.BlockchainBlockFetchQuery.Proof == 'Cuckoo') ? ((hashdata.BlockchainBlockFetchQuery.target_difficulty_cuckatoo + hashdata.BlockchainBlockFetchQuery.target_difficulty_cuckaroo) | number) : (hashdata.BlockchainBlockFetchQuery.Proof == 'RandomX') ? (hashdata.BlockchainBlockFetchQuery.target_difficulty_randomx | number) : (hashdata.BlockchainBlockFetchQuery.Proof == 'ProgPow') ? (hashdata.BlockchainBlockFetchQuery.target_difficulty_progpow | number) : 0}}</h6>
</div>
<div class="col-sm-6 col-md-4 mt-4 pt-2">
<div class="d-inline-block align-middle">

View File

@ -3,9 +3,9 @@
<div class="box_shadow">
<div class="blocks">
<h2 class="chart_heading d-inline-block">{{'home.TOTAL_DIFFICULTY' | translate}}</h2>
<span class="txn_count" *ngIf="this.lg_last">{{
this.lg_last | number
}}</span>
<!-- <span class="txn_count" *ngIf="this.lg_last.length > 0"><span *ngFor="let l of lg_last">{{
this.l | number</span>
}}</span> -->
<div class="chart_show">
<epic-explorer-plotly *ngIf="linearGraphData.data" [data]="linearGraphData.data" [layout]="linearGraphData.layout">
</epic-explorer-plotly>

View File

@ -25,7 +25,7 @@ export class GraphListComponent implements OnInit {
public stackGraphData: any = [];
public pieGraphData: any = [];
public lg_last: any = '';
public lg_last: any;
public ag_last: any = '';
public dg_last: any = '';
public brg_last: any = '';
@ -146,16 +146,14 @@ export class GraphListComponent implements OnInit {
res => {
if (res['status'] == 200) {
let sDate = res.response.Date;
let Cuckaroo = res.response.Cuckaroo;
let Cuckatoo = res.response.Cuckatoo;
let Cuckoo = res.response.Cuckoo;
let ProgPow = res.response.ProgPow;
let RandomX = res.response.RandomX;
this.sg_last =
RandomX[RandomX.length - 1];
this.stackchartFunc(
sDate,
Cuckaroo,
Cuckatoo,
Cuckoo,
ProgPow,
RandomX
);
@ -276,25 +274,21 @@ export class GraphListComponent implements OnInit {
if (res['status'] == 200) {
let mDate = res.response.date;
let ProgPow = res.response.ProgPow;
let Cuckaroo = res.response.Cuckaroo;
let Cuckatoo = res.response.Cuckatoo;
let Cuckoo = res.response.Cuckoo;
let RandomX = res.response.RandomX;
let ProgPowper = res.response.ProgPowper;
let Cuckarooper = res.response.Cuckarooper;
let Cuckatooper = res.response.Cuckatooper;
let Cuckooper = res.response.Cuckooper;
let RandomXper = res.response.RandomXper;
this.dg_last = RandomXper[RandomXper.length - 1];
this.blockminedFunc(
mDate,
ProgPow,
Cuckaroo,
Cuckatoo,
Cuckoo,
RandomX,
ProgPowper,
Cuckarooper,
Cuckatooper,
Cuckooper,
RandomXper,
);
resolve();
@ -399,7 +393,7 @@ export class GraphListComponent implements OnInit {
let DifficultyProgpow = res.response.DifficultyProgpow;
let DifficultyRandomx = res.response.DifficultyRandomx;
this.lg_last =
DifficultyCuckaroo[DifficultyCuckaroo.length - 1];
[DifficultyCuckaroo[DifficultyCuckaroo.length - 1],DifficultyCuckatoo[DifficultyCuckatoo.length - 1],DifficultyProgpow[DifficultyProgpow.length - 1],DifficultyRandomx[DifficultyRandomx.length - 1]];
this.difficultyChartFunc(
DifficultychartDate,
DifficultyCuckaroo,
@ -487,31 +481,31 @@ export class GraphListComponent implements OnInit {
};
}
stackchartFunc(sDate, Cuckaroo, Cuckatoo, ProgPow, RandomX) {
stackchartFunc(sDate, Cuckoo, ProgPow, RandomX) {
this.stackGraphData = {
data: [
{
x: sDate,
y: Cuckaroo,
y: Cuckoo,
name: '',
type: 'bar',
text: Cuckaroo,
hovertemplate: '%{x}<br> Cuckatoo : %{text:,}',
text: Cuckoo,
hovertemplate: '%{x}<br> Cuckoo : %{text:,}',
marker: {
color: '#77817C',
},
},
{
x: sDate,
y: Cuckatoo,
name: '',
type: 'bar',
text: Cuckatoo,
hovertemplate: '%{x}<br> Cuckaroo : %{text:,}',
marker: {
color: '#54CFDC',
},
},
// {
// x: sDate,
// y: Cuckatoo,
// name: '',
// type: 'bar',
// text: Cuckatoo,
// hovertemplate: '%{x}<br> Cuckaroo : %{text:,}',
// marker: {
// color: '#54CFDC',
// },
// },
{
x: sDate,
y: ProgPow,
@ -540,15 +534,23 @@ export class GraphListComponent implements OnInit {
hovermode: 'closest',
//width: 350,
height: 250,
autosize: false,
autosize: true,
showlegend: false,
barmode: 'relative',
xaxis: {
showgrid: true,
zeroline: false,
tickangle: -45,
tickformat: '%m-%d',
rangemode: 'nonnegative',
fixedrange: true,
},
yaxis: {
showline: false,
title: 'Block',
rangemode: 'nonnegative',
fixedrange: true,
showgrid: true,
},
margin: {
l: 50,
@ -757,14 +759,14 @@ export class GraphListComponent implements OnInit {
};
}
blockminedFunc(mDate,ProgPow, Cuckaroo, Cuckatoo, RandomX, ProgPowper, Cuckarooper, Cuckatooper, RandomXper) {
blockminedFunc(mDate,ProgPow, Cuckoo, RandomX, ProgPowper, Cuckooper, RandomXper) {
this.doubleareaGraphData = {
data: [
{
x: mDate,
y: Cuckarooper,
text: Cuckaroo,
hovertemplate: 'Cuckaroo :%{y} % ( %{text:,} )',
y: Cuckooper,
text: Cuckoo,
hovertemplate: 'Cuckoo :%{y} % ( %{text:,} )',
name: '',
fill: 'tozeroy',
type: 'line',
@ -772,18 +774,18 @@ export class GraphListComponent implements OnInit {
color: '#f5ca19',
},
},
{
x: mDate,
y: Cuckatooper,
text: Cuckatoo,
hovertemplate: 'Cuckatoo :%{y} % ( %{text:,} )',
name: '',
fill: 'tozeroy',
type: 'line',
line: {
color: '#f5c1a9',
},
},
// {
// x: mDate,
// y: Cuckatooper,
// text: Cuckatoo,
// hovertemplate: 'Cuckatoo :%{y} % ( %{text:,} )',
// name: '',
// fill: 'tozeroy',
// type: 'line',
// line: {
// color: '#f5c1a9',
// },
// },
{
x: mDate,
y: RandomXper,
@ -861,31 +863,36 @@ export class GraphListComponent implements OnInit {
hovermode: 'closest',
height: 250,
//width: 365,
autosize: false,
autosize: true,
annotations: [],
font: {
size: 8.5,
},
xaxis: {
ticks: '',
tickangle: 360,
tickangle: screen.width < 767 ? '-90' : 360,
side: 'top',
autotick: false,
showgrid: true,
rangemode: 'nonnegative',
fixedrange: true,
autosize: true,
},
yaxis: {
ticks: '',
ticksuffix: ' ',
tickformat: '%m-%d',
autosize: false,
autosize: true,
showgrid: true,
autotick: false,
rangemode: 'nonnegative',
fixedrange: true,
},
margin: {
l: 30,
r: 30,
b: 60,
t: 60,
r: 0,
b: 50,
t: 50,
},
showlegend: false,
},
@ -928,17 +935,22 @@ export class GraphListComponent implements OnInit {
},
],
layout: {
autosize: false,
autosize: true,
// width: 350,
height: 250,
xaxis: {
showgrid: false,
showgrid: true,
zeroline: false,
tickformat: '%m-%d',
rangemode: 'nonnegative',
fixedrange: true,
},
yaxis: {
showline: false,
title: 'Transactions',
rangemode: 'nonnegative',
fixedrange: true,
showgrid: true,
},
margin: {
l: 50,

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { HttpClient, HttpParams, HttpErrorResponse } from '@angular/common/http';
import { HttpClient, HttpParams, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
import { ChartService } from '../../../shared/services/chart.service';
import { FormGroup, FormControl } from '@angular/forms';
import { TransServiceService } from '../../../shared/services/trans-service.service';
@ -44,15 +44,18 @@ export class LatestblocksComponent implements OnInit {
}
public getpeersList() {
const httpOptions = {
headers: new HttpHeaders({
'Access-Control-Allow-Origin':'*'
})
};
console.log('EEE');
this.http
.get('http://5.9.174.122:3413/v1/peers/connected')
.pipe(
map(res => {
.get('http://5.9.174.122:3413/v1/peers/connected',httpOptions)
.subscribe((res) => {
console.log('reeeee',res);
}),
catchError((error: HttpErrorResponse): any => throwError(error)),
);
});
}