Skip to content

Instantly share code, notes, and snippets.

@rpardee
Forked from lennymd/values.js
Last active November 21, 2020 20:52
Show Gist options
  • Save rpardee/c4b7e4036c26d1221fa3d1cd5f1bf760 to your computer and use it in GitHub Desktop.
Save rpardee/c4b7e4036c26d1221fa3d1cd5f1bf760 to your computer and use it in GitHub Desktop.
var outcomes_health ;
function filter_down(indata) {
const cols = indata.columns;
let values = {};
indata.columns.forEach(col => (values[col] = d3.map(indata, d => d[col]).keys()));
outcomes_health = values['health_outcomes'] ;
}
async function get_values() {
let data = await d3.csv('https://raw.githubusercontent.com/lennymd/test_evidence_map/main/public/data/column_values.csv');
filter_down(data) ;
console.log(outcomes_health) ; // works!
}
get_values() ;
console.log(outcomes_health) ; // runs first--and returns undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment