I am getting an error "Cannot read property 'prototype' of null"

49 views
Skip to first unread message

Md Rehan Moazzam

unread,
Mar 2, 2016, 2:35:29 AM3/2/16
to Google Visualization API
I am getting an error "Cannot read property 'prototype' of null" whenever I am trying to create a chart.

The code follows:

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>


<script type="text/javascript">
    // Load the Visualization API and the controls package.
    google.charts.load('current', { 'packages': ['controls'] });

    // Set a callback to run when the Google Visualization API is loaded.
    google.charts.setOnLoadCallback(drawDashboard);

    // Callback that creates and populates a data table,
    // instantiates a dashboard, a range slider and a pie chart,
    // passes in the data and draws it.
    function drawDashboard() {

        // Create our data table.
        var data = google.visualization.arrayToDataTable([
          ['Name', 'Donuts eaten'],
          ['Michael', 5],
          ['Elisa', 7],
          ['Robert', 3],
          ['John', 2],
          ['Jessica', 6],
          ['Aaron', 1],
          ['Margareth', 8]
        ]);

        // Create a dashboard.
        var dashboard = new google.visualization.Dashboard(
            document.getElementById('programmatic_dashboard_div'));

        // Create a range slider, passing some options
        var donutRangeSlider = new google.visualization.ControlWrapper({
            'controlType': 'NumberRangeFilter',
            'containerId': 'programmatic_control_div',
            'options': {
                'filterColumnLabel': 'Donuts eaten'
            }
        });

        // Create a pie chart, passing some options
        var pieChart = new google.visualization.ChartWrapper({
            'chartType': 'PieChart',
            'containerId': 'programmatic_chart_div',
            'options': {
                'width': 300,
                'height': 300,
                'pieSliceText': 'value',
                'legend': 'right'
            }
        });

        // Establish dependencies, declaring that 'filter' drives 'pieChart',
        // so that the pie chart will only display entries that are let through
        // given the chosen slider range.
        dashboard.bind(donutRangeSlider, pieChart);

        // Draw the dashboard.
        dashboard.draw(data);
    }
    </script>
  <body>
    <div id="programmatic_dashboard_div" style="border: 1px solid #ccc">
      <table class="columns">
        <tr>
          <td>
            <div id="programmatic_chart_div" style="width:800px; height:300px"></div>
          </td>
           
        </tr>
          <tr>
              <td>
              <div id="programmatic_control_div" style="width:800px; height:50px"></div>
                  </td>
          </tr>
      </table>
    </div>
  </body>




Error screen from chrome console is attached. Please help me out its kind of urgent

ErrorChart.png

Sergey Grabkovsky

unread,
Mar 2, 2016, 10:27:26 AM3/2/16
to Google Visualization API

Hi,

You are experiencing the issues caused by caching and propagation delays of our latest release. These issues should fix themselves eventually (probably in a few days). In the meantime, you can workaround it by explicitly specifying a version, such as '43' or '44' instead of 'current' or 'upcoming' as you currently do.


--
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/309c9cfb-03c2-44f7-8007-43fed7958f0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

unnamed.gif

Sergey Grabkovsky

Software Engineer

Google, Inc

gra...@google.com


Md Rehan Moazzam

unread,
Mar 7, 2016, 7:41:57 AM3/7/16
to Google Visualization API
Thanks Sergey. I followed the same and its working fine. :)
Reply all
Reply to author
Forward
0 new messages