Skip to content

Commit

Permalink
Merge pull request #104 from ffac/chart-pr2
Browse files Browse the repository at this point in the history
Map and graph enhancements
  • Loading branch information
Nils Schneider committed Feb 23, 2015
2 parents 5321f21 + e29764d commit 5e1f76a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 23 deletions.
30 changes: 29 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,35 @@ define("config", function () {
strength: 1.0,

// path to the nodes.json
nodesJSON: "nodes.json"
nodesJSON: "nodes.json",

graph: {
type: "rrd"
},

map: {
layer: {
url: "http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg",
config: {
subdomains: "1234",
type: "osm",
attribution: "Map data Tiles &copy; <a href=\"http://www.mapquest.com/\" target=\"_blank\">MapQuest</a> <img src=\"http://developer.mapquest.com/content/osm/mq_logo.png\" />, Map data © OpenStreetMap contributors, CC-BY-SA",
opacity: 0.7
}
}
/*
layer: {
url: "http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png",
config: {
subdomains: "abcd",
type: "osm",
attribution: "© <a href=\"http://osm.org/copyright\" target=\"_blank\">OpenStreetMap</a> contributors, Open Database License",
opacity: 0.7
}
}*/
}


}

return ffmapConfig
Expand Down
6 changes: 6 additions & 0 deletions css/graph.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,15 @@ header, footer {
#nodeinfo {
top: 10px;
left: 10px;
z-index: 10;
}

#nodeinfo a {
color: #444;
}

#nodeinfo button.close {
cursor: pointer;
float: right;
}

Expand Down
7 changes: 1 addition & 6 deletions lib/geomap.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ define("geomap", [

L.control.scale().addTo(map)

map.addLayer(new L.TileLayer("http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg", {
subdomains: "1234",
type: "osm",
attribution: "Map data Tiles &copy; <a href=\"http://www.mapquest.com/\" target=\"_blank\">MapQuest</a> <img src=\"http://developer.mapquest.com/content/osm/mq_logo.png\" />, Map data © OpenStreetMap contributors, CC-BY-SA",
opacity: 0.7
}))
map.addLayer(new L.TileLayer(ffmapConfig.map.layer.url, ffmapConfig.map.layer.config))

svg = d3.select(map.getPanes().overlayPane).append("svg")
g = svg.append("g").attr("class", "leaflet-zoom-hide")
Expand Down
34 changes: 18 additions & 16 deletions lib/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,26 +166,28 @@ define("graph", [
nodeinfo.remove()
})

nodeinfo.append("button")
.attr("class", "refresh")
.text("refresh")
.on("click", function() {
gotoNode(d)
})

nodeinfo.append("h1")
.text(d.name + " / " + d.id)

nodeinfo.append("h2").text("Stats")
if (!ffmapConfig.graph || !ffmapConfig.graph.type || ffmapConfig.graph.type !== "none") {
nodeinfo.append("h2").text("Stats")

var imglink = "nodes/" + d.id.replace(/:/g, "") + ".png"
if (!ffmapConfig.graph || !ffmapConfig.graph.type || ffmapConfig.graph.type === "rrd") {
var imglink = "nodes/" + d.id.replace(/:/g, "") + ".png"

nodeinfo.append("a")
.attr("target","_blank")
.attr("href",imglink)
.append("img")
.attr("src",imglink)
.attr("width","300")
nodeinfo.append("a")
.attr("target", "_blank")
.attr("href", imglink)
.append("img")
.attr("src", imglink)
.attr("width", "300")

}
/*else if (ffmapConfig.graph.type === "graphite") {
//TODO: Add d3 chart
}*/

}

nodeinfo.append("h2").text("VPN-Links")

Expand Down Expand Up @@ -217,7 +219,7 @@ define("graph", [
// graph when the user navigates back.
.attr("target","_blank")
.attr("href","geomap.html#lat=" + d.geo[0] + "&lon=" + d.geo[1])
.text(d.geo)
.text(d.geo[0] + ", " + d.geo[1])
}
}

Expand Down

0 comments on commit 5e1f76a

Please sign in to comment.