Visualization: Map

Overview

The Google Map Chart displays a map using the Google
Maps API. Data values are displayed as markers on the map. Data
values can be coordinates (lat-long pairs) or addresses. The map will
be scaled so that it includes all the identified points.

If you want your maps to be line drawings rather than satellite imagery, use a
geochart instead.

Named Locations

You can identify the places to put markers by name, as shown below
in this map of the top ten countries by population.

[This section requires a browser that supports JavaScript and iframes.]

When the user selects one of the markers, a tooltip with the name
and population of the country is displayed, because we used the
showInfoWindow option. Also, when the user hovers over one of the markers for
a short while, a 'title' tip will show up with the same info, because we used the
showTooltip option.
Here's the full HTML:

Adding Multiple Marker Sets

In addition to creating a default set of markers, you can also create multiple sets of
markers.

To create an additional marker set, add an ID to the icons option and set your
marker images. Then, add a column to your Data Table, and set the ID of the marker set you wish
to use for each row in the Data Table (you can also use 'default' or
null to use the default markers).

[This section requires a browser that supports JavaScript and iframes.]

Styling Maps

The Map Visualization comes with the ability to set custom styles, allowing you to create one,
or several, custom map types.

You can define a custom map type by creating a map style object and putting it under its
identifier (mapTypeId) under the maps option. For example:

var options = {
maps: {
<map style ID>: <map style object>
}
};

You can later refer to this custom map type by the map style ID you assigned to it.

Your map style object contains a name, which will be the display name in the
map type control (it does not have to match its mapTypeId), and a styles
array, which will contain style objects for each element you wish to style. The
Google Maps API reference
contains a list of the different element, feature, and style types with which you can create a
custom map type.

Note: Your custom mapTypeId must be placed under the
maps option.

[This section requires a browser that supports JavaScript and iframes.]

In addition to creating custom map types, you can also specify which maps the user can
view in the map type control with the mapTypeIds option. By default all map types,
including your custom map types, will appear in the map type control. The
mapTypeIds option accepts an array of strings of the map types you wish to allow the
user to view. These strings must refer to either the predefined names for the default map
styles (i.e. normal, satellite, terrain, hybrid), or the map style ID of a custom map type you
defined. By setting the mapTypeIds option, your map will only make available the map types
you specify in this array.

You can also use this in conjunction with the mapType option to set a map style as
the default, but not include it in the mapTypeIds array. This will cause that map to
only display on the initial load.

[This section requires a browser that supports JavaScript and iframes.]

Data Format

Two alternative data formats are supported:

Lat-Long pairs - The first two columns should be numbers designating
the latitude and longitude, respectively.
An optional third column holds a string that describes the location
specified in the first two columns.

String address - The first column should be a string that
contains an address. This address should be as complete as you can
make it. An optional second column holds a string that
describes the location in the first column. String addresses load more slowly, especially when you have more than 10 addresses.

Note: The Lat-Long pairs option loads maps much
faster, especially with large data. We recommend that you use this option for large
data sets. Please visit Google
Maps API to find out how to transform your addresses to lat-long points. The map can display a maximum of 400 entries;
if your data holds more than 400 rows, only the first 400
will be shown.

Configuration Options

Name

enableScrollWheel

If set to true, enables zooming in and out using the mouse scroll wheel.

Type: boolean

Default: false

icons

Holds set(s) of custom markers. Each marker set can specify a normal and
selected marker image. Can set a default set by setting the
default option, or custom marker sets by setting a unique marker ID.

An object containing properties of a custom map type. This custom map type will be
accessed by the mapTypeId you specify for the custom map type. A new
mapTypeId must be given for each custom map type created. Each custom map
type should contain two properties:

name: The display name for the styled map type

styles: An array containing the style objects for the styled map type

Type: object

Default: null

maps.<mapTypeId>.name

The name of the map that will be displayed in the map control if
useMapTypeControl is set to true.

Type: string

Default: null

maps.<mapTypeId>.styles

Holds the style objects for the various elements of a custom map type.

Each style object can contain 1 to 3 properties: featureType,
elementType, and stylers. If featureType and
elementType are omitted, the styles will be applied to all map
features/elements.

See the Maps
documentation for more information on the different features, elements, and stylers.

Type: array

Default: null

mapType

The type of map to show. Possible values are 'normal', 'terrain', 'satellite', 'hybrid', or
the ID of a custom map type, if any were created.

Type: string

Default: 'hybrid'

mapTypeIds

If using the map type control (useMapTypeControl: true), the IDs specified in
this array will be the only map types displayed in the map type control. If this option is
not set, the map type control will default to the standard Google Maps map type control
options plus any custom map types that may be available.

Type: array

Default: null

showInfoWindow

If set to true, shows the location description in a separate window when a
point marker is selected by the user. This option used to be called showTip
up until version 45. Also see showTooltip

If set to true, shows the location description as a tooltip when the mouse is positioned
above a point marker. This option used to be called showTip
up until version 45. Note that at this time, HTML is not supported, so
the tooltip would show raw HTML tags.

Type: boolean

Default: false

useMapTypeControl

Show a map type selector that enables the viewer to switch between [map, satellite, hybrid,
terrain]. When useMapTypeControl is false (default) no selector is presented and the type
is determined by the mapType option.

Type: boolean

Default: false

zoomLevel

An integer indicating the initial zoom level of the map, where 0 is completely zoomed out
(whole world) and 19 is the maximum zoom level.
(See "Zoom Levels" in the
Google Maps API.)

Type: number

Default: automatic

Methods

Method

draw(data, options)

Draws the map.

Return Type: none

getSelection()

Standard getSelection() implementation. Selection elements are all row elements.
Can return more than one selected row.