Skip to content
GeographicGenerated from the public API

ChoroplethChart

Plot positions and routes on a plane whose bounds and coordinate meaning you declare.

@luc/ui/charts

What it shows

Show one value per region on a registered geographic map, using colour to compare regions.

Live preview

A six-by-four synthetic grid registered by the page; one region carries no value and is drawn as no-data.

Loading
// A map is registered once, globally, before a choropleth renders.
useEffect(() => {
  registerEChartsMap("luc-showcase-grid", gridGeoJson).then(() => setReady(true));
}, []);

<ChoroplethChart
  mapName="luc-showcase-grid"
  regions={regions}
  valueLabel="Index"
  format={{ kind: "number", decimals: 1 }}
  ariaLabel="Values on a grid map"
/>

Usage

The values are prepared by the caller: this component draws the points it is given and computes no statistic of its own, so units, scaling and any summary have to be settled before the data reaches it.

It is drawn by the ECharts engine.

Worked examples with real data are on the family overview: Geographic

import { ChoroplethChart } from "@luc/ui/charts";
// A map is registered once, globally, before a choropleth renders.
useEffect(() => {
  registerEChartsMap("luc-showcase-grid", gridGeoJson).then(() => setReady(true));
}, []);

<ChoroplethChart
  mapName="luc-showcase-grid"
  regions={regions}
  valueLabel="Index"
  format={{ kind: "number", decimals: 1 }}
  ariaLabel="Values on a grid map"
/>

Data contract

Register a map before render, then pass `mapName` and `regions` whose region ids match that map. Values are supplied per region; missing regions are not filled with zero.

Important configuration

Use `valueLabel` and `format` for the measure, state the colour domain, and register the map once before mounting the chart.

Guidelines

When not to use

Do not compare raw counts across regions of very different size without normalising, and do not imply that LUC supplies political boundaries.

Configuration

Exported symbols
ExportKindSignature
ChoroplethChart16 documented props({ mapName, regions, nameProperty, format, valueLabel, ramp, title, description, state, height, className, ariaLabel, ariaDescription, onReady, onEvent, eager, }: ChoroplethChartProps) => import("@ty…

ChoroplethChart props

Type: ChoroplethChartProps

Values the compiler reads from the declaration.

ChoroplethChart props
PropTypeDefaultNotes
ariaDescription?string | undefined—
ariaLabel?string | undefined—
className?string | undefined—
description?string | undefined—
eager?boolean | undefined—Create the engine on mount rather than when the surface is approached.
format?ChartFormat | undefined—
height?string | number | undefined—
mapNamestring—The name passed to `registerEChartsMap`.
nameProperty?string | undefined—GeoJSON property that carries the region id. Default `"name"`.
onEvent?((event: EChartEvent) => void) | undefined—
onReady?((chart: EChartsInstance) => void) | undefined—
ramp?"sequential" | "diverging" | undefined—Which ramp encodes the value.
regionsreadonly ChoroplethRegion[]—
state?ChartState | undefined—
title?string | undefined—
valueLabel?string | undefined—Legend caption, e.g. "Population per km²".

Accessibility

A chart is a picture of data, so it needs a name that states what it shows, and the numbers must exist as text somewhere on the page — in a table or a written summary — because a drawing is not readable by a screen reader and cannot be copied.

What happens on the server, and when hydration changes it.

Family

Geographic

Maps are the caller's: LUC ships no boundary data and no political set.

Luc UI v1.0ChoroplethChartdark theme