import type { BarChartConfig } from "./bar_chart"; import type { GanttChartConfig } from "./gantt_chart"; import { type ChartTheme } from "./theme"; import type { LineChartConfig, ScatterChartConfig } from "./types"; /** * A Vega-Lite top-level spec. Loosely typed on purpose — the object *is* the * portable intermediate language, produced identically here (TypeScript) and * by the Python package, then rendered either by vega-embed (web) or by the * matplotlib translator (paper). Keep these builders pure and free of DOM / * engine references so they stay node-testable and reusable on both sides. */ export type VegaLiteSpec = Record; export declare const VL_SCHEMA = "https://vega.github.io/schema/vega-lite/v6.json"; export interface SpecSize { width?: number | "container"; height?: number; } /** Continuous channels that can carry a scale binding. */ export type ZoomChannel = "x" | "y"; /** One scale-bound interval selection per zoomable axis. */ export declare const ZOOM_PARAM: { readonly x: "zoomX"; readonly y: "zoomY"; }; /** * Flags `VegaChart` stamps on a wheel event to say which axis gutter the * pointer is over. * * A Vega event filter is compiled without the signal scope object, so it can * call the geometry functions (`x()`, `y()`) but throws `ReferenceError: _ is * not defined` the moment it reads a signal. That rules out the expression the * region test wants — `y() > height` — because `height` is a signal. Hence the * test happens where the geometry is knowable and arrives here as a boolean. */ export declare const ZOOM_EVENT_FLAG: { readonly x: "molplotZoomX"; readonly y: "molplotZoomY"; }; /** A scale-bound interval selection, one per zoomable axis. */ export interface ZoomParam { name: string; bind: "scales"; select: { type: "interval"; encodings: ZoomChannel[]; zoom: string; }; } /** * The zoom params a builder attached, wherever it legally placed them: top * level for a unit spec, `layer[0]` for a layered one. Empty for a spec that * never went through a builder (`RawChart`). */ export declare function zoomParamsOf(spec: VegaLiteSpec): ZoomParam[]; /** * Pan/zoom, one param per continuous axis: drag pans, wheel over an axis * gutter zooms that axis alone, Shift+wheel zooms every bound axis, double * click resets. * * The `view:` source matters. Vega-Lite's default for a scale binding is * `scope` — the plot group — but axes render with `pointer-events: none`, so a * wheel over an axis falls through to the SVG root and never enters that * group. `view:` listens on the chart's own element instead, which both catches * the axis wheel and keeps sibling charts on the page from reacting to it. * * `|| event.shiftKey` keeps the spec self-sufficient: Shift+wheel zooms even * when nobody is stamping the event (a raw `vegaEmbed` of this spec, the docs). * * `bind: "scales"` attaches a `domainRaw` signal that outranks the computed * domain, so `zero` / `nice` / an explicit `domain` still choose the *initial* * view and the interaction owns the view from then on. * * Pass only continuous channels; binding a band scale warns "Scale bindings are * currently only supported for scales with unbinned, continuous domains." * * Inert outside the browser: the matplotlib translator and vl-convert both * ignore `params` and render the initial view. */ export declare function interactionParams(channels: ZoomChannel[]): ZoomParam[]; /** LINE — one path per series, per-series width/opacity via nominal scales. */ export declare function lineSpec(config: LineChartConfig, theme: ChartTheme, spec?: SpecSize): VegaLiteSpec; /** SCATTER — points + optional highlight ring + optional colour channel. */ export declare function scatterSpec(config: ScatterChartConfig, theme: ChartTheme, spec?: SpecSize): VegaLiteSpec; /** BAR — stack / group / overlay, vertical or horizontal, line-over-bars. */ export declare function barSpec(config: BarChartConfig, theme: ChartTheme, spec?: SpecSize): VegaLiteSpec; /** GANTT — one time-spanning bar per task, coloured by status group. */ export declare function ganttSpec(config: GanttChartConfig, theme: ChartTheme, spec?: SpecSize): VegaLiteSpec;