json - Using 'Ajax updated' dataset with crossfilter -
i have large dataset (about 500 000 records...) co2 emission on london want display maps , charts using crossfilter. reasons of performance, want queries beforehand boroughs, i've done ajax function dynamically when click on borough (just imagine map of london borough boundaries can click on them). ajax code works fine :
function load_data(str){ var londondata = null; $.ajax({ url: "php/london-data.php", data: "name='"+str+"'", type: 'get', async: false, success: function(data) { londondata = data; } }); alert(json.stringify(londondata)); return londondata;}
it returns json file. when click on borough, alert function shows me data updated. use crossfilter, wanted have global variable updates when click on borough, load_data function, doesn't work -> variable keeps same value initialized.
i don't know if i'm clear enough think there solution update global variable, , consequence update crossfilter data? :
layer.on("click", function (e) { londondata = load_data(/*name of layer clicked on*/) }); dataset = crossfilter(londondata);
at end i'd charts updates when click on borough, 'dataset' variable has change when click on one. don't know if it's possible or if i'm doing wrong... anyway thank in advance help.
i think since ajax request asynchronous , have apply crossfilter function in success function. create , use crossfilter data after ajax data loaded.
Comments
Post a Comment