MapChart

image not found

Contents:

Attention: For using the XdevGeoChart or XdevMapChart a Google API-Key is required. This API key can be here can be requested.

Optimal data structure (database):

Lat

Long

Labeling

37.4232

-122.0853

"Work"

37.4289

-122.1697

"University"

37.6153

-122.3900

"Airport"

…​

or

Address

Label

"Musterweg 16 92225 Musterndorf"

"Work"

Optimal object structure (Java)

public class MapChartObject {
    private Double longitude;
    private Double latitude;
    private String name;

    public Double getLongitude() {
        return longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    public Double getLatitude() {
        return latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

Example: Filling the data

//Beim Instanziieren muss das DataMapFormat definiert werden
//DataMapFormat.Latitude --> Definition der Orte über "Long" and "Lat"
//DataMapFormat.Address --> Definition der Orte die Adresse z.B. "Mustersweg 16 92224 Musterndorf"
final ChartModel model = ChartModel.New()
    .addColumn(Column.New(Column.Type.NUMBER, "longitude"))
    .addColumn(Column.New(Column.Type.NUMBER, "latitude"))
    .addColumn(Column.New(Column.Type.STRING, "Beschriftung"));

model.addRow(37.4232, -122.0853, "Work");
model.addRow(37.4289, -122.1697, "University");
model.addRow(37.6153, -122.3900, "Airport");
model.addRow(37.4422, -122.1731, "Shopping");

mapChart.setModel(model);

API and methods:

Properties

API Key

Some charts require an API key from Google. You can get a key here: https://developers.google.com/maps/documentation/javascript/get-api-key

mapsChart.setMapsApiKey("123456789wertzuiopü");

MapType

The type of map to display. Possible values are "normal", "terrain", "satellite", "hybrid" or the ID of a custom map type if one has been created.

mapsChart.setMapType("normal");

ShowInfoWindow

If this option is set to true, the location description is displayed in a separate window when the user selects a point marker.

mapsChart.setShowInfoWindow(true);

ShowLine

If this option is set to true, a Google Maps polyline displayed through all points.

mapsChart.setShowLine(true);

ShowTooltip

If this option is set to true, the location description is displayed as a tooltip when the mouse is over a point marker. Until version 45, this option was called showTip. Note that at this time HTML is not supported, so the tooltip would display raw HTML tags.

mapsChart.setShowTooltip(true);

UseMapTypeControl

Displays a map type selector that allows the viewer to switch between [map, satellite, hybrid, terrain]. If useMapTypeControl is set to false (default), no selector is displayed and the type is determined by the mapType option.

mapsChart.setUseMapTypeControl(true);

ZoomLevel

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

mapsChart.setZoomLevel(8);

EnableScrollWheel

When this option is set to true, zooming in and out using the mouse wheel is enabled.

mapsChart.setEnableScrollWheel(true);