Browse Source

add statistic about geoinformations

Neal Oakey 9 years ago
parent
commit
3575e08a40
1 changed files with 16 additions and 1 deletions
  1. 16 1
      lib/proportions.js

+ 16 - 1
lib/proportions.js

@@ -3,7 +3,7 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
 
   return function (config) {
     var self = this
-    var fwTable, hwTable, autoTable, gwTable
+    var fwTable, hwTable, geoTable, autoTable, gwTable
     var scale = Chroma.scale("YlGnBu").mode("lab")
 
     function showStatGlobal(o) {
@@ -98,6 +98,12 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
 
       var fwDict = count(nodes, ["nodeinfo", "software", "firmware", "release"])
       var hwDict = count(nodes, ["nodeinfo", "hardware", "model"])
+      var geoDict = count(nodes, ["nodeinfo", "location"], function (d) {
+        if (d)
+          return "ja"
+        else
+          return "nein"
+      })
       var autoDict = count(nodes, ["nodeinfo", "software", "autoupdater"], function (d) {
         if (d === null)
           return null
@@ -119,6 +125,7 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
 
       fillTable(fwTable, fwDict.sort(function (a, b) { return b[1] - a[1] }))
       fillTable(hwTable, hwDict.sort(function (a, b) { return b[1] - a[1] }))
+      fillTable(geoTable, geoDict.sort(function (a, b) { return b[1] - a[1] }))
       fillTable(autoTable, autoDict.sort(function (a, b) { return b[1] - a[1] }))
       fillTable(gwTable, gwDict.sort(function (a, b) { return b[1] - a[1] }))
     }
@@ -141,6 +148,14 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
       hwTable.classList.add("proportion")
       el.appendChild(hwTable)
 
+      h2 = document.createElement("h2")
+      h2.textContent = "Auf der Karte sichtbar"
+      el.appendChild(h2)
+
+      geoTable = document.createElement("table")
+      geoTable.classList.add("proportion")
+      el.appendChild(geoTable)
+
       h2 = document.createElement("h2")
       h2.textContent = "Autoupdater"
       el.appendChild(h2)