HomeLabHire Me
ml-ui10 components

Get started

IntroductionInstallation

UI

Dots

Dot CalendarNewDot CodeNew

Dither

Dither GlobeNew

Text

Ink PrintNew

Data viz

Dither

Dither MapNew

Media

Dots

Dot WaveformNew

AI

Diffusion ImageNew

Backgrounds

Koi PondNewMarigoldsNewWhite BlossomNew

ml-ui / Data viz

Dither Map

Each country is shaded by its value as a density of ink dots, from a light stipple for the least to solid for the most, on a log scale when the data spans decades; land without data is a faint stipple, the sea is the plain page, and neighbours are kept apart by a hairline gap. It develops in when it first comes into view, and a change of data eases each country to its new density. Point at a country, or focus the map and use the arrow keys (highest first), to read it; a hidden table gives screen readers the whole of the data.

Needs: None. Canvas 2D. Borders from Natural Earth 1:110m (public domain), built in at about 11 KB.

Customize

Props

PropTypeDefaultDescription
dataRecord<string, number>requiredA value for each country, keyed by ISO 3166 alpha-2 code.
format(value: number) => string–How a value reads.
labelstring"Value"What the values are, e.g. “Active users”.
onSelect(code: string, value: number) => void–Called when a country with data is clicked or chosen with Enter.
tonestring–The ink. The page's accent by default.
cellnumber3Size of one dither cell in px.
legendbooleantrueThe key below the map.
classNamestring–Class on the map. It fills its container's width.
styleCSSProperties–Style on the map.