add gas limit chart

This commit is contained in:
Fabian Vogelsteller 2015-08-06 12:22:47 +02:00
parent c4f8343372
commit c1f1a0989d
3 changed files with 46 additions and 0 deletions

View File

@ -436,6 +436,25 @@ History.prototype.getBlockTimes = function()
return blockTimes; return blockTimes;
} }
History.prototype.getGasLimit = function()
{
var gasLimitHistory = _( this._items )
.sortByOrder( 'height', false )
.filter(function (item)
{
return item.block.trusted;
})
.slice(0, MAX_BINS)
.reverse()
.map(function (item)
{
return item.block.gasLimit;
})
.value();
return gasLimitHistory;
}
History.prototype.getDifficulty = function() History.prototype.getDifficulty = function()
{ {
var difficultyHistory = _( this._items ) var difficultyHistory = _( this._items )
@ -570,6 +589,7 @@ History.prototype.getCharts = function()
uncles: item.block.uncles.length, uncles: item.block.uncles.length,
transactions: item.block.transactions.length, transactions: item.block.transactions.length,
gasSpending: item.block.gasUsed, gasSpending: item.block.gasUsed,
gasLimit: item.block.gasLimit,
miner: item.block.miner miner: item.block.miner
}; };
}) })
@ -583,6 +603,7 @@ History.prototype.getCharts = function()
uncles : _.pluck( chartHistory, 'uncles' ), uncles : _.pluck( chartHistory, 'uncles' ),
transactions : _.pluck( chartHistory, 'transactions' ), transactions : _.pluck( chartHistory, 'transactions' ),
gasSpending : _.pluck( chartHistory, 'gasSpending' ), gasSpending : _.pluck( chartHistory, 'gasSpending' ),
gasLimit : _.pluck( chartHistory, 'gasLimit' ),
miners : this.getMinersCount(), miners : this.getMinersCount(),
propagation : this.getBlockPropagation(), propagation : this.getBlockPropagation(),
uncleCount : this.getUncleCount(), uncleCount : this.getUncleCount(),

View File

@ -21,6 +21,7 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, $localStorage, soc
$scope.uncleCount = 0; $scope.uncleCount = 0;
$scope.bestStats = {}; $scope.bestStats = {};
$scope.lastGasLimit = _.fill(Array(MAX_BINS), 2);
$scope.lastBlocksTime = _.fill(Array(MAX_BINS), 2); $scope.lastBlocksTime = _.fill(Array(MAX_BINS), 2);
$scope.difficultyChart = _.fill(Array(MAX_BINS), 2); $scope.difficultyChart = _.fill(Array(MAX_BINS), 2);
$scope.transactionDensity = _.fill(Array(MAX_BINS), 2); $scope.transactionDensity = _.fill(Array(MAX_BINS), 2);
@ -327,6 +328,9 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, $localStorage, soc
if( !_.isEqual($scope.avgHashrate, data.avgHashrate) ) if( !_.isEqual($scope.avgHashrate, data.avgHashrate) )
$scope.avgHashrate = data.avgHashrate; $scope.avgHashrate = data.avgHashrate;
if( !_.isEqual($scope.lastGasLimit, data.gasLimit) && data.gasLimit.length >= MAX_BINS )
$scope.lastGasLimit = data.gasLimit;
if( !_.isEqual($scope.lastBlocksTime, data.blocktime) && data.blocktime.length >= MAX_BINS ) if( !_.isEqual($scope.lastBlocksTime, data.blocktime) && data.blocktime.length >= MAX_BINS )
$scope.lastBlocksTime = data.blocktime; $scope.lastBlocksTime = data.blocktime;

View File

@ -88,6 +88,16 @@ block content
span.small-title uptime span.small-title uptime
span.small-value {{ upTimeTotal | upTimeFilter }} span.small-value {{ upTimeTotal | upTimeFilter }}
div.row.second-row
div.col-xs-3.stat-holder.box
div.col-xs-3.stat-holder.box
div.gasprice.text-info
i.icon-gasprice
span.small-title gas limit
span.small-value {{ bestStats.block.gasLimit }} gas
div.col-xs-3.stat-holder.box
div.col-xs-3.stat-holder.box
div.row div.row
div.col-xs-3.stat-holder div.col-xs-3.stat-holder
div.big-info.chart(class="{{ avgBlockTime | avgTimeClass }}") div.big-info.chart(class="{{ avgBlockTime | avgTimeClass }}")
@ -146,6 +156,16 @@ block content
//- div.col-xs-12 //- div.col-xs-12
nodemap#mapHolder(data="map") nodemap#mapHolder(data="map")
div.row
div.col-xs-3.stat-holder
div.big-info.chart.text-info
//- i.icon-difficulty
span.small-title gas limit
//- span.small-value {{ lastDifficulty | number }}
sparkchart.big-details.spark-difficulty(data="{{lastGasLimit.join(',')}}")
div.row
div.col-xs-12.stats-boxes div.col-xs-12.stats-boxes
div.row.second-row div.row.second-row
div.col-xs-12.stat-holder.box div.col-xs-12.stat-holder.box
@ -154,6 +174,7 @@ block content
span.small-title Block #1028201 hash span.small-title Block #1028201 hash
span.small-value {{frontierHash}} span.small-value {{frontierHash}}
//- div.clearfix //- div.clearfix
div.row(ng-cloak, style="padding-top: 10px") div.row(ng-cloak, style="padding-top: 10px")