import { IRGradientStop, IRNode, IRScope } from '@retikz/core'; import { CoordinateFrame, GuideContext, LoweredGuide, ProvenanceContext } from '../../contract'; import { ResolvedLegendGuideTokens } from '../../providers'; import { IRPlotAxisGuide, LegendChannelValue, LegendOrientValue, LegendPositionValue } from '../../schemas'; import { Rect } from '../../shared'; /** * 自定义坐标系的曲线轴(通用 path-aware 轴):沿 projectRoles 投影密采样画轴线 + 在 scale 刻度处放刻度 / 标签 * @description 取该维度的位置 scale 刻度、其余角色锚在各自 scale 首刻度(≈ domain 起点),按 frame.roles 序喂 projectRoles * 得轴线(任意曲线)与刻度点;刻度短线 / 标签沿局部切向的法线摆。frame 无 roleScales[dimension] → 不画(返回空)。 * 通用性即「轴 = 参数路径」:直线 / 拱 / 圆 / 螺旋同一套画法。自定义坐标系暂不生成网格 */ export declare const lowerCustomAxis: (frame: CoordinateFrame, guide: IRPlotAxisGuide, fontSize: number, context: ProvenanceContext | undefined) => LoweredGuide; /** * 把一个 axis guide 下沉成网格层 + 轴层(各自一层 core scope;样式上提到 scope) * @description 按坐标帧分支:polar(ctx.frame 存在)按维度角色走 angular(外圆弧 + 圆周刻度 / 标签 + 角向辐条 grid) * 或 radial(辐条轴 + 同心环 grid);否则走 cartesian 直线轴 / 网格。 * 下沉目标统一是 core Node(标签)+ Path(直段 / arc step)。id → 轴层 scope.id(anchor 预留) */ export declare const lowerGuide: (guide: IRPlotAxisGuide, ctx: GuideContext, context?: ProvenanceContext) => LoweredGuide; /** legend swatch 边长(user units);离散色块 / 形状框 / size 符号格的基准格尺寸 */ export declare const LEGEND_SWATCH_SIZE = 14; /** legend swatch 到标签的水平间距(user units) */ export declare const LEGEND_LABEL_GAP = 6; /** legend 条目间的行 / 列距(user units) */ export declare const LEGEND_ENTRY_GAP = 6; /** legend 标题到首条目的间距(user units) */ export declare const LEGEND_TITLE_GAP = 6; /** 连续色带 ramp 的长边长度(user units) */ export declare const LEGEND_RAMP_LENGTH = 100; /** 连续色带 ramp 的短边宽度(user units) */ export declare const LEGEND_RAMP_THICKNESS = 12; /** * 一个离散 legend 条目:swatch 视觉量 + 标签 * @description color = 色块填充;shape = glyph 名(形状 swatch);radius = size 梯度符号半径;opacity = 透明度块。 * 一个条目按 channel 取其中一种视觉量;label 是已格式化的文本(formatter 在 expand 侧据 fieldType 选定) */ export type LegendEntry = { /** 条目标签(类别串 / 代表值 / 区间) */ label: string; /** 色块填充色(color / 分箱 swatch) */ color?: string; /** glyph 形状名(shape swatch) */ shape?: string; /** glyph 视觉盒尺寸(shape swatch) */ symbolSize?: number; /** size 梯度符号半径(px) */ radius?: number; /** 透明度(opacity 块;0..1) */ opacity?: number; }; /** 连续色带 ramp:渐变 stop(offset 0..1 + 色)+ 沿带刻度(offset 0..1 + 标签) */ export type LegendRamp = { /** 渐变 stop(喂 core linearGradient paint server) */ stops: Array; /** 沿带刻度标签(offset 0..1) */ ticks: Array<{ offset: number; label: string; }>; }; /** * lowerLegend 入参:已解析的 legend 内容(形态 + 条目 / ramp + 摆放) * @description 形态选择(swatch / ramp)与颜色 / 代表值由 expand 据 descriptor + scale 求好后传入; * 本函数只管几何摆放与 core 节点产出(关注点分离:求值在 expand、绘制在 guide) */ export type LegendInput = { /** 形态:swatch(离散 / 分箱 / size / opacity)或 ramp(连续色带) */ form: 'swatch' | 'ramp'; /** 绑定通道(决定 swatch 视觉量取色 / 形状 / 半径 / 透明度) */ channel: LegendChannelValue; /** 标题(缺省 = 绑定字段名;undefined → 不画标题) */ title?: IRNode['text']; /** 离散条目(form==='swatch') */ entries: Array; /** 连续色带(form==='ramp') */ ramp?: LegendRamp; /** 摆放位置(预留带所在边) */ position: LegendPositionValue; /** 条目排布方向 */ orient: LegendOrientValue; /** label 字号 */ fontSize: number; /** 预留带矩形(plotArea 旁的 legend 带;条目从带左上角起摆) */ band: Rect; /** legend scope id(稳定,'legend' 前缀;anchor / 识别用) */ id?: string; /** legend 语义图层的 core zIndex */ zIndex?: number; /** 已按 built-in theme < PlotSpec.theme < LegendGuide.style 合并的视觉 token */ style: ResolvedLegendGuideTokens; }; /** * 把已解析的 legend 内容下沉成一个 core scope(swatch / ramp + 标签) * @description swatch 形态:每条目一个矩形 swatch Node(shape rectangle,填 color / opacity;size 条目额外一个圆点 Node)+ 一个标签 Node,纵 / 横堆叠; * ramp 形态:一个矩形 Node 填 core linearGradient paint server(连续真渐变)+ 沿带刻度标签 Node。 * 条目几何在传入 band 内从左上角起摆,受无文字度量约束(plot-design §13.1):超 band 溢出可接受、不做测量自适应。 * 下沉目标统一是 core Node(标签 / swatch / ramp 矩形 / size 圆点),纯 JSON */ export declare const lowerLegend: (input: LegendInput) => IRScope; //# sourceMappingURL=guide.d.ts.map