Geo map
Where: a world choropleth in one sequential hue, bubbles on places, country names in the reader's language — plain SVG, the world loaded on demand.
- Domain
- Data display
- Support level
- Size
- Not measured
- Who uses it
- No live product imports it yet
import { GeoMap } from "@krizaka/charts/geo";Web only — React, from @krizaka/charts/geo. Beta: its API may still change in a minor version.
- Mobile · n/a. A choropleth over the world; a phone shows the MapLibre map of @krizaka/ui/native/map or a ranked list. → Bar chart
Why it is here. Audience by region, on MapLibre (PS-C).
When to use
- An audience by country: a creator's viewers, a service's users.
- Places with an amount: cities, data centres, as bubbles.
When not to use
Installation
Install
npm install @krizaka/chartsImport
import { GeoMap } from "@krizaka/charts/geo";Examples
Viewers by country
A creator's viewers by country, the top cities as bubbles.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
datarequired | readonly T[] | — | One row per region with a value. |
regionrequired | string | ((datum: T, index: number) => string) | — | The field (or function) of the region's ISO 3166-1 alpha-2 code ("FR", "US"). |
valuerequired | string | ((datum: T, index: number) => number) | — | The field (or function) of its value. |
actionsMenu | boolean | — | The ⋯ actions menu of the kit. false: the former “Show data” and export buttons, drawn in line. Default true. |
brand | BrandId | — | The brand whose palette the charts use. Without it, a chart follows a .brand-<id> ancestor, else Krizaka. Set it
when the app loads a brand stylesheet on :root (@krizaka/tokens/brands/sovkora.css). |
className | string | — | A class on the figure (layout: margins, grid placement). |
dataTable | boolean | — | “View as table” in the actions menu (the table is in the page for screen readers either way). Default true. |
description | ReactNode | — | A sentence under the title: the period, the unit, the source. |
empty | ReactNode | — | What to show when there is nothing to draw (default: the empty label). An EmptyState of
@krizaka /ui fits. |
error | ReactNode | — | The data could not be loaded: true says the default words, a node says yours (a retry button…). |
exportable | boolean | readonly ExportFormat[] | — | The downloads of the actions menu: all three by default, or the formats you want, or false for none. |
format | ValueFormat | — | How the values are written. |
height | number | — | The height of the plot in pixels. Default 280 (a sparkline: 32). |
hideTitle | boolean | — | Visually hide the title (it stays the chart's accessible name): a card that already has its heading. |
id | string | — | The id of the figure. |
insight | ReactNode | — | One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”. |
labels | ChartLabelsInput | — | The words, translated: the buttons, the states, the written summary. |
live | boolean | — | Streaming data (a job queue, an auction): no entrance on updates, no announcement of every new point. |
loading | boolean | — | The data is on its way: a skeleton of the chart, announced once. |
locale | Locale | — | The locale of every figure and date ("fr-FR"). Default "en-US". |
onSelect | ((datum: T, index: number) => void) | — | Called with the row when a region is clicked (or Enter is pressed on it). |
points | readonly GeoPoint[] | — | Bubbles on places, their area by value. |
regionLabel | string | — | The header of the regions and of the values in the table (“Country”, “Viewers”). |
steps | number | — | The number of colour steps of the scale. Default 5. |
style | CSSProperties | — | Inline style on the figure (layout only: colours come from the tokens). |
summary | "hidden" | "visible" | — | The written summary: read by screen readers only ("hidden", default), or shown under the chart ("visible"). |
summaryText | string | — | Your own summary instead of the generated one (still read first by screen readers). |
title | string | — | What the chart shows, in a few words: its accessible name, and its heading unless hideTitle. Inside a ChartCard, the card's title is the default. |
valueLabel | string | — | The header of the values (“Viewers”). |
Accessibility
- The summary names the five largest regions with their shares; the table lists every region and place.
- The Equal Earth projection keeps areas true: no country looks larger than it is.
- The world's countries (~38 kB) are loaded only when a map is drawn; a skeleton holds the height meanwhile.
Keyboard
| Keys | Action |
|---|---|
| Arrow keys | Walk the regions that have data, largest first, then the places. |
| Home / End | Jump to the largest or the last item. |
| Esc | Clears the active region. |
Best practices
- Key the regions by ISO 3166-1 alpha-2 (
FR,US): the names come fromIntl.DisplayNamesin the reader's locale. - Map rates (per viewer, per capita) rather than raw counts when the countries' sizes differ widely.
- Pair it with a ranked table or bars when the exact order matters.
Related components
Generated from the code of @krizaka/ui 5.3.4: its meta.ts, its examples and its types.Edit this documentation on GitHub