This commit is contained in:
SuriyaR 2019-08-12 18:33:50 +05:30
parent 7a7f4c34ba
commit 7b7a0108aa
6 changed files with 402 additions and 318 deletions

View File

@ -1552,83 +1552,119 @@ export class BlockchainBlockController {
});
let height = BlockchainLatestBlockQuery[0].height;
var coin_existence;
// if (height > 12960) {
// var remain_block = height - 12960;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// 1440 * 80 +
// 1440 * 60 +
// 1440 * 50 +
// 25 * remain_block;
// } else if (height > 11520) {
// var remain_block = height - 11520;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// 1440 * 80 +
// 1440 * 60 +
// remain_block * 50;
// } else if (height > 10080) {
// var remain_block = height - 10080;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// 1440 * 80 +
// remain_block * 60;
// } else if (height > 8640) {
// var remain_block = height - 8640;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// remain_block * 80;
// } else if (height > 7200) {
// var remain_block = height - 7200;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// remain_block * 100;
// } else if (height > 5760) {
// var remain_block = height - 5760;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// remain_block * 120;
// } else if (height > 4320) {
// var remain_block = height - 4320;
// var coin_existence =
// 1440 * 200 + 1440 * 180 + 1440 * 160 + remain_block * 140;
// } else if (height > 2880) {
// var remain_block = height - 2880;
// var coin_existence = 1440 * 200 + 1440 * 180 + remain_block * 160;
// } else if (height > 1440) {
// var remain_block = height - 1440;
// var coin_existence = 1440 * 200 + remain_block * 180;
// } else {
// var coin_existence = height * 200;
// }
let DAY_HEIGHT = 1440
/// Height of the first epic block emission era
const BLOCK_ERA_1 = DAY_HEIGHT * 334;
/// Height of the second epic block emission era
const BLOCK_ERA_2 = BLOCK_ERA_1 + (DAY_HEIGHT * 470);
/// Height of the third epic block emission era
const BLOCK_ERA_3 = BLOCK_ERA_2 + (DAY_HEIGHT * 601);
/// Height of the fourth epic block emission era
const BLOCK_ERA_4 = BLOCK_ERA_3 + (DAY_HEIGHT * 800);
/// Height of the fifth epic block emission era
const BLOCK_ERA_5 = BLOCK_ERA_4 + (DAY_HEIGHT * 1019);
/// After the epic block emission era 6, each era will last 4 years (approximately 1460 days)
const BLOCK_ERA_6_ONWARDS = DAY_HEIGHT * 1460;
/// Block Reward that will be assigned after we change from era 5 to era 6.
const BASE_REWARD_ERA_6_ONWARDS = 0.15625;
if (height > 12960) {
var remain_block = height - 12960;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
1440 * 80 +
1440 * 60 +
1440 * 50 +
25 * remain_block;
} else if (height > 11520) {
var remain_block = height - 11520;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
1440 * 80 +
1440 * 60 +
remain_block * 50;
} else if (height > 10080) {
var remain_block = height - 10080;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
1440 * 80 +
remain_block * 60;
} else if (height > 8640) {
var remain_block = height - 8640;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
remain_block * 80;
} else if (height > 7200) {
var remain_block = height - 7200;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
remain_block * 100;
} else if (height > 5760) {
var remain_block = height - 5760;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
remain_block * 120;
} else if (height > 4320) {
var remain_block = height - 4320;
var coin_existence =
1440 * 200 + 1440 * 180 + 1440 * 160 + remain_block * 140;
} else if (height > 2880) {
var remain_block = height - 2880;
var coin_existence = 1440 * 200 + 1440 * 180 + remain_block * 160;
} else if (height > 1440) {
var remain_block = height - 1440;
var coin_existence = 1440 * 200 + remain_block * 180;
} else {
var coin_existence = height * 200;
}
/// Compute the total reward generated by each block in a given height.
if (height <= BLOCK_ERA_1) {
coin_existence = 16;
} else if (height <= BLOCK_ERA_2) {
coin_existence = 8;
} else if (height <= BLOCK_ERA_3) {
coin_existence = 4;
} else if (height <= BLOCK_ERA_4) {
coin_existence = 2;
} else if (height <= BLOCK_ERA_5) {
coin_existence = 1;
} else {
// After the era 6, we reduce the block rewards by half each 1460 days.
// Minus 1 to include multiples in the same index
// (i.e changes greater than to greater or equals to)
let height_with_offset = height - (BLOCK_ERA_5 - 1);
let exp = height_with_offset / BLOCK_ERA_6_ONWARDS;
coin_existence = BASE_REWARD_ERA_6_ONWARDS / (1 << exp);
}
letest_block = this.dateDiff(BlockchainLatestBlockQuery[0].timestamp,true);
letest_block_num = letest_block; // "72"

