@antv/gpt-vis 1.3.2 → 1.4.1

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 (284) hide show
  1. package/README.md +261 -137
  2. package/README.zh-CN.md +263 -116
  3. package/dist/cjs/annotation/components/bottom-n.d.ts +2 -0
  4. package/dist/cjs/annotation/components/bottom-n.js +57 -0
  5. package/dist/cjs/annotation/components/centroid.d.ts +2 -0
  6. package/dist/cjs/annotation/components/centroid.js +75 -0
  7. package/dist/cjs/annotation/components/connector.d.ts +25 -0
  8. package/dist/cjs/annotation/components/connector.js +298 -0
  9. package/dist/cjs/annotation/components/contribution.d.ts +3 -0
  10. package/dist/cjs/annotation/components/contribution.js +136 -0
  11. package/dist/cjs/annotation/components/crossing.d.ts +3 -0
  12. package/dist/cjs/annotation/components/crossing.js +504 -0
  13. package/dist/cjs/annotation/components/event.d.ts +2 -0
  14. package/dist/cjs/annotation/components/event.js +62 -0
  15. package/dist/cjs/annotation/components/first.d.ts +2 -0
  16. package/dist/cjs/annotation/components/first.js +42 -0
  17. package/dist/cjs/annotation/components/group.d.ts +3 -0
  18. package/dist/cjs/annotation/components/group.js +73 -0
  19. package/dist/cjs/annotation/components/highlight.d.ts +14 -0
  20. package/dist/cjs/annotation/components/highlight.js +552 -0
  21. package/dist/cjs/annotation/components/index.d.ts +34 -0
  22. package/dist/cjs/annotation/components/index.js +128 -0
  23. package/dist/cjs/annotation/components/last.d.ts +2 -0
  24. package/dist/cjs/annotation/components/last.js +42 -0
  25. package/dist/cjs/annotation/components/max-x.d.ts +2 -0
  26. package/dist/cjs/annotation/components/max-x.js +41 -0
  27. package/dist/cjs/annotation/components/max-y.d.ts +2 -0
  28. package/dist/cjs/annotation/components/max-y.js +41 -0
  29. package/dist/cjs/annotation/components/mean.d.ts +2 -0
  30. package/dist/cjs/annotation/components/mean.js +50 -0
  31. package/dist/cjs/annotation/components/median.d.ts +2 -0
  32. package/dist/cjs/annotation/components/median.js +49 -0
  33. package/dist/cjs/annotation/components/min-x.d.ts +2 -0
  34. package/dist/cjs/annotation/components/min-x.js +41 -0
  35. package/dist/cjs/annotation/components/min-y.d.ts +2 -0
  36. package/dist/cjs/annotation/components/min-y.js +41 -0
  37. package/dist/cjs/annotation/components/outlier.d.ts +3 -0
  38. package/dist/cjs/annotation/components/outlier.js +83 -0
  39. package/dist/cjs/annotation/components/path.d.ts +20 -0
  40. package/dist/cjs/annotation/components/path.js +147 -0
  41. package/dist/cjs/annotation/components/peak.d.ts +2 -0
  42. package/dist/cjs/annotation/components/peak.js +42 -0
  43. package/dist/cjs/annotation/components/point.d.ts +26 -0
  44. package/dist/cjs/annotation/components/point.js +241 -0
  45. package/dist/cjs/annotation/components/quadrant.d.ts +3 -0
  46. package/dist/cjs/annotation/components/quadrant.js +97 -0
  47. package/dist/cjs/annotation/components/quantile.d.ts +2 -0
  48. package/dist/cjs/annotation/components/quantile.js +49 -0
  49. package/dist/cjs/annotation/components/range-inside.d.ts +2 -0
  50. package/dist/cjs/annotation/components/range-inside.js +65 -0
  51. package/dist/cjs/annotation/components/range-outside.d.ts +2 -0
  52. package/dist/cjs/annotation/components/range-outside.js +65 -0
  53. package/dist/cjs/annotation/components/range-x.d.ts +2 -0
  54. package/dist/cjs/annotation/components/range-x.js +39 -0
  55. package/dist/cjs/annotation/components/range-y.d.ts +2 -0
  56. package/dist/cjs/annotation/components/range-y.js +39 -0
  57. package/dist/cjs/annotation/components/range.d.ts +15 -0
  58. package/dist/cjs/annotation/components/range.js +87 -0
  59. package/dist/cjs/annotation/components/target.d.ts +2 -0
  60. package/dist/cjs/annotation/components/target.js +51 -0
  61. package/dist/cjs/annotation/components/text.d.ts +15 -0
  62. package/dist/cjs/annotation/components/text.js +74 -0
  63. package/dist/cjs/annotation/components/threshold-highlight.d.ts +3 -0
  64. package/dist/cjs/annotation/components/threshold-highlight.js +223 -0
  65. package/dist/cjs/annotation/components/threshold-x.d.ts +2 -0
  66. package/dist/cjs/annotation/components/threshold-x.js +39 -0
  67. package/dist/cjs/annotation/components/threshold-y.d.ts +2 -0
  68. package/dist/cjs/annotation/components/threshold-y.js +40 -0
  69. package/dist/cjs/annotation/components/top-n.d.ts +2 -0
  70. package/dist/cjs/annotation/components/top-n.js +57 -0
  71. package/dist/cjs/annotation/components/valley.d.ts +2 -0
  72. package/dist/cjs/annotation/components/valley.js +42 -0
  73. package/dist/cjs/annotation/index.d.ts +1 -0
  74. package/dist/cjs/annotation/index.js +29 -0
  75. package/dist/cjs/annotation/label.d.ts +38 -0
  76. package/dist/cjs/annotation/label.js +347 -0
  77. package/dist/cjs/annotation/layout.d.ts +12 -0
  78. package/dist/cjs/annotation/layout.js +142 -0
  79. package/dist/cjs/annotation/merge.d.ts +19 -0
  80. package/dist/cjs/annotation/merge.js +60 -0
  81. package/dist/cjs/annotation/registry.d.ts +190 -0
  82. package/dist/cjs/annotation/registry.js +134 -0
  83. package/dist/cjs/annotation/runtime/g2.d.ts +90 -0
  84. package/dist/cjs/annotation/runtime/g2.js +521 -0
  85. package/dist/cjs/annotation/runtime/g6.d.ts +40 -0
  86. package/dist/cjs/annotation/runtime/g6.js +310 -0
  87. package/dist/cjs/annotation/runtime/index.d.ts +11 -0
  88. package/dist/cjs/annotation/runtime/index.js +41 -0
  89. package/dist/cjs/annotation/runtime/summary.d.ts +17 -0
  90. package/dist/cjs/annotation/runtime/summary.js +39 -0
  91. package/dist/cjs/annotation/runtime/table.d.ts +16 -0
  92. package/dist/cjs/annotation/runtime/table.js +39 -0
  93. package/dist/cjs/annotation/utils.d.ts +40 -0
  94. package/dist/cjs/annotation/utils.js +275 -0
  95. package/dist/cjs/theme/annotation.d.ts +236 -0
  96. package/dist/cjs/theme/annotation.js +167 -0
  97. package/dist/cjs/theme/g2.js +13 -15
  98. package/dist/cjs/theme/g6.js +2 -2
  99. package/dist/cjs/theme/summary.js +2 -2
  100. package/dist/cjs/types/annotation.d.ts +310 -0
  101. package/dist/cjs/types/annotation.js +17 -0
  102. package/dist/cjs/types/index.d.ts +1 -0
  103. package/dist/cjs/util/axis.d.ts +28 -0
  104. package/dist/cjs/util/axis.js +184 -0
  105. package/dist/cjs/util/components.d.ts +0 -10
  106. package/dist/cjs/util/components.js +9 -64
  107. package/dist/cjs/util/index.d.ts +7 -4
  108. package/dist/cjs/util/index.js +53 -9
  109. package/dist/cjs/vis/area/index.d.ts +2 -0
  110. package/dist/cjs/vis/area/index.js +30 -13
  111. package/dist/cjs/vis/bar/index.d.ts +2 -0
  112. package/dist/cjs/vis/bar/index.js +37 -7
  113. package/dist/cjs/vis/boxplot/index.js +14 -3
  114. package/dist/cjs/vis/column/index.d.ts +2 -0
  115. package/dist/cjs/vis/column/index.js +28 -9
  116. package/dist/cjs/vis/dual-axes/index.js +9 -9
  117. package/dist/cjs/vis/fishbone-diagram/index.js +2 -2
  118. package/dist/cjs/vis/flow-diagram/index.js +2 -2
  119. package/dist/cjs/vis/funnel/index.js +10 -13
  120. package/dist/cjs/vis/histogram/index.js +2 -2
  121. package/dist/cjs/vis/indented-tree/index.js +2 -2
  122. package/dist/cjs/vis/line/index.d.ts +2 -0
  123. package/dist/cjs/vis/line/index.js +26 -10
  124. package/dist/cjs/vis/liquid/index.js +2 -2
  125. package/dist/cjs/vis/mindmap/index.js +2 -2
  126. package/dist/cjs/vis/network-graph/index.d.ts +2 -0
  127. package/dist/cjs/vis/network-graph/index.js +24 -3
  128. package/dist/cjs/vis/organization-chart/index.js +2 -2
  129. package/dist/cjs/vis/pie/index.d.ts +2 -0
  130. package/dist/cjs/vis/pie/index.js +21 -10
  131. package/dist/cjs/vis/radar/index.js +4 -6
  132. package/dist/cjs/vis/sankey/index.js +14 -1
  133. package/dist/cjs/vis/scatter/index.d.ts +10 -3
  134. package/dist/cjs/vis/scatter/index.js +18 -7
  135. package/dist/cjs/vis/summary/index.d.ts +12 -3
  136. package/dist/cjs/vis/summary/index.js +29 -11
  137. package/dist/cjs/vis/table/index.d.ts +2 -0
  138. package/dist/cjs/vis/table/index.js +48 -30
  139. package/dist/cjs/vis/venn/index.js +2 -2
  140. package/dist/cjs/vis/violin/index.js +14 -3
  141. package/dist/cjs/vis/waterfall/index.js +17 -9
  142. package/dist/cjs/vis/word-cloud/index.js +4 -6
  143. package/dist/esm/annotation/components/bottom-n.d.ts +2 -0
  144. package/dist/esm/annotation/components/bottom-n.js +42 -0
  145. package/dist/esm/annotation/components/centroid.d.ts +2 -0
  146. package/dist/esm/annotation/components/centroid.js +73 -0
  147. package/dist/esm/annotation/components/connector.d.ts +25 -0
  148. package/dist/esm/annotation/components/connector.js +332 -0
  149. package/dist/esm/annotation/components/contribution.d.ts +3 -0
  150. package/dist/esm/annotation/components/contribution.js +174 -0
  151. package/dist/esm/annotation/components/crossing.d.ts +3 -0
  152. package/dist/esm/annotation/components/crossing.js +665 -0
  153. package/dist/esm/annotation/components/event.d.ts +2 -0
  154. package/dist/esm/annotation/components/event.js +46 -0
  155. package/dist/esm/annotation/components/first.d.ts +2 -0
  156. package/dist/esm/annotation/components/first.js +18 -0
  157. package/dist/esm/annotation/components/group.d.ts +3 -0
  158. package/dist/esm/annotation/components/group.js +64 -0
  159. package/dist/esm/annotation/components/highlight.d.ts +14 -0
  160. package/dist/esm/annotation/components/highlight.js +838 -0
  161. package/dist/esm/annotation/components/index.d.ts +34 -0
  162. package/dist/esm/annotation/components/index.js +34 -0
  163. package/dist/esm/annotation/components/last.d.ts +2 -0
  164. package/dist/esm/annotation/components/last.js +18 -0
  165. package/dist/esm/annotation/components/max-x.d.ts +2 -0
  166. package/dist/esm/annotation/components/max-x.js +17 -0
  167. package/dist/esm/annotation/components/max-y.d.ts +2 -0
  168. package/dist/esm/annotation/components/max-y.js +17 -0
  169. package/dist/esm/annotation/components/mean.d.ts +2 -0
  170. package/dist/esm/annotation/components/mean.js +40 -0
  171. package/dist/esm/annotation/components/median.d.ts +2 -0
  172. package/dist/esm/annotation/components/median.js +32 -0
  173. package/dist/esm/annotation/components/min-x.d.ts +2 -0
  174. package/dist/esm/annotation/components/min-x.js +17 -0
  175. package/dist/esm/annotation/components/min-y.d.ts +2 -0
  176. package/dist/esm/annotation/components/min-y.js +17 -0
  177. package/dist/esm/annotation/components/outlier.d.ts +3 -0
  178. package/dist/esm/annotation/components/outlier.js +98 -0
  179. package/dist/esm/annotation/components/path.d.ts +20 -0
  180. package/dist/esm/annotation/components/path.js +165 -0
  181. package/dist/esm/annotation/components/peak.d.ts +2 -0
  182. package/dist/esm/annotation/components/peak.js +20 -0
  183. package/dist/esm/annotation/components/point.d.ts +26 -0
  184. package/dist/esm/annotation/components/point.js +277 -0
  185. package/dist/esm/annotation/components/quadrant.d.ts +3 -0
  186. package/dist/esm/annotation/components/quadrant.js +83 -0
  187. package/dist/esm/annotation/components/quantile.d.ts +2 -0
  188. package/dist/esm/annotation/components/quantile.js +32 -0
  189. package/dist/esm/annotation/components/range-inside.d.ts +2 -0
  190. package/dist/esm/annotation/components/range-inside.js +55 -0
  191. package/dist/esm/annotation/components/range-outside.d.ts +2 -0
  192. package/dist/esm/annotation/components/range-outside.js +55 -0
  193. package/dist/esm/annotation/components/range-x.d.ts +2 -0
  194. package/dist/esm/annotation/components/range-x.js +15 -0
  195. package/dist/esm/annotation/components/range-y.d.ts +2 -0
  196. package/dist/esm/annotation/components/range-y.js +15 -0
  197. package/dist/esm/annotation/components/range.d.ts +15 -0
  198. package/dist/esm/annotation/components/range.js +92 -0
  199. package/dist/esm/annotation/components/target.d.ts +2 -0
  200. package/dist/esm/annotation/components/target.js +44 -0
  201. package/dist/esm/annotation/components/text.d.ts +15 -0
  202. package/dist/esm/annotation/components/text.js +78 -0
  203. package/dist/esm/annotation/components/threshold-highlight.d.ts +3 -0
  204. package/dist/esm/annotation/components/threshold-highlight.js +297 -0
  205. package/dist/esm/annotation/components/threshold-x.d.ts +2 -0
  206. package/dist/esm/annotation/components/threshold-x.js +23 -0
  207. package/dist/esm/annotation/components/threshold-y.d.ts +2 -0
  208. package/dist/esm/annotation/components/threshold-y.js +24 -0
  209. package/dist/esm/annotation/components/top-n.d.ts +2 -0
  210. package/dist/esm/annotation/components/top-n.js +42 -0
  211. package/dist/esm/annotation/components/valley.d.ts +2 -0
  212. package/dist/esm/annotation/components/valley.js +20 -0
  213. package/dist/esm/annotation/index.d.ts +1 -0
  214. package/dist/esm/annotation/index.js +1 -0
  215. package/dist/esm/annotation/label.d.ts +38 -0
  216. package/dist/esm/annotation/label.js +449 -0
  217. package/dist/esm/annotation/layout.d.ts +12 -0
  218. package/dist/esm/annotation/layout.js +182 -0
  219. package/dist/esm/annotation/merge.d.ts +19 -0
  220. package/dist/esm/annotation/merge.js +67 -0
  221. package/dist/esm/annotation/registry.d.ts +190 -0
  222. package/dist/esm/annotation/registry.js +220 -0
  223. package/dist/esm/annotation/runtime/g2.d.ts +90 -0
  224. package/dist/esm/annotation/runtime/g2.js +754 -0
  225. package/dist/esm/annotation/runtime/g6.d.ts +40 -0
  226. package/dist/esm/annotation/runtime/g6.js +447 -0
  227. package/dist/esm/annotation/runtime/index.d.ts +11 -0
  228. package/dist/esm/annotation/runtime/index.js +26 -0
  229. package/dist/esm/annotation/runtime/summary.d.ts +17 -0
  230. package/dist/esm/annotation/runtime/summary.js +21 -0
  231. package/dist/esm/annotation/runtime/table.d.ts +16 -0
  232. package/dist/esm/annotation/runtime/table.js +21 -0
  233. package/dist/esm/annotation/utils.d.ts +40 -0
  234. package/dist/esm/annotation/utils.js +370 -0
  235. package/dist/esm/theme/annotation.d.ts +236 -0
  236. package/dist/esm/theme/annotation.js +186 -0
  237. package/dist/esm/theme/g2.js +2 -10
  238. package/dist/esm/theme/g6.js +1 -1
  239. package/dist/esm/theme/summary.js +1 -1
  240. package/dist/esm/types/annotation.d.ts +310 -0
  241. package/dist/esm/types/annotation.js +1 -0
  242. package/dist/esm/types/index.d.ts +1 -0
  243. package/dist/esm/util/axis.d.ts +28 -0
  244. package/dist/esm/util/axis.js +222 -0
  245. package/dist/esm/util/components.d.ts +0 -10
  246. package/dist/esm/util/components.js +24 -69
  247. package/dist/esm/util/index.d.ts +7 -4
  248. package/dist/esm/util/index.js +7 -4
  249. package/dist/esm/vis/area/index.d.ts +2 -0
  250. package/dist/esm/vis/area/index.js +32 -9
  251. package/dist/esm/vis/bar/index.d.ts +2 -0
  252. package/dist/esm/vis/bar/index.js +37 -6
  253. package/dist/esm/vis/boxplot/index.js +10 -2
  254. package/dist/esm/vis/column/index.d.ts +2 -0
  255. package/dist/esm/vis/column/index.js +33 -12
  256. package/dist/esm/vis/dual-axes/index.js +10 -10
  257. package/dist/esm/vis/fishbone-diagram/index.js +1 -1
  258. package/dist/esm/vis/flow-diagram/index.js +1 -1
  259. package/dist/esm/vis/funnel/index.js +2 -7
  260. package/dist/esm/vis/histogram/index.js +4 -3
  261. package/dist/esm/vis/indented-tree/index.js +1 -1
  262. package/dist/esm/vis/line/index.d.ts +2 -0
  263. package/dist/esm/vis/line/index.js +31 -9
  264. package/dist/esm/vis/liquid/index.js +1 -1
  265. package/dist/esm/vis/mindmap/index.js +1 -1
  266. package/dist/esm/vis/network-graph/index.d.ts +2 -0
  267. package/dist/esm/vis/network-graph/index.js +29 -2
  268. package/dist/esm/vis/organization-chart/index.js +1 -1
  269. package/dist/esm/vis/pie/index.d.ts +2 -0
  270. package/dist/esm/vis/pie/index.js +25 -8
  271. package/dist/esm/vis/radar/index.js +1 -3
  272. package/dist/esm/vis/sankey/index.js +15 -1
  273. package/dist/esm/vis/scatter/index.d.ts +10 -3
  274. package/dist/esm/vis/scatter/index.js +28 -5
  275. package/dist/esm/vis/summary/index.d.ts +12 -3
  276. package/dist/esm/vis/summary/index.js +35 -16
  277. package/dist/esm/vis/table/index.d.ts +2 -0
  278. package/dist/esm/vis/table/index.js +50 -33
  279. package/dist/esm/vis/venn/index.js +1 -1
  280. package/dist/esm/vis/violin/index.js +10 -2
  281. package/dist/esm/vis/waterfall/index.js +16 -13
  282. package/dist/esm/vis/word-cloud/index.js +1 -3
  283. package/dist/umd/index.min.js +1 -1
  284. package/package.json +1 -1
