@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.
15 lines (14 loc) • 1.29 kB
TypeScript
import type { ComponentChildren, JSX } from 'preact';
import type { ChartHostCommonOptions, ChartHostOptions, ChartTooltipBodyContext, ChartValue } from '@tanstack/charts';
export interface ChartPresentationProps {
className?: string;
style?: JSX.CSSProperties;
}
export interface ChartTooltipBodyRenderContext<TDatum = unknown, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> extends ChartTooltipBodyContext<TDatum, TXValue, TYValue> {
defaultBody: ComponentChildren;
}
export interface ChartTooltipBodyRenderProps<TDatum = unknown, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> {
renderTooltipBody?: (context: ChartTooltipBodyRenderContext<TDatum, TXValue, TYValue>) => ComponentChildren;
}
export type ChartCommonProps<TDatum = unknown, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> = ChartHostCommonOptions<TDatum, TXValue, TYValue> & ChartPresentationProps & ChartTooltipBodyRenderProps<TDatum, TXValue, TYValue>;
export type ChartProps<TDatum = unknown, TXValue extends ChartValue = ChartValue, TYValue extends ChartValue = ChartValue> = ChartHostOptions<TDatum, TXValue, TYValue> & ChartPresentationProps & ChartTooltipBodyRenderProps<TDatum, TXValue, TYValue>;