mirror of
https://github.com/wownero/diff-chart.git
synced 2026-10-17 15:21:25 +02:00
use BigInteger to correctly compute coin supply
This commit is contained in:
+1309
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,7 @@
|
||||
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
|
||||
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
|
||||
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
|
||||
<script src="util.js"></script>
|
||||
<script src="aeon-data-0.js"></script>
|
||||
<script src="aeon-data-1.js"></script>
|
||||
<script src="aeon-data-2.js"></script>
|
||||
@@ -42,7 +43,7 @@ chartData = chartData.concat(chartData_9);
|
||||
for (var i = 0; i < chartData.length; ++i) {
|
||||
chartData[i].date = new Date(1000 * chartData[i][0]);
|
||||
chartData[i].height = i + 1;
|
||||
chartData[i].reward = chartData[i][2] / Math.pow(10, 11);
|
||||
chartData[i].reward = print_money(chartData[i][2], 12);
|
||||
}
|
||||
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
|
||||
+16
-8
@@ -14,6 +14,8 @@
|
||||
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
|
||||
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
|
||||
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
|
||||
<script src="BigInteger.js"></script>
|
||||
<script src="util.js"></script>
|
||||
<script src="aeon-data-0.js"></script>
|
||||
<script src="aeon-data-1.js"></script>
|
||||
<script src="aeon-data-2.js"></script>
|
||||
@@ -27,8 +29,8 @@
|
||||
|
||||
<!-- Chart code -->
|
||||
<script>
|
||||
var chartData = chartData_0;
|
||||
chartData.shift();
|
||||
var chartData = [];
|
||||
chartData = chartData.concat(chartData_0);
|
||||
chartData = chartData.concat(chartData_1);
|
||||
chartData = chartData.concat(chartData_2);
|
||||
chartData = chartData.concat(chartData_3);
|
||||
@@ -39,14 +41,20 @@ chartData = chartData.concat(chartData_7);
|
||||
chartData = chartData.concat(chartData_8);
|
||||
chartData = chartData.concat(chartData_9);
|
||||
|
||||
var coin_supply = 0;
|
||||
for (var i = 0; i < chartData.length; ++i) {
|
||||
chartData[i].date = new Date(1000 * chartData[i][0]);
|
||||
chartData[i].height = i + 1;
|
||||
coin_supply += chartData[i][2];
|
||||
chartData[i].coin_supply = coin_supply;
|
||||
chartData[i].height = i;
|
||||
chartData[i].coin_supply = bigInt(chartData[i][2]);
|
||||
for (var j = 0; j < chartData[i][4].length; ++j)
|
||||
chartData[i].coin_supply = chartData[i].coin_supply.minus(chartData[i][4][j][4]);
|
||||
if (i > 0)
|
||||
chartData[i].coin_supply = chartData[i].coin_supply.plus(chartData[i - 1].coin_supply);
|
||||
chartData[i].coin_supply_str = print_money(chartData[i].coin_supply, 12);
|
||||
chartData[i].coin_supply_real = chartData[i].coin_supply.toJSNumber() / Math.pow(10, 11);
|
||||
}
|
||||
|
||||
chartData.shift();
|
||||
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "serial",
|
||||
"theme": "light",
|
||||
@@ -61,13 +69,13 @@ var chart = AmCharts.makeChart("chartdiv", {
|
||||
"graphs": [{
|
||||
"id": "g1",
|
||||
"lineColor": "#cc9900",
|
||||
"balloonText": "Supply: <b>[[value]]</b>\nHeight: <b>[[height]]</b>",
|
||||
"balloonText": "Supply: <b>[[coin_supply_str]]</b>\nHeight: <b>[[height]]</b>",
|
||||
"bullet": "round",
|
||||
"bulletBorderAlpha": 1,
|
||||
"bulletColor": "#FFFFFF",
|
||||
"hideBulletsCount": 50,
|
||||
"title": "coin supply",
|
||||
"valueField": "coin_supply",
|
||||
"valueField": "coin_supply_real",
|
||||
"useLineColorForBulletBorder": true,
|
||||
"balloon":{
|
||||
"cornerRadius": 10,
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
|
||||
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
|
||||
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
|
||||
<script src="util.js"></script>
|
||||
<script src="monero-data-0.js"></script>
|
||||
<script src="monero-data-1.js"></script>
|
||||
<script src="monero-data-2.js"></script>
|
||||
@@ -56,7 +57,7 @@ chartData = chartData.concat(chartData_16);
|
||||
for (var i = 0; i < chartData.length; ++i) {
|
||||
chartData[i].date = new Date(1000 * chartData[i][0]);
|
||||
chartData[i].height = i + 1;
|
||||
chartData[i].reward = chartData[i][2] / Math.pow(10, 11);
|
||||
chartData[i].reward = print_money(chartData[i][2], 12);
|
||||
}
|
||||
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
|
||||
+16
-8
@@ -14,6 +14,8 @@
|
||||
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
|
||||
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
|
||||
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
|
||||
<script src="BigInteger.js"></script>
|
||||
<script src="util.js"></script>
|
||||
<script src="monero-data-0.js"></script>
|
||||
<script src="monero-data-1.js"></script>
|
||||
<script src="monero-data-2.js"></script>
|
||||
@@ -34,8 +36,8 @@
|
||||
|
||||
<!-- Chart code -->
|
||||
<script>
|
||||
var chartData = chartData_0;
|
||||
chartData.shift();
|
||||
var chartData = [];
|
||||
chartData = chartData.concat(chartData_0);
|
||||
chartData = chartData.concat(chartData_1);
|
||||
chartData = chartData.concat(chartData_2);
|
||||
chartData = chartData.concat(chartData_3);
|
||||
@@ -53,14 +55,20 @@ chartData = chartData.concat(chartData_14);
|
||||
chartData = chartData.concat(chartData_15);
|
||||
chartData = chartData.concat(chartData_16);
|
||||
|
||||
var coin_supply = 0;
|
||||
for (var i = 0; i < chartData.length; ++i) {
|
||||
chartData[i].date = new Date(1000 * chartData[i][0]);
|
||||
chartData[i].height = i + 1;
|
||||
coin_supply += chartData[i][2];
|
||||
chartData[i].coin_supply = coin_supply;
|
||||
chartData[i].height = i;
|
||||
chartData[i].coin_supply = bigInt(chartData[i][2]);
|
||||
for (var j = 0; j < chartData[i][4].length; ++j)
|
||||
chartData[i].coin_supply = chartData[i].coin_supply.minus(chartData[i][4][j][4]);
|
||||
if (i > 0)
|
||||
chartData[i].coin_supply = chartData[i].coin_supply.plus(chartData[i - 1].coin_supply);
|
||||
chartData[i].coin_supply_str = print_money(chartData[i].coin_supply, 12);
|
||||
chartData[i].coin_supply_real = chartData[i].coin_supply.toJSNumber() / Math.pow(10, 11);
|
||||
}
|
||||
|
||||
chartData.shift();
|
||||
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "serial",
|
||||
"theme": "light",
|
||||
@@ -75,13 +83,13 @@ var chart = AmCharts.makeChart("chartdiv", {
|
||||
"graphs": [{
|
||||
"id": "g1",
|
||||
"lineColor": "#cc9900",
|
||||
"balloonText": "Supply: <b>[[value]]</b>\nHeight: <b>[[height]]</b>",
|
||||
"balloonText": "Supply: <b>[[coin_supply_str]]</b>\nHeight: <b>[[height]]</b>",
|
||||
"bullet": "round",
|
||||
"bulletBorderAlpha": 1,
|
||||
"bulletColor": "#FFFFFF",
|
||||
"hideBulletsCount": 50,
|
||||
"title": "coin supply",
|
||||
"valueField": "coin_supply",
|
||||
"valueField": "coin_supply_real",
|
||||
"useLineColorForBulletBorder": true,
|
||||
"balloon":{
|
||||
"cornerRadius": 10,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
function print_money(amount, decimal_point) {
|
||||
var s1 = String(amount);
|
||||
while (s1.length < decimal_point+1)
|
||||
s1 = "0" + s1;
|
||||
var s2 = "";
|
||||
for (var i = 0; i < decimal_point; ++i)
|
||||
s2 = s1[s1.length - 1 - i] + s2;
|
||||
s2 = "." + s2;
|
||||
for (var i = 0; i < s1.length - decimal_point; ++i) {
|
||||
if (i > 0 && i % 3 == 0)
|
||||
s2 = "," + s2;
|
||||
s2 = s1[s1.length - 1 - decimal_point - i] + s2
|
||||
}
|
||||
return s2;
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
|
||||
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
|
||||
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
|
||||
<script src="util.js"></script>
|
||||
<script src="wownero-data-0.js"></script>
|
||||
|
||||
<!-- Chart code -->
|
||||
@@ -24,7 +25,7 @@ chartData.shift();
|
||||
for (var i = 0; i < chartData.length; ++i) {
|
||||
chartData[i].date = new Date(1000 * chartData[i][0]);
|
||||
chartData[i].height = i + 1;
|
||||
chartData[i].reward = chartData[i][2] / Math.pow(10, 11);
|
||||
chartData[i].reward = print_money(chartData[i][2], 11);
|
||||
}
|
||||
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
|
||||
@@ -14,21 +14,29 @@
|
||||
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
|
||||
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
|
||||
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
|
||||
<script src="BigInteger.js"></script>
|
||||
<script src="util.js"></script>
|
||||
<script src="wownero-data-0.js"></script>
|
||||
|
||||
<!-- Chart code -->
|
||||
<script>
|
||||
var chartData = chartData_0;
|
||||
chartData.shift();
|
||||
var chartData = [];
|
||||
chartData = chartData.concat(chartData_0);
|
||||
|
||||
var coin_supply = 0;
|
||||
for (var i = 0; i < chartData.length; ++i) {
|
||||
chartData[i].date = new Date(1000 * chartData[i][0]);
|
||||
chartData[i].height = i + 1;
|
||||
coin_supply += chartData[i][2];
|
||||
chartData[i].coin_supply = coin_supply;
|
||||
chartData[i].height = i;
|
||||
chartData[i].coin_supply = bigInt(chartData[i][2]);
|
||||
for (var j = 0; j < chartData[i][4].length; ++j)
|
||||
chartData[i].coin_supply = chartData[i].coin_supply.minus(chartData[i][4][j][4]);
|
||||
if (i > 0)
|
||||
chartData[i].coin_supply = chartData[i].coin_supply.plus(chartData[i - 1].coin_supply);
|
||||
chartData[i].coin_supply_str = print_money(chartData[i].coin_supply, 11);
|
||||
chartData[i].coin_supply_real = chartData[i].coin_supply.toJSNumber() / Math.pow(10, 11);
|
||||
}
|
||||
|
||||
chartData.shift();
|
||||
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "serial",
|
||||
"theme": "light",
|
||||
@@ -43,13 +51,13 @@ var chart = AmCharts.makeChart("chartdiv", {
|
||||
"graphs": [{
|
||||
"id": "g1",
|
||||
"lineColor": "#cc9900",
|
||||
"balloonText": "Supply: <b>[[value]]</b>\nHeight: <b>[[height]]</b>",
|
||||
"balloonText": "Supply: <b>[[coin_supply_str]]</b>\nHeight: <b>[[height]]</b>",
|
||||
"bullet": "round",
|
||||
"bulletBorderAlpha": 1,
|
||||
"bulletColor": "#FFFFFF",
|
||||
"hideBulletsCount": 50,
|
||||
"title": "coin supply",
|
||||
"valueField": "coin_supply",
|
||||
"valueField": "coin_supply_real",
|
||||
"useLineColorForBulletBorder": true,
|
||||
"balloon":{
|
||||
"cornerRadius": 10,
|
||||
|
||||
Reference in New Issue
Block a user