/** * Shared chart rendering helpers — colors, axes, SVG primitives, legend, * value formatting. Used by the per-chart renderers in [charts.ts] and the * tooltip zones in [chart-tooltip.ts]. */ import type { ComponentNode, RenderContext } from '../engine.js'; export declare const COLORS: string[]; export declare const AXIS_COLOR = "var(--muted-foreground, #6b7280)"; export declare const GRID_COLOR = "var(--border, #e5e7eb)"; export declare const AXIS_FONT = "10"; export interface SeriesEntry { dataKey: string; label?: string; color?: string; yAxisId?: 'left' | 'right'; tooltipFormat?: string; } export interface ChartLayout { /** Usable plot area after axis padding */ plotLeft: number; plotRight: number; plotTop: number; plotBottom: number; plotWidth: number; plotHeight: number; } /** Compute chart layout accounting for optional Y-axis label space. */ export declare function chartLayout(svgWidth: number, svgHeight: number, hasYAxis: boolean, hasYAxisRight?: boolean): ChartLayout; /** Draw Y-axis labels + optional horizontal grid lines into SVG. */ export declare function drawYAxis(svg: SVGSVGElement, layout: ChartLayout, max: number, showGrid: boolean, format?: string): void; /** Draw secondary Y-axis labels on the right side of the plot. */ export declare function drawYAxisRight(svg: SVGSVGElement, layout: ChartLayout, max: number, format?: string): void; /** Draw X-axis labels under the plot area. */ export declare function drawXAxisLabels(svg: SVGSVGElement, data: Record[], xAxisKey: string, getX: (index: number) => number, yBase: number, format?: (raw: unknown) => string): void; /** Draw a baseline (X-axis line) at the bottom of the plot. */ export declare function drawBaseline(svg: SVGSVGElement, layout: ChartLayout): void; /** Apply a pipe expression to a value using the Rx engine. */ export declare function applyPipeFormat(value: unknown, pipe: string, ctx: RenderContext): string; export declare function formatYValue(value: number, format?: string): string; /** * Effective value-axis / tooltip format for a chart node. * * `valueFormat` (protocol 0.3 / upstream PR #454) is the canonical field; * `yAxisFormat` remains a TS-only override for the left axis of dual-axis * charts. `"auto"` (upstream's default) means "no explicit format". */ export declare function resolveValueFormat(node: ComponentNode): string | undefined; /** Create a format callback for tooltip entries that handles per-axis formats + null. */ export declare function makeTooltipFormatter(ctx: RenderContext, yAxisFormat?: string, yAxisRightFormat?: string): (raw: unknown, s: SeriesEntry) => string; export declare function createSvg(width: number, height: number, chartType?: string): SVGSVGElement; /** Create an SVG element with string-coerced attributes. */ export declare function svgEl(tag: K, attrs: Record): SVGElementTagNameMap[K]; /** Create an SVG element with content. */ export declare function svgText(attrs: Record, text: string): SVGTextElement; /** Polar → SVG coords (degrees, math convention with screen y flipped). */ export declare function polar(cx: number, cy: number, r: number, angleDeg: number): { x: number; y: number; }; /** Sampled arc stroke path between two angles — avoids large-arc/sweep flag math. */ export declare function arcPath(cx: number, cy: number, r: number, a1: number, a2: number): string; export declare function addLegend(wrapper: HTMLElement, series: SeriesEntry[], show?: boolean): void; //# sourceMappingURL=chart-helpers.d.ts.map