From 2a79705f95c8764f7799aad52a35cf10c5f53863 Mon Sep 17 00:00:00 2001
From: sgiehl <stefan@piwik.org>
Date: Sun, 11 Oct 2015 12:14:08 +0200
Subject: [PATCH] use number formats in visitor map

---
 plugins/UserCountryMap/javascripts/visitor-map.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/plugins/UserCountryMap/javascripts/visitor-map.js b/plugins/UserCountryMap/javascripts/visitor-map.js
index fb4d5ad259..b3b6d747a1 100644
--- a/plugins/UserCountryMap/javascripts/visitor-map.js
+++ b/plugins/UserCountryMap/javascripts/visitor-map.js
@@ -156,11 +156,13 @@
 
                 var val = data[metric] % 1 === 0 || Number(data[metric]) != data[metric] ? data[metric] : data[metric].toFixed(1);
                 if (metric == 'bounce_rate') {
-                    val += '%';
+                    val = NumberFormatter.formatPercent(val);
                 } else if (metric == 'avg_time_on_site') {
                     val = new Date(0, 0, 0, val / 3600, val % 3600 / 60, val % 60)
                         .toTimeString()
                         .replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1");
+                } else {
+                    val = NumberFormatter.formatNumber(val);
                 }
 
                 var v = _[metric].replace('%s', '<strong>' + val + '</strong>');
@@ -266,8 +268,10 @@
             }
 
             function formatPercentage(val) {
-                if (val < 0.001) return '< 0.1%';
-                return Math.round(1000 * val) / 10 + '%';
+                if (val < 0.001) {
+                    return '< ' + NumberFormatter.formatPercent(0.1);
+                }
+                return NumberFormatter.formatPercent(Math.round(1000 * val) / 10);
             }
 
             /*
-- 
GitLab