JsVectorMap

~12kb gzipped (JS) + ~1kb CSS (+ ~30kb map data)

Stylized SVG country maps for data viz -- the fastest way to render a "sales by country" choropleth.


01

See It in Action

Each demo loads the world map data and styles it for the dark theme. Hover countries or markers to see tooltips, click for events.

A stylized world map with six office markers. Hover a marker to see the city name. The "Where we are" widget pattern, without real-world tile streaming.

Preview

02

What is JsVectorMap?

JsVectorMap is a JavaScript library that draws stylized SVG country and region maps in the browser. It does not stream real-world tiles -- it loads a static map data file (world, world-mercator, individual continents or countries) and renders the borders as customizable SVG shapes.

It is the modern, MIT-licensed successor to the abandoned jvectormap library, written from scratch with no jQuery dependency. The killer feature is its choropleth API: pass an object of countryCode -> value pairs and JsVectorMap colors each country on a gradient automatically -- the fastest way to render a "sales by country" or "users by region" dashboard widget.

🌍
Stylized SVG Country Shapes
Drop in a world, region, or country map and JsVectorMap draws clean SVG borders -- no satellite tiles, no streets, just the shapes. Perfect when geography is context, not the focus.
🎨
Choropleth Color Scales
Pass a flat object of country-code -> value pairs. The library colors regions on a gradient between two endpoints automatically -- the easiest way to render 'sales by country' or 'users by region'.
📍
Markers, Lines, Tooltips
Drop markers at lat/lng, draw connecting lines, customize tooltips on hover, and bind region/marker click handlers. All four states (initial, hover, selected, selectedHover) are stylable.

03

When to Use JsVectorMap

Use when
Sales-by-country or users-by-region dashboard widgets
Election results or polling visualizations
Service coverage maps for SaaS marketing pages
Stylized 'Where we operate' company pages without real-world tiles
Static infographic-style maps embedded in blog posts or reports
Avoid when
Anything that needs streets, satellite imagery, or real-world tiles -- use Leaflet or MapLibre
Sub-country detail (cities, neighborhoods, custom shapes) -- the map data files are country-level only
Live geolocation or routing -- tile-based libraries handle this natively

04

How JsVectorMap Compares

JsVectorMap vs Leaflet

Leaflet renders real-world maps from streamed tile providers -- streets, satellite, terrain. JsVectorMap renders stylized SVG country shapes from a static data file. Pick Leaflet when geography matters; pick JsVectorMap when you just need 'color these countries by value'.

JsVectorMap wins at
No tile provider needed (offline-friendly), instant load (no tile streaming), much smaller bundle when you do not need real-world detail, choropleth coloring built in
Leaflet wins at
Real streets and satellite imagery, zoom into city detail, mobile-grade pan + pinch, mature ecosystem of plugins
JsVectorMap vs D3.js (with TopoJSON)

D3 + TopoJSON is the maximally-flexible way to draw SVG choropleth maps -- you control every projection, every interpolation, every interaction. JsVectorMap is the batteries-included choice that gets you a working choropleth in 10 lines instead of 100.

JsVectorMap wins at
Drop-in choropleth with one config object, built-in tooltips and hover states, no projection math, no TopoJSON wrangling, much shorter learning curve
D3.js (with TopoJSON) wins at
Custom projections (Albers, Robinson, etc.), arbitrary GeoJSON shapes (not just countries), animation primitives, full control over rendering pipeline
JsVectorMap vs Highmaps (Highcharts Maps)

Highmaps is the polished commercial choice with deep features and professional support -- but it is paid for non-personal use. JsVectorMap is MIT-licensed and free forever. Pick Highmaps if you already pay for Highcharts; pick JsVectorMap for free projects.

JsVectorMap wins at
Free + open source MIT license, no licensing concerns for commercial sites, lightweight bundle, simpler API
Highmaps (Highcharts Maps) wins at
Polished defaults, deeper feature set (drilldown, time-series animation), commercial support, official Angular/React/Vue wrappers
JsVectorMap vs amCharts Maps

amCharts is feature-rich but requires a paid license to remove the watermark on commercial sites. JsVectorMap has no watermark and no license fees. Use amCharts for highly-customized data viz dashboards; use JsVectorMap when you need a clean choropleth without paying or branding constraints.

JsVectorMap wins at
No watermark, no commercial license fees, smaller bundle, simpler config object, MIT free-use forever
amCharts Maps wins at
Far richer chart types (treemaps, sankeys, force diagrams), animations, themes, professional commercial support

05

Get Started with JsVectorMap

Terminal
npm install jsvectormap
Terminal
yarn add jsvectormap
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/jsvectormap.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jsvectormap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/maps/world.js"></script>
Quick Start
<!-- In your <head> -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/jsvectormap.min.css">

<!-- In your <body> -->
<div id="map" style="height: 500px;"></div>

<!-- The library, then the map data file -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jsvectormap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/maps/world.js"></script>

<script>
  // Pass a CSS selector + a registered map name. That is the whole API.
  const map = new jsVectorMap({
    selector: "#map",
    map: "world",
    backgroundColor: "transparent",
    regionStyle: {
      initial: { fill: "#cbd5e1" },
      hover:   { fill: "#4ecdc4" }
    }
  });
</script>

06

Related Libraries