Last active
April 21, 2016 17:32
-
-
Save dmachat/b75a5a01cfb31cf92cf5 to your computer and use it in GitHub Desktop.
Revisions
-
dmachat revised this gist
Sep 26, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,12 +10,12 @@ 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); }); } -
dmachat created this gist
Sep 26, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ 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. This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ <!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://rawgithub.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: blue }, done: function(datamap) { datamap.svg.selectAll('.datamaps-subunit').on('click', function(geography) { var selectedGeo = {}; selectedGeo[geography.id] = green; datamap.updateChoropleth(selectedGeo); }); } }); </script> </body> </html>