diff options
author | sgiehl <stefan@piwik.org> | 2015-10-11 13:14:08 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2015-10-11 15:46:03 +0300 |
commit | 2a79705f95c8764f7799aad52a35cf10c5f53863 (patch) | |
tree | 0b58944b8c5582a01b0cee62b7be1f4fb30b0c8e /plugins/UserCountryMap/javascripts/visitor-map.js | |
parent | 567fb02f1e765d2bcc774c770d46181412b5620c (diff) |
use number formats in visitor map
Diffstat (limited to 'plugins/UserCountryMap/javascripts/visitor-map.js')
-rw-r--r-- | plugins/UserCountryMap/javascripts/visitor-map.js | 10 |
1 files 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); } /* |