终于找到了一种方法,以为会有更简单的方法,但可能没有
// Place graph
var drawChart = new google.visualization.Dashboard(document.getElementById('dashboard')).bind([compPicker], [chart, table]);;
drawChart.draw(data);
// Filter respondents
document.getElementById('names').onchange = function(evt) {
if (evt.target.selectedIndex == 0) {
// Expectancy
chart.setView({'columns': [0,1,2,3,4]});
chart.setOption('colors', ["#FFC000","#00b0f0","#ff0000","#92d050"]);
} else if (evt.target.selectedIndex == 1) {
chart.setView({'columns': [0,1]});
chart.setOption('colors', ["#FFC000"]);
} else if (evt.target.selectedIndex == 2) {
chart.setView({'columns': [0,2]});
chart.setOption('colors', ["#00b0f0"]);
} else if (evt.target.selectedIndex == 3) {
chart.setView({'columns': [0,3]});
chart.setOption('colors', ["#ff0000"]);
} else if (evt.target.selectedIndex == 4) {
chart.setView({'columns': [0,4]});
chart.setOption('colors', ["#92d050"]);
} else {
chart.setView({'columns': [0,1,2,3,4]});
chart.setOption('colors', ["#FFC000","#00b0f0","#ff0000","#92d050"]);
}
drawChart.draw(data);
};
<select id="names">
<option value="all">all</option>
<option value="pete">pete</option>
<option value="john">john</option>
<option value="carl">carl</option>
<option value="andrea">andrea</option>
</select>
完整代码和示例http://jsfiddle.net/fcqeA/1/