View as Markdown

API reference: @salmonui/charts/geo-map

GeoMapcomponent

import { GeoMap } from '@salmonui/charts/geo-map';
function GeoMap<T = unknown>(props: GeoMapProps<T>): ReactNode;

Props: GeoMapProps

GeoMap props (40)
NameSignatureDescription
layersoptionalreadonly layers?: readonly GeoMapLayer<T>[] | undefined;

The layers; or GeoMapLayer children, read when layers is absent.

childrenoptionalreadonly children?: ReactNode;
animatedoptionalreadonly animated?: boolean | undefined;

Entrance transition (@salmonui/charts/viz-animations.css); default true.

projectionoptionalreadonly projection?: ProjectionName | undefined;
widthoptionalreadonly width?: number | undefined;

Drawing size in px (default 600 x 400); the map scales to its container through viewBox.

heightoptionalreadonly height?: number | undefined;
titleoptionalreadonly title?: string | undefined;
subtitleoptionalreadonly subtitle?: string | undefined;
descriptionoptionalreadonly description?: string | undefined;
localeoptionalreadonly locale?: string | undefined;
textoptionalreadonly text?: Partial<GeoMapText> | undefined;

Built-in text (over the nearest LocaleProvider's geoMap entry).

fitTooptionalreadonly fitTo?: 'markers' | readonly [ LatLon, LatLon ] | undefined;

Initial frame: fit every marker or [[lat, lon], [lat, lon]] bounds instead of the base layer.

viewoptionalreadonly view?: GeoMapView | undefined;
defaultViewoptionalreadonly defaultView?: GeoMapView | undefined;
onViewChangeoptionalreadonly onViewChange?: ((view: GeoMapView, event: GeoMapChangeEvent) => void) | undefined;
activeLayeroptionalreadonly activeLayer?: string | undefined;
defaultActiveLayeroptionalreadonly defaultActiveLayer?: string | undefined;
onActiveLayerChangeoptionalreadonly onActiveLayerChange?: ((id: string, event: GeoMapChangeEvent) => void) | undefined;
selectionoptionalreadonly selection?: boolean | { readonly multiple?: boolean | undefined; } | undefined;

Shape selection (default single); false disables it.

selectedShapesoptionalreadonly selectedShapes?: readonly string[] | undefined;
defaultSelectedShapesoptionalreadonly defaultSelectedShapes?: readonly string[] | undefined;
onSelectedShapesChangeoptionalreadonly onSelectedShapesChange?: ((keys: readonly string[], event: GeoMapChangeEvent) => void) | undefined;
highlightoptionalreadonly highlight?: boolean | undefined;

Hover highlight of shapes (default true).

zoomoptionalreadonly zoom?: boolean | GeoMapZoomOptions | undefined;
panoptionalreadonly pan?: boolean | undefined;

Drag and Ctrl+arrow panning (default true when zoom is on).

tooltipoptionalreadonly tooltip?: boolean | { readonly trigger?: 'hover' | 'click' | undefined; readonly render?: ((ctx: GeoMapTooltipContext) => ReactNode) | undefined; } | undefined;
legendoptionalreadonly legend?: boolean | GeoMapLegendOptions | undefined;
annotationsoptionalreadonly annotations?: readonly GeoMapAnnotation[] | undefined;
onShapeClickoptionalreadonly onShapeClick?: ((ctx: { readonly layerId: string; readonly key: string; readonly name: string; readonly datum: unknown; }) => void) | undefined;
onMarkerClickoptionalreadonly onMarkerClick?: ((ctx: GeoMapMarkerContext) => void) | undefined;
onClusterClickoptionalreadonly onClusterClick?: ((ctx: GeoMapClusterContext) => void) | undefined;
onMarkerMoveoptionalreadonly onMarkerMove?: ((move: GeoMapMarkerMove, event: GeoMapChangeEvent) => void) | undefined;

A draggable marker was dropped (pointer release) or moved by an arrow key; update the marker data.

onBubbleClickoptionalreadonly onBubbleClick?: ((ctx: { readonly layerId: string; readonly key: string; readonly value: unknown; readonly datum: unknown; }) => void) | undefined;
onMapClickoptionalreadonly onMapClick?: ((position: { readonly latitude: number; readonly longitude: number; }) => void) | undefined;
showDataTableoptionalreadonly showDataTable?: boolean | undefined;
classNameoptionalreadonly className?: string | undefined;
styleoptionalreadonly style?: CSSProperties | undefined;
refoptionalreadonly ref?: Ref<GeoMapApi> | undefined;
idoptionalreadonly id?: string | undefined;
data-testidoptionalreadonly 'data-testid'?: string | undefined;