/** 默认整图宽度(user units),用于 lowering 与 locator 缺省尺寸 */ export declare const DEFAULT_PLOT_WIDTH = 480; /** 默认整图高度(user units),用于 lowering 与 locator 缺省尺寸 */ export declare const DEFAULT_PLOT_HEIGHT = 300; /** label 字号(估算占位 + 实绘 label 共用),无显式 fontSize 时的默认值 */ export declare const DEFAULT_FONT_SIZE = 11; /** 数字字宽经验系数(字宽约等于 0.6em),用于无 measureText 时估算 label 像素宽 */ export declare const CHAR_WIDTH_FACTOR = 0.6; /** 默认刻度线长(user units);axis 与 guide 复用 */ export declare const DEFAULT_AXIS_TICK_LENGTH = 6; /** 默认刻度线到 label 的间距(user units);axis 与 guide 共用 */ export declare const DEFAULT_AXIS_LABEL_GAP = 4; /** 矩形区域(绘图区 plot area 用) */ export type Rect = { /** 左上角 x(user units) */ x: number; /** 左上角 y(user units) */ y: number; /** 宽(user units) */ width: number; /** 高(user units) */ height: number; }; /** 四边留白(整图边缘到 plot area 的距离) */ export type Margins = { /** 顶部留白 */ top: number; /** 右侧留白 */ right: number; /** 底部留白 */ bottom: number; /** 左侧留白 */ left: number; }; /** 四边 legend 预留带宽(user units):legend 占某边时该边在 axis margin 之外再让出的带宽 */ export type LegendReserve = { /** 右侧预留带宽 */ right?: number; /** 左侧预留带宽 */ left?: number; /** 顶部预留带高 */ top?: number; /** 底部预留带高 */ bottom?: number; }; /** * 估算一段文字的像素宽。 * @description plot lowering 在 core compile 前运行、无 measureText,按字符数 * 字号 * 经验系数估算。 * 作为 margin 估算与 guide label 偏移的单一来源,避免多处各算一份 */ export declare const estimateLabelWidth: (text: string, fontSize: number) => number; /** computePlotArea 输入:哪些维度有 axis + 其刻度标签(估算占位用)+ legend 各边预留 */ export type PlotAreaInput = { /** x 维度是否有坐标轴(决定是否留 bottom margin) */ hasXAxis: boolean; /** y 维度是否有坐标轴(决定是否留 left margin) */ hasYAxis: boolean; /** x 轴刻度标签(估算最右 label 半宽防溢出) */ xLabels: ReadonlyArray; /** y 轴刻度标签(估算最宽 label 定 left margin) */ yLabels: ReadonlyArray; /** legend 各边预留带宽(在 axis margin 之外叠加;缺省无 legend 占位) */ legendReserve?: LegendReserve; }; /** computePlotArea 选项:字号 + 用户覆盖 margin */ export type PlotAreaOptions = { /** label 字号(估算 + 实绘共用),默认 DEFAULT_FONT_SIZE */ fontSize?: number; /** layout / decoration 额外预留,只叠加到自动 margin;显式 margin 仍逐边覆盖 */ reserve?: Partial; /** 逐边覆盖估算的 margin */ margin?: Partial; }; /** * 由整图尺寸 + axis 占位估算 plot area(d3 margin convention) * @description margin 仅在对应维度有 axis 时才留;无 axis → 全 0 → plot area = 整图。 * 用户 options.margin 逐边覆盖估算。估算用 fontSize × 字符数,不精确但对数字轴足够(用户可 margin 覆盖)。 * margin 之和 ≥ 尺寸(plot area 非正)→ 抛清晰错误,不静默出退化坏图 */ export declare const computePlotArea: (width: number, height: number, input: PlotAreaInput, options?: PlotAreaOptions) => { plotArea: Rect; margins: Margins; }; /** computePolarCoordinate 输入:哪个维度有角向轴 + 角向刻度标签(估算外圈标签留白用) */ export type PolarCoordinateInput = { /** 是否有角向坐标轴(决定是否为外圈角向标签预留留白) */ hasAngularAxis: boolean; /** 角向刻度标签(估算最宽标签、为外圈留白) */ angularLabels: ReadonlyArray; }; /** computePolarCoordinate 结果:圆心(屏幕坐标)+ 外半径(user units,整圆 bbox 内接) */ export type PolarLayout = { /** 圆心(plot area 中心,屏幕坐标) */ center: [number, number]; /** 外半径(user units,可用外半径,已减角向标签留白) */ outerRadius: number; }; /** * 由整图尺寸估算极坐标布局:圆心 = plot area 中心、外半径 = 可用尺寸减角向标签留白 * @description 按整圆 bbox 定 center / outerRadius。 * 有角向轴时为外圈刻度标签预留一圈留白(按最宽标签估),让标签不溢出画布;调用方只消费本 frame、不回写 layout。 * margin 之大 → 外半径 ≤ 0 → 抛清晰错误,不静默出退化坏图。 */ export declare const computePolarCoordinate: (width: number, height: number, input: PolarCoordinateInput, options?: PlotAreaOptions) => PolarLayout; //# sourceMappingURL=layout.d.ts.map