wrap links/nodes in graph

This commit is contained in:
Nils Schneider 2015-03-31 17:21:58 +02:00
parent 3c3cb4047d
commit b8a9ac9a26
4 changed files with 8 additions and 5 deletions

View File

@ -9,7 +9,7 @@ define(["tablesort", "tablesort.numeric"], function (Tablesort) {
} }
self.setData = function (data) { self.setData = function (data) {
if (data.links.length === 0) if (data.graph.links.length === 0)
return return
var h2 = document.createElement("h2") var h2 = document.createElement("h2")
@ -39,7 +39,7 @@ define(["tablesort", "tablesort.numeric"], function (Tablesort) {
var tbody = document.createElement("tbody") var tbody = document.createElement("tbody")
data.links.forEach( function (d) { data.graph.links.forEach( function (d) {
var row = document.createElement("tr") var row = document.createElement("tr")
var td1 = document.createElement("td") var td1 = document.createElement("td")
var a = document.createElement("a") var a = document.createElement("a")

View File

@ -70,7 +70,10 @@ function (config, moment, Router, L, GUI) {
new: newnodes, new: newnodes,
lost: lostnodes lost: lostnodes
}, },
links: links graph: {
links: links,
nodes: graph.nodes
}
} }
} }

View File

@ -81,7 +81,7 @@ define(["leaflet", "moment", "leaflet.label"], function (L, moment) {
nodeDict = {} nodeDict = {}
linkDict = {} linkDict = {}
var lines = addLinksToMap(linkDict, linkScale, data.links, router) var lines = addLinksToMap(linkDict, linkScale, data.graph.links, router)
L.featureGroup(lines).addTo(map) L.featureGroup(lines).addTo(map)
var nodesOnline = subtract(data.nodes.all.filter(online), data.nodes.new) var nodesOnline = subtract(data.nodes.all.filter(online), data.nodes.new)

View File

@ -121,7 +121,7 @@ define(function () {
objects.nodes[d.nodeinfo.node_id] = d objects.nodes[d.nodeinfo.node_id] = d
}) })
data.links.forEach( function (d) { data.graph.links.forEach( function (d) {
objects.links[linkId(d)] = d objects.links[linkId(d)] = d
}) })
} }