Hello,
the Object #<NodeList> has no method 'each' error comes when i click any
region.
this happens only on chrome and safari but not at all on firefox.. it works
perfectly fine on firefox, the world region can be drilled down to
countries and then US can be further drill down to regions without any
error.
on chrome the first world map loads wothout error but the further clicks
gives this error but still drills down to country level.. when clicked on
states it does show the state level but doesnt show the data points that
appears on firefox (e.g: the Dallas and richardson in US-TX)
following is my code:
the data is passed in variable $globalData form the php controller file :
{"world":[["US",10]],"US":[["US-AR",1],["US-TX",4]],"US-AR":[["Edmonton",1]],"US-TX":[["Dallas",1],["irving",1],["Richardson",2]]}
google.load('visualization', '1', {'packages': ['geochart']});
google.setOnLoadCallback(drawMap);
function drawMap() {
var globalData = eval('(' + '{/literal}{$globalData}{literal}' + ')');
var globaldata_length = globalData.world.length;
var data1 = new google.visualization.DataTable();
data1.addColumn('string', 'Countries');
data1.addColumn('number', 'Dollar Amt.');
for (i=0;i<globaldata_length;i++) {
data1.addRow(globalData.world[i]);
}
var options = {};
options['width'] = '600';
options['height'] = '450';
options['colors'] = ['#E4ff0a', '#c9f205', '#A5d902'];
options['dataMode'] = 'regions';
var geochart = new
google.visualization.GeoChart(document.getElementById('map_canvas_dollar'));
geochart.draw(data1, options);
//listner for region click
//region click for countries is available for all countries but for
states is only available for US
google.visualization.events.addListener(geochart, 'regionClick', function
(e)
{
var regionData = globalData[e.region];
if(regionData && regionData.length > 0 )
{
var count=data1.getNumberOfRows(); //alert(count)
data1.removeRows(0, count);
for (i=0;i<regionData.length;i++) {
data1.addRow(regionData[i]);
}
var options = {
region: e.region,
resolution:'provinces',
width:600,
height:450,
displayMode: (e.region.indexOf("-") == -1)?'regions':'markers',
colorAxis:{colors: ['#E4ff0a', '#c9f205', '#A5d902']}
};
geochart.clearChart();
geochart.draw(data1, options);
} else { alert("Cannot Drill Further") }
});
};
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/lu-ATiNV8PQJ.
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.