ERROR: Object #<NodeList> has no method 'each'

516 views
Skip to first unread message

ni man

unread,
Apr 30, 2012, 1:12:30 PM4/30/12
to google-visua...@googlegroups.com
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") }
    });
 };





EZChart

unread,
May 2, 2012, 10:51:50 AM5/2/12
to google-visua...@googlegroups.com
I created a simple page with you code (http://savedbythegoog.appspot.com/?id=a5215756e4147da99c1da54613c08561d99b1cbb), and for me it works without throwing errors both on chrome v18.0.1025.162 and on safari v5.1.5.

From looking at your code, the only thing that seems a bit dangerous is the fact you're changing the data table after you pass it to draw().
It would be better if you do "new google.visualization.DataTable()" every time you redraw.

Hope this helps,
EZChart

--
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 google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

ni man

unread,
Aug 2, 2012, 5:01:32 PM8/2/12
to google-visua...@googlegroups.com
Hello,

thanks for your reply. i got a little close to the problem.. my website has prototype.js and as soon as i include it.. the page start giving error.. 
Do you know of anyway this interference of the prototype could be solved.

thanks again


On Wednesday, 2 May 2012 09:51:50 UTC-5, EZChart wrote:
I created a simple page with you code (http://savedbythegoog.appspot.com/?id=a5215756e4147da99c1da54613c08561d99b1cbb), and for me it works without throwing errors both on chrome v18.0.1025.162 and on safari v5.1.5.

From looking at your code, the only thing that seems a bit dangerous is the fact you're changing the data table after you pass it to draw().
It would be better if you do "new google.visualization.DataTable()" every time you redraw.

Hope this helps,
EZChart
To post to this group, send email to google-visualization-api@googlegroups.com.
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages