@chengxianglibra/dsh-data-analysis 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/README.md +139 -53
  2. package/cordis.patch.yml +1 -1
  3. package/lib/bin/environment.js +9 -7
  4. package/lib/bin/presentation-lint.js +21 -0
  5. package/lib/bridges.js +2 -2
  6. package/lib/client/credentials/changes.js +74 -0
  7. package/lib/client/credentials/create-datasource.js +171 -0
  8. package/lib/client/credentials/credential-draft.js +42 -0
  9. package/lib/client/credentials/defaults.js +11 -0
  10. package/lib/client/credentials/descriptions.js +46 -0
  11. package/lib/client/credentials/install.js +319 -0
  12. package/lib/client/credentials/model.js +766 -0
  13. package/lib/client/credentials/report-publishing.js +96 -0
  14. package/lib/client/credentials/styles.js +21 -0
  15. package/lib/client/i18n/context.js +22 -0
  16. package/lib/client/i18n/copy.js +57 -0
  17. package/lib/client/i18n/credentials.js +475 -0
  18. package/lib/client/i18n/host.js +27 -0
  19. package/lib/client/i18n/navigation.js +41 -0
  20. package/lib/client/i18n/presentation.js +577 -0
  21. package/lib/client/i18n/python.js +36 -0
  22. package/lib/client/i18n/semantic.js +441 -0
  23. package/lib/client/input-context.js +21 -0
  24. package/lib/client/python-tool/card.js +35 -0
  25. package/lib/client/python-tool/execution-error.js +35 -0
  26. package/lib/client/python-tool/install.js +9 -0
  27. package/lib/client/python-tool/model.js +101 -0
  28. package/lib/client/right-tabs/install.js +535 -0
  29. package/lib/client/right-tabs/live-delivery.js +58 -0
  30. package/lib/client/right-tabs/navigation.js +47 -0
  31. package/lib/client/right-tabs/page.js +178 -0
  32. package/lib/client/right-tabs/styles.js +11 -0
  33. package/lib/client/rpc.js +5 -0
  34. package/lib/client/semantic-reference.js +10 -0
  35. package/lib/client/workspace-header-action.js +24 -0
  36. package/lib/client/workspace-shortcuts.js +26 -0
  37. package/lib/client.js +1250 -730
  38. package/lib/compatibility.js +2 -2
  39. package/lib/datasource/authoring.js +109 -0
  40. package/lib/datasource/bridge-programs.js +42 -27
  41. package/lib/datasource/bridge.js +144 -9
  42. package/lib/datasource/changes-contract.js +41 -0
  43. package/lib/datasource/changes.js +49 -0
  44. package/lib/datasource/configure.js +39 -0
  45. package/lib/datasource/defaults.js +25 -0
  46. package/lib/datasource/index.js +4 -2
  47. package/lib/datasource/python-options.js +21 -0
  48. package/lib/datasource/python.js +206 -0
  49. package/lib/datasource/resolver-program.js +112 -0
  50. package/lib/datasource/rpc.js +150 -0
  51. package/lib/datasource/service.js +962 -0
  52. package/lib/datasource/shell-env.js +2 -333
  53. package/lib/datasource/test.js +25 -51
  54. package/lib/disclosure/activation.js +19 -7
  55. package/lib/disclosure/execution-guidance.js +52 -0
  56. package/lib/disclosure/help.js +4 -1
  57. package/lib/environment/binding.js +54 -9
  58. package/lib/environment/runtime.js +120 -108
  59. package/lib/environment/subprocess.js +6 -1
  60. package/lib/environment/summary.js +3 -3
  61. package/lib/environment/workspace.js +23 -1
  62. package/lib/index.js +1 -1
  63. package/lib/lifecycle.js +33 -0
  64. package/lib/plugin-agents.js +154 -0
  65. package/lib/plugin.js +172 -133
  66. package/lib/presentation/asset.js +34 -0
  67. package/lib/presentation/assets/portable.js +606 -0
  68. package/lib/presentation/assets/static.js +1216 -0
  69. package/lib/presentation/build/index.js +72 -0
  70. package/lib/presentation/commit.js +163 -0
  71. package/lib/presentation/contracts/asset-path.js +9 -0
  72. package/lib/presentation/contracts/catalog.js +62 -0
  73. package/lib/presentation/contracts/charts.js +453 -0
  74. package/lib/presentation/contracts/editing.js +58 -0
  75. package/lib/presentation/contracts/index.js +663 -0
  76. package/lib/presentation/contracts/interaction.js +62 -0
  77. package/lib/presentation/contracts/types.js +15 -0
  78. package/lib/presentation/contracts/values.js +28 -0
  79. package/lib/presentation/delivery.js +71 -0
  80. package/lib/presentation/export-html.js +214 -0
  81. package/lib/presentation/files.js +82 -0
  82. package/lib/presentation/index.js +6 -0
  83. package/lib/presentation/lint.js +46 -0
  84. package/lib/presentation/projection/files.js +85 -0
  85. package/lib/presentation/projection/index.js +196 -0
  86. package/lib/presentation/projection/program.js +137 -0
  87. package/lib/presentation/projection/sql-code.js +79 -0
  88. package/lib/presentation/receipt.js +34 -0
  89. package/lib/presentation/reports.js +219 -0
  90. package/lib/presentation/rpc.js +186 -0
  91. package/lib/presentation/tool.js +118 -0
  92. package/lib/python-execution-contracts.js +1 -0
  93. package/lib/python-execution.js +232 -0
  94. package/lib/report-publishing/adapters.js +111 -0
  95. package/lib/report-publishing/config.js +69 -0
  96. package/lib/report-publishing/service.js +180 -0
  97. package/lib/rpc.js +49 -0
  98. package/lib/semantic-browser/contracts.js +97 -0
  99. package/lib/semantic-browser/definition.js +64 -0
  100. package/lib/semantic-browser/program.js +129 -0
  101. package/lib/semantic-browser/service.js +106 -0
  102. package/lib/semantic-reference/bridge.js +127 -0
  103. package/lib/semantic-reference/contracts.js +127 -0
  104. package/lib/semantic-reference/environment.js +56 -0
  105. package/lib/semantic-reference/index.js +3 -0
  106. package/lib/semantic-reference/labels.js +16 -0
  107. package/lib/semantic-reference/rpc.js +143 -0
  108. package/lib/semantic-reference/search.js +95 -0
  109. package/lib/semantic-reference/usage.js +152 -0
  110. package/lib/tool-lifecycle.js +22 -0
  111. package/lib/types/bridges.d.ts +2 -2
  112. package/lib/types/client/credentials/changes.d.ts +9 -0
  113. package/lib/types/client/credentials/create-datasource.d.ts +7 -0
  114. package/lib/types/client/credentials/credential-draft.d.ts +14 -0
  115. package/lib/types/client/credentials/defaults.d.ts +2 -0
  116. package/lib/types/client/credentials/descriptions.d.ts +1 -0
  117. package/lib/types/client/credentials/install.d.ts +19 -0
  118. package/lib/types/client/credentials/model.d.ts +79 -0
  119. package/lib/types/client/credentials/report-publishing.d.ts +5 -0
  120. package/lib/types/client/credentials/styles.d.ts +1 -0
  121. package/lib/types/client/i18n/context.d.ts +17 -0
  122. package/lib/types/client/i18n/copy.d.ts +806 -0
  123. package/lib/types/client/i18n/credentials.d.ts +475 -0
  124. package/lib/types/client/i18n/host.d.ts +16 -0
  125. package/lib/types/client/i18n/navigation.d.ts +41 -0
  126. package/lib/types/client/i18n/presentation.d.ts +577 -0
  127. package/lib/types/client/i18n/python.d.ts +19 -0
  128. package/lib/types/client/i18n/semantic.d.ts +441 -0
  129. package/lib/types/client/input-context.d.ts +19 -0
  130. package/lib/types/client/presentation/ask-dsh.d.ts +5 -0
  131. package/lib/types/client/presentation/catalog-model.d.ts +24 -0
  132. package/lib/types/client/presentation/catalog.d.ts +20 -0
  133. package/lib/types/client/presentation/chart-explorer.d.ts +12 -0
  134. package/lib/types/client/presentation/chart-geometry.d.ts +30 -0
  135. package/lib/types/client/presentation/chart-renderer.d.ts +10 -0
  136. package/lib/types/client/presentation/chart-specials.d.ts +10 -0
  137. package/lib/types/client/presentation/chart-styles.d.ts +1 -0
  138. package/lib/types/client/presentation/chart-tooltip.d.ts +13 -0
  139. package/lib/types/client/presentation/chart-view.d.ts +23 -0
  140. package/lib/types/client/presentation/context-reference.d.ts +12 -0
  141. package/lib/types/client/presentation/copy-context.d.ts +5 -0
  142. package/lib/types/client/presentation/delivery-model.d.ts +75 -0
  143. package/lib/types/client/presentation/delivery.d.ts +78 -0
  144. package/lib/types/client/presentation/download.d.ts +2 -0
  145. package/lib/types/client/presentation/editor-controls.d.ts +12 -0
  146. package/lib/types/client/presentation/export-menu.d.ts +26 -0
  147. package/lib/types/client/presentation/export-view.d.ts +63 -0
  148. package/lib/types/client/presentation/global-filters.d.ts +6 -0
  149. package/lib/types/client/presentation/host-entry.d.ts +18 -0
  150. package/lib/types/client/presentation/icons.d.ts +4 -0
  151. package/lib/types/client/presentation/markdown.d.ts +5 -0
  152. package/lib/types/client/presentation/model.d.ts +61 -0
  153. package/lib/types/client/presentation/reader.d.ts +24 -0
  154. package/lib/types/client/presentation/reference-source.d.ts +9 -0
  155. package/lib/types/client/presentation/source-code-model.d.ts +17 -0
  156. package/lib/types/client/presentation/source-code.d.ts +6 -0
  157. package/lib/types/client/presentation/source-dialog.d.ts +12 -0
  158. package/lib/types/client/presentation/source-facts.d.ts +20 -0
  159. package/lib/types/client/presentation/source-format.d.ts +5 -0
  160. package/lib/types/client/presentation/source-highlight.d.ts +7 -0
  161. package/lib/types/client/presentation/sources.d.ts +13 -0
  162. package/lib/types/client/presentation/styles.d.ts +1 -0
  163. package/lib/types/client/presentation/table.d.ts +16 -0
  164. package/lib/types/client/presentation/use-element-width.d.ts +5 -0
  165. package/lib/types/client/python-tool/card.d.ts +2 -0
  166. package/lib/types/client/python-tool/execution-error.d.ts +3 -0
  167. package/lib/types/client/python-tool/install.d.ts +2 -0
  168. package/lib/types/client/python-tool/model.d.ts +20 -0
  169. package/lib/types/client/right-tabs/install.d.ts +18 -0
  170. package/lib/types/client/right-tabs/live-delivery.d.ts +8 -0
  171. package/lib/types/client/right-tabs/navigation.d.ts +17 -0
  172. package/lib/types/client/right-tabs/page.d.ts +36 -0
  173. package/lib/types/client/right-tabs/styles.d.ts +2 -0
  174. package/lib/types/client/rpc.d.ts +3 -0
  175. package/lib/types/client/semantic-reference.d.ts +4 -0
  176. package/lib/types/client/workspace-header-action.d.ts +7 -0
  177. package/lib/types/client/workspace-shortcuts.d.ts +15 -0
  178. package/lib/types/client.d.ts +9 -124
  179. package/lib/types/compatibility.d.ts +3 -3
  180. package/lib/types/datasource/authoring.d.ts +35 -0
  181. package/lib/types/datasource/bridge.d.ts +43 -4
  182. package/lib/types/datasource/changes-contract.d.ts +18 -0
  183. package/lib/types/datasource/changes.d.ts +15 -0
  184. package/lib/types/datasource/configure.d.ts +7 -0
  185. package/lib/types/datasource/defaults.d.ts +7 -0
  186. package/lib/types/datasource/index.d.ts +8 -5
  187. package/lib/types/datasource/python-options.d.ts +9 -0
  188. package/lib/types/datasource/python.d.ts +19 -0
  189. package/lib/types/datasource/resolver-program.d.ts +6 -0
  190. package/lib/types/datasource/rpc.d.ts +5 -0
  191. package/lib/types/datasource/service.d.ts +155 -0
  192. package/lib/types/datasource/shell-env.d.ts +0 -29
  193. package/lib/types/datasource/test.d.ts +6 -29
  194. package/lib/types/disclosure/activation.d.ts +2 -1
  195. package/lib/types/disclosure/execution-guidance.d.ts +6 -0
  196. package/lib/types/disclosure/help.d.ts +1 -1
  197. package/lib/types/environment/binding.d.ts +5 -1
  198. package/lib/types/environment/errors.d.ts +1 -1
  199. package/lib/types/environment/runtime.d.ts +5 -5
  200. package/lib/types/environment/types.d.ts +15 -3
  201. package/lib/types/environment/workspace.d.ts +1 -0
  202. package/lib/types/index.d.ts +1 -1
  203. package/lib/types/lifecycle.d.ts +8 -0
  204. package/lib/types/plugin-agents.d.ts +27 -0
  205. package/lib/types/plugin.d.ts +14 -24
  206. package/lib/types/presentation/asset.d.ts +6 -0
  207. package/lib/types/presentation/build/index.d.ts +16 -0
  208. package/lib/types/presentation/commit.d.ts +4 -0
  209. package/lib/types/presentation/contracts/asset-path.d.ts +2 -0
  210. package/lib/types/presentation/contracts/catalog.d.ts +27 -0
  211. package/lib/types/presentation/contracts/charts.d.ts +11 -0
  212. package/lib/types/presentation/contracts/editing.d.ts +8 -0
  213. package/lib/types/presentation/contracts/index.d.ts +11 -0
  214. package/lib/types/presentation/contracts/interaction.d.ts +8 -0
  215. package/lib/types/presentation/contracts/types.d.ts +255 -0
  216. package/lib/types/presentation/contracts/values.d.ts +9 -0
  217. package/lib/types/presentation/delivery.d.ts +3 -0
  218. package/lib/types/presentation/export-html.d.ts +13 -0
  219. package/lib/types/presentation/files.d.ts +7 -0
  220. package/lib/types/presentation/index.d.ts +6 -0
  221. package/lib/types/presentation/lint.d.ts +13 -0
  222. package/lib/types/presentation/projection/files.d.ts +2 -0
  223. package/lib/types/presentation/projection/index.d.ts +20 -0
  224. package/lib/types/presentation/projection/program.d.ts +2 -0
  225. package/lib/types/presentation/projection/sql-code.d.ts +2 -0
  226. package/lib/types/presentation/receipt.d.ts +14 -0
  227. package/lib/types/presentation/reports.d.ts +10 -0
  228. package/lib/types/presentation/rpc.d.ts +25 -0
  229. package/lib/types/presentation/tool.d.ts +12 -0
  230. package/lib/types/python-execution-contracts.d.ts +10 -0
  231. package/lib/types/python-execution.d.ts +10 -0
  232. package/lib/types/report-publishing/adapters.d.ts +6 -0
  233. package/lib/types/report-publishing/config.d.ts +22 -0
  234. package/lib/types/report-publishing/service.d.ts +68 -0
  235. package/lib/types/rpc.d.ts +3 -0
  236. package/lib/types/semantic-browser/contracts.d.ts +47 -0
  237. package/lib/types/semantic-browser/definition.d.ts +20 -0
  238. package/lib/types/semantic-browser/program.d.ts +2 -0
  239. package/lib/types/semantic-browser/service.d.ts +26 -0
  240. package/lib/types/semantic-reference/bridge.d.ts +12 -0
  241. package/lib/types/semantic-reference/contracts.d.ts +54 -0
  242. package/lib/types/semantic-reference/environment.d.ts +22 -0
  243. package/lib/types/semantic-reference/index.d.ts +3 -0
  244. package/lib/types/semantic-reference/labels.d.ts +16 -0
  245. package/lib/types/semantic-reference/rpc.d.ts +15 -0
  246. package/lib/types/semantic-reference/search.d.ts +10 -0
  247. package/lib/types/semantic-reference/usage.d.ts +43 -0
  248. package/lib/types/tool-lifecycle.d.ts +4 -0
  249. package/lib/types/workspace-identity.d.ts +6 -0
  250. package/lib/workspace-identity.js +9 -0
  251. package/package.json +99 -53
  252. package/python/presentation-kit/dist/dsh_data_analysis_presentation_kit-1.1.0-py3-none-any.whl +0 -0
  253. package/skills/dsh-data-analysis-files/SKILL.md +32 -0
  254. package/skills/dsh-data-analysis-files/references/examples.md +93 -0
  255. package/skills/dsh-data-analysis-presentation/SKILL.md +28 -0
  256. package/skills/dsh-data-analysis-presentation/references/chart-examples.md +18 -0
  257. package/skills/dsh-data-analysis-presentation/references/charts.md +55 -0
  258. package/skills/dsh-data-analysis-presentation/references/examples/artifact.draft.json +36 -0
  259. package/skills/dsh-data-analysis-presentation/references/examples/charts-bins.dataset.json +33 -0
  260. package/skills/dsh-data-analysis-presentation/references/examples/charts-boxes.dataset.json +45 -0
  261. package/skills/dsh-data-analysis-presentation/references/examples/charts-composition.dataset.json +33 -0
  262. package/skills/dsh-data-analysis-presentation/references/examples/charts-funnel.dataset.json +27 -0
  263. package/skills/dsh-data-analysis-presentation/references/examples/charts-precision.dataset.json +21 -0
  264. package/skills/dsh-data-analysis-presentation/references/examples/charts-series.dataset.json +58 -0
  265. package/skills/dsh-data-analysis-presentation/references/examples/charts-shares.dataset.json +33 -0
  266. package/skills/dsh-data-analysis-presentation/references/examples/charts-waterfall.dataset.json +44 -0
  267. package/skills/dsh-data-analysis-presentation/references/examples/charts.draft.json +393 -0
  268. package/skills/dsh-data-analysis-presentation/references/examples/comparison-selected.dataset.json +24 -0
  269. package/skills/dsh-data-analysis-presentation/references/examples/comparison-summary.dataset.json +22 -0
  270. package/skills/dsh-data-analysis-presentation/references/examples/comparison.dataset.json +18 -0
  271. package/skills/dsh-data-analysis-presentation/references/examples/comparison.draft.json +80 -0
  272. package/skills/dsh-data-analysis-presentation/references/examples/computed-sources.draft.json +42 -0
  273. package/skills/dsh-data-analysis-presentation/references/examples/computed.dataset.json +12 -0
  274. package/skills/dsh-data-analysis-presentation/references/examples/computed.draft.json +58 -0
  275. package/skills/dsh-data-analysis-presentation/references/examples/interaction-detail.dataset.json +30 -0
  276. package/skills/dsh-data-analysis-presentation/references/examples/interaction-summary.dataset.json +22 -0
  277. package/skills/dsh-data-analysis-presentation/references/examples/interaction.draft.json +279 -0
  278. package/skills/dsh-data-analysis-presentation/references/examples/source-only.draft.json +27 -0
  279. package/skills/dsh-data-analysis-presentation/references/examples/write-charts.py +73 -0
  280. package/skills/dsh-data-analysis-presentation/references/examples/write-comparison.py +42 -0
  281. package/skills/dsh-data-analysis-presentation/references/examples/write-computed.py +21 -0
  282. package/skills/dsh-data-analysis-presentation/references/examples/write-interaction.py +33 -0
  283. package/skills/dsh-data-analysis-presentation/references/examples.md +44 -0
  284. package/skills/dsh-data-analysis-presentation/references/export-html.md +7 -0
  285. package/skills/dsh-data-analysis-presentation/references/interaction.md +56 -0
  286. package/skills/dsh-data-analysis-presentation/references/narrative.md +37 -0
  287. package/skills/dsh-data-analysis-presentation/references/publishing.md +3 -0
  288. package/skills/dsh-data-analysis-presentation/references/schema.md +162 -0
  289. package/lib/datasource/access.js +0 -60
  290. package/lib/datasource/credentials.js +0 -24
  291. package/lib/evidence/bridge-program.js +0 -153
  292. package/lib/evidence/bridge.js +0 -166
  293. package/lib/evidence/index.js +0 -2
  294. package/lib/evidence/sources.js +0 -263
  295. package/lib/types/datasource/access.d.ts +0 -27
  296. package/lib/types/evidence/bridge.d.ts +0 -40
  297. package/lib/types/evidence/index.d.ts +0 -4
  298. package/lib/types/evidence/sources.d.ts +0 -57
  299. package/python/report-kit/dist/dsh_data_analysis_report_kit-3.0.0-py3-none-any.whl +0 -0
  300. package/skills/dsh-data-analysis-report/SKILL.md +0 -57
  301. package/skills/dsh-data-analysis-report/assets/marivo-artifact.js +0 -113
  302. package/skills/dsh-data-analysis-report/assets/marivo-session-dag.js +0 -1201
  303. package/skills/dsh-data-analysis-report/assets/report-data.js +0 -449
