change threshholds for linkquality colors

alfred-data
Nils Schneider 2012-09-03 23:36:55 +02:00
parent 1ed42ab9ee
commit d748f917cb
1 changed files with 15 additions and 4 deletions

View File

@ -366,9 +366,15 @@ function reload() {
}) })
} }
var linkcolor = d3.scale.linear() var linkcolor = {'default':
.domain([1, 1.5, 3]) d3.scale.linear()
.range(["#0a3", "orange", "red"]); .domain([1, 1.25, 1.5])
.range(["#0a3", "orange", "red"]),
'wifi':
d3.scale.linear()
.domain([1, 3, 10])
.range(["#0a3", "orange", "red"]),
}
function update() { function update() {
var links = data.links var links = data.links
@ -413,7 +419,12 @@ function update() {
return d.type != 'client' return d.type != 'client'
}) })
.style("stroke", function(d) { .style("stroke", function(d) {
return linkcolor(Math.max.apply(null, d.quality.split(","))) switch (d.type) {
case "vpn":
return linkcolor['default'](Math.max.apply(null, d.quality.split(",")))
default:
return linkcolor['wifi'](Math.max.apply(null, d.quality.split(",")))
}
}) })
.attr("class", function(d) { .attr("class", function(d) {
return d.quality.split(",").length==1?"unidirectional":"bidirectional" return d.quality.split(",").length==1?"unidirectional":"bidirectional"