Map

Place data on a map to reveal geographic patterns.

Map

The smallest runnable chart

Explore the chart and its data table. Open the code below to use this example.

Basic example

Loading

Control help

Zoom and pan inspect the rendered surface without changing data axes or values. When playback controls are available, they move through real steps in the order each unique value first appears in the source data.

Use Tab to reach a control and Enter or Space to activate it. With the chart focused, use plus and minus to zoom and arrow keys to pan.

Auto placement compares perimeter candidates and avoids the plot, legend, and other callouts when possible. Explicit placement is preserved with only necessary safety correction. Callout text wraps safely inside the bubble. Long unbroken tokens are visually shortened within the line budget, while the complete source text remains available to assistive technology.

Loading

View code and settings

Browser API

Graflume.map()

const data = [
  {
    "latitude": 37.57,
    "latitude2": 35.68,
    "longitude": 126.98,
    "longitude2": 139.69,
    "name": "Seoul",
    "value": 92
  },
  {
    "latitude": 35.68,
    "latitude2": 1.35,
    "longitude": 139.69,
    "longitude2": 103.82,
    "name": "Tokyo",
    "value": 78
  },
  {
    "latitude": 1.35,
    "latitude2": 28.61,
    "longitude": 103.82,
    "longitude2": 77.21,
    "name": "Singapore",
    "value": 64
  },
  {
    "latitude": 28.61,
    "latitude2": 48.86,
    "longitude": 77.21,
    "longitude2": 2.35,
    "name": "Delhi",
    "value": 58
  },
  {
    "latitude": 48.86,
    "latitude2": 40.71,
    "longitude": 2.35,
    "longitude2": -74,
    "name": "Paris",
    "value": 73
  },
  {
    "latitude": 40.71,
    "latitude2": 37.77,
    "longitude": -74,
    "longitude2": -122.42,
    "name": "New York",
    "value": 88
  },
  {
    "latitude": 37.77,
    "latitude2": 19.43,
    "longitude": -122.42,
    "longitude2": -99.13,
    "name": "San Francisco",
    "value": 69
  },
  {
    "latitude": -33.87,
    "latitude2": 37.57,
    "longitude": 151.21,
    "longitude2": 126.98,
    "name": "Sydney",
    "value": 51
  }
];

const options = {
  "axes": {
    "x": false,
    "y": false
  },
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "size": "value"
    }
  },
  "width": "container",
  "x": {
    "field": "longitude",
    "title": "Longitude",
    "type": "quantitative"
  },
  "y": {
    "field": "latitude",
    "title": "Latitude",
    "type": "quantitative"
  }
};

Graflume.map('#chart', data, options);

Portable schema

ChartSpec 0.1 · options

{
  "axes": {
    "x": false,
    "y": false
  },
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "size": "value"
    }
  },
  "width": "container",
  "x": {
    "field": "longitude",
    "title": "Longitude",
    "type": "quantitative"
  },
  "y": {
    "field": "latitude",
    "title": "Latitude",
    "type": "quantitative"
  }
}
Quick API
map()
Browser snapshot
graflume
mark
map
Presets
9
  • minimal-implementation

Common features

Features shared by every chart

Use the tabs to compare header, tooltip, theme, legend, highlight, callout, selection, view controls, and accessibility one feature at a time. Hover over a data mark. On supported charts, move the pointer along the axis to see the nearest value. All exact values are available in the table below.

Header

Add a chart title and supporting description inside the visualization.

Loading

Control help

Zoom and pan inspect the rendered surface without changing data axes or values. When playback controls are available, they move through real steps in the order each unique value first appears in the source data.

Use Tab to reach a control and Enter or Space to activate it. With the chart focused, use plus and minus to zoom and arrow keys to pan.

Auto placement compares perimeter candidates and avoids the plot, legend, and other callouts when possible. Explicit placement is preserved with only necessary safety correction. Callout text wraps safely inside the bubble. Long unbroken tokens are visually shortened within the line budget, while the complete source text remains available to assistive technology.

Loading

View code and settings

Browser API

Graflume.map()

const data = [
  {
    "latitude": 37.57,
    "latitude2": 35.68,
    "longitude": 126.98,
    "longitude2": 139.69,
    "name": "Seoul",
    "value": 92
  },
  {
    "latitude": 35.68,
    "latitude2": 1.35,
    "longitude": 139.69,
    "longitude2": 103.82,
    "name": "Tokyo",
    "value": 78
  },
  {
    "latitude": 1.35,
    "latitude2": 28.61,
    "longitude": 103.82,
    "longitude2": 77.21,
    "name": "Singapore",
    "value": 64
  },
  {
    "latitude": 28.61,
    "latitude2": 48.86,
    "longitude": 77.21,
    "longitude2": 2.35,
    "name": "Delhi",
    "value": 58
  },
  {
    "latitude": 48.86,
    "latitude2": 40.71,
    "longitude": 2.35,
    "longitude2": -74,
    "name": "Paris",
    "value": 73
  },
  {
    "latitude": 40.71,
    "latitude2": 37.77,
    "longitude": -74,
    "longitude2": -122.42,
    "name": "New York",
    "value": 88
  },
  {
    "latitude": 37.77,
    "latitude2": 19.43,
    "longitude": -122.42,
    "longitude2": -99.13,
    "name": "San Francisco",
    "value": 69
  },
  {
    "latitude": -33.87,
    "latitude2": 37.57,
    "longitude": 151.21,
    "longitude2": 126.98,
    "name": "Sydney",
    "value": 51
  }
];

const options = {
  "axes": {
    "x": false,
    "y": false
  },
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "size": "value"
    }
  },
  "title": {
    "subtitle": "Map uses runnable data and options to demonstrate point/region/choropleth/route/heat halo; flat geodesics.",
    "text": "Map"
  },
  "width": "container",
  "x": {
    "field": "longitude",
    "title": "Longitude",
    "type": "quantitative"
  },
  "y": {
    "field": "latitude",
    "title": "Latitude",
    "type": "quantitative"
  }
};

Graflume.map('#chart', data, options);

Portable schema

ChartSpec 0.1 · options

{
  "axes": {
    "x": false,
    "y": false
  },
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "size": "value"
    }
  },
  "title": {
    "subtitle": "Map uses runnable data and options to demonstrate point/region/choropleth/route/heat halo; flat geodesics.",
    "text": "Map"
  },
  "width": "container",
  "x": {
    "field": "longitude",
    "title": "Longitude",
    "type": "quantitative"
  },
  "y": {
    "field": "latitude",
    "title": "Latitude",
    "type": "quantitative"
  }
}
  • header