Error: 'Invalid row index NaN. Should be in the range [0-0]' rendering chart

601 views
Skip to first unread message

Joseph Nelson

unread,
Mar 11, 2016, 2:58:16 PM3/11/16
to Google Visualization API
Hi All,

I have the following snipped that's producing the above error and the chart doesn't render. I'm new to JS and gViz API as well. What am I doing wrong?

 <table>
    <h1>Software Versions - By Role</h1>
    <div id="chart_div"></div>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);


      function drawChart(){

      // Create DataTable object from dremel table
      var dt = new google.visualization.DataTable();
      dt.addColumn('string', 'name');
      dt.addColumn('string', 'role');
      dt.addColumn('string', 'vendor');
      dt.addColumn('string', 'hw_rev');
      dt.addColumn('string', 'sw_rev');

      // Populate with data from Dremel query
      
        dt.addRow(['ar01.bog01',
                   'AR',
                   'Juniper',
                   'mx960',
                   '13.3X2'
                ]);
      
        dt.addRow(['ar01.bom05',
                   'AR',
                   'Juniper',
                   't4000',
                   '13.3X2'
                ]);
      
        dt.addRow(['ar01.bom07',
                   'AR',
                   'Juniper',
                   't4000',
                   '13.3X2'
                ]);
      
        dt.addRow(['ar01.ctg01',
                   'AR',
                   'Juniper',
                   'mx960',
                   '13.3X2'
                ]);

// More entries omitted

      var chart = new google.visualization.Histogram(
                             document.getElementById('chart_div'));

      var column_key = [1, 2];
      //var column_opt = [1, {'column':2, 'aggregation':google.visualization.data.count, 'type':'number'}];

      var chart_opts = {
        title: 'Sofware Revsions by Role',
      }

      var group = google.visualization.data.group(
          dt,
          column_key
          );

      chart.draw(group);
      }

    </script>
  </table>

Daniel LaLiberte

unread,
Mar 11, 2016, 4:34:19 PM3/11/16
to Google Visualization API
Hi Joseph,

I'm not exactly sure what you want to do, but here is an example based on your code that might give you something to work from.  http://jsfiddle.net/dlaliberte/g08jb8x6/

A good debugging technique is to use a Table to see what you are generating, particularly with groups and joins.

The Histogram doesn't have much to show if there is only one item, but it seems to work.


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/6162bdb5-65c8-4579-a1ce-3235574d57df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Esorkinc

unread,
May 6, 2016, 1:15:21 PM5/6/16
to Google Visualization API
Hi All,

I am having the same problem too. Mine was working since January and stopped working a week ago. I have not touched any of my source code.
Is there any way to look at the jQuery function?

Thanks
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.



--
Reply all
Reply to author
Forward
0 new messages