Demo of a bug that happens when you trigger updateChoropleth
from a geography click. Fill is updated properly, but per the mouseout functions found at https://github.com/markmarkoh/datamaps/blob/master/src/js/datamaps.js#L523 & https://github.com/markmarkoh/datamaps/blob/master/src/js/datamaps.js#L252, when you mouseout from the just-selected geography, the fill reverts.
-
-
Save adg29/609f280c2659cde6e6dadaf7175636b7 to your computer and use it in GitHub Desktop.
Map click + updateChoropleth bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<body> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://d3js.org/topojson.v1.min.js"></script> | |
<script src="http://rawgit.com/markmarkoh/datamaps/master/dist/datamaps.usa.min.js"></script> | |
<div id="map" style="height: 500px; width: 900px;"></div> | |
<script> | |
var map = new Datamap({ | |
element: document.getElementById('map'), | |
scope: 'usa', | |
data: { | |
AZ: '#A9C0DE' | |
}, | |
done: function(datamap) { | |
datamap.svg.selectAll('.datamaps-subunit').on('click', function(geography) { | |
var selectedGeo = {}; | |
selectedGeo[geography.id] = '#ED1ADF'; | |
datamap.updateChoropleth(selectedGeo); | |
}); | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment