import { VegaChart } from "./chart_base"; import { type VegaLiteSpec } from "./specs"; import type { ChartTheme } from "./theme"; import type { AxisConfig, LegendConfig, ThemeMode } from "./types"; export interface BarPoint { x: number | string; y: number; /** Optional per-bar text used by the tooltip. */ text?: string; /** Optional payload echoed back in ``onBarClick``. */ customdata?: unknown; } export interface BarSeriesConfig { id: string; label?: string; color?: string; points: BarPoint[]; /** * Trace type for this series. Defaults to ``"bar"``; ``"line"`` overlays as * a line over stacked / grouped bars (e.g. a "Started" reference line on top * of "Succeeded/Failed" bars). */ type?: "bar" | "line"; /** Retained for API compatibility; tooltips are preset-driven. */ hovertemplate?: string; } export type BarMode = "stack" | "group" | "overlay"; export interface BarChartConfig { series: BarSeriesConfig[]; /** Default ``"group"`` (side-by-side). */ mode?: BarMode; /** Bar orientation: ``"v"`` (default) draws ``y`` over ``x``; ``"h"`` flips them. */ orientation?: "v" | "h"; xAxis?: AxisConfig & { dtype?: "category" | "date" | "linear"; }; yAxis?: AxisConfig & { dtype?: "category" | "date" | "linear"; }; /** Show legend strip. Default false. */ showLegend?: boolean; /** Legend orientation / position overrides; honoured only when ``showLegend`` is true. */ legend?: LegendConfig; /** Interaction toolbar visible. Default false. */ modebar?: boolean; /** Retained for API compatibility; advisory under the Vega renderer. */ modebarRemove?: string[]; /** Gap between bars as a band-scale padding fraction. */ bargap?: number; theme?: ThemeMode; /** Named preset from presets/*.json. Default "molplot". */ preset?: string; /** ``hovermode``; retained for API compatibility. */ hovermode?: "closest" | "x" | "x unified"; } export interface BarClickEvent { seriesId: string; index: number; x: number | string; y: number; customdata?: unknown; } type ClickListener = (e: BarClickEvent) => void; /** * Categorical / time bar chart. Stacking & grouping are picked via * {@link BarChartConfig.mode}; a `type:"line"` series overlays as a line that * tracks the cumulative stack total. Mirrors {@link LineChart}'s lifecycle. */ export declare class BarChart extends VegaChart { private config; private readonly clickListeners; constructor(container: HTMLElement, config: BarChartConfig); update(partial: Partial): Promise; onBarClick(cb: ClickListener): () => void; private barRows; private lineRows; protected datasets(): Record; protected buildSpec(theme: ChartTheme, sizeHint: { width: number; height: number; }): VegaLiteSpec; protected onDatum(datum: Record): void; } export {};