Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Aubry <mattab@users.noreply.github.com>2016-12-15 05:23:00 +0300
committerGitHub <noreply@github.com>2016-12-15 05:23:00 +0300
commit24d86bf03b00acb53d6f2ac78934bfa391632058 (patch)
treed7392f62b15189e8ce78c700e49e5f2d095ff3fb /plugins/UserCountryMap/javascripts/visitor-map.js
parent0c6da8c62740f3e56f4d8b4924b4fb91a43a9254 (diff)
Prevent JS error "Cannot apply style to null" on the Visitor Map when there was no geo data (#11015)
* Prevent timeout when synchronising UI tests screenshots * Prevent JS error "Cannot apply style to null" on the Visitor Map when there was no geo data
Diffstat (limited to 'plugins/UserCountryMap/javascripts/visitor-map.js')
-rw-r--r--plugins/UserCountryMap/javascripts/visitor-map.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/plugins/UserCountryMap/javascripts/visitor-map.js b/plugins/UserCountryMap/javascripts/visitor-map.js
index 07b5710259..a3bc0041b7 100644
--- a/plugins/UserCountryMap/javascripts/visitor-map.js
+++ b/plugins/UserCountryMap/javascripts/visitor-map.js
@@ -517,8 +517,10 @@
}
}
- // Apply the color scale to the map.
- map.getLayer('countries')
+ var countryLayer = map.getLayer('countries');
+ if(countryLayer) {
+ // Apply the color scale to the map.
+ countryLayer
.style('fill', countryFill)
.on('mouseenter', function (d, path, evt) {
if (evt.shiftKey) { // highlight on mouseover with shift pressed
@@ -531,13 +533,15 @@
}
});
- // Update the map tooltips.
- map.getLayer('countries').tooltips(function (data) {
- var metric = $$('.userCountryMapSelectMetrics').val(),
- country = UserCountryMap.countriesByIso[data.iso];
- return '<h3>' + country.name + '</h3>' +
- formatValueForTooltips(country, metric, target);
- });
+ // Update the map tooltips.
+ countryLayer.tooltips(function (data) {
+ var metric = $$('.userCountryMapSelectMetrics').val(),
+ country = UserCountryMap.countriesByIso[data.iso];
+ return '<h3>' + country.name + '</h3>' +
+ formatValueForTooltips(country, metric, target);
+ });
+ }
+
}
// if the view hasn't changed (but probably the selected metric),