I have used the rangechange event like you suggested. Here is the
code:
google.visualization.events.addListener(chart, 'rangechange',
function(event) {
var range = chart.getVisibleChartRange();
var start = range['start'];
var end = range['end'];
var rangeDiff = end - start;
if( rangeDiff > 3600000 ) {
data1.setColumns([0,4,5,6]);
} else {
data1.setColumns([0,1,2,3]);
}
chart.draw(data1,{'zoomStartTime' : start,
'zoomEndTime' : end});
});
Let me give the scenario which has the problem. If I clicked on '1h' ,
data1 now has columns set as [0,1,2,3] which is the minutes data. And
now, if I click on 'Max', within the minutes data, it zooms out to the
maximum and the chart displays lots of data points. What I am
expecting is that it fires the 'rangechange' event and picks up the
hourly data and displays less number of data points.
The reason I am switching between mins vs hourly data is to achieve
something similar to google finance's behavior of changing the volume
from '2min' to '30min', '1d', etc depending on the zoom range
selected(1d, 1m, 3m)..If you know a better way to achieve this
behavior I would appreciate it.
Thanks.