Maps

Maps

Methods thats work directly with our maps. ZingChart maps have their own custom methods. Use the maps property in the following format to access them.

zingcharts.maps.methodName(); Copy

getInfo()

This method returns information about the map.

zingchart.maps.getInfo('mapName'); Copy

It accepts the following parameters:

ParameterTypeDescription
mapNameStringThe name of the map.

getItems()

https://app.zingsoft.com/demos/embed/23Z0KCOR
https://app.zingsoft.com/demos/embed/23Z0KCOR

This method returns a list of the map items.

zingchart.maps.getItems('mapName'); Copy

It accepts the following parameters:

ParameterTypeDescription
mapNameStringThe name of the map.

getItemInfo()

This method returns information about the specified map item.

zingchart.maps.getItemInfo('mapName', 'itemName'); Copy
https://app.zingsoft.com/demos/embed/TYS5TI8R
https://app.zingsoft.com/demos/embed/TYS5TI8R

It accepts the following parameters:

ParameterTypeDescription
mapNameStringThe name of the map.
itemNameStringThe name of the map item.

getLonLat()

This method returns the corresponding longitude and latitude coordinates of the specified x and y positions.

zingchart.maps.getLonLat('mapName', [x, y]); Copy
https://app.zingsoft.com/demos/embed/8KPKU1WE
https://app.zingsoft.com/demos/embed/8KPKU1WE

It accepts the following parameters:

ParameterTypeDescription
mapNameStringThe name of the map.
[...]StringAn array that accepts two number values: the x and y positions, respectively.

getXY()

This method returns the corresponding x and y positions of the specified longitude and latitude coordinates.

zingchart.maps.getXY('mapName', [lon, lat]); Copy
https://app.zingsoft.com/demos/embed/YFGNSDI1
https://app.zingsoft.com/demos/embed/YFGNSDI1

It accepts the following parameters:

ParameterTypeDescription
mapNameStringThe name of the map.
[...]StringAn array that accepts two number values: the longitude and latitude coordinates, respectively.

loadGeoJSON()

This method allows you to create maps from outside GeoJSON files.

Note: It also requires you to explicitly load the module: maps-geojson

zingchart.maps.loadGeoJSON({...}); Copy

It accepts an object with the following properties:

PropertyTypeDescription
idStringThe name of the custom map..
urlStringThe map file source.
mappingsObjectAllows you to map property names from the GeoJSON file to ZingChart.
stylingObjectAllows you to style the map.
callbackFunctionRepresents the function that renders the map.

viewAll()

This method allows you to view the entire map.

zingchart.maps.viewAll('mapName'); Copy
https://app.zingsoft.com/demos/embed/MPSAH2S0
https://app.zingsoft.com/demos/embed/MPSAH2S0

It accepts the following parameters:

ParameterTypeDescription
mapNameStringThe name of the map.

zoomIn()

This method allows you to zoom in on the map.

zingchart.maps.zoomIn('mapName'); Copy
https://app.zingsoft.com/demos/embed/R7NIM6GE
https://app.zingsoft.com/demos/embed/R7NIM6GE

It accepts the following parameters:

ParameterTypeDescription
mapNameStringThe name of the map.

zoomOut()

This method allows you to zoom out on the map.

zingchart.maps.zoomOut('mapName'); Copy
https://app.zingsoft.com/demos/embed/7PQIYRZY
https://app.zingsoft.com/demos/embed/7PQIYRZY

It accepts the following parameters:

ParameterTypeDescription
mapNameStringThe name of the map.

zoomTo()

This method allows you to zoom to a specified area on the map.

zingchart.maps.zoomTo('mapName', {...}); Copy
https://app.zingsoft.com/demos/embed/8ANK05LL
https://app.zingsoft.com/demos/embed/8ANK05LL

It accepts the following parameters:

ParameterTypeDescription
mapNameStringThe name of the map.
{...}Object

An object that accepts the following properties:

  • zoom
  • offsetX
  • offsetY

zoomToItem()

This method allows you to zoom to a specified item on the map.

zingchart.maps.zoomToItem('mapName', 'itemName'); Copy
https://app.zingsoft.com/demos/embed/DBDLBZ01
https://app.zingsoft.com/demos/embed/DBDLBZ01

It accepts the following parameters:

ParameterTypeDescription
mapNameStringThe name of the map.
itemNameStringThe name of the map item.
On This Page