Geographic charts · offline

World Map points and choropleth

Show measured values at geographic locations and color country areas on an offline world map. The map is bundled with the package, so drawing it requires no online tile service. Zoom, pan, tooltips, clicks and trace legends work in the browser.

Live example

Explore points and countries

Wheel to zoom, drag to pan, and hover or click a marker or country area to inspect its value. Reset restores the full world.

Loading the map…

Click a marker or country area to inspect it.

JavaScript and TypeScript

Create a World Map

Install fastplotjs, add a Canvas to the page, then use type: "map". engine: "ts" selects the supported scene path explicitly.

import { createChart } from "fastplotjs";

const chart = createChart(document.getElementById("map"), {
  type: "map",
  engine: "ts",
  responsive: true,
  traces: [{
    name: "Observations",
    data: [
      { longitude: -74.006, latitude: 40.7128, value: 42, label: "New York" },
      { longitude: 2.3522, latitude: 48.8566, value: 68, label: "Paris" },
      { longitude: 139.6917, latitude: 35.6895, value: 91, label: "Tokyo" },
    ],
  }],
  map: { markerSize: 6, colorScaleLegend: { position: "right", title: "Value" } },
  legend: true,
  interactions: { zoom: { wheel: true }, pan: true, dragMode: "pan", tooltip: true, pointClick: true },
});

// Call chart.resetZoom() to restore the complete world.
// Call chart.destroy() when the Canvas is removed.
Country areas

Country choropleth: color countries by value

Use bundled Natural Earth ADM0_A3 identifiers, such as FRA and USA; these are not ISO codes. Unknown or duplicate IDs fail. Unvalued countries remain neutral. Point markers can overlay colored regions, and both use the same color scale.

map: { regions: [{ id: "FRA", value: 68 }, { id: "USA", value: 44 }] },
interactions: { tooltip: true, pointClick: true },
onRegionClick(event) { console.log(event.id, event.name, event.value); }

For static output, use renderMapToSVG or renderMapToPNG in Node or Python. The static Map document is separate from browser chart options.

Input contract

Locations, color and viewport

Each point needs finite longitude from −180 to 180, latitude from −90 to 90, and a numeric value. label is optional. Marker colors use a continuous value scale; the trace color outlines markers and identifies them in the trace legend. map.colorScale accepts value-scale bounds and colors, while map.colorScaleLegend controls the optional scale legend.

The map uses an equirectangular projection. The viewport is bounded by world coordinates, including when zooming or panning. Empty data still draws the land basemap. See all map options.

Current scope

Limits

The basemap contains Natural Earth 1:110m land polygons. Country areas come from the bundled Natural Earth Admin-0 layer; small geographic features, geocoding and online tiles are not included. The map occupies one panel and does not accept Cartesian axes, subplots or Cartesian references. engine: "rust" is unsupported for map scenes. Static Map SVG and PNG export requires a supported native Node addon or Python native library.

The same geographic point-value capability is available in the FastPlotPy alpha; use its Python package for Python-specific examples and platform details.