From eb315ab60a68a22ff41dafed6556b3e5f20bf926 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 1 Apr 2015 03:57:10 +0200 Subject: [PATCH] forcegraph: remove labels --- lib/forcegraph.js | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/lib/forcegraph.js b/lib/forcegraph.js index 063569f..64870a3 100644 --- a/lib/forcegraph.js +++ b/lib/forcegraph.js @@ -2,7 +2,7 @@ define(["d3"], function (d3) { return function (linkScale, sidebar, router) { var self = this var nodes, links - var svg, vis, link, node, label + var svg, vis, link, node var nodesDict, linksDict var zoomBehavior var force @@ -100,10 +100,6 @@ define(["d3"], function (d3) { node .attr("cx", function(d) { return d.x }) .attr("cy", function(d) { return d.y }) - - label.attr("transform", function(d) { - return "translate(" + d.x + "," + d.y + ")" - }) } el = document.createElement("div") @@ -123,7 +119,6 @@ define(["d3"], function (d3) { vis.append("g").attr("class", "links") vis.append("g").attr("class", "nodes") - vis.append("g").attr("class", "labels").attr("pointer-events", "none") force = d3.layout.force() .charge(-70) @@ -216,36 +211,6 @@ define(["d3"], function (d3) { nodesDict[d.node.nodeinfo.node_id] = d }) - label = vis.select("g.labels") - .selectAll("g.label") - .data(data.graph.nodes, function (d) { - return d.id - }) - - var labelEnter = label.enter() - .append("g") - .attr("class", "label") - - labelEnter.append("path").attr("class", "clients") - - labelEnter.append("text") - .attr("class", "name") - .attr("text-anchor", "middle") - .attr("y", "21px") - .attr("x", "0px") - - label.selectAll("text.name").text(nodeName) - - var labelTextWidth = function (e) { - return e.parentNode.querySelector("text").getBBox().width + 3 - } - - labelEnter.insert("rect", "text") - .attr("y", "10px") - .attr("x", function() { return labelTextWidth(this) / (-2)}) - .attr("width", function() { return labelTextWidth(this)}) - .attr("height", "15px") - nodeEnter.append("title") nodeEnter.each( function (d) { if (nodePositions[d.id]) { @@ -321,7 +286,6 @@ define(["d3"], function (d3) { vis = null link = null node = null - label = null } return self