Created
July 14, 2013 11:41
-
-
Save sigon426/5994009 to your computer and use it in GitHub Desktop.
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
function charts(data_id) { | |
var campo = data_id; | |
var url ="http://{username}.cartodb.com/api/v1/sql?q=SELECT nbarri,rfd_2008,rfd_2009,rfd_2010, rfd_2011 FROM {tablename} WHERE cartodb_id="+campo+"" | |
console.log(url); | |
var cartoItems = []; | |
$.getJSON(url, function(data) { | |
$.each(data.rows, function(key, val) { | |
cartoItems.push(val.rfd_2008); | |
cartoItems.push(val.rfd_2009); | |
cartoItems.push(val.rfd_2010); | |
cartoItems.push(val.rfd_2011); | |
barrio= val.nbarri; | |
}); | |
console.log(cartoItems); | |
console.log(barrio); | |
creaChart(cartoItems,barrio); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment