@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
@@ -0,0 +1,186 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
+ import { CHART_FONT_FAMILY, CHART_STYLE_DEFAULTS, getChartVisualTokens } from "../util/tokens";
14
+ import { mergeTheme } from "./merge";
15
+ import { resolveTheme } from "./resolve";
16
+ import { normalizePalette } from "./shared";
17
+ var pointPulse = {
18
+ duration: 1800,
19
+ startScale: 1.5,
20
+ endScale: 3,
21
+ staticScale: 2.2,
22
+ opacity: 0.32,
23
+ lineWidth: 1
24
+ };
25
+ var connector = {
26
+ offset: 24,
27
+ extension: 4,
28
+ curveRatio: 0.12,
29
+ maxCurveHeight: 40,
30
+ arrowSize: 9
31
+ };
32
+ var highlight = {
33
+ dimOpacity: 0.16,
34
+ contributionDimOpacity: 0.16,
35
+ pieDimOpacity: 0.16,
36
+ lineWidth: 2
37
+ };
38
+
39
+ /** Internal label appearances; public overrides live in each annotation's style. */
40
+ function getLabelStyles(_ref) {
41
+ var surface = _ref.surface,
42
+ border = _ref.border,
43
+ accent = _ref.accent,
44
+ text = _ref.text,
45
+ fontWeight = _ref.fontWeight,
46
+ radius = _ref.radius;
47
+ var base = {
48
+ fill: text,
49
+ background: surface,
50
+ backgroundOpacity: 1,
51
+ border: 'none',
52
+ borderOpacity: 1,
53
+ padding: [3, 6],
54
+ radius: Math.min(radius, 4),
55
+ maxWidth: 200,
56
+ gap: 8,
57
+ fontWeight: fontWeight
58
+ };
59
+ return {
60
+ path: _objectSpread(_objectSpread({}, base), {}, {
61
+ padding: [2, 4],
62
+ backgroundOpacity: 0.94
63
+ }),
64
+ range: _objectSpread(_objectSpread({}, base), {}, {
65
+ border: accent,
66
+ borderOpacity: 0.3,
67
+ backgroundOpacity: 0.94
68
+ }),
69
+ connector: _objectSpread(_objectSpread({}, base), {}, {
70
+ padding: [3, 6],
71
+ fontWeight: 500
72
+ }),
73
+ point: _objectSpread(_objectSpread({}, base), {}, {
74
+ border: border,
75
+ padding: [8, 10],
76
+ radius: radius,
77
+ maxWidth: 220,
78
+ gap: 12,
79
+ fontWeight: 500
80
+ }),
81
+ text: _objectSpread(_objectSpread({}, base), {}, {
82
+ background: 'none',
83
+ padding: [0, 0],
84
+ maxWidth: 260,
85
+ gap: 0
86
+ }),
87
+ highlight: _objectSpread(_objectSpread({}, base), {}, {
88
+ border: border,
89
+ padding: [4, 7],
90
+ gap: 10
91
+ })
92
+ };
93
+ }
94
+
95
+ /** Graph and DOM annotations follow their chart's theme and local styles. */
96
+ export function getAnnotationDefaults(type, theme, localStyle) {
97
+ var _ref2, _style$label$fill, _style$label, _ref3, _style$label$fontWeig, _style$label2, _ref4, _style$mark$point$str, _style$mark, _ref5, _style$mark$line$line, _style$mark2, _ref6, _style$mark$connector, _style$mark3, _ref7, _style$mark$point$lin, _style$mark4, _style$mark$point$siz, _style$mark5, _style$mark$point$sha, _style$mark6, _ref8, _style$label$fontFami, _style$label3, _ref9, _style$label$fontSize, _style$label4, _ref10, _tokens$colorSurface, _tokens$colorStroke, _tokens$radius, _palette$, _style$backgroundColo;
98
+ var _resolveTheme = resolveTheme(type, theme, localStyle),
99
+ baseTheme = _resolveTheme.baseTheme,
100
+ tokens = _resolveTheme.tokens,
101
+ styles = _resolveTheme.styles;
102
+ var style = mergeTheme.apply(void 0, [{}].concat(_toConsumableArray(styles)));
103
+ var visual = getChartVisualTokens(baseTheme);
104
+ var palette = normalizePalette(style.palette, baseTheme);
105
+ var stroke = palette[0];
106
+ var labelFill = (_ref2 = (_style$label$fill = (_style$label = style.label) === null || _style$label === void 0 ? void 0 : _style$label.fill) !== null && _style$label$fill !== void 0 ? _style$label$fill : tokens.colorText) !== null && _ref2 !== void 0 ? _ref2 : visual.textPrimary;
107
+ var fontWeight = (_ref3 = (_style$label$fontWeig = (_style$label2 = style.label) === null || _style$label2 === void 0 ? void 0 : _style$label2.fontWeight) !== null && _style$label$fontWeig !== void 0 ? _style$label$fontWeig : tokens.fontWeight) !== null && _ref3 !== void 0 ? _ref3 : 400;
108
+ return {
109
+ stroke: stroke,
110
+ pointStroke: (_ref4 = (_style$mark$point$str = (_style$mark = style.mark) === null || _style$mark === void 0 || (_style$mark = _style$mark.point) === null || _style$mark === void 0 ? void 0 : _style$mark.stroke) !== null && _style$mark$point$str !== void 0 ? _style$mark$point$str : style.backgroundColor) !== null && _ref4 !== void 0 ? _ref4 : visual.background,
111
+ lineWidth: {
112
+ path: (_ref5 = (_style$mark$line$line = (_style$mark2 = style.mark) === null || _style$mark2 === void 0 || (_style$mark2 = _style$mark2.line) === null || _style$mark2 === void 0 ? void 0 : _style$mark2.lineWidth) !== null && _style$mark$line$line !== void 0 ? _style$mark$line$line : tokens.lineWidth) !== null && _ref5 !== void 0 ? _ref5 : 1.5,
113
+ connector: (_ref6 = (_style$mark$connector = (_style$mark3 = style.mark) === null || _style$mark3 === void 0 || (_style$mark3 = _style$mark3.connector) === null || _style$mark3 === void 0 ? void 0 : _style$mark3.lineWidth) !== null && _style$mark$connector !== void 0 ? _style$mark$connector : tokens.lineWidth) !== null && _ref6 !== void 0 ? _ref6 : 2,
114
+ point: (_ref7 = (_style$mark$point$lin = (_style$mark4 = style.mark) === null || _style$mark4 === void 0 || (_style$mark4 = _style$mark4.point) === null || _style$mark4 === void 0 ? void 0 : _style$mark4.lineWidth) !== null && _style$mark$point$lin !== void 0 ? _style$mark$point$lin : tokens.lineWidth) !== null && _ref7 !== void 0 ? _ref7 : 1.5
115
+ },
116
+ size: (_style$mark$point$siz = (_style$mark5 = style.mark) === null || _style$mark5 === void 0 || (_style$mark5 = _style$mark5.point) === null || _style$mark5 === void 0 ? void 0 : _style$mark5.size) !== null && _style$mark$point$siz !== void 0 ? _style$mark$point$siz : CHART_STYLE_DEFAULTS.scatterPointSize,
117
+ shape: (_style$mark$point$sha = (_style$mark6 = style.mark) === null || _style$mark6 === void 0 || (_style$mark6 = _style$mark6.point) === null || _style$mark6 === void 0 ? void 0 : _style$mark6.shape) !== null && _style$mark$point$sha !== void 0 ? _style$mark$point$sha : 'point',
118
+ pulse: pointPulse,
119
+ connector: connector,
120
+ labelFill: labelFill,
121
+ fontFamily: (_ref8 = (_style$label$fontFami = (_style$label3 = style.label) === null || _style$label3 === void 0 ? void 0 : _style$label3.fontFamily) !== null && _style$label$fontFami !== void 0 ? _style$label$fontFami : tokens.fontFamily) !== null && _ref8 !== void 0 ? _ref8 : CHART_FONT_FAMILY,
122
+ labelFontSize: (_ref9 = (_style$label$fontSize = (_style$label4 = style.label) === null || _style$label4 === void 0 ? void 0 : _style$label4.fontSize) !== null && _style$label$fontSize !== void 0 ? _style$label$fontSize : tokens.fontSize) !== null && _ref9 !== void 0 ? _ref9 : 12,
123
+ fontWeight: fontWeight,
124
+ labels: getLabelStyles({
125
+ surface: (_ref10 = (_tokens$colorSurface = tokens.colorSurface) !== null && _tokens$colorSurface !== void 0 ? _tokens$colorSurface : style.backgroundColor) !== null && _ref10 !== void 0 ? _ref10 : visual.tooltipBackground,
126
+ border: (_tokens$colorStroke = tokens.colorStroke) !== null && _tokens$colorStroke !== void 0 ? _tokens$colorStroke : visual.tooltipBorder,
127
+ accent: stroke,
128
+ text: labelFill,
129
+ fontWeight: fontWeight,
130
+ radius: (_tokens$radius = tokens.radius) !== null && _tokens$radius !== void 0 ? _tokens$radius : 6
131
+ }),
132
+ highlight: _objectSpread(_objectSpread({}, highlight), {}, {
133
+ color: (_palette$ = palette[1]) !== null && _palette$ !== void 0 ? _palette$ : stroke,
134
+ fillOpacity: 0.16,
135
+ dimOpacity: type === 'table' || type === 'summary' ? 1 : highlight.dimOpacity,
136
+ background: (_style$backgroundColo = style.backgroundColor) !== null && _style$backgroundColo !== void 0 ? _style$backgroundColo : visual.background,
137
+ labelBackground: visual.tooltipBackground,
138
+ labelBorder: visual.tooltipBorder,
139
+ labelGap: 16
140
+ })
141
+ };
142
+ }
143
+
144
+ /** Annotation defaults follow the resolved chart theme. */
145
+ export function getAnnotationStyle(_ref11) {
146
+ var _mark$point$shape, _theme$tooltip, _mark$point$stroke, _ref12, _mark$line$lineWidth, _theme$line, _ref13, _mark$interval$lineWi, _theme$interval, _ref14, _mark$connector$lineW, _theme$connector, _ref15, _ref16, _mark$point$lineWidth, _theme$point, _theme$point2, _mark$point$size, _palette$2, _ref17, _theme$label$fontFami, _theme$label, _theme$axis, _ref18, _theme$label$fontSize, _theme$label2, _theme$axis2, _tooltip$backgroundC, _theme$axis$lineStrok, _theme$axis3, _theme$label3, _theme$label$fontWeig, _theme$label4, _tooltip$borderRadiu;
147
+ var theme = _ref11.theme,
148
+ mark = _ref11.mark;
149
+ var shape = (_mark$point$shape = mark.point.shape) !== null && _mark$point$shape !== void 0 ? _mark$point$shape : 'point';
150
+ var palette = theme.category10;
151
+ var visual = getChartVisualTokens(theme.type);
152
+ var tooltip = ((_theme$tooltip = theme.tooltip) === null || _theme$tooltip === void 0 ? void 0 : _theme$tooltip.css)['.g2-tooltip'];
153
+ return {
154
+ palette: palette,
155
+ directions: {
156
+ up: theme.type === 'dark' ? '#4ade80' : '#16a34a',
157
+ down: theme.type === 'dark' ? '#f87171' : '#dc2626'
158
+ },
159
+ stroke: palette[0],
160
+ pointStroke: (_mark$point$stroke = mark.point.stroke) !== null && _mark$point$stroke !== void 0 ? _mark$point$stroke : theme.view.viewFill,
161
+ lineWidth: {
162
+ path: (_ref12 = (_mark$line$lineWidth = mark.line.lineWidth) !== null && _mark$line$lineWidth !== void 0 ? _mark$line$lineWidth : (_theme$line = theme.line) === null || _theme$line === void 0 || (_theme$line = _theme$line.line) === null || _theme$line === void 0 ? void 0 : _theme$line.lineWidth) !== null && _ref12 !== void 0 ? _ref12 : CHART_STYLE_DEFAULTS.lineWidth,
163
+ range: (_ref13 = (_mark$interval$lineWi = mark.interval.lineWidth) !== null && _mark$interval$lineWi !== void 0 ? _mark$interval$lineWi : (_theme$interval = theme.interval) === null || _theme$interval === void 0 || (_theme$interval = _theme$interval.rect) === null || _theme$interval === void 0 ? void 0 : _theme$interval.lineWidth) !== null && _ref13 !== void 0 ? _ref13 : 1.5,
164
+ connector: (_ref14 = (_mark$connector$lineW = mark.connector.lineWidth) !== null && _mark$connector$lineW !== void 0 ? _mark$connector$lineW : (_theme$connector = theme.connector) === null || _theme$connector === void 0 || (_theme$connector = _theme$connector.connector) === null || _theme$connector === void 0 ? void 0 : _theme$connector.lineWidth) !== null && _ref14 !== void 0 ? _ref14 : 2,
165
+ point: (_ref15 = (_ref16 = (_mark$point$lineWidth = mark.point.lineWidth) !== null && _mark$point$lineWidth !== void 0 ? _mark$point$lineWidth : (_theme$point = theme.point) === null || _theme$point === void 0 || (_theme$point = _theme$point[shape]) === null || _theme$point === void 0 ? void 0 : _theme$point.lineWidth) !== null && _ref16 !== void 0 ? _ref16 : (_theme$point2 = theme.point) === null || _theme$point2 === void 0 || (_theme$point2 = _theme$point2.point) === null || _theme$point2 === void 0 ? void 0 : _theme$point2.lineWidth) !== null && _ref15 !== void 0 ? _ref15 : CHART_STYLE_DEFAULTS.pointLineWidth
166
+ },
167
+ fillOpacity: 0.12,
168
+ size: (_mark$point$size = mark.point.size) !== null && _mark$point$size !== void 0 ? _mark$point$size : CHART_STYLE_DEFAULTS.scatterPointSize,
169
+ shape: shape,
170
+ pulse: pointPulse,
171
+ connector: connector,
172
+ highlight: _objectSpread(_objectSpread({}, highlight), {}, {
173
+ color: (_palette$2 = palette[1]) !== null && _palette$2 !== void 0 ? _palette$2 : palette[0]
174
+ }),
175
+ fontFamily: (_ref17 = (_theme$label$fontFami = (_theme$label = theme.label) === null || _theme$label === void 0 ? void 0 : _theme$label.fontFamily) !== null && _theme$label$fontFami !== void 0 ? _theme$label$fontFami : (_theme$axis = theme.axis) === null || _theme$axis === void 0 ? void 0 : _theme$axis.labelFontFamily) !== null && _ref17 !== void 0 ? _ref17 : CHART_FONT_FAMILY,
176
+ labelFontSize: (_ref18 = (_theme$label$fontSize = (_theme$label2 = theme.label) === null || _theme$label2 === void 0 ? void 0 : _theme$label2.fontSize) !== null && _theme$label$fontSize !== void 0 ? _theme$label$fontSize : (_theme$axis2 = theme.axis) === null || _theme$axis2 === void 0 ? void 0 : _theme$axis2.labelFontSize) !== null && _ref18 !== void 0 ? _ref18 : 12,
177
+ labels: getLabelStyles({
178
+ surface: (_tooltip$backgroundC = tooltip['background-color']) !== null && _tooltip$backgroundC !== void 0 ? _tooltip$backgroundC : visual.tooltipBackground,
179
+ border: (_theme$axis$lineStrok = (_theme$axis3 = theme.axis) === null || _theme$axis3 === void 0 ? void 0 : _theme$axis3.lineStroke) !== null && _theme$axis$lineStrok !== void 0 ? _theme$axis$lineStrok : visual.tooltipBorder,
180
+ accent: palette[0],
181
+ text: (_theme$label3 = theme.label) === null || _theme$label3 === void 0 ? void 0 : _theme$label3.fill,
182
+ fontWeight: (_theme$label$fontWeig = (_theme$label4 = theme.label) === null || _theme$label4 === void 0 ? void 0 : _theme$label4.fontWeight) !== null && _theme$label$fontWeig !== void 0 ? _theme$label$fontWeig : 400,
183
+ radius: Number.parseFloat(String((_tooltip$borderRadiu = tooltip['border-radius']) !== null && _tooltip$borderRadiu !== void 0 ? _tooltip$borderRadiu : 6))
184
+ })
185
+ };
186
+ }
@@ -17,7 +17,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
17
17
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
19
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
- import { CHART_FONT_FAMILY, CHART_STYLE_DEFAULTS, getChartVisualTokens } from "../util/tokens";
20
+ import { CHART_FONT_FAMILY, CHART_STYLE_DEFAULTS, getChartVisualTokens } from "../util";
21
21
  import { mergeTheme } from "./merge";
