Skip to content

Instantly share code, notes, and snippets.

@bchartoff
Last active August 29, 2015 14:06
Show Gist options
  • Save bchartoff/231caabc4cb8949d3ed5 to your computer and use it in GitHub Desktop.
Save bchartoff/231caabc4cb8949d3ed5 to your computer and use it in GitHub Desktop.
//listen for change event, call menuChanged func
dropDown.on("change", menuChanged });
function menuChanged() {
var selectedValue = d3.event.target.value;
//get the name of the selected option from the change event object
countryData.indicators.forEach(function (d) {
//loop through your source data, however it happens to be organized (this is just an example)
if (selectedValue === d.name){
//if the dropdown value matches the indicator name
console.log(d);
updateMap(d.name);
//call whatever function draws the #map according to whatever indicator
};
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment