mirror of
https://github.com/wownero/diff-chart.git
synced 2026-10-17 15:21:25 +02:00
tx-per-day: show avg tx sizes
This commit is contained in:
+46
-6
@@ -1,4 +1,4 @@
|
||||
function get_chart(chartData, offset) {
|
||||
function get_chart(chartData, cryptonote_config, offset) {
|
||||
if (offset === undefined)
|
||||
chartData.shift();
|
||||
var chartData_tpd = [];
|
||||
@@ -14,9 +14,20 @@ function get_chart(chartData, offset) {
|
||||
chartData_tpd.push({
|
||||
"date": block_date,
|
||||
"num_txes": 0,
|
||||
"tx_size_sum": 0,
|
||||
});
|
||||
}
|
||||
chartData_tpd[chartData_tpd.length - 1].num_txes += chartData[i][5].length;
|
||||
var blk_size = chartData[i][4];
|
||||
var blk_blob_size = chartData[i][5];
|
||||
var num_txes = chartData[i][6].length;
|
||||
var height = i + (offset === undefined ? 1 : offset.height);
|
||||
var miner_tx_size = blk_blob_size - cryptonote_config.get_blockheader_size(height) - num_txes * 32 - 1;
|
||||
chartData_tpd[chartData_tpd.length - 1].num_txes += num_txes;
|
||||
chartData_tpd[chartData_tpd.length - 1].tx_size_sum += blk_size - miner_tx_size;
|
||||
}
|
||||
for (var i = 0; i < chartData_tpd.length; ++i) {
|
||||
chartData_tpd[i].tx_size = chartData_tpd[i].num_txes === 0 ? 1 : (chartData_tpd[i].tx_size_sum / chartData_tpd[i].num_txes);
|
||||
chartData_tpd[i].tx_size_str = formatBytes(chartData_tpd[i].tx_size, 3);
|
||||
}
|
||||
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
@@ -27,15 +38,31 @@ function get_chart(chartData, offset) {
|
||||
"marginTop": 7,
|
||||
"dataProvider": chartData_tpd,
|
||||
"valueAxes": [{
|
||||
"id":"va_num",
|
||||
"color": "#9966cc",
|
||||
"axisColor": "#9966cc",
|
||||
"axisThickness": 2,
|
||||
"axisAlpha": 0.2,
|
||||
"dashLength": 1,
|
||||
"position": "left",
|
||||
}, {
|
||||
"id":"va_size",
|
||||
"color": "#118844",
|
||||
"axisColor": "#118844",
|
||||
"axisThickness": 2,
|
||||
"axisAlpha": 0.2,
|
||||
"dashLength": 1,
|
||||
"position": "left",
|
||||
"gridAlpha": 0,
|
||||
"position": "right"
|
||||
}],
|
||||
"mouseWheelZoomEnabled": true,
|
||||
"graphs": [{
|
||||
"id": "g1",
|
||||
"id": "g_num",
|
||||
"valueAxis": "va_num",
|
||||
"lineColor": "#cc99ff",
|
||||
"balloonText": "<b>[[value]]</b>",
|
||||
"lineThickness": 2,
|
||||
"balloonText": "Count: <b>[[value]]</b>\nSize: [[tx_size_str]]",
|
||||
"bullet": "round",
|
||||
"bulletBorderAlpha": 1,
|
||||
"bulletColor": "#FFFFFF",
|
||||
@@ -46,14 +73,27 @@ function get_chart(chartData, offset) {
|
||||
"balloon":{
|
||||
"cornerRadius": 10,
|
||||
}
|
||||
},{
|
||||
"id": "g_size",
|
||||
"valueAxis": "va_size",
|
||||
"lineColor": "#22b681",
|
||||
"lineThickness": 1,
|
||||
"showBalloon" : false,
|
||||
"bullet": "round",
|
||||
"bulletBorderAlpha": 1,
|
||||
"bulletColor": "#FFFFFF",
|
||||
"hideBulletsCount": 50,
|
||||
"title": "StdDev",
|
||||
"valueField": "tx_size",
|
||||
"useLineColorForBulletBorder": true,
|
||||
}],
|
||||
"chartScrollbar": {
|
||||
"autoGridCount": true,
|
||||
"graph": "g1",
|
||||
"graph": "g_num",
|
||||
"scrollbarHeight": 40
|
||||
},
|
||||
"chartCursor": {
|
||||
"limitToGraph":"g1",
|
||||
"limitToGraph":"g_num",
|
||||
"pan": false
|
||||
},
|
||||
"categoryField": "date",
|
||||
|
||||
Reference in New Issue
Block a user