0
timechart = new google.visualization.Dashboard(document.getElementById('timechart'));

を取得しundefined is not a function on this lineます。同じページで初期化された他のグラフがあり、正常に動作します。参考までに、関連するコードの残りの部分:

var timechartGraph = new google.visualization.ChartWrapper({
 'chartType': 'LineChart',
 'containerId': 'timechart-graph',
 'options': {
   // Use the same chart area width as the control for axis alignment.
  'legend': {'position': 'right'}

 },
 // Convert the first column from 'date' to 'string'.
 'view': {
   'columns': [
      {
       'calc': function(dataTable, rowIndex) {
         return dataTable.getFormattedValue(rowIndex, 11);
       },
       'type': 'string'
     },1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
 }
 });

  var timechartRangeSlider = new google.visualization.ControlWrapper({
 'controlType': 'ChartRangeFilter',
 'containerId': 'timechart-range-slider',
 'options': {
   // Filter by the date axis.
   'filterColumnIndex': 11,
   'ui': {
     'chartType': 'LineChart',
     'chartOptions': {
       'hAxis': {'baselineColor': 'none'}
     },
     // Display a single series that shows the closing value of the stock.
     // Thus, this view has two columns: the date (axis) and the stock value (line series).
     'chartView': {
       'columns': [11, 12]
     },
     // 1 day in milliseconds = 24 * 60 * 60 * 1000 = 86,400,000
     //'minRangeSize': 86400000
   }
 },
 // Initial range: 2012-02-09 to 2012-03-20.
 //'state': {'range': {'start': new Date(2012, 1, 9), 'end': new Date(2012, 2, 20)}}
});

timechartData = new google.visualization.DataTable();

timechart = new google.visualization.Dashboard(document.getElementById('timechart'));
timechart.bind(timechartRangeSlider, timechartGraph);
4

1 に答える 1

2

現在、corechart だけをロードしている場合、コードはおそらく次のようになります。

google.load('visualization', '1', {
  'packages': ['corechart']
});

次のように、コントロール パッケージもロードする必要があります。

google.load('visualization', '1', {
  'packages': ['corechart', 'controls']
});

これで google.visualization.Dashboard が定義されます。

于 2013-07-24T17:13:43.833 に答える