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.

26 lines (25 loc) 1.46 kB
import type { ChartPoint, ChartRenderContext, ChartSvgRenderer, ChartTextMeasurer, ChartValue, DomChartDefinition } from '@tanstack/charts'; import type { OctaneNode } from 'octane'; import type { ChartTooltipBodyRenderContext } from './renderer-types.js'; export interface ChartCommonProps<TDatum = unknown, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> { ariaLabel: string; ariaDescription?: string; height?: number; aspectRatio?: number; width?: number; initialWidth?: number; class?: string; style?: Record<string, string | number | undefined>; tabIndex?: number; idPrefix?: string; renderSvg?: ChartSvgRenderer<NoInfer<TDatum>, NoInfer<TXValue>, NoInfer<TYValue>>; measureText?: ChartTextMeasurer; onFocusChange?: (point: ChartPoint<TDatum, TXValue, TYValue> | null) => void; onFocusGroupChange?: (points: readonly ChartPoint<TDatum, TXValue, TYValue>[]) => void; onSelect?: (point: ChartPoint<TDatum, TXValue, TYValue> | null) => void; onRender?: (context: ChartRenderContext<TDatum, TXValue, TYValue>) => void; renderTooltipBody?: (context: ChartTooltipBodyRenderContext<TDatum, TXValue, TYValue>) => OctaneNode; } export type ChartProps<TDatum = unknown, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> = ChartCommonProps<TDatum, TXValue, TYValue> & { definition: DomChartDefinition<TDatum, TXValue, TYValue>; };