From bbc38c62c747bd85a10d0f4db03149b41788d2f2 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Fri, 20 Mar 2015 20:28:21 +0100 Subject: [PATCH] history: longlings 90th percentile, show tq --- history.html | 2 +- history.js | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/history.html b/history.html index f3786fd..96d246b 100644 --- a/history.html +++ b/history.html @@ -96,7 +96,7 @@ width: 100%; } - #lists td:nth-child(2) { + #lists td:not(:first-child) { text-align: right; } diff --git a/history.js b/history.js index 4bd8e28..2236a03 100644 --- a/history.js +++ b/history.js @@ -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) }) }