@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) • 660 B
TypeScript
import type { ChartKey, ResolvedColorScale } from './types.js';
export interface CategoricalLegendItem<TValue extends ChartKey = ChartKey> {
key: string;
value: TValue;
label: string;
color: string;
}
export interface CategoricalLegendLayout {
columns: number;
rows: number;
itemWidth: number;
}
export declare function resolveCategoricalLegendItems<TValue extends ChartKey = ChartKey>(colors: ResolvedColorScale, format?: (value: TValue) => string): readonly CategoricalLegendItem<TValue>[];
export declare function layoutCategoricalLegendItems(itemCount: number, width: number, minimumItemWidth: number): CategoricalLegendLayout;