google.visualization.Dashboard不是构造函数

时间:2017-10-05 18:21:20

标签: javascript google-chartwrapper

我收到了这个错误:

google.visualization.Dashboard is not a constructor

这是我的代码:

 <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>

我该如何解决这个问题?

0 个答案:

没有答案