UNPKG

@tanstack/charts

Version:

A chart grammar for TypeScript and JavaScript. Marks consume your data directly, channels describe visual encodings, and the engine compiles them into a renderer-neutral keyed scene. TanStack's compact scales cover common numeric and categorical mappings.

34 lines (33 loc) 1.79 kB
import type { LinkOptions } from './link.js'; import type { Channel, ChannelOutput, ChartKey, ChartMark, ChartValue } from './types.js'; export interface DelaunayLinkDatum<TDatum, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> { readonly edgeKey: string; readonly group: ChartKey | null; readonly source: TDatum; readonly sourceIndex: number; readonly sourceKey: ChartKey; readonly target: TDatum; readonly targetIndex: number; readonly targetKey: ChartKey; readonly x1: TXValue; readonly y1: TYValue; readonly x2: TXValue; readonly y2: TYValue; } export type DelaunayLinkOptions<TDatum> = { x: Channel<TDatum, ChartValue | null | undefined>; y: Channel<TDatum, ChartValue | null | undefined>; /** Triangulates each non-null group independently. */ z?: Channel<TDatum, ChartKey | null | undefined>; /** Stable point identity used to derive canonical edge keys. */ key?: Channel<TDatum, ChartKey>; } & Omit<LinkOptions<DelaunayLinkDatum<TDatum>>, 'x1' | 'y1' | 'x2' | 'y2' | 'z' | 'key'>; type DelaunayXOutput<TDatum, TOptions> = ChannelOutput<TDatum, TOptions extends { x: infer TChannel; } ? TChannel : never, number>; type DelaunayYOutput<TDatum, TOptions> = ChannelOutput<TDatum, TOptions extends { y: infer TChannel; } ? TChannel : never, number>; /** Connects final-screen Delaunay neighbors while retaining semantic endpoints. */ export declare function delaunayLink<TDatum, const TOptions extends DelaunayLinkOptions<NoInfer<TDatum>>>(source: Iterable<TDatum>, options: TOptions): ChartMark<DelaunayLinkDatum<TDatum, DelaunayXOutput<TDatum, TOptions>, DelaunayYOutput<TDatum, TOptions>>, DelaunayXOutput<TDatum, TOptions>, DelaunayYOutput<TDatum, TOptions>>; export {};