@antv/gpt-vis 1.3.1 → 1.4.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 (286) 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 +9 -2
  136. package/dist/cjs/vis/summary/index.js +25 -8
  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/cjs/vis-wrapper/index.js +2 -1
  144. package/dist/esm/annotation/components/bottom-n.d.ts +2 -0
  145. package/dist/esm/annotation/components/bottom-n.js +42 -0
  146. package/dist/esm/annotation/components/centroid.d.ts +2 -0
  147. package/dist/esm/annotation/components/centroid.js +73 -0
  148. package/dist/esm/annotation/components/connector.d.ts +25 -0
  149. package/dist/esm/annotation/components/connector.js +332 -0
  150. package/dist/esm/annotation/components/contribution.d.ts +3 -0
  151. package/dist/esm/annotation/components/contribution.js +174 -0
  152. package/dist/esm/annotation/components/crossing.d.ts +3 -0
  153. package/dist/esm/annotation/components/crossing.js +665 -0
  154. package/dist/esm/annotation/components/event.d.ts +2 -0
  155. package/dist/esm/annotation/components/event.js +46 -0
  156. package/dist/esm/annotation/components/first.d.ts +2 -0
  157. package/dist/esm/annotation/components/first.js +18 -0
  158. package/dist/esm/annotation/components/group.d.ts +3 -0
  159. package/dist/esm/annotation/components/group.js +64 -0
  160. package/dist/esm/annotation/components/highlight.d.ts +14 -0
  161. package/dist/esm/annotation/components/highlight.js +838 -0
  162. package/dist/esm/annotation/components/index.d.ts +34 -0
  163. package/dist/esm/annotation/components/index.js +34 -0
  164. package/dist/esm/annotation/components/last.d.ts +2 -0
  165. package/dist/esm/annotation/components/last.js +18 -0
  166. package/dist/esm/annotation/components/max-x.d.ts +2 -0
  167. package/dist/esm/annotation/components/max-x.js +17 -0
  168. package/dist/esm/annotation/components/max-y.d.ts +2 -0
  169. package/dist/esm/annotation/components/max-y.js +17 -0
  170. package/dist/esm/annotation/components/mean.d.ts +2 -0
  171. package/dist/esm/annotation/components/mean.js +40 -0
  172. package/dist/esm/annotation/components/median.d.ts +2 -0
  173. package/dist/esm/annotation/components/median.js +32 -0
  174. package/dist/esm/annotation/components/min-x.d.ts +2 -0
  175. package/dist/esm/annotation/components/min-x.js +17 -0
  176. package/dist/esm/annotation/components/min-y.d.ts +2 -0
  177. package/dist/esm/annotation/components/min-y.js +17 -0
  178. package/dist/esm/annotation/components/outlier.d.ts +3 -0
  179. package/dist/esm/annotation/components/outlier.js +98 -0
  180. package/dist/esm/annotation/components/path.d.ts +20 -0
  181. package/dist/esm/annotation/components/path.js +165 -0
  182. package/dist/esm/annotation/components/peak.d.ts +2 -0
  183. package/dist/esm/annotation/components/peak.js +20 -0
  184. package/dist/esm/annotation/components/point.d.ts +26 -0
  185. package/dist/esm/annotation/components/point.js +277 -0
  186. package/dist/esm/annotation/components/quadrant.d.ts +3 -0
  187. package/dist/esm/annotation/components/quadrant.js +83 -0
  188. package/dist/esm/annotation/components/quantile.d.ts +2 -0
  189. package/dist/esm/annotation/components/quantile.js +32 -0
  190. package/dist/esm/annotation/components/range-inside.d.ts +2 -0
  191. package/dist/esm/annotation/components/range-inside.js +55 -0
  192. package/dist/esm/annotation/components/range-outside.d.ts +2 -0
  193. package/dist/esm/annotation/components/range-outside.js +55 -0
  194. package/dist/esm/annotation/components/range-x.d.ts +2 -0
  195. package/dist/esm/annotation/components/range-x.js +15 -0
  196. package/dist/esm/annotation/components/range-y.d.ts +2 -0
  197. package/dist/esm/annotation/components/range-y.js +15 -0
  198. package/dist/esm/annotation/components/range.d.ts +15 -0
  199. package/dist/esm/annotation/components/range.js +92 -0
  200. package/dist/esm/annotation/components/target.d.ts +2 -0
  201. package/dist/esm/annotation/components/target.js +44 -0
  202. package/dist/esm/annotation/components/text.d.ts +15 -0
  203. package/dist/esm/annotation/components/text.js +78 -0
  204. package/dist/esm/annotation/components/threshold-highlight.d.ts +3 -0
  205. package/dist/esm/annotation/components/threshold-highlight.js +297 -0
  206. package/dist/esm/annotation/components/threshold-x.d.ts +2 -0
  207. package/dist/esm/annotation/components/threshold-x.js +23 -0
  208. package/dist/esm/annotation/components/threshold-y.d.ts +2 -0
  209. package/dist/esm/annotation/components/threshold-y.js +24 -0
  210. package/dist/esm/annotation/components/top-n.d.ts +2 -0
  211. package/dist/esm/annotation/components/top-n.js +42 -0
  212. package/dist/esm/annotation/components/valley.d.ts +2 -0
  213. package/dist/esm/annotation/components/valley.js +20 -0
  214. package/dist/esm/annotation/index.d.ts +1 -0
  215. package/dist/esm/annotation/index.js +1 -0
  216. package/dist/esm/annotation/label.d.ts +38 -0
  217. package/dist/esm/annotation/label.js +449 -0
  218. package/dist/esm/annotation/layout.d.ts +12 -0
  219. package/dist/esm/annotation/layout.js +182 -0
  220. package/dist/esm/annotation/merge.d.ts +19 -0
  221. package/dist/esm/annotation/merge.js +67 -0
  222. package/dist/esm/annotation/registry.d.ts +190 -0
  223. package/dist/esm/annotation/registry.js +220 -0
  224. package/dist/esm/annotation/runtime/g2.d.ts +90 -0
  225. package/dist/esm/annotation/runtime/g2.js +754 -0
  226. package/dist/esm/annotation/runtime/g6.d.ts +40 -0
  227. package/dist/esm/annotation/runtime/g6.js +447 -0
  228. package/dist/esm/annotation/runtime/index.d.ts +11 -0
  229. package/dist/esm/annotation/runtime/index.js +26 -0
  230. package/dist/esm/annotation/runtime/summary.d.ts +17 -0
  231. package/dist/esm/annotation/runtime/summary.js +21 -0
  232. package/dist/esm/annotation/runtime/table.d.ts +16 -0
  233. package/dist/esm/annotation/runtime/table.js +21 -0
  234. package/dist/esm/annotation/utils.d.ts +40 -0
  235. package/dist/esm/annotation/utils.js +370 -0
  236. package/dist/esm/theme/annotation.d.ts +236 -0
  237. package/dist/esm/theme/annotation.js +186 -0
  238. package/dist/esm/theme/g2.js +2 -10
  239. package/dist/esm/theme/g6.js +1 -1
  240. package/dist/esm/theme/summary.js +1 -1
  241. package/dist/esm/types/annotation.d.ts +310 -0
  242. package/dist/esm/types/annotation.js +1 -0
  243. package/dist/esm/types/index.d.ts +1 -0
  244. package/dist/esm/util/axis.d.ts +28 -0
  245. package/dist/esm/util/axis.js +222 -0
  246. package/dist/esm/util/components.d.ts +0 -10
  247. package/dist/esm/util/components.js +24 -69
  248. package/dist/esm/util/index.d.ts +7 -4
  249. package/dist/esm/util/index.js +7 -4
  250. package/dist/esm/vis/area/index.d.ts +2 -0
  251. package/dist/esm/vis/area/index.js +32 -9
  252. package/dist/esm/vis/bar/index.d.ts +2 -0
  253. package/dist/esm/vis/bar/index.js +37 -6
  254. package/dist/esm/vis/boxplot/index.js +10 -2
  255. package/dist/esm/vis/column/index.d.ts +2 -0
  256. package/dist/esm/vis/column/index.js +33 -12
  257. package/dist/esm/vis/dual-axes/index.js +10 -10
  258. package/dist/esm/vis/fishbone-diagram/index.js +1 -1
  259. package/dist/esm/vis/flow-diagram/index.js +1 -1
  260. package/dist/esm/vis/funnel/index.js +2 -7
  261. package/dist/esm/vis/histogram/index.js +4 -3
  262. package/dist/esm/vis/indented-tree/index.js +1 -1
  263. package/dist/esm/vis/line/index.d.ts +2 -0
  264. package/dist/esm/vis/line/index.js +31 -9
  265. package/dist/esm/vis/liquid/index.js +1 -1
  266. package/dist/esm/vis/mindmap/index.js +1 -1
  267. package/dist/esm/vis/network-graph/index.d.ts +2 -0
  268. package/dist/esm/vis/network-graph/index.js +29 -2
  269. package/dist/esm/vis/organization-chart/index.js +1 -1
  270. package/dist/esm/vis/pie/index.d.ts +2 -0
  271. package/dist/esm/vis/pie/index.js +25 -8
  272. package/dist/esm/vis/radar/index.js +1 -3
  273. package/dist/esm/vis/sankey/index.js +15 -1
  274. package/dist/esm/vis/scatter/index.d.ts +10 -3
  275. package/dist/esm/vis/scatter/index.js +28 -5
  276. package/dist/esm/vis/summary/index.d.ts +9 -2
  277. package/dist/esm/vis/summary/index.js +31 -13
  278. package/dist/esm/vis/table/index.d.ts +2 -0
  279. package/dist/esm/vis/table/index.js +50 -33
  280. package/dist/esm/vis/venn/index.js +1 -1
  281. package/dist/esm/vis/violin/index.js +10 -2
  282. package/dist/esm/vis/waterfall/index.js +16 -13
  283. package/dist/esm/vis/word-cloud/index.js +1 -3
  284. package/dist/esm/vis-wrapper/index.js +2 -1
  285. package/dist/umd/index.min.js +1 -1
  286. package/package.json +2 -2
