Map chart
Compares one geographic measure worldwide using proportional circles for amounts or sequential shading for rates.
import { MapChart } from '@uthereal/ui/map-chart'Map chart playground
Arrow keys explore records. Home and End reach the first and last record. PageUp and PageDown jump. Escape clears the selection.
| Location | Orders | Country code |
|---|---|---|
| United States of America | 4,200 | USA |
| Brazil | 1,800 | BRA |
| Germany | 2,900 | DEU |
| India | 3,600 | IND |
| Australia | 1,200 | AUS |
Overview
MapChart displays how a single geographic measure varies worldwide on a fixed Equal Earth projection with bundled country geometry. It requires no map tiles, API keys, runtime network requests, pan/zoom controls, or geocoding.
locations: circle area encodes a nonnegative amount at WGS84 longitude and latitude coordinates.country-totals: circle area encodes an absolute total at each country's label point without population normalization.country-rates: seven sequential color steps encode a host-normalized rate, percentage, density, or average across one shared unit and reporting period. Never shade raw counts to imply incidence.
Use a bar chart for exact rankings. Use a dedicated mapping library for street detail, navigation, or thousands of overlapping points.
Usage
import { MapChart } from '@uthereal/ui/map-chart'
export function ConversionMap() {
return (
<MapChart
title="Conversion by country"
description="Illustrative rates for one reporting period"
valueLabel="Conversion"
valueFormat={{ style: 'percent', maximumFractionDigits: 1 }}
max={0.1}
tableToggle
data={{
type: 'country-rates',
countries: [
{ country: 'USA', value: 0.045 },
{ country: 'DEU', value: 0.062 },
{ country: 'BRA', value: null },
],
}}
/>
)
}Replace the entire data object when changing data.type. Normalize rates in the host before passing them to country-rates, and omit unit when valueFormat already includes a unit or percent symbol.
Examples
Data modes
The playground above shows proportional circles (country-totals). The examples below compare sequential regional shading (country-rates) and coordinate bubbles (locations). Both examples use illustrative data.
Arrow keys explore records. Home and End reach the first and last record. PageUp and PageDown jump. Escape clears the selection.
| Location | Conversion | Country code |
|---|---|---|
| United States of America | 4.5% | USA |
| Brazil | 2.6% | BRA |
| Germany | 6.2% | DEU |
| India | 0% | IND |
| Australia | No data | AUS |
| Afghanistan | No data | AFG |
| Angola | No data | AGO |
| Albania | No data | ALB |
| United Arab Emirates | No data | ARE |
| Argentina | No data | ARG |
| Armenia | No data | ARM |
| Antarctica | No data | ATA |
| French Southern and Antarctic Lands | No data | ATF |
| Austria | No data | AUT |
| Azerbaijan | No data | AZE |
| Burundi | No data | BDI |
| Belgium | No data | BEL |
| Benin | No data | BEN |
| Burkina Faso | No data | BFA |
| Bangladesh | No data | BGD |
| Bulgaria | No data | BGR |
| The Bahamas | No data | BHS |
| Bosnia and Herzegovina | No data | BIH |
| Belarus | No data | BLR |
| Belize | No data | BLZ |
| Bolivia | No data | BOL |
| Brunei | No data | BRN |
| Bhutan | No data | BTN |
| Botswana | No data | BWA |
| Central African Republic | No data | CAF |
| Canada | No data | CAN |
| Switzerland | No data | CHE |
| Chile | No data | CHL |
| People's Republic of China | No data | CHN |
| Ivory Coast | No data | CIV |
| Cameroon | No data | CMR |
| Democratic Republic of the Congo | No data | COD |
| Republic of the Congo | No data | COG |
| Colombia | No data | COL |
| Costa Rica | No data | CRI |
| Cuba | No data | CUB |
| Turkish Republic of Northern Cyprus | No data | CYN |
| Cyprus | No data | CYP |
| Czech Republic | No data | CZE |
| Djibouti | No data | DJI |
| Denmark | No data | DNK |
| Dominican Republic | No data | DOM |
| Algeria | No data | DZA |
| Ecuador | No data | ECU |
| Egypt | No data | EGY |
| Eritrea | No data | ERI |
| Western Sahara | No data | ESH |
| Spain | No data | ESP |
| Estonia | No data | EST |
| Ethiopia | No data | ETH |
| Finland | No data | FIN |
| Fiji | No data | FJI |
| Falkland Islands | No data | FLK |
| France | No data | FRA |
| Gabon | No data | GAB |
| United Kingdom | No data | GBR |
| Georgia | No data | GEO |
| Ghana | No data | GHA |
| Guinea | No data | GIN |
| The Gambia | No data | GMB |
| Guinea-Bissau | No data | GNB |
| Equatorial Guinea | No data | GNQ |
| Greece | No data | GRC |
| Greenland | No data | GRL |
| Guatemala | No data | GTM |
| Guyana | No data | GUY |
| Honduras | No data | HND |
| Croatia | No data | HRV |
| Haiti | No data | HTI |
| Hungary | No data | HUN |
| Indonesia | No data | IDN |
| Ireland | No data | IRL |
| Iran | No data | IRN |
| Iraq | No data | IRQ |
| Iceland | No data | ISL |
| Israel | No data | ISR |
| Italy | No data | ITA |
| Jamaica | No data | JAM |
| Jordan | No data | JOR |
| Japan | No data | JPN |
| Kazakhstan | No data | KAZ |
| Kenya | No data | KEN |
| Kyrgyzstan | No data | KGZ |
| Cambodia | No data | KHM |
| South Korea | No data | KOR |
| Kosovo | No data | KOS |
| Kuwait | No data | KWT |
| Laos | No data | LAO |
| Lebanon | No data | LBN |
| Liberia | No data | LBR |
| Libya | No data | LBY |
| Sri Lanka | No data | LKA |
| Lesotho | No data | LSO |
| Lithuania | No data | LTU |
| Luxembourg | No data | LUX |
| Latvia | No data | LVA |
| Morocco | No data | MAR |
| Moldova | No data | MDA |
| Madagascar | No data | MDG |
| Mexico | No data | MEX |
| North Macedonia | No data | MKD |
| Mali | No data | MLI |
| Myanmar | No data | MMR |
| Montenegro | No data | MNE |
| Mongolia | No data | MNG |
| Mozambique | No data | MOZ |
| Mauritania | No data | MRT |
| Malawi | No data | MWI |
| Malaysia | No data | MYS |
| Namibia | No data | NAM |
| New Caledonia | No data | NCL |
| Niger | No data | NER |
| Nigeria | No data | NGA |
| Nicaragua | No data | NIC |
| Netherlands | No data | NLD |
| Norway | No data | NOR |
| Nepal | No data | NPL |
| New Zealand | No data | NZL |
| Oman | No data | OMN |
| Pakistan | No data | PAK |
| Panama | No data | PAN |
| Peru | No data | PER |
| Philippines | No data | PHL |
| Papua New Guinea | No data | PNG |
| Poland | No data | POL |
| Puerto Rico | No data | PRI |
| North Korea | No data | PRK |
| Portugal | No data | PRT |
| Paraguay | No data | PRY |
| Palestine | No data | PSE |
| Qatar | No data | QAT |
| Romania | No data | ROU |
| Russia | No data | RUS |
| Rwanda | No data | RWA |
| Saudi Arabia | No data | SAU |
| Sudan | No data | SDN |
| Senegal | No data | SEN |
| Solomon Islands | No data | SLB |
| Sierra Leone | No data | SLE |
| El Salvador | No data | SLV |
| Somaliland | No data | SOL |
| Somalia | No data | SOM |
| Serbia | No data | SRB |
| South Sudan | No data | SSD |
| Suriname | No data | SUR |
| Slovakia | No data | SVK |
| Slovenia | No data | SVN |
| Sweden | No data | SWE |
| Eswatini | No data | SWZ |
| Syria | No data | SYR |
| Chad | No data | TCD |
| Togo | No data | TGO |
| Thailand | No data | THA |
| Tajikistan | No data | TJK |
| Turkmenistan | No data | TKM |
| East Timor | No data | TLS |
| Trinidad and Tobago | No data | TTO |
| Tunisia | No data | TUN |
| Turkey | No data | TUR |
| Taiwan | No data | TWN |
| Tanzania | No data | TZA |
| Uganda | No data | UGA |
| Ukraine | No data | UKR |
| Uruguay | No data | URY |
| Uzbekistan | No data | UZB |
| Venezuela | No data | VEN |
| Vietnam | No data | VNM |
| Vanuatu | No data | VUT |
| Yemen | No data | YEM |
| South Africa | No data | ZAF |
| Zambia | No data | ZMB |
| Zimbabwe | No data | ZWE |
Arrow keys explore records. Home and End reach the first and last record. PageUp and PageDown jump. Escape clears the selection.
| Location | Orders | Longitude, latitude |
|---|---|---|
| London | 900 | -0.1276, 51.5072 |
| Tokyo | 1,600 | 139.6917, 35.6895 |
| Sydney | 400 | 151.2093, -33.8688 |
Zero, missing, and unmapped records
Zero renders as a small hollow circle and null renders as a dashed hollow circle rather than encoding area. Country codes absent from the bundled 1:110m geometry (such as SGP) remain in the shared scale, keyboard sequence, visible unmatchedLabel notice, and data table.
Arrow keys explore records. Home and End reach the first and last record. PageUp and PageDown jump. Escape clears the selection.
Unmapped country codes: 1. All values remain in the data table.
| Location | Orders | Country code |
|---|---|---|
| United States of America | 0 | USA |
| Brazil | No data | BRA |
| SGP | 500 | SGP — Not on map |
Data and scale
data is a discriminated union keyed by type:
| Type | Collection | Record shape |
|---|---|---|
locations | locations, up to 500 | { id, label, longitude, latitude, value } |
country-totals | countries, up to 250 | { country, value } |
country-rates | countries, up to 250 | { country, value } |
IDs and uppercase three-letter country codes must be unique. Longitude spans -180 to 180 and latitude spans -90 to 90; coordinates are never snapped to land, wrapped, or guessed. Numeric values must be finite and nonnegative (null marks missing data). Invalid coordinates, duplicate records, or values exceeding an explicit max reject the configuration atomically.
Country joins require exact uppercase ISO alpha-3 codes (such as USA, DEU, BRA) or documented Natural Earth unit codes. Import mapCountries from @uthereal/ui/map-chart for the complete list of supported codes and labels; names and alpha-2 codes are not converted. Unmapped codes are never drawn on another country's geometry, and their values remain in the shared scale so failed joins cannot rescale visible marks.
The scale always starts at zero. Set max to fix the upper bound across views; otherwise the scale uses the largest supplied value (or 1 when all values are zero or missing). Circle area is strictly proportional to value (four times the value doubles the radius) without inflating small positive circles. country-rates divides [0, max] into seven equal-width intervals including each upper boundary, with zero in the first interval and unshaded regions indicating missing data.
Geographic accuracy and limitations
Country geometry comes from Natural Earth 5.1.2 at 1:110m scale under public-domain terms, covering 177 geographic units. Small territories, islands, and fine coastlines are omitted; boundaries follow that snapshot rather than an authoritative jurisdiction source.
Equal Earth preserves relative area globally while distorting shapes, angles, and distances. Country circles anchor at Natural Earth LABEL_X/LABEL_Y points rather than capitals or population centroids. At the antimeridian (±180°), nearby points appear on opposite edges of the fixed world view. Co-located circles do not cluster or displace; smaller marks draw on top, nearest-center pointer snapping selects one record within at least 12 px, and keyboard navigation and the data table expose every record. Resizing fits the full world without cropping, and dir="rtl" changes text direction only, never east-west geography.
API reference
These serializable arguments and defaults come directly from the component schema.
| Argument | Type / default | Description |
|---|---|---|
title | stringDefault: "Orders by country" | Figure title; names the chart for assistive technology |
description | string— | One or two sentences on what the chart shows; omit when the title says it |
tableToggle | booleanDefault: false | Show a button that reveals the data table; the table is always announced |
tableLabel | stringDefault: "Data table" | Name of the data table toggle and the table caption suffix |
pointLabel | stringDefault: "{series}, {x}: {value}" | Announced when keyboard focus moves to a point; {series}, {x}, {value} |
noDataLabel | stringDefault: "No data" | Announced and shown in the tooltip for a missing value |
valueFormat | NumberFormat— | How values are displayed; omitted shows plain numbers |
locale | string— | BCP 47 locale for numbers and dates; omitted inherits the application |
data | MapChartDataDefault: {"type":"country-totals","countries":[{"country":"USA","value":4200},{"country":"BRA","value":1800},{"country":"DEU","value":2900},{"country":"IND","value":3600},{"country":"AUS","value":1200}]} | One geographic measure: locations, country-totals, or country-rates |
valueLabel | stringDefault: "Orders" | Name of the measure in the tooltip, legend and table |
locationLabel | stringDefault: "Location" | First column of the data table |
unit | string— | Unit appended to full values; omit if valueFormat already supplies it |
max | number— | Fixed zero-based scale maximum, containing every supplied value; omitted uses the largest value, including unmatched records |
keysLabel | stringDefault: "Arrow keys explore records. Home and End reach the first and last record. PageUp and PageDown jump. Escape clears the selection." | Instructions for the focusable plot |
unmatchedLabel | stringDefault: "Unmapped country codes: {count}. All values remain in the data table." | Visible notice; {count} is the number of unsupported country codes |
unplacedLabel | stringDefault: "Not on map" | Status of an unsupported country code |
zeroLabel | stringDefault: "Zero (hollow circle)" | Explanation of the zero-value symbol |
missingLabel | stringDefault: "Missing (dashed circle or unshaded region)" | Explanation of missing values |
loading | booleanDefault: false | Keep the lines on screen, dimmed, while the next data loads |
loadingLabel | stringDefault: "Loading" | Announced politely while loading |
emptyLabel | stringDefault: "No geographic records" | Message for an empty input collection |
height | integerDefault: 360 | Plot height in pixels; the world fits without cropping |
recipe | studio | softDefault: "studio" | Visual treatment |
theme | MapChartTheme— | Shared chart theme overrides |
motion | none | subtle | expressiveDefault: "subtle" | Draw and update motion; reduced motion takes precedence |
motionOptions | ChartMotionOptions— | Draw and morph transitions |
dir | ltr | rtl— | Text direction; geographic east and west never mirror |
React integration
| Prop | Purpose |
|---|---|
onActiveChange | Fires with { id, value, placed } during transient exploration, or null when cleared |
preset | Application defaults, overridden by explicit instance props |
tokens | CSS variables applied after the typed theme |
ref | Ref forwarded to the root <figure> |
className, style | Applied to the root <figure> |
| Native attributes | id, data-*, and remaining <figure> attributes forwarded to the root |
Keyboard & accessibility
| Key | Interaction |
|---|---|
Tab | Focus the plot on the first geographic record |
ArrowLeft, Right, Up, Down | Step through records in input order (plus unmapped rates) |
PageUp, PageDown | Jump across multiple records |
Home, End | Jump to the first or last record |
Escape | Clear the active exploration marker and tooltip |
The chart renders a <figure> named by title, described by description, and linked via aria-details to a native data table (set tableToggle: true to display a visible disclosure button). For country-rates, the table includes all bundled countries, including those without supplied data. The plot is a single tab stop described by keysLabel. Each focused record displays a non-color-dependent focus marker and announces its full formatted value, noting unplacedLabel ("Not on map") for unsupported codes. Touch drags scrub records and release on lift while vertical swipes scroll the page. loading: true disables exploration and announces loadingLabel; empty collections display emptyLabel.
Motion and theming
Circle marks reveal on entry and morph radii when values change, while geographic coordinates update directly so markers never animate across unrelated regions. Rate fills transition smoothly across the seven sequential steps. motionOptions.draw and motionOptions.morph accept a tween with duration (ms) or a spring. motion="none" and prefers-reduced-motion: reduce apply updates immediately.
theme accepts a mode, an accent, and semantic tokens from the shared chart theme. An application-wide UtherealProvider supplies defaults.
Composition
In an agent composition, MapChart is a leaf with no actions. Exploration is transient and is not persisted in host state; the host owns data fetching, normalization, and composition updates. See Building with agents.
{
"type": "MapChart",
"props": {
"title": "Orders by country",
"valueLabel": "Orders",
"data": {
"type": "country-totals",
"countries": [{ "country": "USA", "value": 4200 }]
}
},
"children": []
}