changed histogram to 10s

This commit is contained in:
cubedro
2015-05-13 02:44:47 +03:00
parent 3fc4f455eb
commit 17046d4370
4 changed files with 12 additions and 14 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+4 -7
View File
@@ -5,7 +5,7 @@ var MAX_HISTORY = 1000;
var MAX_PEER_PROPAGATION = 36;
var MIN_PROPAGATION_RANGE = 0;
var MAX_PROPAGATION_RANGE = 20000;
var MAX_PROPAGATION_RANGE = 10000;
var MAX_UNCLES_PER_BIN = 25;
var MAX_BINS = 40;
@@ -188,7 +188,7 @@ History.prototype.getBlockPropagation = function()
{
_.forEach(n.propagTimes, function (p, i)
{
var prop = _.result(p, 'propagation', -1);
var prop = Math.min(MAX_PROPAGATION_RANGE, _.result(p, 'propagation', -1));
if(prop >= 0)
propagation.push(prop);
@@ -200,13 +200,10 @@ History.prototype.getBlockPropagation = function()
var avgPropagation = Math.round( _.sum(propagation) / propagation.length );
}
var x = d3.scale.linear()
.domain([ MIN_PROPAGATION_RANGE, MAX_PROPAGATION_RANGE ])
.interpolate( d3.interpolateRound );
var data = d3.layout.histogram()
.frequency( false )
.bins( x.ticks(MAX_BINS) )
.range([ MIN_PROPAGATION_RANGE, MAX_PROPAGATION_RANGE ])
.bins( MAX_BINS )
( propagation );
var freqCum = 0;
+6 -5
View File
@@ -127,7 +127,7 @@ angular.module('netStatsApp.directives', []).
var TICKS = 40;
var x = d3.scale.linear()
.domain([0, 20000])
.domain([0, 10000])
.rangeRound([0, width])
.interpolate(d3.interpolateRound);
@@ -136,8 +136,8 @@ angular.module('netStatsApp.directives', []).
.interpolate(d3.interpolateRound);
var color = d3.scale.linear()
.domain([1000, 3000, 7000, 10000, 20000])
.range(["#7bcc3a", "#FFD162", "#ff8a00", "#F74B4B", "#CC0000"]);
.domain([1000, 3000, 7000, 10000])
.range(["#7bcc3a", "#FFD162", "#ff8a00", "#F74B4B"]);
var xAxis = d3.svg.axis()
.scale(x)
@@ -214,8 +214,8 @@ angular.module('netStatsApp.directives', []).
bar.insert("rect")
.attr("class", "bar")
.attr("y", function(d) { return y(d.y); })
.attr("rx", 1.2)
.attr("ry", 1.2)
.attr("rx", 1)
.attr("ry", 1)
.attr("fill", function(d) { return color(d.x); })
.attr("width", x(data[0].dx + data[0].x) - x(data[0].x) - 1)
.attr("height", function(d) { return height - y(d.y) + 1; });
@@ -236,6 +236,7 @@ angular.module('netStatsApp.directives', []).
scope.$watch('data', function() {
if(scope.data.length > 0) {
alert(scope.data);
scope.init();
}
}, true);