Re: Geochart - Zoom in option

1,881 views
Skip to first unread message

asgallant

unread,
Oct 10, 2012, 3:53:28 PM10/10/12
to google-visua...@googlegroups.com
Geocharts are built in SVG (or VML in IE < 9), so you don't need to know any HTML5 to use them.  The API doesn't support zooming the charts, though.  You can change the region drawn (based on visualization "select" events if you like) to "zoom" in or out, but you can't arbitrarily zoom any given map. 

On Wednesday, October 10, 2012 2:19:52 PM UTC-4, Vandy wrote:
Hi ,

Do you have any options in Geochart for Zoom in ?

I am very new to html5 so I don't know how to implement the methods (like action listeners).

Thank You!

Tim Plummer

unread,
Jun 6, 2014, 1:26:43 PM6/6/14
to google-visua...@googlegroups.com
Do you have any reference on how to accomplish this?  

Andrew Gallant

unread,
Jun 6, 2014, 4:38:24 PM6/6/14
to google-visua...@googlegroups.com
You can create a "select" event handler to zoom by doing something like this:

google.visualization.events.addListener(chart, 'select', function () {
    var selection = chart.getSelection();
    if (selection.length) {
        var region = data.getValue(selection[0].row, 0);
        // figure out the region code and resolution from your selected region
        options.resolution = /* resolution to draw at */;
        options.region = /* region to draw */;
        chart.draw(data, options);
    }
});

Tim Plummer

unread,
Jun 6, 2014, 5:06:52 PM6/6/14
to google-visua...@googlegroups.com
So then would you have to program in a "zoom-out" parameter to the selected item to take you back to the region you were just in?

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/mWV3OcHlHVk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Andrew Gallant

unread,
Jun 6, 2014, 5:14:25 PM6/6/14
to google-visua...@googlegroups.com
Likely you would want a zoom out button somewhere; I don't think any chart elements are well-suited to a zoom out function.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages