import type { Path2D } from "../../widgets/utils/path-builder"; export type Extents2D = { minX: number; maxX: number; minY: number; maxY: number; }; export type FinalizedSvg = { svgBody: string; vbMinX: number; vbMinY: number; width: number; height: number; }; export interface CanvasOptions { chartArea: { left: number; top: number; width: number; height: number; }; fontPxDefault: number; lineHeightDefault: number; } export interface Canvas { clipId: string; drawInClippedRegion(renderFn: (clippedCanvas: Canvas) => void): void; drawText(opts: { x: number; y: number; text: string; anchor?: "start" | "middle" | "end"; dominantBaseline?: "hanging" | "middle" | "baseline"; fontPx?: number; fontWeight?: "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"; paintOrder?: "stroke fill"; stroke?: string; strokeWidth?: number | string; fill?: string; opacity?: number; strokeOpacity?: number; fillOpacity?: number; transform?: string; rotate?: { angle: number; cx: number; cy: number; }; }): void; drawWrappedText(opts: { x: number; y: number; text: string; className?: string; maxWidthPx: number; anchor?: "start" | "middle" | "end"; fontPx?: number; lineHeight?: number; fontWeight?: "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"; paintOrder?: "stroke fill"; stroke?: string; strokeWidth?: number | string; fill?: string; opacity?: number; strokeOpacity?: number; fillOpacity?: number; transform?: string; rotate?: { angle: number; cx: number; cy: number; }; dominantBaseline?: "auto" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "middle"; }): void; drawLine(x1: number, y1: number, x2: number, y2: number, style: { stroke: string; strokeWidth: number; dash?: string; strokeLinecap?: "butt" | "round" | "square"; strokeLinejoin?: "miter" | "round" | "bevel"; strokeMiterlimit?: number; markerStart?: string; markerMid?: string; markerEnd?: string; opacity?: number; strokeOpacity?: number; transform?: string; }): void; drawCircle(cx: number, cy: number, r: number, style: { fill?: string; stroke?: string; strokeWidth?: number; dash?: string; fillPatternId?: string; opacity?: number; fillOpacity?: number; strokeOpacity?: number; transform?: string; }): void; drawRect(x: number, y: number, w: number, h: number, style: { fill?: string; stroke?: string; strokeWidth?: number; dash?: string; fillPatternId?: string; opacity?: number; fillOpacity?: number; strokeOpacity?: number; transform?: string; }): void; drawEllipse(cx: number, cy: number, rx: number, ry: number, style: { fill?: string; stroke?: string; strokeWidth?: number; dash?: string; fillPatternId?: string; opacity?: number; fillOpacity?: number; strokeOpacity?: number; transform?: string; }): void; drawPath(path: Path2D, style: { fill?: string; stroke?: string; strokeWidth?: number; dash?: string; strokeLinecap?: "butt" | "round" | "square"; strokeLinejoin?: "miter" | "round" | "bevel"; strokeMiterlimit?: number; fillRule?: "nonzero" | "evenodd"; markerStart?: string; markerMid?: string; markerEnd?: string; opacity?: number; fillOpacity?: number; strokeOpacity?: number; transform?: string; }): void; drawPolygon(points: Array<{ x: number; y: number; }>, style: { fill?: string; stroke?: string; strokeWidth?: number; dash?: string; fillRule?: "nonzero" | "evenodd"; strokeLinejoin?: "miter" | "round" | "bevel"; strokeMiterlimit?: number; opacity?: number; fillOpacity?: number; strokeOpacity?: number; transform?: string; }): void; drawPolyline(points: Array<{ x: number; y: number; }>, style: { stroke: string; strokeWidth: number; dash?: string; strokeLinecap?: "butt" | "round" | "square"; strokeLinejoin?: "miter" | "round" | "bevel"; strokeMiterlimit?: number; opacity?: number; strokeOpacity?: number; transform?: string; }): void; drawForeignObject(opts: { x: number; y: number; width: number; height: number; content: string; transform?: string; }): void; drawImage(opts: { x: number; y: number; width: number; height: number; href: string; preserveAspectRatio?: string; opacity?: number; transform?: string; }): void; drawLegendBlock(opts: { startX: number; startY: number; rows: Array<{ sample: { stroke: string; strokeWidth: number; dash?: string; marker?: "circle" | "square"; }; label: string; }>; rowGapPx: number; labelFontPx?: number; sampleLengthPx?: number; }): void; addDef(def: string): void; addStyle(cssRules: string): void; withTransform(transform: string, renderFn: () => void): void; addHatchPattern(opts: { id: string; color: string; strokeWidth: number; spacing?: number; angleDeg?: number; }): void; addLinearGradient(opts: { id: string; stops: Array<{ offset: string; color: string; }>; x1?: string; y1?: string; x2?: string; y2?: string; gradientUnits?: "objectBoundingBox" | "userSpaceOnUse"; }): void; addRadialGradient(opts: { id: string; stops: Array<{ offset: string; color: string; }>; cx?: string; cy?: string; r?: string; fx?: string; fy?: string; gradientUnits?: "objectBoundingBox" | "userSpaceOnUse"; }): void; finalize(padPx: number): FinalizedSvg; } export interface AxisPlacementOptions { axisPlacement: "leftEdge" | "internalZero"; titlePadding?: number; tickLength?: number; labelPadding?: number; axisTitleFontPx?: number; } export declare function calculateYAxisLayoutAxisAware(yAxis: { max: number; min: number; tickInterval: number; label: string; }, xAxis: { min: number; max: number; }, svgWidth: number, chartHeightPx: number, pads: { top: number; right: number; bottom: number; }, opts: AxisPlacementOptions): { leftMargin: number; yAxisLabelX: number; anchorX: number; }; /** * Calculates the required bottom margin and X-axis title position for a chart. * @param hasTickLabels - Whether the chart has tick labels on the X-axis * @param titlePadding - Optional spacing between tick labels and title (default: 25px) * @returns An object containing the calculated `bottomMargin` and `xAxisTitleY` position. */ export declare function calculateXAxisLayout(hasTickLabels?: boolean, titlePadding?: number): { bottomMargin: number; xAxisTitleY: number; }; /** * Calculates the required right margin and right Y-axis title position for a chart. * @param yAxisRight - The right Y-axis configuration object (null if no right axis). * @param titlePadding - Optional spacing between tick labels and title (default: 20px) * @returns An object containing the calculated `rightMargin` and `rightYAxisLabelX` position. */ export declare function calculateRightYAxisLayout(yAxisRight: { max: number; min: number; tickInterval: number; label: string; } | null, titlePadding?: number): { rightMargin: number; rightYAxisLabelX: number; }; /** * NEW: Calculates the required left margin for a horizontal bar chart's categorical Y-axis. * It measures the actual category labels to ensure the margin is always sufficient. * * @param yAxisLabels - An array of the string labels for the Y-axis categories. * @param labelPadding - Optional spacing between the axis line and the labels (default: 10px). * @returns An object containing the calculated `leftMargin`. */ export declare function calculateHorizontalBarChartYAxisLayout(yAxisLabels: string[], labelPadding?: number): { leftMargin: number; }; /** * Calculates dynamic title positioning with proper spacing that adapts to title length. * Provides bulletproof title placement that prevents clipping regardless of title length. * @param title - The title text to measure * @param maxTitleWidth - Available width for the title (typically width - 60px) * @param customTopMargin - Override for special cases (optional) * @returns Object with titleY position, topMargin, and estimated title height */ export declare function calculateTitleLayout(title?: string, maxTitleWidth?: number, customTopMargin?: number): { titleY: number; topMargin: number; estimatedTitleHeight: number; }; /** * Calculates layout for a dedicated line legend area positioned outside the chart. * Prevents label conflicts with curves, points, and axis elements. * @param lineCount - Number of line labels to accommodate * @param chartRight - Right edge of chart area (pad.left + chartWidth) * @param chartTop - Top edge of chart area (pad.top) * @param legendSpacing - Vertical spacing between legend items (default: 18px) * @returns Object with legend positioning and required right margin */ export declare function calculateLineLegendLayout(_lineCount: number, chartRight: number, chartTop: number, legendSpacing?: number): { legendAreaX: number; legendStartY: number; legendSpacing: number; requiredRightMargin: number; }; /** * Selects a deterministic, non-overlapping subset of labels for an axis. * This is the unified function for all numeric and categorical axes. * It ensures visually uniform spacing by calculating a single `step` and applying it * consistently across all candidate labels. */ export declare function selectAxisLabels(inputs: { labels: string[]; positions: number[]; axisLengthPx: number; orientation: "horizontal" | "vertical"; fontPx: number; minGapPx: number; avgCharWidthPx?: number; }): Set; //# sourceMappingURL=layout.d.ts.map