Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

ObjectChart:兑现 ChartConfig 作者形状(type / xAxis.field / yAxis[].field / series[].name)与轴表现属性(framework#3701 对齐) #2880

Closed

Description

@os-zhuang

framework 侧 umbrella:objectstack-ai/objectstack#3729(含完整评估、主流平台参照与方言对照表)。本 issue 是 objectui 侧的实施部分。

背景

spec 的 ChartConfigSchema 是图表协议(ADR-0082 决策 1),按 ECharts/Highcharts 表现层原型订立、词汇库中立;但 ObjectChart 实际读取的是 Recharts 味的内部 props(chartType、xAxisKey、series[].dataKey)。ChartConfig 的 type/xAxis/yAxis/series 抵达渲染器后被静默丢弃——framework#3725 已把 react 契约裁剪为诚实的现状;本 issue 实现终态:渲染器兑现 spec 形状,然后 framework 把契约切回来。实现词汇不再泄漏进作者面,也意味着未来更换图表库不动协议。

S1 — 绑定对齐(小,立即做)

在 ObjectChart 入口做一处规范化(不是散落的 ?? fallback——规范化层是把作者面 spec 形状翻译到内部管线契约的唯一入口):

  • chartType ??= schema.type(ChartType 值)
  • xAxisKey ??= schema.xAxis?.field
  • series[]:dataKey ??= item.name;同时接受 spec ChartSeries 的 label/variant/dashArray/opacity、type→chartType
  • 无 series 时,yAxis?.[0]?.field 作为单序列 dataKey 来源
  • dataset 页面路径(object-chart 组件 properties.yAxis[].field)同入规范化——使 framework validate-chart-bindings §3 的校验从 no-op 变为真实
  • 显式传入的内部 props 优先(DashboardRenderer / ObjectView / dataset 路径等内部调用方继续按现状工作,零迁移)

注意配套约束(framework#3729「协议约束」节):inline aggregate 保持单测度——结果列的原始字段名约定依赖它不碰撞,多测度是 dataset measure 的职责。

S2 — 轴表现属性(中,按需排序)

Recharts 均有原生能力。优先做作者最常要的:

优先:

  • ChartAxis.format → tickFormatter
  • ChartAxis.min/max → domain
  • 双轴:yAxis[].position + series[].yAxis: 'left'|'right'(combo 目前按 series 类型隐式分配,改为显式绑定优先)

次之:

  • ChartAxis.logarithmic → scale('log')
  • ChartAxis.showGridLines → CartesianGrid 开关
  • showLegend(当前无人读)、title/subtitle 真实渲染(当前 title 仅用于下钻抽屉标题)、showDataLabels 盘点

S3 — 实现或上报裁减(优先级:stack > annotations > interaction)

  1. series.stack(提为最优先):堆叠/分组柱是所有 BI 的桌面赌注;framework chart.zod.ts 的 taxonomy 注释自己承认 stacked-bar/stacked-area 变体被裁是因为渲染器画不出——是渲染器缺陷,不是协议取舍。实现后这些变体可回归 taxonomy。
  2. annotations(ReferenceLine/ReferenceArea)。
  3. interaction(zoom/brush/clickAction)——最可裁;实现不了就反馈到 framework#3729,按 Fix Studio metadata admin translations #1475 先例从 schema 裁减(deliberate spec change)。

验收

  • S1 落地后通知 framework#3729 执行契约/lint 切换
  • 每级配组件测试;S1 需覆盖「spec 形状与内部 props 并存时内部优先」「dataset 页面 yAxis[].field 生效」

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions