import type { BarsSeriesWire, BarsWire } from '../types/bars.type'; import { type NumericFormat } from './v2.util'; /** Apollo rule: a vertical chart with more categories than this renders horizontal. */ export declare const MAX_VERTICAL_CATEGORIES = 8; /** Category labels longer than this are cut with an ellipsis on the axis. */ export declare const MAX_CATEGORY_LABEL_LENGTH = 28; export type BarsRow = Record; export type BarsSeries = BarsSeriesWire & { /** How its values are written: `number`, or `decimal` when any has decimals. */ format: NumericFormat; }; export type BarsDatum = { /** The category, always text. */ category: string; /** One numeric value per series field; `null` when the row has none. */ values: Record; /** Sum of the series values, written at the end of a stacked bar; `null` when every value is missing. */ total: number | null; }; export type BarsModel = { data: BarsDatum[]; series: BarsSeries[]; variant: BarsWire['variant']; stacked: boolean; showLegend: boolean; /** Format of the stack total and of the value axis ticks (decimal if any series is). */ aggregateFormat: NumericFormat; }; /** A vertical chart switches to horizontal above `MAX_VERTICAL_CATEGORIES`. */ export declare const resolveVariant: (variant: BarsWire['variant'], categoryCount: number) => BarsWire['variant']; /** Cuts a long category for the axis; the full text stays in the tooltip. */ export declare const truncateCategory: (category: string) => string; export interface CategoryLabelFit { /** Tilted labels: the band of a category is narrower than its name. */ tilted: boolean; /** Height of the category axis, in px. */ axisHeight: number; } /** * How the category names of a vertical chart are laid out in `width` px: flat * when every (truncated) name fits its band, tilted otherwise, with the axis * tall enough for the longest. A name is never hidden. */ export declare const fitCategoryLabels: (categories: readonly string[], width: number) => CategoryLabelFit; /** * Reads only the fields the wire declares (`x` and each series `field`) from * the rows. Categories are text; values are finite numbers or `null`. */ export declare const toBarsModel: (wire: Pick, rows: readonly BarsRow[]) => BarsModel; /** * Format of a Recharts data key: series are keyed `s`; anything else * (the total key, an out-of-range index) takes the axis format. */ export declare const formatForKey: (model: Pick, dataKey: string) => NumericFormat;