From 86307665fc2d35d1f0da0715d54f5e3c8b7769a2 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sat, 16 Jun 2012 05:01:05 +0200 Subject: [PATCH] do not count nodes own TT link as client --- html/force.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/html/force.js b/html/force.js index 5a6de9b..5ef9368 100644 --- a/html/force.js +++ b/html/force.js @@ -118,10 +118,10 @@ meshinfo.append("p") .attr("id", "nodecount") meshinfo.append("p") - .attr("id", "clientcount") + .attr("id", "gatewaycount") meshinfo.append("p") - .attr("id", "gatewaycount") + .attr("id", "clientcount") //cp.append("input") // .on("keyup", function(){show_node(this.value)}) @@ -343,20 +343,24 @@ function reload() { updated_at.text(d3.time.format("%X")(new Date())) + var nNodes = data.nodes.filter(function(d) { + return !d.flags.client + }).length, + nGateways = data.nodes.filter(function(d) { + return d.flags.gateway + }).length, + nClients = data.nodes.filter(function(d) { + return d.flags.client + }).length + d3.select("#nodecount") - .text((data.nodes.filter(function(d) { - return !d.flags.client - }).length) + " Knoten") + .text(nNodes + " Knoten") d3.select("#gatewaycount") - .text((data.nodes.filter(function(d) { - return d.flags.gateway - }).length) + " Gateways") + .text(nGateways + " Gateways") d3.select("#clientcount") - .text((data.nodes.filter(function(d) { - return d.flags.client - }).length) + " Clients") + .text("ungefähr " + (nClients - nNodes) + " Clients") update() })