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.

27 lines (26 loc) 1.23 kB
import type { ChartValue, ResolvedScale } from './types.js'; export interface InteractionAxis<TValue extends ChartValue> { readonly scale: ResolvedScale; readonly extent: readonly [number, number]; readonly values?: readonly TValue[]; readonly positions?: readonly number[]; position: (value: TValue) => number; /** Inverts a continuous scale without clamping to the interaction extent. */ invert: (position: number) => TValue; valueAt: (position: number) => TValue; order: (first: TValue, second: TValue) => readonly [TValue, TValue]; indexOf: (value: TValue) => number; at: (index: number) => TValue; step: (value: TValue, amount: number) => TValue; clampPosition: (position: number) => number; layoutKey: (value: TValue) => string; } export interface InteractionAxisOptions<TValue extends ChartValue> { axis: 'x' | 'y'; scale: ResolvedScale | undefined; extent: readonly [number, number]; sample: TValue; values?: readonly TValue[]; } /** Shared semantic-value/pixel conversion for scale-bound interactions. */ export declare function createInteractionAxis<TValue extends ChartValue>(options: InteractionAxisOptions<TValue>): InteractionAxis<TValue>;