我正在研究谷歌可视化图表。我希望当我选择图表的特定区域时,我可以缩放该特定选定区域。我也希望它对折线图、条形图、饼图做同样的事情
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Date');
data.addColumn('number', 'Company1');
data.addColumn('number', 'Company2');
data.addColumn('number', 'Company3');
data.addColumn('number', 'Company4');
data.addColumn('number', 'Company5');
data.addColumn('number', 'Company6');
data.addRows([
['Feb 1, 2012 - Feb 28, 2012', 10, 10, 5, 15, 10, 55]
]);
data.addRows([
['Mar 1, 2012 - Mar 31, 2012', 10, 10, 5, 15, 10, 55]
]);
var options = {
title: 'Total Reviews',
hAxis: {title: '', titleTextStyle: {color: 'blue'}}
};
var chart = new google.visualization.ColumnChart(document.getElementById('total'));
chart.draw(data, options);
google.visualization.events.addListener(chart, 'select', function() {
var selection = chart.getSelection()[0];
var label = data.getColumnLabel(selection.column);
// alert(label); //SOMETHING GOES HERE TO MAKE IT ZOOOM
})
}
</script>
</head>
<body>
<div id="total" style="width: 600px; height: 400px;"></div>
</body>
</html>