I'm searching for having zoom and pan buttons on a google chart.
Like Here. (Maybe there is no option to have it and i have to dev it myself)
I also wondering how they do to have dynamic Xmin and Xmax. Is this calculated in real time by the client ?
Asked
Active
Viewed 3,469 times
2
-
see the configuration option for `explorer` -- this option doesn't add any buttons but allows the user to zoom and pan... – WhiteHat Nov 30 '16 at 16:23
1 Answers
1
Here is one possiblity to zoom in a google chart. The zooming is done by clicking and dragging the mouse left or right. Panning ist not possible in this version (but you don't need a scroll wheel).
explorer: {
actions: ['dragToZoom', 'rightClickToReset'],
axis: 'horizontal',
keepInBounds: true,
maxZoomIn: 4.0
}
If you want to try it look here: https://jsfiddle.net/4w626v2s/2/
Another possiblity is the following. Here you need a mouse scroll wheel to zoom into the chart. After zooming you can click and drag to pan within the chart.
explorer: {
axis: 'horizontal',
keepInBounds: true,
maxZoomIn: 4.0
}
And here you can test it: https://jsfiddle.net/5h7jxqq8/2/
Look also here

Michael Hutter
- 1,064
- 13
- 33
-
Above both option are not working in android WebView.. please help me how to Zoom & Scroll Chart in android Webview.. @Michael – Fra Red Jan 23 '19 at 11:45
-
If the fiddle didn't work on your Android device it may depend on your browser. Try another browser. Basically it should not matter which operating System you have. – Michael Hutter Jan 23 '19 at 12:39
-
I don't think it is a browser issue.. because in Mobile browser there is no right click to reset Zoom or drag to zoom **eg:actions: ['dragToZoom', 'rightClickToReset']** – Fra Red Jan 23 '19 at 13:59
-
In a touch environment (e. g. mobile phone) a right click can be performed by touching a üoint on the display for more than 1 second ('long click'). That's how a reset should work. – Michael Hutter Jan 24 '19 at 05:21
-
-
I tried it on my mobile phone - it also does not work. May be there is no possibility to do this with google charts. Sorry. – Michael Hutter Jan 24 '19 at 09:52
-