history: longlings 90th percentile, show tq

This commit is contained in:
Nils Schneider 2015-03-20 20:28:21 +01:00
parent ccd46b521b
commit bbc38c62c7
2 changed files with 14 additions and 2 deletions

View File

@ -96,7 +96,7 @@
width: 100%;
}
#lists td:nth-child(2) {
#lists td:not(:first-child) {
text-align: right;
}

View File

@ -151,7 +151,7 @@ function handle_data(map) {
longlinks = graph.slice().sort( function (a, b) {
return a.distance - b.distance
}).reverse().slice(0, 10)
}).reverse().slice(0, Math.ceil(0.1 * graph.length))
addToLongLinksList(document.getElementById("longlinks"), longlinks)
@ -163,6 +163,14 @@ function showDistance(d) {
return (new Intl.NumberFormat("de-DE", {maximumFractionDigits: 0}).format(d.distance)) + " m"
}
function showTq(d) {
var opts = { maximumFractionDigits: 2,
minimumFractionDigits: 2
}
return (new Intl.NumberFormat("de-DE", opts).format(d.tq)) + " TQ"
}
function mkmap(map, newnodes, lostnodes, onlinenodes, graph) {
L.control.zoom({ position: "topright" }).addTo(map)
@ -242,6 +250,10 @@ function addToLongLinksList(el, links) {
td2.textContent = showDistance(d)
row.appendChild(td2)
var td3 = document.createElement("td")
td3.textContent = showTq(d)
row.appendChild(td3)
el.appendChild(row)
})
}