View File

@ -3,20 +3,20 @@ import { getConnection } from "typeorm";
var moment = require("moment");
moment.updateLocale('en', {
relativeTime: {
future: "in %s",
past: "%s ago",
s: "seconds",
m: "1 minute",
mm: "%d minutes",
h: "1 hour",
hh: "%d hours",
d: "1 day",
dd: "%d days",
M: "1 month",
MM: "%d months",
y: "1 year",
yy: "%d years"
}
future: "in %s",
past: "%s ago",
s: "seconds",
m: "1 minute",
mm: "%d minutes",
h: "1 hour",
hh: "%d hours",
d: "1 day",
dd: "%d days",
M: "1 month",
MM: "%d months",
y: "1 year",
yy: "%d years"
}
});
function dateDiff(date2, insec = false) {
@ -29,7 +29,7 @@ function dateDiff(date2, insec = false) {
var enddayrnd = Math.round(enddaydif);
// if(enddayrnd < 1) {
var time = convertMinsToHrmin(
Math.abs(date2.getTime() - current_date.getTime()),insec
Math.abs(date2.getTime() - current_date.getTime()), insec
);
return time;
// } else if(enddayrnd == 1) {
@ -40,9 +40,9 @@ function dateDiff(date2, insec = false) {
}
function convertMinsToHrmin(millseconds,insec) {
function convertMinsToHrmin(millseconds, insec) {
var seconds = Math.floor(millseconds / 1000);
if(insec){
if (insec) {
let sec = Math.floor(millseconds / 1000);
return sec;
}
@ -81,83 +81,118 @@ export async function universalGetLatestBlockDetails(socket) {
"SELECT bb.timestamp,bb.proof,bb.height,bb.edge_bits,bb.hash,bb.secondary_scaling, bb.previous_id, bb.total_difficulty_cuckaroo, bb.total_difficulty_cuckatoo, bb.total_difficulty_progpow, bb.total_difficulty_randomx, COUNT(DISTINCT(bi.block_id)) AS input_count, COUNT(DISTINCT(bk.block_id)) AS kernel_count, COUNT(DISTINCT(bo.block_id)) AS output_count FROM blockchain_block bb LEFT JOIN blockchain_input bi ON bi.block_id = bb.hash LEFT JOIN blockchain_kernel bk ON bk.block_id = bb.hash LEFT JOIN blockchain_output bo ON bo.block_id = bb.hash group by bb.hash, bb.timestamp ORDER BY bb.timestamp DESC LIMIT 1");
const BlockchainPreviousBlockQuery = await getConnection().query(
"SELECT total_difficulty_cuckaroo, total_difficulty_cuckatoo, total_difficulty_progpow, total_difficulty_randomx FROM blockchain_block WHERE hash=" +
"'" +
BlockchainLatestBlockQuery[0].previous_id +
"'"
"'" +
BlockchainLatestBlockQuery[0].previous_id +
"'"
);
let height = BlockchainLatestBlockQuery[0].height;
if (height > 12960) {
var remain_block = height - 12960;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
1440 * 80 +
1440 * 60 +
1440 * 50 +
25 * remain_block;
} else if (height > 11520) {
var remain_block = height - 11520;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
1440 * 80 +
1440 * 60 +
remain_block * 50;
} else if (height > 10080) {
var remain_block = height - 10080;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
1440 * 80 +
remain_block * 60;
} else if (height > 8640) {
var remain_block = height - 8640;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
remain_block * 80;
} else if (height > 7200) {
var remain_block = height - 7200;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
remain_block * 100;
} else if (height > 5760) {
var remain_block = height - 5760;
var coin_existence =
1440 * 200 + 1440 * 180 + 1440 * 160 + 1440 * 140 + remain_block * 120;
} else if (height > 4320) {
var remain_block = height - 4320;
var coin_existence =
1440 * 200 + 1440 * 180 + 1440 * 160 + remain_block * 140;
} else if (height > 2880) {
var remain_block = height - 2880;
var coin_existence = 1440 * 200 + 1440 * 180 + remain_block * 160;
} else if (height > 1440) {
var remain_block = height - 1440;
var coin_existence = 1440 * 200 + remain_block * 180;
// if (height > 12960) {
// var remain_block = height - 12960;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// 1440 * 80 +
// 1440 * 60 +
// 1440 * 50 +
// 25 * remain_block;
// } else if (height > 11520) {
// var remain_block = height - 11520;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// 1440 * 80 +
// 1440 * 60 +
// remain_block * 50;
// } else if (height > 10080) {
// var remain_block = height - 10080;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// 1440 * 80 +
// remain_block * 60;
// } else if (height > 8640) {
// var remain_block = height - 8640;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// remain_block * 80;
// } else if (height > 7200) {
// var remain_block = height - 7200;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// remain_block * 100;
// } else if (height > 5760) {
// var remain_block = height - 5760;
// var coin_existence =
// 1440 * 200 + 1440 * 180 + 1440 * 160 + 1440 * 140 + remain_block * 120;
// } else if (height > 4320) {
// var remain_block = height - 4320;
// var coin_existence =
// 1440 * 200 + 1440 * 180 + 1440 * 160 + remain_block * 140;
// } else if (height > 2880) {
// var remain_block = height - 2880;
// var coin_existence = 1440 * 200 + 1440 * 180 + remain_block * 160;
// } else if (height > 1440) {
// var remain_block = height - 1440;
// var coin_existence = 1440 * 200 + remain_block * 180;
// } else {
// var coin_existence = height * 200;
// }
var coin_existence;
let DAY_HEIGHT = 1440
/// Height of the first epic block emission era
const BLOCK_ERA_1 = DAY_HEIGHT * 334;
/// Height of the second epic block emission era
const BLOCK_ERA_2 = BLOCK_ERA_1 + (DAY_HEIGHT * 470);
/// Height of the third epic block emission era
const BLOCK_ERA_3 = BLOCK_ERA_2 + (DAY_HEIGHT * 601);
/// Height of the fourth epic block emission era
const BLOCK_ERA_4 = BLOCK_ERA_3 + (DAY_HEIGHT * 800);
/// Height of the fifth epic block emission era
const BLOCK_ERA_5 = BLOCK_ERA_4 + (DAY_HEIGHT * 1019);
/// After the epic block emission era 6, each era will last 4 years (approximately 1460 days)
const BLOCK_ERA_6_ONWARDS = DAY_HEIGHT * 1460;
/// Block Reward that will be assigned after we change from era 5 to era 6.
const BASE_REWARD_ERA_6_ONWARDS = 0.15625;
/// Compute the total reward generated by each block in a given height.
if (height <= BLOCK_ERA_1) {
coin_existence = 16;
} else if (height <= BLOCK_ERA_2) {
coin_existence = 8;
} else if (height <= BLOCK_ERA_3) {
coin_existence = 4;
} else if (height <= BLOCK_ERA_4) {
coin_existence = 2;
} else if (height <= BLOCK_ERA_5) {
coin_existence = 1;
} else {
var coin_existence = height * 200;
// After the era 6, we reduce the block rewards by half each 1460 days.
// Minus 1 to include multiples in the same index
// (i.e changes greater than to greater or equals to)
let height_with_offset = height - (BLOCK_ERA_5 - 1);
let exp = height_with_offset / BLOCK_ERA_6_ONWARDS;
coin_existence = BASE_REWARD_ERA_6_ONWARDS / (1 << exp);
}
letest_block = dateDiff(BlockchainLatestBlockQuery[0].timestamp, true);
@ -200,11 +235,11 @@ export async function universalGetLatestBlockDetails(socket) {
BlockchainPreviousBlockQuery[0].total_difficulty_randomx;
}
if(BlockchainLatestBlockQuery[0].proof == "RandomX"){
var Difficulty = targetdifficultyrandomx;
}else if(BlockchainLatestBlockQuery[0].proof == "ProgPow"){
if (BlockchainLatestBlockQuery[0].proof == "RandomX") {
var Difficulty = targetdifficultyrandomx;
} else if (BlockchainLatestBlockQuery[0].proof == "ProgPow") {
var Difficulty = targetdifficultyprogpow;
}else if(BlockchainLatestBlockQuery[0].proof == "Cuckoo" ){
} else if (BlockchainLatestBlockQuery[0].proof == "Cuckoo") {
var Difficulty = targetdifficultycuckatoo;
}
@ -214,9 +249,9 @@ export async function universalGetLatestBlockDetails(socket) {
var TotalCuckoo =
parseInt(BlockchainLatestBlockQuery[0].total_difficulty_cuckatoo) +
parseInt(BlockchainLatestBlockQuery[0].total_difficulty_cuckaroo);
let balance = BlockchainLatestBlockQuery[0].hash.substring(2, 62);
let arr = balance.match(/.{1,6}/g);
var hasharray = arr.map(i => '#' + i);
let balance = BlockchainLatestBlockQuery[0].hash.substring(2, 62);
let arr = balance.match(/.{1,6}/g);
var hasharray = arr.map(i => '#' + i);
socket.emit("latestblockdetail", {
block_height,
@ -230,7 +265,7 @@ export async function universalGetLatestBlockDetails(socket) {
targetdifficultyprogpow,
targetdifficultyrandomx,
TotalCuckoo,
age : dateTimeDurationString,
age: dateTimeDurationString,
input_count: BlockchainLatestBlockQuery[0].input_count,
kernel_count: BlockchainLatestBlockQuery[0].kernel_count,
output_count: BlockchainLatestBlockQuery[0].output_count,
@ -238,8 +273,8 @@ export async function universalGetLatestBlockDetails(socket) {
proof: BlockchainLatestBlockQuery[0].proof,
hasharray: hasharray,
Difficulty: Difficulty,
hashstart:BlockchainLatestBlockQuery[0].hash.slice(0, 2),
hashend:BlockchainLatestBlockQuery[0].hash.slice(62,64),
hashstart: BlockchainLatestBlockQuery[0].hash.slice(0, 2),
hashend: BlockchainLatestBlockQuery[0].hash.slice(62, 64),
TotalDifficultyCuckaroo:
BlockchainLatestBlockQuery[0].total_difficulty_cuckaroo,
TotalDifficultyCuckatoo:

View File

@ -69,6 +69,9 @@
{{chartType | translate}}</h2>
<div class="day_filter" *ngIf="this.title=='Target Difficulty'">
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', comp.difficultyRange,'all'); selectedItem12 = 4
" id="4" #item124 [ngClass]="{ active: selectedItem12 == item124.id, txt_primay: true }">All</a>
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', comp.difficultyRange,'cuckatoo'); selectedItem12 = 1
" id="1" #item121 [ngClass]="{ active: selectedItem12 == item121.id, txt_primay: true }">Cuckoo</a>
<a href="JavaScript:void(0);" (click)="
@ -79,7 +82,9 @@
" id="3" #item123 [ngClass]="{ active: selectedItem12 == item123.id, txt_primay: true }">RandomX</a>
</div>
<div class="day_filter" *ngIf="this.title=='Total Difficulty'">
<a href="JavaScript:void(0);" (click)="
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', comp.TdifficultyRange,'cuckatoo'); selectedItem12 = 4
" id="4" #item124 [ngClass]="{ active: selectedItem12 == item124.id, txt_primay: true }">All</a> <a href="JavaScript:void(0);" (click)="
ChartFromView('', '', comp.TdifficultyRange,'cuckatoo'); selectedItem12 = 1
" id="1" #item121 [ngClass]="{ active: selectedItem12 == item121.id, txt_primay: true }">Cuckoo</a>
<a href="JavaScript:void(0);" (click)="
@ -94,26 +99,26 @@
<div class="day_filter" *ngIf="this.title!='Transactions over time'">
<a href="JavaScript:void(0);" *ngIf="this.title=='Total Difficulty' || this.title=='Target Difficulty' || this.title == 'Blocks'" (click)="
ChartFromView('', '', '1 day', comp.Type); selectedItem = 6; comp.difficultyRange = '1 day'
ChartFromView('', '', '1 day', comp.Type); selectedItem = 6; comp.difficultyRange = '1 day';comp.TdifficultyRange = '1 day'
" id="6" #item6 [ngClass]="{ active: selectedItem == item6.id, txt_primay: true }">1 Day</a>
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', '1 week', comp.Type); selectedItem = 1; comp.difficultyRange = '1 week'
ChartFromView('', '', '1 week', comp.Type); selectedItem = 1; comp.difficultyRange = '1 week';comp.TdifficultyRange = '1 week'
" id="1" #item1 [ngClass]="{ active: selectedItem == item1.id, txt_primay: true }">1
{{'home.WEEK' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', '15 days', comp.Type); selectedItem = 2; comp.difficultyRange = '15 days'
ChartFromView('', '', '15 days', comp.Type); selectedItem = 2; comp.difficultyRange = '15 days';comp.TdifficultyRange = '15 days'
" id="2" #item2 [ngClass]="{ active: selectedItem == item2.id, day15_txt: true }">15
{{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', '30 days', comp.Type); selectedItem = 3; comp.difficultyRange = '30 days'
ChartFromView('', '', '30 days', comp.Type); selectedItem = 3; comp.difficultyRange = '30 days';comp.TdifficultyRange = '30 days'
" id="3" #item3 [ngClass]="{ active: selectedItem == item3.id, day30_txt: true }">30
{{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', '60 days', comp.Type); selectedItem = 4; comp.difficultyRange = '60 days'
ChartFromView('', '', '60 days', comp.Type); selectedItem = 4; comp.difficultyRange = '30 days';comp.TdifficultyRange = '30 days'
" id="4" #item4 [ngClass]="{ active: selectedItem == item4.id, day60_txt: true }">60
{{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', '3 months', comp.Type); selectedItem = 5; comp.difficultyRange = '3 months'
ChartFromView('', '', '3 months', comp.Type); selectedItem = 5; comp.difficultyRange = '3 months';comp.TdifficultyRange = '3 months'
" id="5" #item5 [ngClass]="{ active: selectedItem == item5.id, day3m_txt: true }">3
{{'home.MONTHS' | translate}}</a>
</div>
@ -152,8 +157,6 @@
<div class="box_shadow_large bg-white p-3">
<h2 class="chart_heading mb-2 d-inline-block">{{'home.EXPLORE' | translate}}</h2>
<ul class="list-unstyled pl-3">
<li class="mb-1" *ngIf="this.title!='Target Difficulty'"><a
routerLink="/chart/target-difficulty">{{'target-difficulty' | translate}}</a></li>
<li class="mb-1" *ngIf="this.title!='Total Difficulty'"><a
routerLink="/chart/total-difficulty">{{'total-difficulty' | translate}}</a></li>
<li class="mb-1" *ngIf="this.title!='Transactions over time'"><a
@ -173,6 +176,8 @@
routerLink="/chart/transactions-by-date">{{'home.TRANSACTIONS_VS_DATE' | translate}}</a></li>
<li class="mb-1" *ngIf="this.title!='Stackbar Chart'"><a routerLink="/chart/blocks-by-algorithm">Blocks by Algorithm</a>
</li>
<li class="mb-1" *ngIf="this.title!='Target Difficulty'"><a
routerLink="/chart/target-difficulty">{{'target-difficulty' | translate}}</a></li>
<!-- <li class="mb-1" *ngIf="this.title!='Pie Chart'"><a routerLink="/chart/piechart">Pie Chart</a></li> -->
</ul>
</div>

View File

@ -23,7 +23,7 @@ export class GraphDetailComponent implements OnInit {
public chartType : any = [];
public selectedItem: Number = 3;
public selectedItem8: Number = 2;
public selectedItem12: Number = 1;
public selectedItem12: Number = 4;
public Type: any = '';
public selectedTarget: Number = 3;
public selectedTarget12: Number = 1;
@ -34,7 +34,6 @@ export class GraphDetailComponent implements OnInit {
public GraphtDate: any;
public GraphtHour: any;
public linearTotalGraphData: any = [];
public TdifficultyRange: any = '1 day';
constructor(
private route: ActivatedRoute,

View File

@ -1,68 +1,4 @@
<div class="row">
<div class="col-md-6 col-lg-4 mb-4">
<div class="box_shadow">
<div class="blocks">
<h2 class="chart_heading d-inline-block">{{'home.TARGET_DIFFICULTY' | translate}}</h2>
<!-- <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">
<div class="difficulty_filter day_filter p-0 bg-transparent mt-2">
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', difficultyRange,'cuckatoo'); selectedItem12 = 1
" id="1" #item121 [ngClass]="{ active: selectedItem12 == item121.id, txt_primay: true }">Cuckoo</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', difficultyRange,'progpow'); selectedItem12 = 2
" id="2" #item122 [ngClass]="{ active: selectedItem12 == item122.id, txt_primay: true }">ProgPow</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', difficultyRange,'randomx'); selectedItem12 = 3
" id="3" #item123 [ngClass]="{ active: selectedItem12 == item123.id, txt_primay: true }">RandomX</a>
</div>
<epic-explorer-plotly *ngIf="linearGraphData.data" [data]="linearGraphData.data" [layout]="linearGraphData.layout">
</epic-explorer-plotly>
<div *ngIf="!linearGraphData.data" class="feedback_div news_desc text-center">
<div class="graph_img background_loading mx-auto mb-3"></div>
<div class=" p-3 bg-white">
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
</div>
</div>
</div>
</div>
<div class="day_filter diff_margin">
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '1 day',''); selectedItem = 6; difficultyRange = '1 day'
" id="6" #item6 [ngClass]="{ active: selectedItem == item6.id, txt_primay: true }">1 day</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '1 week',''); selectedItem = 1; difficultyRange = '1 week'
" id="1" #item1 [ngClass]="{ active: selectedItem == item1.id, txt_primay: true }">1 {{'home.WEEK' | translate}}</a>
<!-- <a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '15 days',''); selectedItem = 2; difficultyRange = '15 days'
" id="2" #item2 [ngClass]="{ active: selectedItem == item2.id, day15_txt: true }">15 {{'home.DAYS' | translate}}</a> -->
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '30 days',''); selectedItem = 3; difficultyRange = '30 days'
" id="3" #item3 [ngClass]="{ active: selectedItem == item3.id, day30_txt: true }">30 {{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '60 days',''); selectedItem = 4; difficultyRange = '60 days'
" id="4" #item4 [ngClass]="{ active: selectedItem == item4.id, day60_txt: true }">60 {{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '3 months',''); selectedItem = 5; difficultyRange = '3 months'
" id="5" #item5 [ngClass]="{ active: selectedItem == item5.id, day3m_txt: true }">3 {{'home.MONTHS' | translate}}</a>
</div>
<div class="explore_all text-right">
<a routerLink="/chart/target-difficulty"><span class="text-uppercase">{{'home.EXPLORE_IT' | translate}} <i
class="fa fa-long-arrow-right"></i></span></a>
</div>
</div>
</div>
<div class="col-md-6 col-lg-4 mb-4">
<div class="box_shadow">
<div class="blocks">
@ -74,6 +10,10 @@
<div class="chart_show">
<div class="difficulty_filter day_filter p-0 bg-transparent mt-2">
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', TdifficultyRange,'all'); selectedTarget12 = 4
" id="4" #itemtarget124
[ngClass]="{ active: selectedTarget12 == itemtarget124.id, txt_primay: true }">All</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', TdifficultyRange,'cuckatoo'); selectedTarget12 = 1
" id="1" #itemtarget121
[ngClass]="{ active: selectedTarget12 == itemtarget121.id, txt_primay: true }">Cuckoo</a>
@ -308,7 +248,7 @@
</div>
</div>
</div>
<div *ngIf="viewchartvar" class="col-md-6 col-lg-4 mb-4">
<div class="col-md-6 col-lg-4 mb-4">
<div class="box_shadow">
<div class="blocks">
<h2 class="chart_heading d-inline-block">{{'home.BLOCKS_MINED' | translate}}</h2>
@ -581,5 +521,71 @@
</div>
</div>
</div> -->
<div *ngIf="viewchartvar" class="col-md-6 col-lg-4 mb-4">
<div class="box_shadow">
<div class="blocks">
<h2 class="chart_heading d-inline-block">{{'home.TARGET_DIFFICULTY' | translate}}</h2>
<!-- <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">
<div class="difficulty_filter day_filter p-0 bg-transparent mt-2">
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', difficultyRange,'all'); selectedItem12 = 4
" id="4" #item124 [ngClass]="{ active: selectedItem12 == item124.id, txt_primay: true }">All</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', difficultyRange,'cuckatoo'); selectedItem12 = 1
" id="1" #item121 [ngClass]="{ active: selectedItem12 == item121.id, txt_primay: true }">Cuckoo</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', difficultyRange,'progpow'); selectedItem12 = 2
" id="2" #item122 [ngClass]="{ active: selectedItem12 == item122.id, txt_primay: true }">ProgPow</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', difficultyRange,'randomx'); selectedItem12 = 3
" id="3" #item123 [ngClass]="{ active: selectedItem12 == item123.id, txt_primay: true }">RandomX</a>
</div>
<epic-explorer-plotly *ngIf="linearGraphData.data" [data]="linearGraphData.data" [layout]="linearGraphData.layout">
</epic-explorer-plotly>
<div *ngIf="!linearGraphData.data" class="feedback_div news_desc text-center">
<div class="graph_img background_loading mx-auto mb-3"></div>
<div class=" p-3 bg-white">
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
</div>
</div>
</div>
</div>
<div class="day_filter diff_margin">
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '1 day',''); selectedItem = 6; difficultyRange = '1 day'
" id="6" #item6 [ngClass]="{ active: selectedItem == item6.id, txt_primay: true }">1 day</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '1 week',''); selectedItem = 1; difficultyRange = '1 week'
" id="1" #item1 [ngClass]="{ active: selectedItem == item1.id, txt_primay: true }">1 {{'home.WEEK' | translate}}</a>
<!-- <a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '15 days',''); selectedItem = 2; difficultyRange = '15 days'
" id="2" #item2 [ngClass]="{ active: selectedItem == item2.id, day15_txt: true }">15 {{'home.DAYS' | translate}}</a> -->
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '30 days',''); selectedItem = 3; difficultyRange = '30 days'
" id="3" #item3 [ngClass]="{ active: selectedItem == item3.id, day30_txt: true }">30 {{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '60 days',''); selectedItem = 4; difficultyRange = '60 days'
" id="4" #item4 [ngClass]="{ active: selectedItem == item4.id, day60_txt: true }">60 {{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '3 months',''); selectedItem = 5; difficultyRange = '3 months'
" id="5" #item5 [ngClass]="{ active: selectedItem == item5.id, day3m_txt: true }">3 {{'home.MONTHS' | translate}}</a>
</div>
<div class="explore_all text-right">
<a routerLink="/chart/target-difficulty"><span class="text-uppercase">{{'home.EXPLORE_IT' | translate}} <i
class="fa fa-long-arrow-right"></i></span></a>
</div>
</div>
</div>
</div>

View File

@ -50,16 +50,16 @@ export class GraphListComponent implements OnInit {
public selectedItem9: Number = 3;
public selectedItem10: Number = 3;
public selectedItem11: Number = 3;
public selectedItem12: Number = 1;
public selectedItem12: Number = 4;
public selectedTarget: Number = 6;
public selectedTarget12: Number = 1;
public selectedTarget12: Number = 4;
public tInput: any;
public tOutput: any;
public tKernal: any;
public tDate: any;
public tHour: any;
public Type: any = '';
public Type: any = 'all';
public difficultyRange: any = '1 day';
public TdifficultyRange: any = '1 day';
@ -386,7 +386,7 @@ export class GraphListComponent implements OnInit {
interval = '',
type = ''
) {
this.Type = type != '' ? type : this.Type == '' ? 'cuckatoo' : this.Type;
this.Type = type != '' ? type : this.Type == '' ? 'all' : this.Type;
return new Promise((resolve, reject) => {
let params = new HttpParams();
params = params.append('FromDate', fromDate);
@ -400,18 +400,73 @@ export class GraphListComponent implements OnInit {
res => {
if (res['status'] == 200) {
let DifficultychartDate = res.response.Date;
let BlocksChartDate = res.response.blockDate;
let TargetDifficulty = res.response.TargetDifficulty;
let DifficultyCuckatoo = res.response.DifficultyCuckatoo;
let DifficultyRandomx = res.response.DifficultyRandomx;
let DifficultyProgpow = res.response.DifficultyProgpow;
let data;
switch(this.Type) {
case 'all':
data =
[
{
x: DifficultychartDate,
y: DifficultyCuckatoo,
text: DifficultychartDate,
mode: 'lines+markers',
type: 'scatter',
name: '',
line: { color: '#ac3333' },
hovertemplate: '%{text}<br> Cuckoo : %{y:,}',
},
{
x: DifficultychartDate,
y: DifficultyProgpow,
text: DifficultychartDate,
mode: 'lines+markers',
type: 'scatter',
name: '',
line: { color: '#ac3333' },
hovertemplate: '%{text}<br> Progpow : %{y:,}',
},
{
x: DifficultychartDate,
y: DifficultyRandomx,
text: DifficultychartDate,
mode: 'lines+markers',
type: 'scatter',
name: '',
line: { color: '#ac3333' },
hovertemplate: '%{text}<br> RandomX : %{y:,}',
},
];
break;
default:
let yvalue = this.Type == 'cuckatoo' ? DifficultyCuckatoo : this.Type == 'progpow' ? DifficultyProgpow : this.Type == 'randomx' ? DifficultyRandomx : []
data =
[
{
x: DifficultychartDate,
y: yvalue,
text: DifficultychartDate,
mode: 'lines+markers',
type: 'scatter',
name: '',
line: { color: '#ac3333' },
hovertemplate: '%{text}<br> Difficulty : %{y:,}',
}];
break;
}
let range = [res.response.Minrange, res.response.Maxrange]
let tickformat = res.response.tickFormat;
this.lg_last =
TargetDifficulty[TargetDifficulty.length - 1];
// this.lg_last =
// TargetDifficulty[TargetDifficulty.length - 1];
switch(difftype){
case 'total':
this.totaldifficultyChartFunc(
DifficultychartDate,
TargetDifficulty,
data,
this.Type,
range,
tickformat
@ -420,7 +475,7 @@ export class GraphListComponent implements OnInit {
case 'target':
this.difficultyChartFunc(
DifficultychartDate,
TargetDifficulty,
data,
this.Type,
range,
tickformat
@ -463,51 +518,10 @@ export class GraphListComponent implements OnInit {
});
}
difficultyChartFunc(DifficultychartDate, TargetDifficulty, Type, range, tickformat) {
difficultyChartFunc(DifficultychartDate, data, Type, range, tickformat) {
// console.log('range rangerangerange',range);
this.linearGraphData = {
data: [
{
x: DifficultychartDate,
y: TargetDifficulty,
text: DifficultychartDate,
mode: 'lines+markers',
type: 'scatter',
name: '',
line: { color: '#ac3333' },
hovertemplate: '%{text}<br> Difficulty : %{y:,}',
},
// {
// x: DifficultychartDate,
// y: DifficultyCuckatoo,
// text: DifficultyCuckatoo,
// mode: 'lines+markers',
// type: 'scatter',
// name: '',
// line: { color: '#A876C6' },
// hovertemplate: '%{x}<br> Cuckatoo : %{text:,}',
// },
// {
// x: DifficultychartDate,
// y: DifficultyProgpow,
// text: DifficultyProgpow,
// mode: 'lines+markers',
// type: 'scatter',
// name: '',
// line: { color: '#54CFDC' },
// hovertemplate: '%{x}<br> Progpow : %{text:,}',
// },
// {
// x: DifficultychartDate,
// y: DifficultyRandomx,
// text: DifficultyRandomx,
// mode: 'lines+markers',
// type: 'scatter',
// name: '',
// line: { color: '#77817C' },
// hovertemplate: '%{x}<br> Randomx : %{text:,}',
// },
],
data: data ,
layout: {
hovermode: 'closest',
height: 250,
@ -1091,20 +1105,9 @@ export class GraphListComponent implements OnInit {
options: null,
};
}
totaldifficultyChartFunc(DifficultychartDate, TargetDifficulty, Type, range, tickformat) {
totaldifficultyChartFunc(DifficultychartDate, data, type, range, tickformat) {
this.linearTotalGraphData = {
data: [
{
x: DifficultychartDate,
y: TargetDifficulty,
text: DifficultychartDate,
mode: 'lines+markers',
type: 'scatter',
name: '',
line: { color: '#ac3333' },
hovertemplate: '%{text}<br> Difficulty : %{y:,}',
},
],
data: data,
layout: {
hovermode: 'closest',
height: 250,