From a00f8d4ac5801d90230f67445249c66d5d425c81 Mon Sep 17 00:00:00 2001 From: stoffu Date: Wed, 9 Jan 2019 12:31:43 +0900 Subject: [PATCH] add nonce plots, requires data upgrade --- README.md | 3 ++ aeon-nonce.html | 59 +++++++++++++++++++++++++++++++++++++ getdata.py | 3 +- js/bc-size.js | 2 +- js/block-reward.js | 2 +- js/block-size.js | 2 +- js/coin-supply.js | 6 ++-- js/diff.js | 2 +- js/nonce.js | 67 ++++++++++++++++++++++++++++++++++++++++++ js/ring-size.js | 4 +-- js/tx-per-day.js | 2 +- monero-nonce.html | 73 ++++++++++++++++++++++++++++++++++++++++++++++ wownero-nonce.html | 37 +++++++++++++++++++++++ 13 files changed, 251 insertions(+), 11 deletions(-) create mode 100644 aeon-nonce.html create mode 100644 js/nonce.js create mode 100644 monero-nonce.html create mode 100644 wownero-nonce.html diff --git a/README.md b/README.md index a2552bc..dc72f21 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ _These JavaScript-based interactive charts are highly memory intensive. You will - [Block reward](https://stoffu.github.io/diff-chart/aeon-block-reward.html) - [Coin supply](https://stoffu.github.io/diff-chart/aeon-coin-supply.html) - [Block time](https://stoffu.github.io/diff-chart/aeon-block-time.html) +- [Nonce](https://stoffu.github.io/diff-chart/aeon-nonce.html) ## Monero @@ -23,6 +24,7 @@ _These JavaScript-based interactive charts are highly memory intensive. You will - [Block reward](https://stoffu.github.io/diff-chart/monero-block-reward.html) - [Coin supply](https://stoffu.github.io/diff-chart/monero-coin-supply.html) - [Block time](https://stoffu.github.io/diff-chart/monero-block-time.html) +- [Nonce](https://stoffu.github.io/diff-chart/monero-nonce.html) ## Wownero @@ -34,3 +36,4 @@ _These JavaScript-based interactive charts are highly memory intensive. You will - [Block reward](https://stoffu.github.io/diff-chart/wownero-block-reward.html) - [Coin supply](https://stoffu.github.io/diff-chart/wownero-coin-supply.html) - [Block time](https://stoffu.github.io/diff-chart/wownero-block-time.html) +- [Nonce](https://stoffu.github.io/diff-chart/wownero-nonce.html) diff --git a/aeon-nonce.html b/aeon-nonce.html new file mode 100644 index 0000000..6e46056 --- /dev/null +++ b/aeon-nonce.html @@ -0,0 +1,59 @@ + +
Aeon nonce + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

Aeon nonce

+
+

Enable panning

+

Back to top

+ + diff --git a/getdata.py b/getdata.py index 48f3fa3..ed86419 100755 --- a/getdata.py +++ b/getdata.py @@ -66,6 +66,7 @@ class GetData(): block_header = res_blk['block_header'] timestamp = block_header['timestamp'] + nonce = block_header['nonce'] difficulty = block_header['difficulty'] reward = block_header['reward'] block_size = block_header['block_size'] @@ -97,7 +98,7 @@ class GetData(): if j > 0: txs_str += ',' txs_str += "[%d,%d,%d,%d,%d,%d]" % (unlock_time, ins, outs, ring_size, fee, extra_size) - print('[%d,%d,%d,%d,[%s]],' % (timestamp, difficulty, reward, block_size, txs_str)) + print('[%d,%d,%d,%d,%d,[%s]],' % (timestamp, nonce, difficulty, reward, block_size, txs_str)) print(']') if __name__ == '__main__': diff --git a/js/bc-size.js b/js/bc-size.js index df65a40..5c6206f 100644 --- a/js/bc-size.js +++ b/js/bc-size.js @@ -4,7 +4,7 @@ function get_chart(chartData) { for (var i = 0; i < chartData.length; ++i) { chartData[i].date = new Date(1000 * chartData[i][0]); chartData[i].height = i + 1; - chartData[i].bc_size = chartData[i][3]; + chartData[i].bc_size = chartData[i][4]; if (i > 0) chartData[i].bc_size += chartData[i - 1].bc_size; chartData[i].bc_size_str = formatBytes(chartData[i].bc_size, 3); diff --git a/js/block-reward.js b/js/block-reward.js index bc6bd46..a3f3ba5 100644 --- a/js/block-reward.js +++ b/js/block-reward.js @@ -4,7 +4,7 @@ function get_chart(chartData, decimal_point) { 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 = print_money(chartData[i][2], decimal_point); + chartData[i].reward = print_money(chartData[i][3], decimal_point); } var chart = AmCharts.makeChart("chartdiv", { diff --git a/js/block-size.js b/js/block-size.js index eb2020f..d0af01d 100644 --- a/js/block-size.js +++ b/js/block-size.js @@ -4,7 +4,7 @@ function get_chart(chartData) { for (var i = 0; i < chartData.length; ++i) { chartData[i].date = new Date(1000 * chartData[i][0]); chartData[i].height = i + 1; - chartData[i].block_size = chartData[i][3]; + chartData[i].block_size = chartData[i][4]; chartData[i].block_size_str = formatBytes(chartData[i].block_size, 3); } diff --git a/js/coin-supply.js b/js/coin-supply.js index 9eef451..9e1a3ac 100644 --- a/js/coin-supply.js +++ b/js/coin-supply.js @@ -2,9 +2,9 @@ function get_chart(chartData, decimal_point) { for (var i = 0; i < chartData.length; ++i) { chartData[i].date = new Date(1000 * chartData[i][0]); 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]); + chartData[i].coin_supply = bigInt(chartData[i][3]); + for (var j = 0; j < chartData[i][5].length; ++j) + chartData[i].coin_supply = chartData[i].coin_supply.minus(chartData[i][5][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, decimal_point); diff --git a/js/diff.js b/js/diff.js index 7e8c768..08d6c32 100644 --- a/js/diff.js +++ b/js/diff.js @@ -12,7 +12,7 @@ function get_chart(chartData, diff_targets) { for (var i = 0; i < chartData.length; ++i) { chartData[i].date = new Date(1000 * chartData[i][0]); chartData[i].height = i + 1; - chartData[i].difficulty = chartData[i][1]; + chartData[i].difficulty = chartData[i][2]; chartData[i].hashrate = formatHashrate(chartData[i].difficulty / get_diff_target(diff_targets, chartData[i].height), 2); } diff --git a/js/nonce.js b/js/nonce.js new file mode 100644 index 0000000..666d8b8 --- /dev/null +++ b/js/nonce.js @@ -0,0 +1,67 @@ +function get_chart(chartData) { + 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].nonce = chartData[i][1]; + } + + var chart = AmCharts.makeChart("chartdiv", { + "type": "serial", + "theme": "light", + "marginRight": 80, + "autoMarginOffset": 20, + "marginTop": 7, + "dataProvider": chartData, + "valueAxes": [{ + "axisAlpha": 0, + }], + "mouseWheelZoomEnabled": true, + "graphs": [{ + "id": "g1", + "lineColor": "#800040", + "lineAlpha": 0, + "bulletAlpha": 1, + "bullet": "square", + "bulletSize": 1, + "minBulletSize": 1, + "balloonText": "Height: [[height]]\nNonce: [[value]]\n", + "showBalloonAt": "close", + "title": "nonce", + "valueField": "nonce", + "balloon":{ + "cornerRadius": 10, + "animationDuration": 0, + } + }], + "chartCursor": { + "pan": false, + "categoryBalloonEnabled": false, + "animationDuration": 0, + "cursorAlpha": 0, + }, + "categoryField": "date", + "categoryAxis": { + "parseDates": true, + "minPeriod": "ss", + "axisColor": "#DADADA", + "dashLength": 1, + "minorGridEnabled": true + }, + "export": { + "enabled": true, + "position": "bottom-right" + } + }); + + // this method is called when chart is first inited as we listen for "rendered" event + function zoomChart() { + // different zoom methods can be used - zoomToIndexes, zoomToDates, zoomToCategoryValues + chart.zoomToIndexes(0, chartData.length - 1); + } + chart.addListener("rendered", zoomChart); + zoomChart(); + + return chart; +} diff --git a/js/ring-size.js b/js/ring-size.js index e121118..3912e39 100644 --- a/js/ring-size.js +++ b/js/ring-size.js @@ -18,9 +18,9 @@ function get_chart(chartData, levels) { num_txes_per_day[block_date] = 0; } var e = chartData_rs[chartData_rs.length - 1]; - var num_txes = chartData[i][4].length; + var num_txes = chartData[i][5].length; if (num_txes > 0) { - var ring_size = chartData[i][4][0][3]; + var ring_size = chartData[i][5][0][3]; while (ring_size >= e.histogram.length) { e.histogram.push(0); } diff --git a/js/tx-per-day.js b/js/tx-per-day.js index d7fed74..5c2a774 100644 --- a/js/tx-per-day.js +++ b/js/tx-per-day.js @@ -15,7 +15,7 @@ function get_chart(chartData) { "num_txes": 0, }); } - chartData_tpd[chartData_tpd.length - 1].num_txes += chartData[i][4].length; + chartData_tpd[chartData_tpd.length - 1].num_txes += chartData[i][5].length; } var chart = AmCharts.makeChart("chartdiv", { diff --git a/monero-nonce.html b/monero-nonce.html new file mode 100644 index 0000000..f47bcbb --- /dev/null +++ b/monero-nonce.html @@ -0,0 +1,73 @@ + +
Monero nonce + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

Monero nonce

+
+

Enable panning

+

Back to top

+ + diff --git a/wownero-nonce.html b/wownero-nonce.html new file mode 100644 index 0000000..4c9a781 --- /dev/null +++ b/wownero-nonce.html @@ -0,0 +1,37 @@ + +
Wownero nonce + + + + + + + + + + + + + + + +
+ +

Wownero nonce

+
+

Enable panning

+

Back to top

+ +