@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.
21 lines (20 loc) • 916 B
TypeScript
import type { ChartColorLegend, ChartKey, ChartLegendPlacement } from './types.js';
import type { ControlledSignal } from './interaction-signal.js';
export interface InteractiveColorLegendChange<TValue extends ChartKey> {
type: 'toggle';
value: TValue;
visible: boolean;
}
export interface InteractiveColorLegendItemContext {
readonly visible: boolean;
}
export interface InteractiveColorLegendOptions<TValue extends ChartKey> {
visible: ControlledSignal<readonly TValue[], InteractiveColorLegendChange<TValue>>;
placement?: ChartLegendPlacement;
ariaLabel?: string;
itemWidth?: number;
format?: (value: TValue) => string;
itemAriaLabel?: (value: TValue, context: InteractiveColorLegendItemContext) => string;
emptyLabel?: string;
}
export declare function interactiveColorLegend<TValue extends ChartKey>(options: InteractiveColorLegendOptions<TValue>): ChartColorLegend;