import type { Canvas2D, Context2D } from "../charts/canvas-types"; import { PlotLayout } from "../layout/plot-layout"; import { type CategoricalDomain } from "./categorical-axis"; import type { AxisDomain } from "./numeric-axis"; import type { Theme } from "../theme/theme"; /** * The category-axis side of a bar chart can render as either a * stringified hierarchical category axis or a true numeric axis (when * the single group_by level is date / datetime / integer / float). * Both shapes flow through `renderBarAxesChrome`; the discriminator is * the `mode` field. */ export type BarCategoryAxis = { mode: "category"; domain: CategoricalDomain; } | { mode: "numeric"; domain: AxisDomain; ticks: number[]; }; export type BarValueAxis = { mode: "category"; domain: CategoricalDomain; } | { mode: "numeric"; domain: AxisDomain; ticks: number[]; }; /** * Render a numeric date-aware axis along the bottom of the plot. Aliases * the bar-axis bottom variant so heatmap can share the implementation. */ export declare function drawNumericCategoryX(ctx: Context2D, layout: PlotLayout, domain: AxisDomain, ticks: number[], theme: Theme, formatter?: (v: number) => string): void; export declare function drawNumericCategoryY(ctx: Context2D, layout: PlotLayout, domain: AxisDomain, ticks: number[], theme: Theme, formatter?: (v: number) => string): void; /** * Render bar-chart chrome: L-shaped axis lines, a categorical axis * (bottom for Y Bar, left for X Bar), and one or two numeric axes on * the opposite sides. * * `isHorizontal=true` flips orientation for X Bar: categorical axis on * the left, numeric axes on the bottom (and top for dual-axis). The * `altDomain`/`altTicks` arguments always describe the *secondary* * numeric axis regardless of orientation. */ export interface BarAxesFormatters { /** Formatter for the value (Y in vertical, X in horizontal) axis. */ value?: (v: number) => string; /** Formatter for the secondary alt value axis. */ alt?: (v: number) => string; /** Formatter for the numeric category axis (when `catAxis.mode === "numeric"`). */ category?: (v: number) => string; } export declare function renderBarAxesChrome(canvas: Canvas2D, catAxis: BarCategoryAxis, valueAxis: BarValueAxis, layout: PlotLayout, theme: Theme, dpr: number, altAxis: BarValueAxis | undefined, isHorizontal?: boolean, formatters?: BarAxesFormatters): void; /** * Render gridlines at the numeric axis ticks. In vertical bar charts * the gridlines run horizontally at numeric Y ticks; in horizontal bar * charts they run vertically at numeric X ticks. */ export declare function renderBarGridlines(canvas: Canvas2D, layout: PlotLayout, valueTicks: number[], theme: Theme, dpr: number, isHorizontal?: boolean): void;