I have modified my code to read as follows:
google.load('visualization', '1', { 'packages': ['corechart'] });
// end test
var map, layer;
var tableID = 1974520;
var location_column = 'geometry';
//var name = 'G05OJ023';
function initialize() {
// initialize map
var latlng = new google.maps.LatLng(53.760861,
-98.813876);
var myOptions = {
center: latlng,
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoomControlOptions: {
style:
google.maps.ZoomControlStyle.SMALL
}
}
map = new
google.maps.Map(document.getElementById("map_canvas"), myOptions);
layer = new google.maps.FusionTablesLayer({
query: {
select: location_column,
from: tableID
}
});
layer.setMap(map);
// click listener - update graph
google.maps.event.addListener(layer, 'click',
function (e) {
//console.log(e);
//console.log(e.row['name'].value);
//if the value exists, change the chart
/*
if (e.row['name'].value) {
var tmp = e.row['name'].value;
tmp = G05OJ023;
drawVisualization(tmp);
} else {
alert("null");
e.infoWindowHtml += "null";
}
*/
drawVisualization(e.row['name'].value);
// click listener - update info window
contents
//customInfoWindow(e);
});
}
function drawVisualization(name) {
console.log("Inside drawVisualization
function: " + name);
google.visualization.drawChart({
"containerId": "chart_div",
"dataSourceUrl": 'http://www.google.com/
fusiontables/gvizdata?tq=',
"query": "SELECT
year,average_ground_water_level FROM 1974520 WHERE name = ' + name +
'",
//"query": "SELECT
year,average_ground_water_level FROM 1961290",
"refreshInterval": 5,
"chartType": "LineChart",
"options": {
"title": "Test",
"vAxis": { "title": "Average Daily
Groundwater Level - (M)" },
"hAxis": {
"title": "Year"
//
"showTextEvery":"5"
}
}
});
}
//google.setOnLoadCallback(drawVisualization);
It seems like there is now a problem with querying the fusion table.
On Oct 26, 1:08 pm, asgallant <[email protected]> wrote:
> I tried out your script, and I can get the chart to draw as is, but the map
> won't draw for me (I suspect I have something else wrong on my end there),
> so I can't test the interactivity between the two, but I noticed the
> drawVisualization call you make in the event handler passes a parameter to
> the function, but the function isn't set up to accept any parameters.
>
> You might want to explore the Map Charts
> (http://code.google.com/apis/chart/interactive/docs/gallery/map.html) which
> is a Viz API wrapper for Google Maps that is designed to interface with the
> charts.
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.