@@ -22,12 +22,12 @@ __export(g2_exports, {
22
22
  getThemeObject: () => getThemeObject
23
23
  });
24
24
  module.exports = __toCommonJS(g2_exports);
25
- var import_tokens = require("../util/tokens");
25
+ var import_util = require("../util");
26
26
  var import_merge = require("./merge");
27
27
  var import_resolve = require("./resolve");
28
28
  var import_shared = require("./shared");
29
29
  var createTheme = (type) => {
30
- const tokens = (0, import_tokens.getChartVisualTokens)(type);
30
+ const tokens = (0, import_util.getChartVisualTokens)(type);
31
31
  const isDark = type === "dark";
32
32
  const isAcademy = type === "academy";
33
33
  const colors = isAcademy ? import_shared.ACADEMY_COLOR_PALETTE : import_shared.DEFAULT_COLOR_PALETTE;
@@ -49,17 +49,17 @@ var createTheme = (type) => {
49
49
  },
50
50
  line: {
51
51
  line: {
52
- lineWidth: import_tokens.CHART_STYLE_DEFAULTS.lineWidth
52
+ lineWidth: import_util.CHART_STYLE_DEFAULTS.lineWidth
53
53
  }
54
54
  },
55
55
  area: {
56
56
  area: {
57
- fillOpacity: import_tokens.CHART_STYLE_DEFAULTS.areaOpacity
57
+ fillOpacity: import_util.CHART_STYLE_DEFAULTS.areaOpacity
58
58
  }
59
59
  },
60
60
  point: {
61
61
  point: {
62
- lineWidth: import_tokens.CHART_STYLE_DEFAULTS.pointLineWidth,
62
+ lineWidth: import_util.CHART_STYLE_DEFAULTS.pointLineWidth,
63
63
  fillOpacity: 0.82
64
64
  },
65
65
  hollow: {
@@ -68,7 +68,6 @@ var createTheme = (type) => {
68
68
  }
69
69
  },
70
70
  axis: {
71
- labelAutoHide: { keepHeader: true, keepTail: true },
72
71
  titleOpacity: 1,
73
72
  titleFillOpacity: 1,
74
73
  labelOpacity: 1,
@@ -95,13 +94,13 @@ var createTheme = (type) => {
95
94
  tickLength: 5
96
95
  } : {
97
96
  titleFill: tokens.textSecondary,
98
- titleFontFamily: import_tokens.CHART_FONT_FAMILY,
97
+ titleFontFamily: import_util.CHART_FONT_FAMILY,
99
98
  titleFontSize: 12,
100
99
  titleFontWeight: 500,
101
100
  titleLineWidth: 0,
102
101
  titleSpacing: 16,
103
102
  labelFill: tokens.textSecondary,
104
- labelFontFamily: import_tokens.CHART_FONT_FAMILY,
103
+ labelFontFamily: import_util.CHART_FONT_FAMILY,
105
104
  labelFontSize: 12,
106
105
  labelFontWeight: 400,
107
106
  labelLineWidth: 0,
@@ -112,7 +111,6 @@ var createTheme = (type) => {
112
111
  },
113
112
  axisX: {
114
113
  grid: isAcademy,
115
- labelAutoRotate: { optionalAngles: [0, 45, 90], recoverWhenFailed: true },
116
114
  ...isAcademy ? {
117
115
  gridStroke: tokens.axisGrid,
118
116
  gridStrokeOpacity: 1,
@@ -132,13 +130,13 @@ var createTheme = (type) => {
132
130
  axisRadar: {
133
131
  zIndex: 1,
134
132
  titleFill: isAcademy ? tokens.textPrimary : tokens.textSecondary,
135
- titleFontFamily: import_tokens.CHART_FONT_FAMILY,
133
+ titleFontFamily: import_util.CHART_FONT_FAMILY,
136
134
  titleFontSize: isAcademy ? 10 : 12,
137
135
  titleFontWeight: isAcademy ? 600 : 500,
138
136
  titleSpacing: 10,
139
137
  labelFill: tokens.textSecondary,
140
138
  labelOpacity: 1,
141
- labelFontFamily: import_tokens.CHART_FONT_FAMILY,
139
+ labelFontFamily: import_util.CHART_FONT_FAMILY,
142
140
  labelFontSize: isAcademy ? 10 : 11,
143
141
  line: true,
144
142
  lineStroke: tokens.axisLine,
@@ -171,7 +169,7 @@ var createTheme = (type) => {
171
169
  itemMarkerStrokeOpacity: 0.92,
172
170
  itemLabelFill: tokens.textPrimary,
173
171
  itemLabelFillOpacity: 0.78,
174
- itemLabelFontFamily: import_tokens.CHART_FONT_FAMILY,
172
+ itemLabelFontFamily: import_util.CHART_FONT_FAMILY,
175
173
  itemLabelFontSize: 12,
176
174
  itemLabelFontWeight: 400,
177
175
  itemLabelLineHeight: 16,
@@ -186,7 +184,7 @@ var createTheme = (type) => {
186
184
  navButtonSize: 9,
187
185
  navPageNumFill: tokens.textSecondary,
188
186
  navPageNumFillOpacity: 0.72,
189
- navPageNumFontFamily: import_tokens.CHART_FONT_FAMILY,
187
+ navPageNumFontFamily: import_util.CHART_FONT_FAMILY,
190
188
  navPageNumFontSize: 11,
191
189
  navPageNumFontWeight: 400,
192
190
  navControllerPadding: 4,
@@ -214,7 +212,7 @@ var createTheme = (type) => {
214
212
  "box-sizing": "border-box",
215
213
  "backdrop-filter": "blur(10px) saturate(1.08)",
216
214
  "-webkit-backdrop-filter": "blur(10px) saturate(1.08)",
217
- "font-family": import_tokens.CHART_FONT_FAMILY,
215
+ "font-family": import_util.CHART_FONT_FAMILY,
218
216
  "font-size": "12px",
219
217
  "line-height": "18px",
220
218
  "font-variant-numeric": "tabular-nums",
@@ -526,7 +524,7 @@ function getThemeObject(type, theme, localStyle) {
526
524
  }
527
525
  );
528
526
  const style = (0, import_merge.mergeTheme)(expandTokens(tokens), ...layers);
529
- const values = (0, import_tokens.getChartVisualTokens)(baseTheme);
527
+ const values = (0, import_util.getChartVisualTokens)(baseTheme);
530
528
  const colors = (0, import_shared.normalizePalette)(
531
529
  ((_a = style.palette) == null ? void 0 : _a.length) ? style.palette : type === "waterfall" ? ["#FF4D4F", "#2EBB59", "#1783FF"] : void 0,
532
530
  baseTheme
@@ -22,7 +22,7 @@ __export(g6_exports, {
22
22
  getThemeObject: () => getThemeObject
23
23
  });
24
24
  module.exports = __toCommonJS(g6_exports);
25
- var import_tokens = require("../util/tokens");
25
+ var import_util = require("../util");
26
26
  var import_merge = require("./merge");
27
27
  var import_resolve = require("./resolve");
28
28
  var import_shared = require("./shared");
@@ -81,7 +81,7 @@ function getThemeObject(type, theme, localStyle) {
81
81
  const edgeStyle = (0, import_shared.pickStyle)(style.edge, ELEMENT_KEYS);
82
82
  const nodeType = (_a = style.node) == null ? void 0 : _a.type;
83
83
  const edgeType = (_b = style.edge) == null ? void 0 : _b.type;
84
- const values = (0, import_tokens.getChartVisualTokens)(baseTheme);
84
+ const values = (0, import_util.getChartVisualTokens)(baseTheme);
85
85
  return {
86
86
  baseTheme,
87
87
  theme: baseTheme === "dark" ? "dark" : "light",
@@ -22,7 +22,7 @@ __export(summary_exports, {
22
22
  getThemeObject: () => getThemeObject
23
23
  });
24
24
  module.exports = __toCommonJS(summary_exports);
25
- var import_tokens = require("../util/tokens");
25
+ var import_util = require("../util");
26
26
  var import_merge = require("./merge");
27
27
  var import_resolve = require("./resolve");
28
28
  var import_shared = require("./shared");
@@ -50,7 +50,7 @@ function getThemeObject(type, theme, localStyle) {
50
50
  theme: baseTheme === "dark" ? "dark" : "light",
51
51
  backgrounds: {
52
52
  light: style.backgroundColor ?? "",
53
- dark: style.backgroundColor ?? (0, import_tokens.getChartVisualTokens)("dark").background
53
+ dark: style.backgroundColor ?? (0, import_util.getChartVisualTokens)("dark").background
54
54
  },
55
55
  summary: (0, import_shared.pickStyle)(style.summary, Object.keys(summary))
56
56
  };
@@ -0,0 +1,310 @@
1
+ /** Complete axis fields alone specify coordinates; other objects select existing data. */
2
+ export type AnnotationData<T extends object = Record<string, string | number>> = Partial<T>;
3
+ interface LabelStyle {
4
+ labelFill?: string;
5
+ labelFontSize?: number;
6
+ }
7
+ interface StrokeStyle extends LabelStyle {
8
+ stroke?: string;
9
+ lineWidth?: number;
10
+ }
11
+ interface LineStyle extends StrokeStyle {
12
+ lineDash?: number[];
13
+ }
14
+ interface RangeStyle extends LineStyle {
15
+ fill?: string;
16
+ fillOpacity?: number;
17
+ }
18
+ interface PointStyle extends StrokeStyle {
19
+ /** Defaults to a ring at existing points, or a filled marker at empty positions. */
20
+ fill?: string;
21
+ /** Marker size in pixels, matching theme point sizing: circle radius; other shapes scale proportionally. */
22
+ size?: number;
23
+ }
24
+ interface HighlightStyle extends StrokeStyle {
25
+ /** Preserve the original series color unless explicitly overridden. */
26
+ fill?: string;
27
+ fillOpacity?: number;
28
+ /** Opacity of unselected content; multiple highlights use the lowest value. Defaults follow the theme. */
29
+ dimOpacity?: number;
30
+ }
31
+ /** Shared label and style options; each annotation supplies its supported style subset. */
32
+ export interface AnnotationOptions<TStyle extends LabelStyle = LabelStyle> {
33
+ /** Analysis components supply defaults; a string replaces the text, and '' hides it. */
34
+ label?: string;
35
+ style?: TStyle;
36
+ }
37
+ /** Select original observations without exposing renderer-specific fields. */
38
+ type Selection<T extends object> = AnnotationData<T> | AnnotationData<T>[];
39
+ type TableTarget<T extends object> = {
40
+ row: AnnotationData<T>;
41
+ column?: keyof T & string;
42
+ } | {
43
+ row?: never;
44
+ column: keyof T & string;
45
+ };
46
+ /** Calculation field and optional candidate rows / emphasized column. */
47
+ type TableMapping<T extends object> = {
48
+ field: keyof T & string;
49
+ row?: Selection<T>;
50
+ column?: keyof T & string;
51
+ };
52
+ type PathOptions<T extends object> = AnnotationOptions<LineStyle> & {
53
+ /** One axis field: span the plot. Two or more positions: connect with straight segments in input order. */
54
+ data: Selection<T>;
55
+ };
56
+ type RangeOptions<T extends object> = AnnotationOptions<RangeStyle> & {
57
+ /** Only axis fields are accepted at runtime. An omitted axis spans the plot. */
58
+ data: {
59
+ [K in keyof T]?: [T[K], T[K]];
60
+ };
61
+ };
62
+ type ConnectorOptions<T extends object> = AnnotationOptions<LineStyle> & {
63
+ /** Two anchors to connect or compare; labels and computed results come from the caller. */
64
+ data: [AnnotationData<T>, AnnotationData<T>];
65
+ /** Line and curve point to the second anchor; dimension has two arrows; bracket has none. */
66
+ shape?: 'line' | 'curve' | 'dimension' | 'bracket';
67
+ /** Span of dimension/bracket. Defaults to vertical for dimension, horizontal for bracket. */
68
+ orientation?: 'horizontal' | 'vertical';
69
+ };
70
+ type PointOptions<T extends object> = AnnotationOptions<PointStyle> & {
71
+ /** Arrays draw one marker per object, never a connected path. */
72
+ data: Selection<T>;
73
+ /** Animate the halo by default; false keeps it static. Respects reduced-motion preferences. */
74
+ pulse?: boolean;
75
+ };
76
+ type TextOptions<T extends object> = AnnotationOptions & {
77
+ data: AnnotationData<T>;
78
+ label: string;
79
+ };
80
+ type SelectionOptions<T extends object> = AnnotationOptions<HighlightStyle> & {
81
+ /** Omit to analyze all input observations. */
82
+ data?: Selection<T>;
83
+ };
84
+ type LocalExtremaOptions<T extends object> = SelectionOptions<T> & {
85
+ /** Minimum prominence in original value units. Defaults to 0. */
86
+ minProminence?: number;
87
+ /** Minimum distance in observations within a series, not pixels or time. Defaults to 1. */
88
+ minDistance?: number;
89
+ };
90
+ type RankOptions = AnnotationOptions<HighlightStyle> & {
91
+ /** Positive integer; ties retain input order. Select at most n observations. */
92
+ n: number;
93
+ };
94
+ type ThresholdOptions = AnnotationOptions<Omit<HighlightStyle, 'fillOpacity' | 'dimOpacity'>> & {
95
+ threshold: number;
96
+ /** Emphasize values above or below the threshold. Defaults to above. */
97
+ direction?: 'above' | 'below';
98
+ /** Include values equal to the threshold. Defaults to false. */
99
+ inclusive?: boolean;
100
+ };
101
+ type AxisRangeOptions = AnnotationOptions<RangeStyle> & {
102
+ /** Numeric bounds are ordered; strings identify time or category boundaries. */
103
+ range: [number, number] | [string, string];
104
+ };
105
+ type RangeHighlightOptions = AnnotationOptions<HighlightStyle> & {
106
+ /** Ordered bounds: inside includes endpoints, outside is strictly beyond them. */
107
+ range: [number, number];
108
+ };
109
+ type OutlierOptions = AnnotationOptions<HighlightStyle> & {
110
+ /** Positive IQR fence multiplier. Defaults to 1.5. Each series needs at least four finite values. */
111
+ factor?: number;
112
+ };
113
+ type GroupOptions = AnnotationOptions<HighlightStyle> & {
114
+ /** Select complete named series, not individual observations. */
115
+ data: {
116
+ group: string;
117
+ } | {
118
+ group: string;
119
+ }[];
120
+ };
121
+ /** Charts use their existing mapping; tables require an explicit calculation field. */
122
+ type CalculationDefinition<T extends object, Options> = {
123
+ g2: Options & {
124
+ data?: Selection<T>;
125
+ };
126
+ table: Options & {
127
+ data: TableMapping<T>;
128
+ };
129
+ };
130
+ type StatisticOptions<T extends object> = AnnotationOptions<LineStyle> & {
131
+ /** Logical data axis, independent of chart transposition. Defaults to y. */
132
+ axis?: 'x' | 'y';
133
+ data?: Selection<T>;
134
+ };
135
+ type CrossingOptions<T extends object> = AnnotationOptions<PointStyle> & {
136
+ direction?: 'up' | 'down' | 'both';
137
+ pulse?: boolean;
138
+ } & ({
139
+ threshold: number;
140
+ data?: Selection<T>;
141
+ } | {
142
+ threshold?: never;
143
+ /** Compare the first selected series against the second. */
144
+ data: {
145
+ series: [AnnotationData<T>, AnnotationData<T>];
146
+ };
147
+ });
148
+ /** Configuration contracts only; chart support and implementations belong to the registry. */
149
+ interface AnnotationDefinitions<T extends object> {
150
+ path: {
151
+ g2: PathOptions<T>;
152
+ g6: PathOptions<T> & {
153
+ data: AnnotationData<T>[];
154
+ };
155
+ };
156
+ range: {
157
+ g2: RangeOptions<T>;
158
+ };
159
+ connector: {
160
+ g2: ConnectorOptions<T>;
161
+ g6: ConnectorOptions<T>;
162
+ };
163
+ point: {
164
+ g2: PointOptions<T>;
165
+ g6: PointOptions<T>;
166
+ };
167
+ text: {
168
+ g2: TextOptions<T>;
169
+ g6: TextOptions<T>;
170
+ };
171
+ highlight: {
172
+ g2: AnnotationOptions<HighlightStyle> & {
173
+ data: Selection<T>;
174
+ };
175
+ g6: AnnotationOptions<HighlightStyle> & {
176
+ data: Selection<T>;
177
+ };
178
+ table: AnnotationOptions<HighlightStyle> & {
179
+ data: TableTarget<T> | TableTarget<T>[];
180
+ };
181
+ summary: AnnotationOptions<HighlightStyle> & {
182
+ data: {
183
+ text: string;
184
+ } | {
185
+ text: string;
186
+ }[];
187
+ };
188
+ };
189
+ maxX: {
190
+ g2: SelectionOptions<T>;
191
+ };
192
+ minX: {
193
+ g2: SelectionOptions<T>;
194
+ };
195
+ maxY: {
196
+ g2: SelectionOptions<T>;
197
+ };
198
+ minY: {
199
+ g2: SelectionOptions<T>;
200
+ };
201
+ first: {
202
+ g2: SelectionOptions<T>;
203
+ };
204
+ last: {
205
+ g2: SelectionOptions<T>;
206
+ };
207
+ peak: {
208
+ g2: LocalExtremaOptions<T>;
209
+ };
210
+ valley: {
211
+ g2: LocalExtremaOptions<T>;
212
+ };
213
+ topN: CalculationDefinition<T, RankOptions>;
214
+ bottomN: CalculationDefinition<T, RankOptions>;
215
+ thresholdHighlight: CalculationDefinition<T, ThresholdOptions>;
216
+ rangeInside: CalculationDefinition<T, RangeHighlightOptions>;
217
+ rangeOutside: CalculationDefinition<T, RangeHighlightOptions>;
218
+ outlier: CalculationDefinition<T, OutlierOptions>;
219
+ contribution: {
220
+ /** Selected values are summed and divided by the total of all input observations. */
221
+ g2: AnnotationOptions<HighlightStyle> & {
222
+ data: Selection<T>;
223
+ };
224
+ table: AnnotationOptions<HighlightStyle> & {
225
+ data: TableMapping<T> & {
226
+ row: Selection<T>;
227
+ };
228
+ };
229
+ };
230
+ group: {
231
+ g2: GroupOptions;
232
+ };
233
+ mean: {
234
+ g2: StatisticOptions<T>;
235
+ };
236
+ median: {
237
+ g2: StatisticOptions<T>;
238
+ };
239
+ quantile: {
240
+ g2: StatisticOptions<T> & {
241
+ /** Probability in [0, 1], using R-7 linear interpolation. */
242
+ p: number;
243
+ };
244
+ };
245
+ thresholdX: {
246
+ g2: AnnotationOptions<LineStyle> & {
247
+ threshold: string | number;
248
+ };
249
+ };
250
+ thresholdY: {
251
+ g2: AnnotationOptions<LineStyle> & {
252
+ threshold: number;
253
+ };
254
+ };
255
+ target: {
256
+ g2: AnnotationOptions<LineStyle> & {
257
+ axis?: 'x' | 'y';
258
+ } & ({
259
+ target: number;
260
+ data?: never;
261
+ } | {
262
+ target?: never;
263
+ data: AnnotationData<T>[];
264
+ });
265
+ };
266
+ event: {
267
+ g2: AnnotationOptions<LineStyle> & {
268
+ data: Selection<T>;
269
+ axis?: 'x' | 'y';
270
+ };
271
+ };
272
+ rangeX: {
273
+ g2: AxisRangeOptions;
274
+ };
275
+ rangeY: {
276
+ g2: AxisRangeOptions;
277
+ };
278
+ quadrant: {
279
+ g2: AnnotationOptions<RangeStyle> & {
280
+ /** Intersection of the two numeric dividers, using the chart's original axis fields. */
281
+ data: AnnotationData<T>;
282
+ /** Names of the four regions. Defaults describe high/low axis values; label: '' hides all text. */
283
+ labels?: Partial<Record<'topRight' | 'topLeft' | 'bottomLeft' | 'bottomRight', string>>;
284
+ };
285
+ };
286
+ centroid: {
287
+ g2: AnnotationOptions<PointStyle> & {
288
+ data?: Selection<T>;
289
+ /** Nonnegative weights; omit for the arithmetic center. */
290
+ weight?: keyof T & string;
291
+ pulse?: boolean;
292
+ };
293
+ };
294
+ crossing: {
295
+ g2: CrossingOptions<T>;
296
+ };
297
+ }
298
+ /** @internal Derive renderer data contracts without maintaining parallel annotation-name lists. */
299
+ export type RendererAnnotationOptions<T extends object, R extends string> = {
300
+ [K in keyof AnnotationDefinitions<T>]: {
301
+ type: K;
302
+ } & AnnotationDefinitions<T>[K][Extract<keyof AnnotationDefinitions<T>[K], R>];
303
+ }[keyof AnnotationDefinitions<T>];
304
+ /** Shared configuration entry; each view accepts the targets and capabilities meaningful to it. */
305
+ export type Annotation<T extends object = Record<string, string | number>> = RendererAnnotationOptions<T, string>;
306
+ /** Reusable style derived from an annotation type, without widening its supported fields. */
307
+ export type AnnotationStyle<Type extends Annotation['type'] = Annotation['type']> = NonNullable<Extract<Annotation, {
308
+ type: Type;
309
+ }>['style']>;
310
+ export {};
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/types/annotation.ts
16
+ var annotation_exports = {};
17
+ module.exports = __toCommonJS(annotation_exports);
@@ -1,4 +1,5 @@
1
1
  import type { BuiltinThemeName, ThemeSpec } from './theme';
2
+ export type { Annotation, AnnotationOptions, AnnotationStyle } from './annotation';
2
3
  export type { BuiltinThemeName, ChartType, ThemeSpec, ThemeStyle, ThemeTokens } from './theme';
3
4
  /** Built-in visualization themes supported by GPT-Vis. */
4
5
  export type VisualizationTheme = BuiltinThemeName | ThemeSpec;
@@ -0,0 +1,28 @@
1
+ import type { AxisComponent, Chart, Theme } from '@antv/g2';
2
+ import type { VisualizationOptions } from '../types';
3
+ type CartesianAxisOptions = {
4
+ container?: VisualizationOptions['container'];
5
+ chartWidth?: number;
6
+ chartHeight?: number;
7
+ /** When omitted, infer from values; category IDs opt out explicitly. */
8
+ xType?: 'number' | 'category';
9
+ /** Prefer thinning to rotation for dense line/area categories. */
10
+ preferHorizontal?: boolean;
11
+ /** Point scales place the first/last ticks at the plot edges, without half a band. */
12
+ xTicksAtEdges?: boolean;
13
+ xValues?: unknown[];
14
+ axisXTitle?: string | false;
15
+ axisYTitle?: string | false;
16
+ transposed?: boolean;
17
+ };
18
+ /** GPT-Vis policy only; component handles text truncation and overlap hiding. */
19
+ export declare function createCartesianAxis(options: CartesianAxisOptions, theme?: Theme): {
20
+ axis: Record<"x" | "y", AxisComponent>;
21
+ layout: () => {
22
+ marginRight: number | undefined;
23
+ };
24
+ };
25
+ export declare function getCartesianAxis(options: CartesianAxisOptions, theme?: Theme): Record<"x" | "y", AxisComponent>;
26
+ /** Update right margin before G2's existing autoFit render. */
27
+ export declare function bindCartesianAxisLayout(chart: Chart, axis: ReturnType<typeof createCartesianAxis>): void;
28
+ export {};