2 つのコントロールと 2 つの縦棒グラフを含むサンプルの Google ビジュアライゼーション ダッシュボードがあり、2 番目の縦棒グラフはデータ テーブルの集計を使用して次のように描画されます。
'dataTable' : google.visualization.data.group(data, [0],
[{'column': 2, 'aggregation': google.visualization.data.sum, 'type': 'number'}])
そして、中間テーブル チャートを使用して次のように再描画されます。
google.visualization.events.addListener(divPicker, 'statechange',
function(event) {
// group the data of the filtered table and set the result in the pie chart.
columnChart1.setDataTable( google.visualization.data.group(
// get the filtered results
table.getDataTable(),
[0],
[{'column': 2, 'aggregation': google.visualization.data.sum, 'type': 'number'}]
));
すべてのコードは正常に動作します。しかし、問題は、コントロールを選択したときに集計によって作成されたグラフが正しく変更されないことです。そして、同じコントロール オプションを 2 回選択した場合にのみ変更されます。