Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions src/lib/geo_location_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@ var locationmodeToIdFinder = {

exports.locationToFeature = function(locationmode, location, features) {
var locationId = getLocationId(locationmode, location);
var feature;

for(var i = 0; i < features.length; i++) {
feature = features[i];
if(locationId) {
for(var i = 0; i < features.length; i++) {
var feature = features[i];

if(feature.id === locationId) return feature;
if(feature.id === locationId) return feature;
}

Lib.warn([
'Location with id', locationId,
'does not have a matching topojson feature at this resolution.'
].join(' '));
}

Lib.warn([
'Location with id', locationId,
'does not have a matching topojson feature at this resolution.'
].join(' '));
return false;
};

function getLocationId(locationmode, location) {
Expand All @@ -44,14 +47,14 @@ function getLocationId(locationmode, location) {
}

function countryNameToISO3(countryName) {
var iso3, regex;

for(var i = 0; i < countryIds.length; i++) {
iso3 = countryIds[i];
regex = new RegExp(countryRegex[iso3]);
var iso3 = countryIds[i],
regex = new RegExp(countryRegex[iso3]);

if(regex.test(countryName.toLowerCase())) return iso3;
}

Lib.warn('Unrecognized country name: ' + countryName + '.');

return false;
}
4 changes: 4 additions & 0 deletions src/plots/geo/geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ proto.plot = function(geoCalcData, fullLayout, promises) {
Fx.hover(_this.graphDiv, evt, _this.id);
});

_this.framework.on('mouseout', function() {
Fx.loneUnhover(fullLayout._toppaper);
});

_this.framework.on('click', function() {
Fx.click(_this.graphDiv, { target: true });
});
Expand Down
2 changes: 1 addition & 1 deletion src/traces/choropleth/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ plotChoropleth.calcGeoJSON = function(trace, topojson) {
for(var i = 0; i < len; i++) {
feature = locationToFeature(trace.locationmode, locations[i], features);

if(feature === undefined) continue; // filter the blank features here
if(!feature) continue; // filter the blank features here

// 'data_array' attributes
feature.z = trace.z[i];
Expand Down
Loading