Skip to content

Choropleth

Examples

Map zoom 100%

API Reference

Types come from the public API. A dash indicates no default is documented here.

ChoroplethChart props

Public source
PropTypeDefaultDescription
keyKeepAliveKey<K, Ends> | undefined''The child's identity among its parent's children of one component, or a kept child's among its author's. The empty string by default.
onEmit
Show type
((events: { readonly _tag: "HoverChanged"; readonly index: number | null; } | { readonly _tag: "TransformChanged"; readonly scale: number; readonly x: number; readonly y: number; readonly dragging: boolean; }) => NoInfer<Msg> | undefined) | { readonly HoverChanged: (event: { readonly _tag: "HoverChanged"; readonly index: number | null; }) => NoInfer<Msg> | undefined; readonly TransformChanged: (event: { readonly _tag: "TransformChanged"; readonly scale: number; readonly x: number; readonly y: number; readonly dragging: boolean; }) => NoInfer<Msg> | undefined; } | undefined
—Handle the child's events with a callback, or supply one handler per tag for tagged events. Return a parent message to dispatch it, or `undefined` to ignore the event.
props.data
Show type
{ readonly type: "FeatureCollection"; readonly features: readonly { readonly type: "Feature"; readonly properties: { readonly [x: string]: Schema.Json; readonly id?: string | number; readonly name?: string; } | null; readonly geometry: ChoroplethGeometry; readonly id?: string | number; }[]; }
Required
props.idstringRequired
props.scalenumber—
props.transform{ readonly scale: number; readonly x: number; readonly y: number; }
Varies
  • h.props.initialZoom
  • initialZoom
  • props.initialZoom
props.translatereadonly [number, number]—
props.centerreadonly [number, number]—
props.animationDurationnumber—
props.aspectRatiostring'16 / 9'
props.margin
Show type
{ readonly bottom?: number; readonly left?: number; readonly right?: number; readonly top?: number; }
—
props.classNamestring—
props.ariaLabelstring'Choropleth chart'
props.tooltip
Show type
{ readonly prefix?: string; readonly backgroundColor?: string; readonly className?: string; readonly locale?: string; readonly maximumFractionDigits?: number; readonly panelStyle?: { readonly [x: string]: string | number; }; readonly nameKey?: string; readonly valueKey?: string; readonly valueLabel?: string; readonly suffix?: string; }
—
props.ariaDescriptionstring—
props.revealSignaturestring—
props.enterTransition
Show type
{ readonly delay?: number; readonly duration?: number; readonly ease?: string | readonly number[] | readonly (string | readonly number[])[]; readonly type?: unknown; readonly stiffness?: number; readonly damping?: number; readonly mass?: number; readonly bounce?: number; }
—
props.zoomEnabledboolean—
props.initialZoom{ readonly scale: number; readonly x: number; readonly y: number; }—
props.transformRevisionnumber—
props.hoverRevisionnumber—
props.hoveredIndexnumber | nullnull
props.feature
Show type
{ readonly fill?: string; readonly stroke?: string; readonly strokeWidth?: number; readonly fadedOpacity?: number; readonly colors?: readonly string[]; readonly patterns?: readonly ChoroplethSvgResource[]; readonly patternIds?: readonly (string | null)[]; }
—
props.graticule
Show type
{ readonly stroke?: string; readonly strokeWidth?: number; readonly step?: readonly [number, number]; }
{}
props.zoomMinnumber—
props.zoomMaxnumber—