package/README.zh-CN.md CHANGED
@@ -1,35 +1,29 @@
1
- <img src="https://gw.alipayobjects.com/zos/antfincdn/R8sN%24GNdh6/language.svg" width="18"> [English](./README.md) | 简体中文
2
-
3
1
  <div align="center">
4
- <img src="https://github.com/eosphoros-ai/GPT-Vis/assets/17919400/c8804ffb-d3d6-45d3-846f-cf217681ab05" height="70" />
5
- </div>
6
2
 
7
- <h1 align="center">GPT-Vis</h1>
3
+ [English](./README.md) · [简体中文](./README.zh-CN.md)
8
4
 
9
- <div align="center">
5
+ <a href="https://gpt-vis.antv.vision/zh/">
6
+ <img src="https://github.com/eosphoros-ai/GPT-Vis/assets/17919400/c8804ffb-d3d6-45d3-846f-cf217681ab05" width="169" height="70" alt="GPT-Vis 标志" />
7
+ </a>
10
8
 
11
- 面向 LLM 时代的 AI 原生可视化库,框架无关,开箱即用。
9
+ # GPT-Vis:[让 AI 的洞察跃然图上。](https://gpt-vis.antv.vision/zh/) ✨
12
10
 
13
- [![npm version](https://img.shields.io/npm/v/@antv/gpt-vis.svg)](https://www.npmjs.com/package/@antv/gpt-vis)
14
- [![npm downloads](https://img.shields.io/npm/dm/@antv/gpt-vis.svg)](https://www.npmjs.com/package/@antv/gpt-vis)
15
- [![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
11
+ 面向 AI Agent 和应用的开源可视化库。<br />
12
+ 用 JSON 或 Syntax 渲染图表,用分析标注解释发现,用同一份主题统一整个报告。
16
13
 
17
- <p align="center">
18
- <a href="https://gpt-vis.antv.vision" target="_blank">📖 文档</a> ·
19
- <a href="https://gpt-vis.antv.vision/examples" target="_blank">🎨 图表示例</a> ·
20
- <a href="https://github.com/antvis/mcp-server-chart" target="_blank">🔌 MCP 服务</a> ·
21
- <a href="/skills/chart-visualization" target="_blank">🧩 图表技能</a>
22
- </p>
14
+ [![npm 版本](https://img.shields.io/npm/v/@antv/gpt-vis.svg?style=flat-square)](https://www.npmjs.com/package/@antv/gpt-vis)
15
+ [![npm 下载量](https://img.shields.io/npm/dm/@antv/gpt-vis.svg?style=flat-square)](https://www.npmjs.com/package/@antv/gpt-vis)
16
+ [![开源协议](https://img.shields.io/badge/license-MIT-6950a1.svg?style=flat-square)](./LICENSE)
23
17
 
24
- </div>
18
+ [官网](https://gpt-vis.antv.vision/zh/) · [文档](https://gpt-vis.antv.vision/zh/docs) · [示例](https://gpt-vis.antv.vision/zh/examples) · [主题工作台](https://gpt-vis.antv.vision/zh/themes) · [Agent Skill](https://gpt-vis.antv.vision/zh/docs/agent-skill)
25
19
 
26
- <div align="center">
27
- <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*yNtZT47dH1kAAAAAgBAAAAgAemJ7AQ/fmt.webp" width="100%" alt="GPT-Vis Hero Image" />
28
- </div>
20
+ <a href="https://gpt-vis.antv.vision/zh/">
21
+ <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*kvnpTJBzpr4AAAAAcdAAAAgAemJ7AQ/original" width="100%" alt="GPT-Vis:让 AI 的洞察跃然图上。26 种可视化、分析标注、主题定制与 Agent Skill。点击访问中文官网。" />
22
+ </a>
29
23
 
30
- <br/>
24
+ </div>
31
25
 
32
- ## ✨ 特性
26
+ ## 特性
33
27
 
34
28
  - 🚀 **框架无关** — 原生 JavaScript、React、Vue、Angular,任何框架均可使用
35
29
  - ✍️ **类 Markdown 语法** — LLM 可以直接生成的简洁语法,易学易用
@@ -37,57 +31,152 @@
37
31
  - 🛡️ **高容错** — 优雅处理不完整、格式异常的数据,适配 AI 生成内容的不确定性
38
32
  - 📊 **26 种图表** — 统计图表、关系图表、文本可视化,覆盖主流场景
39
33
  - 🎨 **可复用主题** — 一份 ThemeSpec 应用于所有图表,在 Theme Studio 预览微调,也可通过 AI Skill 创建
34
+ - **28 种分析能力** — 在图表中标出极值、排名、均值、目标、区间和交点,由 SDK 计算统计参考
35
+ - **Agent Skill** — 为 AI 助手提供选图、配置生成、框架集成与主题创建指南
36
+
37
+ 基于 [G2](https://github.com/antvis/G2)、[G6](https://github.com/antvis/G6) 与 [T8](https://github.com/antvis/T8) 构建,支持原生 JavaScript、React、Vue 等浏览器端框架。
38
+
39
+ ## 快速开始
40
+
41
+ ### 在 Agent 中使用
40
42
 
41
- ## 🚀 快速开始
43
+ 在项目目录运行以下命令,选择要使用的兼容助手:
42
44
 
43
- ### 安装
45
+ ```bash
46
+ npx skills add https://github.com/antvis/GPT-Vis/tree/ai --skill chart-visualization
47
+ ```
48
+
49
+ 安装后,让助手生成第一份报告:
50
+
51
+ > 使用 GPT-Vis Skill,根据上半年收入生成一份报告:1 月 84、2 月 96、3 月 91、4 月 118、5 月 126、6 月 148,单位为万元。包含折线图、表格和简短摘要,使用同一份主题,保存为可以在浏览器中打开的 report.html。
52
+
53
+ Skill 包含选图指南、可运行的配置模式和 Theme Creator 参考文档。[查看 Skill 源码](./skills/chart-visualization/SKILL.md)。
54
+
55
+ ### 使用 SDK 开发
44
56
 
45
57
  ```bash
46
58
  npm install @antv/gpt-vis
47
59
  ```
48
60
 
49
- ### 基础用法
61
+ 添加容器,在它挂载后运行以下代码:
50
62
 
51
- ```javascript
52
- import { GPTVis } from '@antv/gpt-vis';
63
+ ```html
64
+ <div id="chart" style="width: 100%; height: 360px;"></div>
65
+ ```
53
66
 
54
- const gptVis = new GPTVis({
55
- container: 'container',
56
- width: 600,
57
- height: 400,
58
- });
67
+ ```typescript
68
+ import { GPTVis } from '@antv/gpt-vis';
59
69
 
60
- gptVis.render({
70
+ const chart = new GPTVis({ container: '#chart', height: 360, theme: 'product' });
71
+ const data = [
72
+ { time: '1月', value: 84 },
73
+ { time: '2月', value: 96 },
74
+ { time: '3月', value: 91 },
75
+ { time: '4月', value: 118 },
76
+ { time: '5月', value: 126 },
77
+ { time: '6月', value: 148 },
78
+ ];
79
+
80
+ chart.render({
61
81
  type: 'line',
62
- data: [
63
- { time: '2020', value: 100 },
64
- { time: '2021', value: 120 },
65
- { time: '2022', value: 150 },
66
- ],
82
+ title: '月度收入(万元)',
83
+ data,
67
84
  });
85
+
86
+ // 视图卸载时销毁实例:
87
+ // chart.destroy();
68
88
  ```
69
89
 
70
- ### 流式渲染
90
+ <details>
91
+ <summary>也可以用 Syntax 文本渲染同一张图表</summary>
71
92
 
72
- AI 模型边生成、图表边渲染,无需等待完整响应:
93
+ 同一个 `render()` 方法接受以下文本:
73
94
 
74
- <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*_xY7Q6QyuZ4AAAAAWeAAAAgAemJ7AQ/original" width="100%" />
95
+ ```typescript
96
+ chart.render(`vis line
97
+ title 月度收入(万元)
98
+ data
99
+ - time 1月
100
+ value 84
101
+ - time 2月
102
+ value 96
103
+ - time 3月
104
+ value 91
105
+ - time 4月
106
+ value 118
107
+ - time 5月
108
+ value 126
109
+ - time 6月
110
+ value 148`);
111
+ ```
112
+
113
+ </details>
114
+
115
+ [快速开始](https://gpt-vis.antv.vision/zh/docs/quickstart) · [Syntax 指南](https://gpt-vis.antv.vision/zh/docs/syntax) · [API 参考](https://gpt-vis.antv.vision/zh/docs/reference/api)
116
+
117
+ ## 模型边生成,图表边呈现
118
+
119
+ 每次收到新内容时,将累计输出传给 `render()`。GPT-Vis 支持不完整输入,让图表在响应完成前开始呈现。
120
+
121
+ <a href="https://gpt-vis.antv.vision/zh/docs/streaming">
122
+ <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*_xY7Q6QyuZ4AAAAAWeAAAAgAemJ7AQ/original" width="100%" loading="lazy" alt="GPT-Vis 随模型输出逐步渲染图表。点击查看流式渲染指南。" />
123
+ </a>
75
124
 
76
125
  ```javascript
77
126
  import { GPTVis, isVisSyntax } from '@antv/gpt-vis';
78
127
 
79
- const gptVis = new GPTVis({ container: 'container', width: 600, height: 400 });
128
+ const chart = new GPTVis({ container: '#chart', width: 600, height: 400 });
80
129
  let buffer = '';
81
130
 
82
131
  function onToken(token) {
83
132
  buffer += token;
84
133
  if (isVisSyntax(buffer)) {
85
- gptVis.render(buffer);
134
+ chart.render(buffer);
86
135
  }
87
136
  }
88
137
  ```
89
138
 
90
- ## 📚 语法指南
139
+ [流式渲染指南 →](https://gpt-vis.antv.vision/zh/docs/streaming)
140
+
141
+ ## 28 种分析能力
142
+
143
+ 通过 `annotations` 表达分析意图,让均值、目标、排名和异常值直接显示在图表中。
144
+
145
+ <a href="https://gpt-vis.antv.vision/zh/examples/annotations">
146
+ <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*K7X8TK5NDl4AAAAASDAAAAgAemJ7AQ/original" width="100%" loading="lazy" alt="GPT-Vis 分析标注前后对比:收入均值与目标线、响应时间参考区间与 IQR 异常值。" />
147
+ </a>
148
+
149
+ 复用快速开始中的数据,添加均值参考线和 140 万元目标线:
150
+
151
+ ```typescript
152
+ chart.render({
153
+ type: 'line',
154
+ data,
155
+ annotations: [{ type: 'mean' }, { type: 'thresholdY', threshold: 140, label: '目标 140' }],
156
+ });
157
+ ```
158
+
159
+ 均值为 **110.5 万元**,6 月收入 **148 万元**超过目标。统计参考由 SDK 计算,目标值由配置提供。
160
+
161
+ <details>
162
+ <summary>查看全部 28 种分析能力</summary>
163
+
164
+ | 分析用途 | 能力 | `type` 配置值 |
165
+ | ------------------ | ---------------------------------------------------- | ----------------------------------------------------------------- |
166
+ | **极值与观测 · 8** | X/Y 最大值与最小值、首尾观测、局部峰值与谷值 | `maxX`, `minX`, `maxY`, `minY`, `first`, `last`, `peak`, `valley` |
167
+ | **排名与贡献 · 4** | Top N、Bottom N、系列强调、贡献占比 | `topN`, `bottomN`, `group`, `contribution` |
168
+ | **统计参考 · 5** | 均值、中位数、分位数、IQR 异常值、散点中心或加权中心 | `mean`, `median`, `quantile`, `outlier`, `centroid` |
169
+ | **阈值与目标 · 4** | X/Y 阈值线、目标或基线、阈值强调 | `thresholdX`, `thresholdY`, `target`, `thresholdHighlight` |
170
+ | **区间与区域 · 5** | X/Y 区间、区间内外强调、象限 | `rangeX`, `rangeY`, `rangeInside`, `rangeOutside`, `quadrant` |
171
+ | **事件与交点 · 2** | 事件标记、阈值穿越或双系列交点 | `event`, `crossing` |
172
+
173
+ </details>
174
+
175
+ [体验全部 28 种能力](https://gpt-vis.antv.vision/zh/examples/annotations) · [支持的图表、数据选择与计算规则](https://gpt-vis.antv.vision/zh/docs/annotations)
176
+
177
+ 这些能力以当前源码为准。使用时请确认所选 SDK 版本包含需要的标注;安装 Skill 不会升级渲染库。
178
+
179
+ ## 语法指南
91
180
 
92
181
  `render()` 支持两种输入格式:对象配置(适合程序化调用)和 DSL 语法(适合 LLM 流式生成)。
93
182
 
@@ -98,7 +187,7 @@ function onToken(token) {
98
187
  **折线图:**
99
188
 
100
189
  ```javascript
101
- gptVis.render({
190
+ chart.render({
102
191
  type: 'line',
103
192
  data: [
104
193
  { time: '2020', value: 100 },
@@ -111,7 +200,7 @@ gptVis.render({
111
200
  **饼图:**
112
201
 
113
202
  ```javascript
114
- gptVis.render({
203
+ chart.render({
115
204
  type: 'pie',
116
205
  data: [
117
206
  { category: 'Android', value: 72 },
@@ -121,52 +210,12 @@ gptVis.render({
121
210
  });
122
211
  ```
123
212
 
124
- **主题:**
125
-
126
- 内置三套主题,通过 `theme` 属性切换:
127
-
128
- | 主题 | 标识 | 背景色 | 色板 |
129
- | ------------ | --------- | --------- | ----------------------------------------------------- |
130
- | 默认(亮色) | `default` | `#FFF` | `#5B6CFF` `#2DAF9E` `#F2B84B` `#EF6A6A` `#55A6D9` ... |
131
- | 暗色 | `dark` | `#141414` | `#5B6CFF` `#2DAF9E` `#F2B84B` `#EF6A6A` `#55A6D9` ... |
132
- | 学术 | `academy` | `#FFF` | `#4e79a7` `#f28e2c` `#e15759` `#76b7b2` `#59a14f` ... |
133
-
134
- ```javascript
135
- gptVis.render({
136
- type: 'line',
137
- data: [
138
- { time: '2020', value: 100 },
139
- { time: '2021', value: 120 },
140
- ],
141
- theme: 'dark',
142
- });
143
- ```
144
-
145
- **可复用的自定义主题:**
146
-
147
- 向构造函数的 `theme` 传入 `ThemeSpec` 对象,即可让全部 26 种图表共享颜色、字体、间距和 Mark 样式,包括关系图、Table 和 Summary:
148
-
149
- ```typescript
150
- import { GPTVis, type ThemeSpec } from '@antv/gpt-vis';
151
-
152
- const theme: ThemeSpec = {
153
- id: 'my-report',
154
- label: 'My report',
155
- tokens: { colorDefault: '#7047eb', fontFamily: 'Arial, sans-serif', radius: 6 },
156
- };
157
- const chart = new GPTVis({ container: '#chart', theme });
158
- ```
159
-
160
- 优先级:**单图 config > 自定义 ThemeSpec > GPT-Vis 内置主题**。具体合并顺序:内置默认值 < Tokens < 全局 `style` < `charts[type].style` < 单图 `style`。嵌套对象合并,数组整体替换。单图显式指定 `theme` 时,会替换构造函数选择的主题。Summary 通过构造函数接收主题,渲染输入仍为 T8 文本,没有单次渲染的 `style` 对象入口。
161
-
162
- 可在 [Theme Studio](https://gpt-vis.antv.vision/themes) 预览和分享主题,阅读[主题文档](https://gpt-vis.antv.vision/docs#custom-themes),或使用[主题创建指南](./skills/chart-visualization/references/theme-creator.md) 根据品牌参考资料生成 ThemeSpec。
163
-
164
- 工作台的预设是 ThemeSpec 示例,使用时需要把完整对象传给 `theme`;`id` 只是元数据,不是已注册的主题名称。
213
+ 主题名称、自定义 ThemeSpec 与样式覆盖见 [主题与样式](#主题与样式)。
165
214
 
166
215
  **自定义样式:**
167
216
 
168
217
  ```javascript
169
- gptVis.render({
218
+ chart.render({
170
219
  type: 'line',
171
220
  data: [
172
221
  { time: '2020', value: 100 },
@@ -267,10 +316,85 @@ data
267
316
  value 150
268
317
  `;
269
318
 
270
- gptVis.render(visSyntax);
319
+ chart.render(visSyntax);
320
+ ```
321
+
322
+ ## 主题与样式
323
+
324
+ 同一份主题可以跨图表和表格复用,统一配色、字体与样式。除了原有的三套基础主题,还可选择 `gpt-vis`、`midnight`、`paper`、`pop` 等 10 套内置风格:
325
+
326
+ <a href="https://gpt-vis.antv.vision/zh/themes">
327
+ <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*qtqnQqP2CLAAAAAATkAAAAgAemJ7AQ/original" width="100%" loading="lazy" alt="GPT-Vis、Midnight、Paper 与 Pop 主题下的相同折线图和表格。" />
328
+ </a>
329
+
330
+ ### 内置主题
331
+
332
+ 通过 `theme` 属性切换内置主题。原有的三套基础主题保持原来的外观:
333
+
334
+ | 主题 | 标识 | 背景色 | 色板 |
335
+ | ------------ | --------- | --------- | ----------------------------------------------------- |
336
+ | 默认(亮色) | `default` | `#FFF` | `#5B6CFF` `#2DAF9E` `#F2B84B` `#EF6A6A` `#55A6D9` ... |
337
+ | 暗色 | `dark` | `#141414` | `#5B6CFF` `#2DAF9E` `#F2B84B` `#EF6A6A` `#55A6D9` ... |
338
+ | 学术 | `academy` | `#FFF` | `#4e79a7` `#f28e2c` `#e15759` `#76b7b2` `#59a14f` ... |
339
+
340
+ 官网主题工作台的 10 套风格也已内置:
341
+
342
+ | 主题 | 标识 |
343
+ | ----------------------------------------------- | -------------- |
344
+ | GPT-Vis | `gpt-vis` |
345
+ | Midnight | `midnight` |
346
+ | Paper | `paper` |
347
+ | Product | `product` |
348
+ | Neon Circuit | `neon-circuit` |
349
+ | Terra Print | `terra-print` |
350
+ | Mono Signal | `mono-signal` |
351
+ | Candy Pop | `candy-pop` |
352
+ | [Pop](https://github.com/microsoft/flint-chart) | `pop` |
353
+ | Bauhaus | `bauhaus` |
354
+
355
+ `gpt-vis` 是官网的品牌主题,与 SDK 的 `default` 不同。
356
+
357
+ ```typescript
358
+ const themedChart = new GPTVis({ container: '#chart', theme: 'pop' });
359
+ ```
360
+
361
+ 主题名称可用于构造函数、图表 JSON 和 Syntax(`theme pop`)。Summary 通过构造函数接收主题,支持的名称类型为 `BuiltinThemeName`。
362
+
363
+ ```javascript
364
+ chart.render({
365
+ type: 'line',
366
+ data: [
367
+ { time: '2020', value: 100 },
368
+ { time: '2021', value: 120 },
369
+ ],
370
+ theme: 'dark',
371
+ });
372
+ ```
373
+
374
+ ### 可复用的自定义主题
375
+
376
+ 向构造函数的 `theme` 传入 `ThemeSpec` 对象,即可让全部 26 种图表共享颜色、字体、间距和 Mark 样式,包括关系图、Table 和 Summary:
377
+
378
+ ```typescript
379
+ import { GPTVis, type ThemeSpec } from '@antv/gpt-vis';
380
+
381
+ const theme: ThemeSpec = {
382
+ id: 'my-report',
383
+ label: 'My report',
384
+ tokens: { colorDefault: '#7047eb', fontFamily: 'Arial, sans-serif', radius: 6 },
385
+ };
386
+ const chart = new GPTVis({ container: '#chart', theme });
271
387
  ```
272
388
 
273
- ## 📊 图表类型
389
+ 优先级:**单图 config > 自定义 ThemeSpec > GPT-Vis 内置主题**。具体合并顺序:内置默认值 < Tokens < 全局 `style` < `charts[type].style` < 单图 `style`。嵌套对象合并,数组整体替换。单图显式指定 `theme` 时,会替换构造函数选择的主题。Summary 通过构造函数接收主题,渲染输入仍为 T8 文本,没有单次渲染的 `style` 对象入口。
390
+
391
+ 可在 [Theme Studio](https://gpt-vis.antv.vision/zh/themes) 预览和分享主题,阅读[主题文档](https://gpt-vis.antv.vision/zh/docs/themes),或使用[主题创建指南](./skills/chart-visualization/references/theme-creator.md) 根据品牌参考资料生成 ThemeSpec。
392
+
393
+ 未修改的工作台预设可直接使用内置名称。自定义后需要把完整对象传给 `theme`;自定义 `id` 只是元数据,不会注册新的主题名称。
394
+
395
+ 单张图表仍可通过 `style` 覆盖主题中的配色和 Mark 样式,见上面的对象配置与 Syntax 示例。
396
+
397
+ ## 图表类型
274
398
 
275
399
  支持 26 种图表,覆盖统计分析、关系网络、文本可视化三大类。
276
400
 
@@ -293,7 +417,7 @@ gptVis.render(visSyntax);
293
417
  | 小提琴图 | `violin` |
294
418
  | 韦恩图 | `venn` |
295
419
  | 桑基图 | `sankey` |
296
- | 树图 | `treemap` |
420
+ | 矩形树图 | `treemap` |
297
421
  | 词云 | `word-cloud` |
298
422
  | 水波图 | `liquid` |
299
423
 
@@ -315,9 +439,17 @@ gptVis.render(visSyntax);
315
439
  | 表格 | `table` |
316
440
  | 文本摘要 | `summary` |
317
441
 
318
- 查看全部示例 → [图表示例](https://gpt-vis.antv.vision/examples)
442
+ 查看全部示例 → [图表示例](https://gpt-vis.antv.vision/zh/examples)
319
443
 
320
- ## 🔧 框架集成
444
+ ## 框架集成
445
+
446
+ | 集成方式 | 从这里开始 |
447
+ | --------------------------------- | ------------------------------------------------------------------------------------------------ |
448
+ | **React 与 Vue** | [框架生命周期示例](https://gpt-vis.antv.vision/zh/docs/integrations/frameworks) |
449
+ | **Markdown** | [渲染模型响应中的可视化代码块](https://gpt-vis.antv.vision/zh/docs/integrations/markdown) |
450
+ | **shadcn/ui** | [将通用或单图表 React 组件复制到项目中](https://gpt-vis.antv.vision/zh/docs/integrations/shadcn) |
451
+ | **MCP** | [MCP Server Chart](https://github.com/antvis/mcp-server-chart) |
452
+ | **服务端渲染、Streamlit 与 Dify** | [了解生态集成](https://gpt-vis.antv.vision/zh/docs/integrations/ecosystem) |
321
453
 
322
454
  <details>
323
455
  <summary><strong>原生 JavaScript</strong></summary>
@@ -325,8 +457,17 @@ gptVis.render(visSyntax);
325
457
  ```javascript
326
458
  import { GPTVis } from '@antv/gpt-vis';
327
459
 
328
- const gptVis = new GPTVis({ container: 'chart', width: 600, height: 400 });
329
- gptVis.render(visSyntaxString);
460
+ const chart = new GPTVis({ container: '#chart', width: 600, height: 400 });
461
+ chart.render({
462
+ type: 'line',
463
+ data: [
464
+ { time: '2020', value: 100 },
465
+ { time: '2021', value: 120 },
466
+ { time: '2022', value: 150 },
467
+ ],
468
+ });
469
+
470
+ // 页面卸载时调用 chart.destroy()。
330
471
  ```
331
472
 
332
473
  </details>
@@ -340,16 +481,16 @@ import { useEffect, useRef } from 'react';
340
481
 
341
482
  function ChartComponent({ visSyntax }) {
342
483
  const containerRef = useRef();
343
- const gptVisRef = useRef();
484
+ const chartRef = useRef();
344
485
 
345
486
  useEffect(() => {
346
- gptVisRef.current = new GPTVis({ container: containerRef.current, width: 600, height: 400 });
347
- return () => gptVisRef.current?.destroy();
487
+ chartRef.current = new GPTVis({ container: containerRef.current, width: 600, height: 400 });
488
+ return () => chartRef.current?.destroy();
348
489
  }, []);
349
490
 
350
491
  useEffect(() => {
351
- if (gptVisRef.current && visSyntax) {
352
- gptVisRef.current.render(visSyntax);
492
+ if (chartRef.current && visSyntax) {
493
+ chartRef.current.render(visSyntax);
353
494
  }
354
495
  }, [visSyntax]);
355
496
 
@@ -368,25 +509,26 @@ function ChartComponent({ visSyntax }) {
368
509
  </template>
369
510
 
370
511
  <script setup>
371
- import { ref, watch, onUnmounted } from 'vue';
512
+ import { ref, watch, onMounted, onUnmounted } from 'vue';
372
513
  import { GPTVis } from '@antv/gpt-vis';
373
514
 
374
515
  const props = defineProps(['visSyntax']);
375
516
  const chartRef = ref(null);
376
- let gptVis = null;
517
+ let chart = null;
518
+
519
+ onMounted(() => {
520
+ chart = new GPTVis({ container: chartRef.value, width: 600, height: 400 });
521
+ if (props.visSyntax) chart.render(props.visSyntax);
522
+ });
377
523
 
378
524
  watch(
379
525
  () => props.visSyntax,
380
526
  (syntax) => {
381
- if (!gptVis) {
382
- gptVis = new GPTVis({ container: chartRef.value, width: 600, height: 400 });
383
- }
384
- gptVis.render(syntax);
527
+ if (chart && syntax) chart.render(syntax);
385
528
  },
386
- { immediate: true },
387
529
  );
388
530
 
389
- onUnmounted(() => gptVis?.destroy());
531
+ onUnmounted(() => chart?.destroy());
390
532
  </script>
391
533
  ```
392
534
 
@@ -439,7 +581,7 @@ const marked = new Marked(
439
581
  code({ text, lang }) {
440
582
  if (lang?.startsWith('vis')) {
441
583
  const syntax = encodeURIComponent(lang + '\n' + text);
442
- return `<gpt-vis data-syntax="${syntax}" style="min-height:300px"></gpt-vis>`;
584
+ return `<gpt-vis data-syntax="${syntax}" style="display:block;min-height:300px"></gpt-vis>`;
443
585
  }
444
586
  return false;
445
587
  },
@@ -463,12 +605,13 @@ title 2024 Programming Language Popularity
463
605
  \`\`\`
464
606
  `;
465
607
 
608
+ // 页面中需有 <div id="content"></div>。
466
609
  document.getElementById('content').innerHTML = marked.parse(markdown);
467
610
  ```
468
611
 
469
612
  </details>
470
613
 
471
- ## 🧩 Shadcn/ui
614
+ ## Shadcn/ui
472
615
 
473
616
  通过 shadcn CLI 将 GPT-Vis React 组件直接复制到你的项目中 — 完全源代码控制,高度可定制。
474
617
 
@@ -484,7 +627,7 @@ npx shadcn@latest add @gpt-vis/gpt-vis
484
627
  import { GPTVis } from '@/components/ui/gpt-vis';
485
628
 
486
629
  <GPTVis
487
- content="vis line
630
+ content={`vis line
488
631
  data
489
632
  - time 2020
490
633
  value 100
@@ -492,7 +635,7 @@ data
492
635
  value 120
493
636
  - time 2022
494
637
  value 150
495
- title 销售趋势"
638
+ title 销售趋势`}
496
639
  theme="academy"
497
640
  />;
498
641
  ```
@@ -533,14 +676,16 @@ npx shadcn@latest add @gpt-vis/mindmap
533
676
 
534
677
  每个类型化组件自动将基础 `GPTVis` 组件作为依赖安装。`width`、`height`、`theme`、`wrapper`、`locale`、`className`、`containerStyle` 等属性在所有组件中保持一致。
535
678
 
536
- ## 🤖 AI 生态
679
+ ## AI 生态
537
680
 
538
681
  GPT-Vis 提供完整的 AI 集成方案:
539
682
 
540
683
  - **[MCP 服务](https://github.com/antvis/mcp-server-chart)** — 通过 Model Context Protocol 让 AI 模型直接调用可视化能力
541
- - **[图表技能](https://github.com/antvis/GPT-Vis/tree/main/skills/chart-visualization)** — 为 AI 助手提供图表选择、JSON、Syntax 和集成代码生成能力,内含 Theme Creator 参考文档,可创建可复用的自定义主题
684
+ - **[图表技能](./skills/chart-visualization/SKILL.md)** — 为 AI 助手提供图表选择、JSON、Syntax 和集成代码生成能力,内含 Theme Creator 参考文档,可创建可复用的自定义主题
542
685
 
543
- ## 🤝 贡献
686
+ - **[服务端渲染与社区集成](https://gpt-vis.antv.vision/zh/docs/integrations/ecosystem)** — 了解服务端出图、Streamlit、Dify 等集成方式
687
+
688
+ ## 贡献
544
689
 
545
690
  > **AI 生成代码策略**:本项目仅合并 AI 生成的代码。
546
691
 
@@ -548,6 +693,8 @@ GPT-Vis 提供完整的 AI 集成方案:
548
693
  2. 标记 @copilot 生成实现方案
549
694
  3. 提交包含 AI 生成代码的 PR
550
695
 
551
- ## 📄 开源协议
696
+ [反馈问题](https://github.com/antvis/GPT-Vis/issues)
697
+
698
+ ## 开源协议
552
699
 
553
700
  [MIT](./LICENSE) © [AntV](https://antv.antgroup.com/)
@@ -0,0 +1,2 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ export declare const bottomN: AnnotationComponent<'bottomN', 'g2' | 'table'>;
@@ -0,0 +1,57 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/annotation/components/bottom-n.ts
20
+ var bottom_n_exports = {};
21
+ __export(bottom_n_exports, {
22
+ bottomN: () => bottomN
23
+ });
24
+ module.exports = __toCommonJS(bottom_n_exports);
25
+ var import_label = require("../label");
26
+ var import_utils = require("../utils");
27
+ var import_highlight = require("./highlight");
28
+ var bottomN = {
29
+ g2: (annotations, { mapping }) => annotations.flatMap((annotation) => {
30
+ const rows = (0, import_utils.selectRows)(mapping.data, annotation.data);
31
+ const field = mapping.y;
32
+ return (0, import_utils.selectRank)(rows, field, annotation.n, false).flatMap((row, index) => {
33
+ const highlights = import_highlight.highlight.create({
34
+ data: [row],
35
+ label: annotation.label ?? `Bottom ${index + 1}`,
36
+ style: annotation.style
37
+ });
38
+ highlights.forEach((highlight2) => import_label.rankedLabels.set(highlight2, annotation));
39
+ return highlights;
40
+ });
41
+ }),
42
+ table: (annotations, { data }) => annotations.flatMap((annotation) => {
43
+ const rows = (0, import_utils.selectRows)(data, annotation.data.row);
44
+ const field = annotation.data.field;
45
+ return (0, import_utils.selectRank)(rows, field, annotation.n, false).flatMap(
46
+ (row, index) => import_highlight.highlight.create({
47
+ data: [{ row, column: annotation.data.column }],
48
+ label: annotation.label ?? `Bottom ${index + 1}`,
49
+ style: annotation.style
50
+ })
51
+ );
52
+ })
53
+ };
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ bottomN
57
+ });
@@ -0,0 +1,2 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ export declare const centroid: AnnotationComponent<'centroid'>;