View as Markdown

API reference: @salmonui/charts/geo-map

GeoMapPropsinterface

import type { GeoMapProps } from '@salmonui/charts/geo-map';
interface GeoMapProps<T = unknown> {
    readonly layers?: readonly GeoMapLayer<T>[] | undefined;
    readonly children?: ReactNode;
    readonly animated?: boolean | undefined;
    readonly projection?: ProjectionName | undefined;
    readonly width?: number | undefined;
    readonly height?: number | undefined;
    readonly title?: string | undefined;
    readonly subtitle?: string | undefined;
    readonly description?: string | undefined;
    readonly locale?: string | undefined;
    readonly text?: Partial<GeoMapText> | undefined;
    readonly fitTo?: 'markers' | readonly [
        LatLon,
        LatLon
    ] | undefined;
    readonly view?: GeoMapView | undefined;
    readonly defaultView?: GeoMapView | undefined;
    readonly onViewChange?: ((view: GeoMapView, event: GeoMapChangeEvent) => void) | undefined;
    readonly activeLayer?: string | undefined;
    readonly defaultActiveLayer?: string | undefined;
    readonly onActiveLayerChange?: ((id: string, event: GeoMapChangeEvent) => void) | undefined;
    readonly selection?: boolean | {
        readonly multiple?: boolean | undefined;
    } | undefined;
    readonly selectedShapes?: readonly string[] | undefined;
    readonly defaultSelectedShapes?: readonly string[] | undefined;
    readonly onSelectedShapesChange?: ((keys: readonly string[], event: GeoMapChangeEvent) => void) | undefined;
    readonly highlight?: boolean | undefined;
    readonly zoom?: boolean | GeoMapZoomOptions | undefined;
    readonly pan?: boolean | undefined;
    readonly tooltip?: boolean | {
        readonly trigger?: 'hover' | 'click' | undefined;
        readonly render?: ((ctx: GeoMapTooltipContext) => ReactNode) | undefined;
    } | undefined;
    readonly legend?: boolean | GeoMapLegendOptions | undefined;
    readonly annotations?: readonly GeoMapAnnotation[] | undefined;
    readonly onShapeClick?: ((ctx: {
        readonly layerId: string;
        readonly key: string;
        readonly name: string;
        readonly datum: unknown;
    }) => void) | undefined;
    readonly onMarkerClick?: ((ctx: GeoMapMarkerContext) => void) | undefined;
    readonly onClusterClick?: ((ctx: GeoMapClusterContext) => void) | undefined;
    readonly onMarkerMove?: ((move: GeoMapMarkerMove, event: GeoMapChangeEvent) => void) | undefined;
    readonly onBubbleClick?: ((ctx: {
        readonly layerId: string;
        readonly key: string;
        readonly value: unknown;
        readonly datum: unknown;
    }) => void) | undefined;
    readonly onMapClick?: ((position: {
        readonly latitude: number;
        readonly longitude: number;
    }) => void) | undefined;
    readonly showDataTable?: boolean | undefined;
    readonly className?: string | undefined;
    readonly style?: CSSProperties | undefined;
    readonly ref?: Ref<GeoMapApi> | undefined;
    readonly id?: string | undefined;
    readonly 'data-testid'?: string | undefined;
}
GeoMapProps members (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;