javascript - Drawing chart visualization with google fusion tables -
i trying dynamically draw chart based off click on fusion table layer/map. whenever state in mexico clicked, chart change reflect value in columns 2007, 2008, 2009, , 2010. @ moment, not working. firebug telling me 'a undefined' don't know means, have not declared variable named 'a' , assuming it's in google script.
this code i'm using. click listener grabs state name column named 'column_1' , passes draw visualization function:
google.maps.event.addlistener(shownlayer, 'click',function(e){ statename = e.row['column_1'].value; drawvisualization(statename); }); function drawvisualization(statename){ google.visualization.drawchart({ containerid: "textbox", datasourceurl: "http://www.google.com/fusiontables/gvizdata?tq=", query: "select '2007','2008','2009','2010' " + "from 3943497 column_1 = '" + statename + "'", charttype: "columnchart", options: { title: statename, height: 300, width: 400 } }); } the map website located here: https://mywebspace.wisc.edu/csterling/web/cartel%20map/index.html
containerid: "textbox", is mispelled. should be:
containerid: "textbox", my suggestion basic static gvis chart working first before worrying linking fusion tables , changing chart based on mouse click. took relevant parts of script not work. when post whole file it's hard separate issues giving problems rest of code. extracted test basic gviz issue:
<!doctype html> <html> <head> <script src="http://www.google.com/jsapi"></script> <script type='text/javascript'> google.load('visualization','1', {packages: ['corechart'] }); window.onload = function () { drawvisualization('chiapas'); } function drawvisualization(statename){ google.visualization.drawchart({ "charttype": "columnchart", "containerid": "textbox", "datasourceurl": "http://www.google.com/fusiontables/gvizdata?tq=", "query": "select '2007','2008','2009','2010' " + "from 3943497 column_1 = '" + statename + "'", "options": { title: statename } }); } </script> </head> <body> <div id="textbox" style="width: 400px; height: 300px;"></div> <br /> </body> </html> this application not work. i'm getting displayed in page: "bars series value domain axis not supported"
i can see in app statename value using "chiapas, mexico" not value shown in fusion table column_1, "chiapas" value there.
Comments
Post a Comment