Skip to content

Data-driven maps in JavaScript from FusionMaps (FusionCharts). Over 1,400+ maps of all countries, regions, counties etc.

Notifications You must be signed in to change notification settings

fusioncharts/fusionmaps-dist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FusionMaps 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.


Table of Contents

Installing FusionMaps

There are multiple ways to install FusionMaps. For general instructions, refer to this developer docs page.

Direct Download You can download zipped version here.

Using CDN Instead of downloading, you can also use FusionCharts’s CDN to access map definition files directly. See below for details

<script src="https://cdn.fusioncharts.com/fusioncharts/latest/maps/<MAP_ALIAS>.js"></script>

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

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

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 <div> container and chart instance, configure the data and render. Check this HTML snippet below:

<!doctype html>
<html>
<head>
    <script src="https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js"></script>
    <script src="https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.maps.js"></script>
    <script src="https://cdn.fusioncharts.com/fusioncharts/latest/maps/fusioncharts.world.js"></script>
    <script src="https://cdn.fusioncharts.com/fusioncharts/latest/themes/fusioncharts.theme.fusion.js"></script>
</head>
<body>
  <div id="chart-container"></div>
  <script>
        FusionCharts.ready(function () {
            // chart instance
            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",
                      "theme": "fusion"
                    },
                    "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();
        });
    </script>
</body>
</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:

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.

import FusionCharts from 'fusioncharts/core';
import Maps from 'fusioncharts/maps';

// include map definition file from maps/es folder - import mapName from fusionmaps/maps/es/<MAP_ALIAS>
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

Front-end Integrations to help you easily integrate FusionCharts Suite in your projects/apps

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

Back-end Integrations to help you easily integrate FusionCharts Suite in your projects/apps

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](mailto: support@fusioncharts.com)

Folder Structure

fusionmaps/
└── maps/
    ├── es
    │   ├── fusioncharts.world.js
    │   ├── fusioncharts.usa.js
    │   ├── ...
    │   └── fusioncharts.<MAP_ALIAS>.js
    ├── fusioncharts.world.js
    ├── fusioncharts.usa.js
    ├── ...
    └── fusioncharts.<MAP_ALIAS>.js