google.visualization.Dashboard is not a constructor

让人想犯罪 __ 提交于 2020-01-17 07:50:07

问题


I'm getting this error:

google.visualization.Dashboard is not a constructor

This is my code:

 <html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);

      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          [ 'Year', 'Sales', 'Expenses'],
          [ '2004',  1000,      400],
          ['2005',  1170,      460],
          ['2006',  660,       1120],
          ['2007',  1030,      540]
        ]);

        var options = {
          title: 'Company Performance',
          curveType: 'function',
          legend: { position: 'bottom' }
        };


        var control = new google.visualization.ControlWrapper({
            containerId: 'control_div',
            controlType: 'CategoryFilter',
            options: {
                filterColumnIndex: 0,
                ui: {

                }
            }
        });

        var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
        var dashboard = new google.visualization.Dashboard(document.getElementById('dashboard'));
        dashboard.bind([control], [chart]);
        dashboard.draw(data);
      }
    </script>
  </head>
  <body>
    <div id="curve_chart" style="width: 900px; height: 500px"></div>


    <div id="dashboard" style="width: 900px; height: 500px"></div>
  </body>
</html>

How can I fix this?

来源:https://stackoverflow.com/questions/46592396/google-visualization-dashboard-is-not-a-constructor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!