From 77ef7ec4da4bfd66dc31a52d350d682da14d0a10 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 3 Jun 2012 19:05:48 +0200 Subject: [PATCH] count uplinks from nodes.json --- html/force.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/html/force.js b/html/force.js index d0dfcd8..1b8c547 100644 --- a/html/force.js +++ b/html/force.js @@ -158,12 +158,15 @@ function render_graph(type) { node.append("title") .text(function(d) { return d.macs; }); - var uplink_info = node.filter(function (d) { - return d.name == "krtek" - }) - .append("g"); - if (type == "mesh") { + var uplink_info = node.filter(function (d) { + if (d.uplinks !== undefined) + return d.uplinks.length > 0; + else + return false; + }) + .append("g"); + uplink_info.append("rect") .attr("width", 16) .attr("height", 16) @@ -175,7 +178,7 @@ function render_graph(type) { uplink_info.append("text") .attr("text-anchor", "middle") .attr("y", 4 - 20) - .text("8"); + .text(function (d) {return d.uplinks.length}); } force.on("tick", function() {