@@ -0,0 +1,55 @@
1
+ # 图形配置与数值表达
2
+
3
+ 所有图形共享 `datasetId`、`chart`、`x`、`y`、`numericMode`。字段绑定使用列 ID,名称和单位来自 dataset;图前说明用 markdown。reader 保留输入行顺序,统计计算先在分析阶段完成。
4
+
5
+ ## 图形选择与字段
6
+
7
+ | chart | x / y | bindings 与数据要求 |
8
+ | --- | --- | --- |
9
+ | `line`、`area` | 有序 x,多列 y | 无;固定 monotone |
10
+ | `stackedArea` | 有序 x,同单位多列 y | 无;先对齐系列,不补零 |
11
+ | `sparkline` | 有序 x,单列 y | 无;紧凑趋势 |
12
+ | `bar`、`horizontalBar` | 类别 x,单列或多列 y | 无;单系列或并列比较 |
13
+ | `stackedBar`、`horizontalStackedBar` | 类别 x,同单位多列 y | 无;普通堆叠 |
14
+ | `stackedBar100`、`horizontalStackedBar100` | 类别 x,预计算比例 y | `denominator`:分母列;比例为 0–1 |
15
+ | `histogram` | 区间标签 x,频数 y(单列) | `binStart`、`binEnd`:已排序、不重叠的区间边界 |
16
+ | `boxPlot` | 分组 x,中位数 y(单列) | `minimum`、`q1`、`q3`、`maximum`:五数摘要 |
17
+ | `scatter` | 数值 x,数值 y(单列) | 可选 `size`、`label`、`color`:点大小、标签、分类字段 |
18
+ | `heatmap` | 行类别 x,矩阵各列 y | 无;每行是已准备矩阵行 |
19
+ | `pie` | 切片标签 x,原值 y(单列) | `share`:预计算占比;默认环形 |
20
+ | `leaderboard` | 类别 x,数值 y(单列) | `rank`:预计算排名;先确定排序和 Top N |
21
+ | `funnel` | 有序阶段 x,原值 y(单列) | `share`:相对于明确首阶段分母的预计算占比 |
22
+ | `waterfall` | 有序步骤 x,变化量/锚点值 y(单列) | `start`、`end`:已有坐标;`role` 列取 start、delta、subtotal、total |
23
+
24
+ `bindings` 的值都是同一 dataset 的列 ID,不是数值或公式。例如箱线图:
25
+
26
+ ```json
27
+ {"id":"distribution","kind":"chart","datasetId":"summary","chart":"boxPlot","x":"group","y":["median"],"numericMode":"exact","bindings":{"minimum":"min","q1":"p25","q3":"p75","maximum":"max"}}
28
+ ```
29
+
30
+ 堆叠系列与 heatmap 必须同单位;普通多系列图的不同单位分图展示。没有双轴或单位推断。100% 堆叠的分母为零/null 时比例也必须 null。pie/funnel 仅绑定预计算 share,作者须说明分母;share 范围为 [0,1],pie 完整快照的已知 share 总和不超过 1,允许不足 1。null share 不绘制切片;share 已知但原值缺失时保留该角度空位。瀑布 delta 步的 end - start 必须等于 y;锚点从零绘制,不重新累计。reader 不把缺失值补为零,不修正不合法统计量。
31
+
32
+ ## 受限选项
33
+
34
+ `options` 只接受以下声明,各类型仅接受适用选项:
35
+
36
+ - `showPoints: "auto" | "always" | "never"`:趋势图数据点,默认 auto 保留孤立观测。
37
+ - `series`:以 y 列 ID 为 key,值可有 `lineStyle: "solid" | "dashed" | "dotted"` 与 `role: "actual" | "baseline" | "target" | "forecast" | "plan" | "comparison"`。计划/目标/基线/预测默认为中性虚线,显式线型优先。
38
+ - `valueLabels: "none" | "auto" | "all"`:数值标签;原值始终保留在 tooltip。
39
+ - `referenceLines: [{"axis":"y","value":20,"label":"参考值"}]`:数值轴参考线。axis 是物理轴;横向柱形和箱线图的数值轴为 x。pie、funnel、heatmap、sparkline 不提供参考线。普通多系列图若含不同单位,该系列数值轴不接受参考线,须为各单位分别声明图表或已准备视图;scatter、histogram 的两个独立数值轴可各自设置参考线。
40
+
41
+ 不写 linear/step、任意配置、前端 aggregate 或时间分粒度。
42
+
43
+ ## 探索与已准备视图
44
+
45
+ chart 可有 `preparedViews`:每项包含唯一 `id`、说明性 `label` 和完整 `datasetId`、`chart`、`x`、`y`、`numericMode` 及适用 bindings/options。它不包含 kind,不嵌套 preparedViews;dataset 必须已在草稿声明。
46
+
47
+ 普通图形可以选择当前数值列和适用类型。需要另一组分箱、分位数、分母或累计值时,先准备 dataset,再声明视图。reader 不按列名猜统计角色,不能使用的类型显示缺少的数据。
48
+
49
+ cell 菜单“探索图表”提供图形、字段、系列、方向/模式、线型、分类过滤和恢复原图。过滤与显隐只改变当前可见内容,原始排名、占比和分母保持不变。来源预览和复制上下文跟随当前视图;下载和打印使用原始快照。重新打开恢复作者配置,不保存探索状态。
50
+
51
+ ## 精度与叙事
52
+
53
+ `exact` 适用于 float64 和 JS 安全整数范围内的 int64。decimal 或较大 int64 只用表格,或显式 `approximate` 绘图;所有数值坐标必须有限。tooltip、来源预览和静态表格保留原始精确文本。null 是缺失,不是 0;空数据展示空状态。
54
+
55
+ 比较图先读[叙事与证据检查](narrative.md),核对字段、方向、单位、分母、范围与正文一致。Top N 保留选取范围与其他项贡献;截断数据不代表全量,绘制成功不证明计算或因果结论成立。完整示例见[图形样例](chart-examples.md)。
@@ -0,0 +1,36 @@
1
+ {
2
+ "schemaVersion": 2,
3
+ "title": "演示:已有 Artifact 表格",
4
+ "datasets": [
5
+ {
6
+ "id": "result",
7
+ "kind": "artifact",
8
+ "sourceId": "analysis",
9
+ "rowLimit": 100,
10
+ "columns": ["region", "revenue"]
11
+ }
12
+ ],
13
+ "sources": [
14
+ {
15
+ "id": "analysis",
16
+ "ref": {
17
+ "sessionId": "example-session",
18
+ "artifactRef": "example-artifact"
19
+ }
20
+ }
21
+ ],
22
+ "blocks": [
23
+ {
24
+ "id": "scope",
25
+ "kind": "markdown",
26
+ "text": "演示草稿:请替换实际来源、列名和分析范围。展示最多 100 行,不据此声称全量总计。"
27
+ },
28
+ {
29
+ "id": "values",
30
+ "kind": "table",
31
+ "datasetId": "result",
32
+ "columns": ["region", "revenue"]
33
+ }
34
+ ],
35
+ "locale": "zh-CN"
36
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "columns": [
4
+ {
5
+ "id": "bin",
6
+ "label": "bin",
7
+ "type": "string",
8
+ "nullable": false
9
+ },
10
+ {
11
+ "id": "lower",
12
+ "label": "lower",
13
+ "type": "float64",
14
+ "nullable": false
15
+ },
16
+ {
17
+ "id": "upper",
18
+ "label": "upper",
19
+ "type": "float64",
20
+ "nullable": false
21
+ },
22
+ {
23
+ "id": "frequency",
24
+ "label": "frequency",
25
+ "type": "float64",
26
+ "nullable": false
27
+ }
28
+ ],
29
+ "rows": [["0–1", 0, 1, 2], ["1–3", 1, 3, 3], ["3–6", 3, 6, 1]],
30
+ "rowCount": 3,
31
+ "limit": 5000,
32
+ "truncated": false
33
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "columns": [
4
+ {
5
+ "id": "group",
6
+ "label": "group",
7
+ "type": "string",
8
+ "nullable": false
9
+ },
10
+ {
11
+ "id": "minimum",
12
+ "label": "minimum",
13
+ "type": "float64",
14
+ "nullable": false
15
+ },
16
+ {
17
+ "id": "q1",
18
+ "label": "q1",
19
+ "type": "float64",
20
+ "nullable": false
21
+ },
22
+ {
23
+ "id": "median",
24
+ "label": "median",
25
+ "type": "float64",
26
+ "nullable": false
27
+ },
28
+ {
29
+ "id": "q3",
30
+ "label": "q3",
31
+ "type": "float64",
32
+ "nullable": false
33
+ },
34
+ {
35
+ "id": "maximum",
36
+ "label": "maximum",
37
+ "type": "float64",
38
+ "nullable": false
39
+ }
40
+ ],
41
+ "rows": [["A", 1, 2, 3, 4, 5], ["B", 2, 3, 4, 5, 6]],
42
+ "rowCount": 2,
43
+ "limit": 5000,
44
+ "truncated": false
45
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "columns": [
4
+ {
5
+ "id": "category",
6
+ "label": "category",
7
+ "type": "string",
8
+ "nullable": false
9
+ },
10
+ {
11
+ "id": "value",
12
+ "label": "value",
13
+ "type": "float64",
14
+ "nullable": false
15
+ },
16
+ {
17
+ "id": "share",
18
+ "label": "share",
19
+ "type": "float64",
20
+ "nullable": false
21
+ },
22
+ {
23
+ "id": "rank",
24
+ "label": "rank",
25
+ "type": "float64",
26
+ "nullable": false
27
+ }
28
+ ],
29
+ "rows": [["A", 60, 0.6, 1], ["B", 30, 0.3, 2], ["C", 10, 0.1, 3]],
30
+ "rowCount": 3,
31
+ "limit": 5000,
32
+ "truncated": false
33
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "columns": [
4
+ {
5
+ "id": "stage",
6
+ "label": "stage",
7
+ "type": "string",
8
+ "nullable": false
9
+ },
10
+ {
11
+ "id": "value",
12
+ "label": "value",
13
+ "type": "float64",
14
+ "nullable": false
15
+ },
16
+ {
17
+ "id": "share",
18
+ "label": "share",
19
+ "type": "float64",
20
+ "nullable": false
21
+ }
22
+ ],
23
+ "rows": [["访问", 100, 1], ["注册", 60, 0.6], ["购买", 20, 0.2]],
24
+ "rowCount": 3,
25
+ "limit": 5000,
26
+ "truncated": false
27
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "columns": [
4
+ {
5
+ "id": "label",
6
+ "label": "label",
7
+ "type": "string",
8
+ "nullable": false
9
+ },
10
+ {
11
+ "id": "amount",
12
+ "label": "amount",
13
+ "type": "decimal",
14
+ "nullable": true
15
+ }
16
+ ],
17
+ "rows": [["精确值", "0.1000"], ["缺失", null], ["长小数", "12345678901234.5678"]],
18
+ "rowCount": 3,
19
+ "limit": 5000,
20
+ "truncated": false
21
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "columns": [
4
+ {
5
+ "id": "period",
6
+ "label": "period",
7
+ "type": "string",
8
+ "nullable": false
9
+ },
10
+ {
11
+ "id": "a",
12
+ "label": "a",
13
+ "type": "float64",
14
+ "nullable": false
15
+ },
16
+ {
17
+ "id": "b",
18
+ "label": "b",
19
+ "type": "float64",
20
+ "nullable": false
21
+ },
22
+ {
23
+ "id": "coordinate",
24
+ "label": "coordinate",
25
+ "type": "float64",
26
+ "nullable": false
27
+ },
28
+ {
29
+ "id": "volume",
30
+ "label": "volume",
31
+ "type": "float64",
32
+ "nullable": false
33
+ },
34
+ {
35
+ "id": "segment",
36
+ "label": "segment",
37
+ "type": "string",
38
+ "nullable": false
39
+ }
40
+ ],
41
+ "rows": [
42
+ ["2026-01", 12, 8, 1, 10, "A"],
43
+ ["2026-02", 18, 11, 2, 20, "B"],
44
+ ["2026-03", 15, 10, 3, 30, "A"],
45
+ ["2026-04", 24, 14, 4, 40, "B"],
46
+ ["2026-05", 19, 13, 5, 50, "A"],
47
+ ["2026-06", 30, 17, 6, 60, "B"],
48
+ ["2026-07", 28, 19, 7, 70, "A"],
49
+ ["2026-08", 34, 18, 8, 80, "B"],
50
+ ["2026-09", 31, 22, 9, 90, "A"],
51
+ ["2026-10", 42, 25, 10, 100, "B"],
52
+ ["2026-11", 39, 24, 11, 110, "A"],
53
+ ["2026-12", 45, 28, 12, 120, "B"]
54
+ ],
55
+ "rowCount": 12,
56
+ "limit": 5000,
57
+ "truncated": false
58
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "columns": [
4
+ {
5
+ "id": "category",
6
+ "label": "category",
7
+ "type": "string",
8
+ "nullable": false
9
+ },
10
+ {
11
+ "id": "a",
12
+ "label": "a",
13
+ "type": "float64",
14
+ "nullable": false
15
+ },
16
+ {
17
+ "id": "b",
18
+ "label": "b",
19
+ "type": "float64",
20
+ "nullable": false
21
+ },
22
+ {
23
+ "id": "denominator",
24
+ "label": "denominator",
25
+ "type": "float64",
26
+ "nullable": false
27
+ }
28
+ ],
29
+ "rows": [["A", 0.6, 0.4, 100], ["B", 0.3, 0.7, 200], ["C", 0.8, 0.2, 50]],
30
+ "rowCount": 3,
31
+ "limit": 5000,
32
+ "truncated": false
33
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "columns": [
4
+ {
5
+ "id": "step",
6
+ "label": "step",
7
+ "type": "string",
8
+ "nullable": false
9
+ },
10
+ {
11
+ "id": "change",
12
+ "label": "change",
13
+ "type": "float64",
14
+ "nullable": false
15
+ },
16
+ {
17
+ "id": "start",
18
+ "label": "start",
19
+ "type": "float64",
20
+ "nullable": false
21
+ },
22
+ {
23
+ "id": "end",
24
+ "label": "end",
25
+ "type": "float64",
26
+ "nullable": false
27
+ },
28
+ {
29
+ "id": "role",
30
+ "label": "role",
31
+ "type": "string",
32
+ "nullable": false
33
+ }
34
+ ],
35
+ "rows": [
36
+ ["期初", 100, 0, 100, "start"],
37
+ ["减少", -20, 100, 80, "delta"],
38
+ ["增加", 30, 80, 110, "delta"],
39
+ ["期末", 110, 0, 110, "total"]
40
+ ],
41
+ "rowCount": 4,
42
+ "limit": 5000,
43
+ "truncated": false
44
+ }