diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2016-04-20 08:09:25 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2016-04-20 08:09:25 +0300 |
commit | dec6be905f6a0657800b5d44ba572dc070b718eb (patch) | |
tree | 4bb5f27ef07fddf6351dc0a1d8a7badff8770595 /plugins/UserCountryMap | |
parent | d75f796b895b907025df91d8c23e4a35c5469ec9 (diff) |
some more fixes
Diffstat (limited to 'plugins/UserCountryMap')
-rw-r--r-- | plugins/UserCountryMap/javascripts/visitor-map.js | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/plugins/UserCountryMap/javascripts/visitor-map.js b/plugins/UserCountryMap/javascripts/visitor-map.js index c0c879ed58..ea1058ae53 100644 --- a/plugins/UserCountryMap/javascripts/visitor-map.js +++ b/plugins/UserCountryMap/javascripts/visitor-map.js @@ -920,12 +920,20 @@ }, title: function (d) { var v = d.curMetric; + if (isNaN(v)) { + return ''; + } + if (metric === 'bounce_rate') { v = Number((''+ v).replace('%', '')); } else if (metric === 'avg_time_on_site') { v = Number(v); } + if (isNaN(v)) { + return ''; + } + if (radscale(v) > 10) { return formatNumber(d.curMetric, metric); } @@ -940,7 +948,7 @@ }, filter: function (d) { if (isNaN(d.lat) || isNaN(d.long)) return false; - return d.curMetric; + return !!d.curMetric && d.curMetric !== '0'; }, aggregate: function (rows) { var row = aggregate(rows); @@ -955,14 +963,24 @@ }, sortBy: 'radius desc', location: function (city) { return [city.long, city.lat]; }, - radius: function (city) { return radscale(city.curMetric); }, + radius: function (city) { + var scale = radscale(city.curMetric); + if (isNaN(scale)) { + return 0.01; + } + return scale; + }, tooltip: function (city) { return '<h3>' + city.city_name + '</h3>' + formatValueForTooltips(city, metric, iso); }, attrs: function (city) { + var color = colscale(city.curMetric); + if (color && color.hex) { + color = color.hex(); + } return { - fill: colscale(city.curMetric).hex(), + fill: color, 'fill-opacity': 0.7, stroke: cityStrokeColor, cursor: 'pointer' |