Data-driven maps in JavaScript from FusionMaps (FusionCharts). Over 2,000+ maps of all countries, regions, counties etc.
npm install fusionmapsFusionMaps is a companion package meant to be used in conjunction with FusionCharts to render data-driven maps (over 2,000+ maps for different continents, countries, states & regions). This package contains choropleth maps that can render on both desktop & mobile, with extended functionality like city or location markers, annotations, events etc.
This package contains definition files for all the maps. Map definition files are the path files required by FusionMaps to plot a map for a particular region. Each map has its own path file.
_By default, FusionCharts package only includes definition files for two maps - the World map and the USA map._
- Official Website: https://www.fusioncharts.com/
- FusionCharts NPM: https://www.npmjs.com/package/fusioncharts
- Documentation: https://www.fusioncharts.com/dev/
- Map Specification Sheets: https://www.fusioncharts.com/dev/maps/spec-sheets/
- Support: https://www.fusioncharts.com/contact-support
- Issues: https://github.com/fusioncharts/fusionmaps-dist
---
html
`
MAP_ALIAS is the name of the map that you're plotting, used by FusionMaps. For each map, FusionMaps has a different JavaScript alias. e.g., World Map is world etc.
Install from NPM
`bash
npm install --save fusionmaps
`
You will also need FusionCharts package installed on your system to use maps. You can install the same using below command
`bash
npm install --save fusioncharts
`
See npm documentation to know more about npm usage.
Getting Started
Easiest way to render map is to include the FusionCharts JavaScript library files and map definition file in your webpage, create container and chart instance, configure the data and render. Check this HTML snippet below:
`html
`
As you can see in above example, each continent is referenced using an ID. Each map in FusionMaps has its own regions, each of which have its own ID and name. These are present in specification sheets for the map. You can find specification sheets for all maps here.
Learn more through resources below:
- Documentation
- Examples
- Marker Data
- API Events & Methods
Using FusionMaps as an ES Module
FusionMaps can be loaded as an ES module via transpilers.
The following examples presumes you are using npm to install FusionCharts and FusionMaps, see Installing FusionMaps for more details.
`javascript
import FusionCharts from 'fusioncharts/core';
import Maps from 'fusioncharts/maps';
// include map definition file from maps/es folder - import mapName from fusionmaps/maps/es/
import World from fusionmaps/maps/es/world
// add chart as dependency - FusionCharts.addDep(ChartType);
FusionCharts.addDep(Maps);
FusionCharts.addDep(World);
// instantiate the chart.
var chart = new FusionCharts({
type: "world",
renderAt: "chart-container", // container where chart will render
width: "600",
height: "400",
dataFormat: "json",
dataSource: {
"chart": {
"caption": "Average Annual Population Growth",
"subcaption": " 1955-2015",
"numbersuffix": "%",
"includevalueinlabels": "1",
"labelsepchar": ": ",
"entityFillHoverColor": "#FFF9C4"
},
"data": [
{ "id": "NA", "value": ".82", "showLabel": "1" },
{ "id": "SA", "value": "2.04", "showLabel": "1" },
{ "id": "AS", "value": "1.78", "showLabel": "1" },
{ "id": "EU", "value": ".40", "showLabel": "1" },
{ "id": "AF", "value": "2.58", "showLabel": "1" },
{ "id": "AU", "value": "1.30", "showLabel": "1" }
]
}
});
// render the chart
chart.render();
`
Related Packages
$3
| | | |
|:----------------|:---------------|:---------|
|AngularJS (1.x and above)|Github Repo|Documentation|
|Angular (2.x and above)|Github Repo|Documentation|
|jQuery|Github Repo|Documentation|
|React|Github Repo|Documentation|
|Vue.js|Github Repo|Documentation|
$3
| | | |
|:----------------|:---------------|:---------|
|ASP.NET (C#)|Github Repo|Documentation|
|ASP.NET (VB)|Github Repo|Documentation|
|Java (JSP)|Github Repo|Documentation|
|Django|Github Repo|Documentation|
|PHP|Github Repo|Documentation|
|Ruby on Rails|Github Repo|Documentation|
Contact Support
Fill this form or drop an email to support@fusioncharts.com
Folder Structure
`
fusionmaps/
└── maps/
├── es
│ ├── fusioncharts.world.js
│ ├── fusioncharts.usa.js
│ ├── ...
│ └── fusioncharts..js
├── fusioncharts.world.js
├── fusioncharts.usa.js
├── ...
└── fusioncharts..js
``