Map

new Map

Creates map, draws paths, binds events.
Parameters:
Name Type Description
params Object Parameters to initialize map with.
Properties
Name Type Description
map String Name of the map in the format territory_proj_lang where territory is a unique code or name of the territory which the map represents (ISO 3166 standard is used where possible), proj is a name of projection used to generate representation of the map on the plane (projections are named according to the conventions of proj4 utility) and lang is a code of the language, used for the names of regions.
backgroundColor String Background color of the map in CSS format.
zoomOnScroll Boolean When set to true map could be zoomed using mouse scroll. Default value is true.
zoomOnScrollSpeed Number Mouse scroll speed. Number from 1 to 10. Default value is 3.
panOnDrag Boolean When set to true, the map pans when being dragged. Default value is true.
zoomMax Number Indicates the maximum zoom ratio which could be reached zooming the map. Default value is 8.
zoomMin Number Indicates the minimum zoom ratio which could be reached zooming the map. Default value is 1.
zoomStep Number Indicates the multiplier used to zoom map with +/- buttons. Default value is 1.6.
zoomAnimate Boolean Indicates whether or not to animate changing of map zoom with zoom buttons.
regionsSelectable Boolean When set to true regions of the map could be selected. Default value is false.
regionsSelectableOne Boolean Allow only one region to be selected at the moment. Default value is false.
markersSelectable Boolean When set to true markers on the map could be selected. Default value is false.
markersSelectableOne Boolean Allow only one marker to be selected at the moment. Default value is false.
regionStyle Object Set the styles for the map's regions. Each region or marker has four states: initial (default state), hover (when the mouse cursor is over the region or marker), selected (when region or marker is selected), selectedHover (when the mouse cursor is over the region or marker and it's selected simultaneously). Styles could be set for each of this states. Default value for that parameter is:
{
  initial: {
    fill: 'white',
    "fill-opacity": 1,
    stroke: 'none',
    "stroke-width": 0,
    "stroke-opacity": 1
  },
  hover: {
    "fill-opacity": 0.8,
    cursor: 'pointer'
  },
  selected: {
    fill: 'yellow'
  },
  selectedHover: {
  }
}
regionLabelStyle Object Set the styles for the regions' labels. Each region or marker has four states: initial (default state), hover (when the mouse cursor is over the region or marker), selected (when region or marker is selected), selectedHover (when the mouse cursor is over the region or marker and it's selected simultaneously). Styles could be set for each of this states. Default value for that parameter is:
{
  initial: {
    'font-family': 'Verdana',
    'font-size': '12',
    'font-weight': 'bold',
    cursor: 'default',
    fill: 'black'
  },
  hover: {
    cursor: 'pointer'
  }
}
markerStyle Object Set the styles for the map's markers. Any parameter suitable for regionStyle could be used as well as numeric parameter r to set the marker's radius. Default value for that parameter is:
{
  initial: {
    fill: 'grey',
    stroke: '#505050',
    "fill-opacity": 1,
    "stroke-width": 1,
    "stroke-opacity": 1,
    r: 5
  },
  hover: {
    stroke: 'black',
    "stroke-width": 2,
    cursor: 'pointer'
  },
  selected: {
    fill: 'blue'
  },
  selectedHover: {
  }
}
You can also use image style attribute for markers. By default marker images are centered with the target point on map. To supply a custom offset please use the following format:
{
  url: 'image/url',
  offset: [-10, 5]
}
markerLabelStyle Object Set the styles for the markers' labels. Default value for that parameter is:
{
  initial: {
    'font-family': 'Verdana',
    'font-size': '12',
    'font-weight': 'bold',
    cursor: 'default',
    fill: 'black'
  },
  hover: {
    cursor: 'pointer'
  }
}
markers Object | Array Set of markers to add to the map during initialization. In case of array is provided, codes of markers will be set as string representations of array indexes. Each marker is represented by latLng (array of two numeric values), name (string which will be show on marker's tip) and any marker styles.
series Object Object with two keys: markers and regions. Each of which is an array of series configs to be applied to the respective map elements. See DataSeries description for a list of parameters available.
focusOn Object | String This parameter sets the initial position and scale of the map viewport. See setFocus docuemntation for possible parameters.
labels Object Defines parameters for rendering static labels. Object could contain two keys: regions and markers. Each key value defines configuration object with the following possible options:
  • render {Function} - defines method for converting region code or marker index to actual label value.
  • offsets {Object|Function} - provides method or object which could be used to define label offset by region code or marker index.
Plase note: static labels feature is not supported in Internet Explorer 8 and below.
selectedRegions Array | Object | String Set initially selected regions.
selectedMarkers Array | Object | String Set initially selected markers.
onRegionTipShow Function (Event e, Object tip, String code) Will be called right before the region tip is going to be shown.
onRegionOver Function (Event e, String code) Will be called on region mouse over event.
onRegionOut Function (Event e, String code) Will be called on region mouse out event.
onRegionClick Function (Event e, String code) Will be called on region click event.
onRegionSelected Function (Event e, String code, Boolean isSelected, Array selectedRegions) Will be called when region is (de)selected. isSelected parameter of the callback indicates whether region is selected or not. selectedRegions contains codes of all currently selected regions.
onMarkerTipShow Function (Event e, Object tip, String code) Will be called right before the marker tip is going to be shown.
onMarkerOver Function (Event e, String code) Will be called on marker mouse over event.
onMarkerOut Function (Event e, String code) Will be called on marker mouse out event.
onMarkerClick Function (Event e, String code) Will be called on marker click event.
onMarkerSelected Function (Event e, String code, Boolean isSelected, Array selectedMarkers) Will be called when marker is (de)selected. isSelected parameter of the callback indicates whether marker is selected or not. selectedMarkers contains codes of all currently selected markers.
onViewportChange Function (Event e, Number scale) Triggered when the map's viewport is changed (map was panned or zoomed).

Methods

addMarker

Add one marker to the map.
Parameters:
Name Type Description
key String Marker unique code.
marker Object Marker configuration parameters.
seriesData Array Values to add to the data series.

addMarkers

Add set of marker to the map.
Parameters:
Name Type Description
markers Object | Array Markers to add to the map. In case of array is provided, codes of markers will be set as string representations of array indexes.
seriesData Array Values to add to the data series.

clearSelectedMarkers

Remove the selected state from all the currently selected markers.

clearSelectedRegions

Remove the selected state from all the currently selected regions.

getMapObject

Return the instance of Map. Useful when instantiated as a jQuery plug-in.
Returns:
Type
Map

getRegionName

Return the name of the region by region code.
Returns:
Type
String

getSelectedMarkers

Return the codes of currently selected markers.
Returns:
Type
Array

getSelectedRegions

Return the codes of currently selected regions.
Returns:
Type
Array

latLngToPoint

Converts coordinates expressed as latitude and longitude to the coordinates in pixels on the map.
Parameters:
Name Type Description
lat Number Latitide of point in degrees.
lng Number Longitude of point in degrees.

pointToLatLng

Converts cartesian coordinates into coordinates expressed as latitude and longitude.
Parameters:
Name Type Description
x Number X-axis of point on map in pixels.
y Number Y-axis of point on map in pixels.

remove

Gracefully remove the map and and all its accessories, unbind event handlers.

removeAllMarkers

Remove all markers from the map.

removeMarkers

Remove some markers from the map.
Parameters:
Name Type Description
markers Array Array of marker codes to be removed.

reset

Reset all the series and show the map with the initial zoom.

setBackgroundColor

Set background color of the map.
Parameters:
Name Type Description
backgroundColor String Background color in CSS format.

setFocus

Set the map's viewport to the specific point and set zoom of the map to the specific level. Point and zoom level could be defined in two ways: using the code of some region to focus on or a central point and zoom level as numbers.
Parameters:
Name Type Description
This method takes a configuration object as the single argument. The options passed to it are the following:
params.regions Array Array of region codes to zoom to.
params.region String Region code to zoom to.
params.scale Number Map scale to set.
params.lat Number Latitude to set viewport to.
params.lng Number Longitude to set viewport to.
params.x Number Number from 0 to 1 specifying the horizontal coordinate of the central point of the viewport.
params.y Number Number from 0 to 1 specifying the vertical coordinate of the central point of the viewport.
params.animate Boolean Indicates whether or not to animate the scale change and transition.

setSelectedMarkers

Set or remove selected state for the markers.
Parameters:
Name Type Description
keys String | Array | Object If String or Array the marker(s) with the corresponding code(s) will be selected. If Object was provided its keys are codes of markers, state of which should be changed. Selected state will be set if value is true, removed otherwise.

setSelectedRegions

Set or remove selected state for the regions.
Parameters:
Name Type Description
keys String | Array | Object If String or Array the region(s) with the corresponding code(s) will be selected. If Object was provided its keys are codes of regions, state of which should be changed. Selected state will be set if value is true, removed otherwise.

updateSize

Synchronize the size of the map with the size of the container. Suitable in situations where the size of the container is changed programmatically or container is shown after it became visible.