forcegraph: remove labels

This commit is contained in:
Nils Schneider 2015-04-01 03:57:10 +02:00
parent a8bb1b40a2
commit eb315ab60a

View File

@ -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