added avg block propagation

This commit is contained in:
cubedro
2015-04-28 18:44:41 +03:00
parent f202ff059a
commit 422b8eb061
4 changed files with 30 additions and 18 deletions

View File

@@ -159,6 +159,7 @@ History.prototype.getNodePropagation = function(id)
History.prototype.getBlockPropagation = function()
{
var propagation = [];
var avgPropagation = 0;
_.forEach(this._items, function(n, key)
{
@@ -171,6 +172,11 @@ History.prototype.getBlockPropagation = function()
});
});
if(propagation.length > 0)
{
var avgPropagation = Math.round(_.sum(propagation) / propagation.length);
}
var x = d3.scale.linear()
.domain([MIN_PROPAGATION_RANGE, MAX_PROPAGATION_RANGE])
.interpolate(d3.interpolateRound);
@@ -187,7 +193,7 @@ History.prototype.getBlockPropagation = function()
return {x: val.x, dx: val.dx, y: val.y, frequency: val.length, cumulative: freqCum, cumpercent: cumPercent};
});
return histogram;
return {histogram: histogram, avg: avgPropagation};
}
History.prototype.getUncleCount = function()