@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.
56 lines (55 loc) • 2.99 kB
TypeScript
import type { Channel, ChartKey, ChartMark, ChartMarkMotionOptions, ChartMarkState, ChartBarStateStyle, ChartValue, OptionChannelOutput, VisualChannel } from './types.js';
import type { GroupLayout } from './group.js';
import type { StackLayout } from './stack.js';
type BarLayout = GroupLayout | StackLayout;
export interface BarYOptions<TDatum> extends ChartMarkMotionOptions<TDatum> {
id?: string;
x?: Channel<TDatum, ChartValue | null | undefined>;
y?: Channel<TDatum, number | null | undefined>;
y1?: number | Channel<TDatum, number | null | undefined>;
y2?: number | Channel<TDatum, number | null | undefined>;
z?: Channel<TDatum, ChartKey | null | undefined>;
color?: Channel<TDatum, ChartKey | null | undefined>;
key?: Channel<TDatum, ChartKey>;
fill?: VisualChannel<TDatum, string>;
fillOpacity?: number;
stroke?: VisualChannel<TDatum, string>;
strokeOpacity?: number;
strokeWidth?: number;
strokeDasharray?: VisualChannel<TDatum, string>;
layout?: BarLayout;
/** Pixels removed from both categorical edges after band layout. */
inset?: number;
/** Maximum painted width in pixels after grouping and inset. */
maxThickness?: number;
radius?: number;
states?: readonly ChartMarkState<TDatum, ChartBarStateStyle<TDatum>>[];
}
export interface BarXOptions<TDatum> extends ChartMarkMotionOptions<TDatum> {
id?: string;
x?: Channel<TDatum, number | null | undefined>;
x1?: number | Channel<TDatum, number | null | undefined>;
x2?: number | Channel<TDatum, number | null | undefined>;
y?: Channel<TDatum, ChartValue | null | undefined>;
z?: Channel<TDatum, ChartKey | null | undefined>;
color?: Channel<TDatum, ChartKey | null | undefined>;
key?: Channel<TDatum, ChartKey>;
fill?: VisualChannel<TDatum, string>;
fillOpacity?: number;
stroke?: VisualChannel<TDatum, string>;
strokeOpacity?: number;
strokeWidth?: number;
strokeDasharray?: VisualChannel<TDatum, string>;
layout?: BarLayout;
/** Pixels removed from both categorical edges after band layout. */
inset?: number;
/** Maximum painted height in pixels after grouping and inset. */
maxThickness?: number;
radius?: number;
states?: readonly ChartMarkState<TDatum, ChartBarStateStyle<TDatum>>[];
}
export declare function barY<TDatum>(source: Iterable<TDatum>): ChartMark<TDatum, number, number>;
export declare function barY<TDatum, const TOptions extends BarYOptions<NoInfer<TDatum>> | undefined>(source: Iterable<TDatum>, options: TOptions): ChartMark<TDatum, OptionChannelOutput<TDatum, TOptions, 'x', number>, number>;
export declare function barX<TDatum>(source: Iterable<TDatum>): ChartMark<TDatum, number, number>;
export declare function barX<TDatum, const TOptions extends BarXOptions<NoInfer<TDatum>> | undefined>(source: Iterable<TDatum>, options: TOptions): ChartMark<TDatum, number, OptionChannelOutput<TDatum, TOptions, 'y', number>>;
export {};