|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
var _ = require('lodash'); |
|
|
|
|
var d3 = require('d3'); |
|
|
|
|
|
|
|
|
|
var MAX_HISTORY = 1008; |
|
|
|
|
var MAX_PEER_PROPAGATION = 36; |
|
|
|
@ -128,11 +129,7 @@ History.prototype.getBlockPropagation = function() |
|
|
|
|
{ |
|
|
|
|
var propagation = []; |
|
|
|
|
|
|
|
|
|
var sorted = _(this._items) |
|
|
|
|
.sortByOrder('height', false) |
|
|
|
|
.slice(0, MAX_BLOCK_PROPAGATION) |
|
|
|
|
.reverse() |
|
|
|
|
.forEach(function(n, key) |
|
|
|
|
_.forEach(this._items, function(n, key) |
|
|
|
|
{ |
|
|
|
|
_.forEach(n.propagTimes, function(p, i) |
|
|
|
|
{ |
|
|
|
@ -141,10 +138,25 @@ History.prototype.getBlockPropagation = function() |
|
|
|
|
if(prop >= 0) |
|
|
|
|
propagation.push(prop); |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.value(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return propagation; |
|
|
|
|
var x = d3.scale.linear() |
|
|
|
|
.domain([0, 20000]) |
|
|
|
|
.interpolate(d3.interpolateRound); |
|
|
|
|
|
|
|
|
|
var data = d3.layout.histogram() |
|
|
|
|
.frequency(false) |
|
|
|
|
.bins(x.ticks(MAX_BINS)) |
|
|
|
|
(propagation); |
|
|
|
|
|
|
|
|
|
var freqCum = 0; |
|
|
|
|
var histo = data.map(function(val) { |
|
|
|
|
freqCum += val.length; |
|
|
|
|
var cumPercent = (freqCum / Math.max(1, propagation.length)); |
|
|
|
|
return {x: val.x, dx: val.dx, y: val.y, frequency: val.length, cumulative: freqCum, cumpercent: cumPercent}; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return histo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
History.prototype.history = function() |
|
|
|
|