22
22
  import { resolveTheme } from "./resolve";
23
23
  import { ACADEMY_COLOR_PALETTE, DEFAULT_COLOR_PALETTE, normalizePalette, pickStyle } from "./shared";
@@ -63,10 +63,6 @@ var createTheme = function createTheme(type) {
63
63
  }
64
64
  },
65
65
  axis: _objectSpread({
66
- labelAutoHide: {
67
- keepHeader: true,
68
- keepTail: true
69
- },
70
66
  titleOpacity: 1,
71
67
  titleFillOpacity: 1,
72
68
  labelOpacity: 1,
@@ -108,11 +104,7 @@ var createTheme = function createTheme(type) {
108
104
  tickOpacity: 1
109
105
  }),
110
106
  axisX: _objectSpread({
111
- grid: isAcademy,
112
- labelAutoRotate: {
113
- optionalAngles: [0, 45, 90],
114
- recoverWhenFailed: true
115
- }
107
+ grid: isAcademy
116
108
  }, isAcademy ? {
117
109
  gridStroke: tokens.axisGrid,
118
110
  gridStrokeOpacity: 1,
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
10
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
11
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
12
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
- import { getChartVisualTokens } from "../util/tokens";
13
+ import { getChartVisualTokens } from "../util";
14
14
  import { mergeTheme } from "./merge";
15
15
  import { resolveTheme } from "./resolve";
16
16
  import { normalizePalette, pickStyle } from "./shared";
@@ -4,7 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
5
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
- import { getChartVisualTokens } from "../util/tokens";
7
+ import { getChartVisualTokens } from "../util";
8
8
  import { mergeTheme } from "./merge";
9
9
  import { resolveTheme } from "./resolve";
10
10
  import { pickStyle } from "./shared";
@@ -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 @@
1
+ export {};
@@ -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 {};