@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
@@ -23,13 +23,13 @@ __export(column_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(column_exports);
25
25
  var import_g2 = require("@antv/g2");
26
+ var import_annotation = require("../../annotation");
26
27
  var import_g22 = require("../../theme/g2");
27
28
  var import_util = require("../../util");
28
- var import_components = require("../../util/components");
29
- var import_tokens = require("../../util/tokens");
30
29
  var Column = (options) => {
31
30
  const { container, width, height, theme: chartTheme = "default" } = options;
32
31
  let chart = null;
32
+ let cleanupAnnotations;
33
33
  const render = (config) => {
34
34
  var _a;
35
35
  const {
@@ -45,20 +45,24 @@ var Column = (options) => {
45
45
  style: localStyle = {}
46
46
  } = config;
47
47
  if (chart) {
48
+ cleanupAnnotations == null ? void 0 : cleanupAnnotations();
48
49
  chart.destroy();
49
50
  }
50
51
  const hasGroupField = data.length > 0 && ((_a = data[0]) == null ? void 0 : _a.group) !== void 0;
51
52
  const cartesianAxisOptions = {
53
+ xType: "category",
54
+ xValues: data.map(({ category }) => category),
52
55
  axisXTitle,
53
56
  axisYTitle,
54
- xLabels: data.map(({ category }) => category),
55
- chartWidth: width
57
+ container,
58
+ chartWidth: width,
59
+ chartHeight: height
56
60
  };
57
61
  const appearance = (0, import_g22.getThemeObject)("column", theme, localStyle);
58
62
  const { theme: rendererTheme } = appearance;
59
63
  const intervalMark = {
60
64
  ...rendererTheme.type !== "academy" && appearance.mark.interval.radius === void 0 ? { radiusTopLeft: 4, radiusTopRight: 4 } : {},
61
- columnWidthRatio: import_tokens.CHART_STYLE_DEFAULTS.intervalWidthRatio,
65
+ columnWidthRatio: import_util.CHART_STYLE_DEFAULTS.intervalWidthRatio,
62
66
  ...!hasGroupField ? { fill: rendererTheme.category10[0] } : {},
63
67
  ...appearance.mark.interval
64
68
  };
@@ -98,10 +102,9 @@ var Column = (options) => {
98
102
  encode,
99
103
  transform,
100
104
  scale: scaleConfig,
101
- ...(0, import_util.getCartesianLayout)(cartesianAxisOptions),
102
- axis: (0, import_util.getCartesianAxis)(cartesianAxisOptions),
103
- legend: (0, import_components.getColorLegend)(hasGroupField),
104
- labels: (0, import_components.getDataLabels)(rendererTheme, {
105
+ axis: (0, import_util.getCartesianAxis)(cartesianAxisOptions, rendererTheme),
106
+ legend: (0, import_util.getColorLegend)(hasGroupField),
107
+ labels: (0, import_util.getDataLabels)(rendererTheme, {
105
108
  visible: label,
106
109
  defaultVisible: true,
107
110
  text: "value",
@@ -125,9 +128,25 @@ var Column = (options) => {
125
128
  theme: rendererTheme
126
129
  };
127
130
  chart.options(chartOptions);
131
+ cleanupAnnotations = (0, import_annotation.bindAnnotations)({
132
+ renderer: "g2",
133
+ chartType: "column",
134
+ chart,
135
+ annotations: config.annotations,
136
+ mapping: {
137
+ x: "category",
138
+ y: "value",
139
+ series: hasGroupField ? "group" : void 0,
140
+ data,
141
+ interval: true
142
+ },
143
+ themeObject: appearance
144
+ });
128
145
  chart.render();
129
146
  };
130
147
  const destroy = () => {
148
+ cleanupAnnotations == null ? void 0 : cleanupAnnotations();
149
+ cleanupAnnotations = void 0;
131
150
  if (chart) {
132
151
  chart.destroy();
133
152
  chart = null;
@@ -25,8 +25,6 @@ module.exports = __toCommonJS(dual_axes_exports);
25
25
  var import_g2 = require("@antv/g2");
26
26
  var import_g22 = require("../../theme/g2");
27
27
  var import_util = require("../../util");
28
- var import_components = require("../../util/components");
29
- var import_tokens = require("../../util/tokens");
30
28
  var getSeriesField = (index) => `value_${index + 1}`;
31
29
  function transformData(series, categories) {
32
30
  return categories.map((category, index) => {
@@ -58,22 +56,25 @@ var DualAxes = (options) => {
58
56
  chart.destroy();
59
57
  }
60
58
  const cartesianAxisOptions = {
59
+ xType: "category",
60
+ xValues: categories,
61
61
  axisXTitle,
62
- xLabels: categories,
63
- chartWidth: width
62
+ container,
63
+ chartWidth: width,
64
+ chartHeight: height
64
65
  };
65
- const cartesianAxis = (0, import_util.getCartesianAxis)(cartesianAxisOptions);
66
66
  const appearance = (0, import_g22.getThemeObject)("dual-axes", theme, localStyle);
67
67
  const { theme: rendererTheme } = appearance;
68
+ const cartesianAxis = (0, import_util.getCartesianAxis)(cartesianAxisOptions, rendererTheme);
68
69
  const intervalMark = {
69
70
  fillOpacity: 0.86,
70
- columnWidthRatio: import_tokens.CHART_STYLE_DEFAULTS.intervalWidthRatio,
71
+ columnWidthRatio: import_util.CHART_STYLE_DEFAULTS.intervalWidthRatio,
71
72
  ...rendererTheme.type !== "academy" && appearance.mark.interval.radius === void 0 ? { radiusTopLeft: 4, radiusTopRight: 4 } : {},
72
73
  ...appearance.mark.interval
73
74
  };
74
75
  const lineMark = {
75
76
  shape: "smooth",
76
- lineWidth: import_tokens.CHART_STYLE_DEFAULTS.lineWidth,
77
+ lineWidth: import_util.CHART_STYLE_DEFAULTS.lineWidth,
77
78
  lineCap: "round",
78
79
  lineJoin: "round",
79
80
  ...appearance.mark.line
@@ -167,13 +168,12 @@ var DualAxes = (options) => {
167
168
  }
168
169
  });
169
170
  const xAxis = cartesianAxis.x;
170
- const legend = (0, import_components.getColorLegend)(series.length > 0);
171
+ const legend = (0, import_util.getColorLegend)(series.length > 0);
171
172
  const chartOptions = {
172
173
  type: "view",
173
174
  data,
174
175
  title: title ? { title, subtitle } : "",
175
176
  children,
176
- ...(0, import_util.getCartesianLayout)(cartesianAxisOptions),
177
177
  axis: { x: xAxis },
178
178
  scale: {
179
179
  y: { nice: true },
@@ -24,7 +24,7 @@ __export(fishbone_diagram_exports, {
24
24
  module.exports = __toCommonJS(fishbone_diagram_exports);
25
25
  var import_g6 = require("@antv/g6");
26
26
  var import_g62 = require("../../theme/g6");
27
- var import_components = require("../../util/components");
27
+ var import_util = require("../../util");
28
28
  var FONT_FAMILY = "system-ui, sans-serif";
29
29
  function getNodeSize(text, depth, style) {
30
30
  const defaultFontSize = depth === 0 ? 24 : depth === 1 ? 18 : 16;
@@ -94,7 +94,7 @@ var FishboneDiagram = (options) => {
94
94
  throw new Error("FishboneDiagram: container element not found");
95
95
  containerEl.innerHTML = "";
96
96
  const appearance = (0, import_g62.getThemeObject)("fishbone-diagram", theme, localStyle);
97
- const graphTitle = (0, import_components.getGraphTitle)(title, subtitle, appearance.titleStyle);
97
+ const graphTitle = (0, import_util.getGraphTitle)(title, subtitle, appearance.titleStyle);
98
98
  const { theme: rendererTheme } = appearance;
99
99
  const baseTheme = appearance.baseTheme;
100
100
  const isDark = baseTheme === "dark";
@@ -24,7 +24,7 @@ __export(flow_diagram_exports, {
24
24
  module.exports = __toCommonJS(flow_diagram_exports);
25
25
  var import_g6 = require("@antv/g6");
26
26
  var import_g62 = require("../../theme/g6");
27
- var import_components = require("../../util/components");
27
+ var import_util = require("../../util");
28
28
  var ACTIVE_COLOR = "#f6c523";
29
29
  var DEFAULT_NODE_WIDTH = 200;
30
30
  var DEFAULT_NODE_HEIGHT = 80;
@@ -129,7 +129,7 @@ var FlowDiagram = (options) => {
129
129
  }
130
130
  ensureBehaviorRegistered();
131
131
  const appearance = (0, import_g62.getThemeObject)("flow-diagram", theme, localStyle);
132
- const graphTitle = (0, import_components.getGraphTitle)(title, subtitle, appearance.titleStyle);
132
+ const graphTitle = (0, import_util.getGraphTitle)(title, subtitle, appearance.titleStyle);
133
133
  const { theme: rendererTheme } = appearance;
134
134
  const baseTheme = appearance.baseTheme;
135
135
  const colors = appearance.colors;
@@ -25,8 +25,6 @@ module.exports = __toCommonJS(funnel_exports);
25
25
  var import_g2 = require("@antv/g2");
26
26
  var import_g22 = require("../../theme/g2");
27
27
  var import_util = require("../../util");
28
- var import_components = require("../../util/components");
29
- var import_tokens = require("../../util/tokens");
30
28
  var FUNNEL_LABELS = {
31
29
  "en-US": {
32
30
  baseline: "Baseline",
@@ -76,13 +74,13 @@ var Funnel = (options) => {
76
74
  const intervalMark = {
77
75
  shape: "funnel",
78
76
  fillOpacity: 0.94,
79
- stroke: (0, import_tokens.getChartVisualTokens)(rendererTheme.type).separator,
77
+ stroke: (0, import_util.getChartVisualTokens)(rendererTheme.type).separator,
80
78
  lineWidth: 2,
81
79
  ...rendererTheme.type === "academy" ? {} : { radius: 4 },
82
80
  ...appearance.mark.interval
83
81
  };
84
82
  const connectorStyle = {
85
- stroke: (0, import_tokens.getChartVisualTokens)(rendererTheme.type).axisLine,
83
+ stroke: (0, import_util.getChartVisualTokens)(rendererTheme.type).axisLine,
86
84
  strokeOpacity: rendererTheme.type === "academy" ? 1 : 0.82,
87
85
  lineWidth: rendererTheme.type === "academy" ? 1 : 0.75,
88
86
  endMarker: false,
@@ -90,7 +88,7 @@ var Funnel = (options) => {
90
88
  ...appearance.mark.connector
91
89
  };
92
90
  const colors = rendererTheme.category10;
93
- const tokens = (0, import_tokens.getChartVisualTokens)(rendererTheme.type);
91
+ const tokens = (0, import_util.getChartVisualTokens)(rendererTheme.type);
94
92
  const connectorMark = connectorStyle;
95
93
  const formatValue = (value) => Number.isFinite(value) ? numberFormatter.format(value) : "—";
96
94
  const isInverted = data.length > 1 && data[0].value < data[data.length - 1].value;
@@ -129,9 +127,9 @@ var Funnel = (options) => {
129
127
  }
130
128
  ]
131
129
  };
132
- const primaryLabels = (0, import_components.getDataLabels)(rendererTheme, {
130
+ const primaryLabels = (0, import_util.getDataLabels)(rendererTheme, {
133
131
  style: {
134
- fontFamily: import_tokens.CHART_FONT_FAMILY,
132
+ fontFamily: import_util.CHART_FONT_FAMILY,
135
133
  fontSize: 12,
136
134
  fontWeight: 500,
137
135
  lineHeight: 17
@@ -140,8 +138,7 @@ var Funnel = (options) => {
140
138
  text: (d) => `${d.category}
141
139
  ${formatValue(d.value)}`,
142
140
  position: "inside",
143
- contrast: "inside",
144
- transform: [{ type: "overflowStroke" }]
141
+ contrast: "inside"
145
142
  }) ?? [];
146
143
  chart = new import_g2.Chart({
147
144
  container,
@@ -183,7 +180,7 @@ ${formatValue(d.value)}`,
183
180
  dx: 8,
184
181
  dy: isInverted ? 6 : -6,
185
182
  style: {
186
- fontFamily: import_tokens.CHART_FONT_FAMILY,
183
+ fontFamily: import_util.CHART_FONT_FAMILY,
187
184
  fontSize: 8,
188
185
  fontWeight: 400,
189
186
  letterSpacing: -2
@@ -205,7 +202,7 @@ ${formatValue(d.value)}`,
205
202
  fill: tokens.textPrimary,
206
203
  dx: 26,
207
204
  style: {
208
- fontFamily: import_tokens.CHART_FONT_FAMILY,
205
+ fontFamily: import_util.CHART_FONT_FAMILY,
209
206
  fontSize: 11,
210
207
  fontWeight: 500
211
208
  }
@@ -252,7 +249,7 @@ ${formatValue(d.value)}`,
252
249
  fill: tokens.textPrimary,
253
250
  dx: 8,
254
251
  style: {
255
- fontFamily: import_tokens.CHART_FONT_FAMILY,
252
+ fontFamily: import_util.CHART_FONT_FAMILY,
256
253
  fontSize: 11,
257
254
  fontWeight: 500
258
255
  }
@@ -264,7 +261,7 @@ ${formatValue(d.value)}`,
264
261
  axis: false,
265
262
  interaction: {
266
263
  tooltip: true,
267
- elementHighlight: { delay: import_tokens.CHART_STYLE_DEFAULTS.interactionDelay }
264
+ elementHighlight: { delay: import_util.CHART_STYLE_DEFAULTS.interactionDelay }
268
265
  },
269
266
  theme: rendererTheme
270
267
  };
@@ -24,7 +24,7 @@ __export(histogram_exports, {
24
24
  module.exports = __toCommonJS(histogram_exports);
25
25
  var import_g2 = require("@antv/g2");
26
26
  var import_g22 = require("../../theme/g2");
27
- var import_components = require("../../util/components");
27
+ var import_util = require("../../util");
28
28
  var Histogram = (options) => {
29
29
  const { container, width, height, theme: chartTheme = "default" } = options;
30
30
  let chart = null;
@@ -70,7 +70,7 @@ var Histogram = (options) => {
70
70
  // binX transform groups continuous data into bins and counts frequency
71
71
  transform: [{ type: "binX", y: "count", thresholds: binNumber }],
72
72
  style: intervalMark,
73
- axis: (0, import_components.getCartesianAxis)({ axisXTitle, axisYTitle }),
73
+ axis: (0, import_util.getCartesianAxis)({ axisXTitle, axisYTitle, xType: "number" }, rendererTheme),
74
74
  scale: {
75
75
  y: {
76
76
  nice: true
@@ -24,7 +24,7 @@ __export(indented_tree_exports, {
24
24
  module.exports = __toCommonJS(indented_tree_exports);
25
25
  var import_g6 = require("@antv/g6");
26
26
  var import_g62 = require("../../theme/g6");
27
- var import_components = require("../../util/components");
27
+ var import_util = require("../../util");
28
28
  var TreeEvent = {
29
29
  COLLAPSE_EXPAND: "collapse-expand",
30
30
  ADD_CHILD: "add-child"
@@ -272,7 +272,7 @@ var IndentedTree = (options) => {
272
272
  throw new Error("IndentedTree: container element not found");
273
273
  containerEl.innerHTML = "";
274
274
  const appearance = (0, import_g62.getThemeObject)("indented-tree", theme, localStyle);
275
- const graphTitle = (0, import_components.getGraphTitle)(title, subtitle, appearance.titleStyle);
275
+ const graphTitle = (0, import_util.getGraphTitle)(title, subtitle, appearance.titleStyle);
276
276
  const { theme: rendererTheme } = appearance;
277
277
  const baseTheme = appearance.baseTheme;
278
278
  const backgroundColor = appearance.backgroundColor;
@@ -1,3 +1,4 @@
1
+ import type { RendererAnnotation } from '../../annotation/registry';
1
2
  import type { ThemeStyle, VisualizationOptions, VisualizationTheme } from '../../types';
2
3
  /**
3
4
  * LineDataItem is the type for each data item in the line chart.
@@ -19,6 +20,7 @@ export interface LineConfig {
19
20
  axisYTitle?: string;
20
21
  theme?: VisualizationTheme;
21
22
  style?: ThemeStyle;
23
+ annotations?: RendererAnnotation<LineDataItem, 'g2', 'line'>[];
22
24
  }
23
25
  /**
24
26
  * LineInstance represents a line chart instance with render and destroy methods.
@@ -23,15 +23,15 @@ __export(line_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(line_exports);
25
25
  var import_g2 = require("@antv/g2");
26
+ var import_annotation = require("../../annotation");
26
27
  var import_g22 = require("../../theme/g2");
27
28
  var import_util = require("../../util");
28
- var import_components = require("../../util/components");
29
- var import_tokens = require("../../util/tokens");
30
29
  var Line = (options) => {
31
30
  const { container, width, height, theme: chartTheme = "default" } = options;
32
31
  let chart = null;
33
32
  let hasRendered = false;
34
33
  let cleanupCrosshairAxisLabels = null;
34
+ let cleanupAnnotations;
35
35
  const render = (config) => {
36
36
  var _a;
37
37
  const {
@@ -44,6 +44,7 @@ var Line = (options) => {
44
44
  style: localStyle = {}
45
45
  } = config;
46
46
  if (chart) {
47
+ cleanupAnnotations == null ? void 0 : cleanupAnnotations();
47
48
  cleanupCrosshairAxisLabels == null ? void 0 : cleanupCrosshairAxisLabels();
48
49
  cleanupCrosshairAxisLabels = null;
49
50
  chart.destroy();
@@ -52,21 +53,25 @@ var Line = (options) => {
52
53
  const cartesianAxisOptions = {
53
54
  axisXTitle,
54
55
  axisYTitle,
55
- xLabels: data.map(({ time }) => time),
56
- chartWidth: width
56
+ preferHorizontal: true,
57
+ xValues: data.map(({ time }) => time),
58
+ container,
59
+ chartWidth: width,
60
+ chartHeight: height
57
61
  };
58
62
  const appearance = (0, import_g22.getThemeObject)("line", theme, localStyle);
59
63
  const { theme: rendererTheme } = appearance;
64
+ const cartesianAxis = (0, import_util.createCartesianAxis)(cartesianAxisOptions, rendererTheme);
60
65
  const lineMark = {
61
- lineWidth: import_tokens.CHART_STYLE_DEFAULTS.lineWidth,
66
+ lineWidth: import_util.CHART_STYLE_DEFAULTS.lineWidth,
62
67
  lineCap: "round",
63
68
  lineJoin: "round",
64
69
  ...appearance.mark.line
65
70
  };
66
71
  const pointStyle = {
67
72
  shape: "point",
68
- size: import_tokens.CHART_STYLE_DEFAULTS.pointSize,
69
- lineWidth: import_tokens.CHART_STYLE_DEFAULTS.pointLineWidth,
73
+ size: import_util.CHART_STYLE_DEFAULTS.pointSize,
74
+ lineWidth: import_util.CHART_STYLE_DEFAULTS.pointLineWidth,
70
75
  stroke: rendererTheme.view.viewFill,
71
76
  ...appearance.mark.point
72
77
  };
@@ -133,20 +138,31 @@ var Line = (options) => {
133
138
  encode,
134
139
  children,
135
140
  scale: scaleConfig,
136
- ...(0, import_util.getCartesianLayout)(cartesianAxisOptions),
137
- axis: (0, import_util.getCartesianAxis)(cartesianAxisOptions),
138
- legend: (0, import_components.getColorLegend)(hasGroupField),
141
+ axis: cartesianAxis.axis,
142
+ ...cartesianAxis.layout(),
143
+ legend: (0, import_util.getColorLegend)(hasGroupField),
139
144
  interaction: {
140
145
  tooltip: (0, import_util.getSharedTooltipInteraction)({ crosshairs: true })
141
146
  },
142
147
  theme: rendererTheme
143
148
  };
144
149
  chart.options(chartOptions);
150
+ (0, import_util.bindCartesianAxisLayout)(chart, cartesianAxis);
151
+ cleanupAnnotations = (0, import_annotation.bindAnnotations)({
152
+ renderer: "g2",
153
+ chartType: "line",
154
+ chart,
155
+ annotations: config.annotations,
156
+ mapping: { x: "time", y: "value", series: hasGroupField ? "group" : void 0, data },
157
+ themeObject: appearance
158
+ });
145
159
  cleanupCrosshairAxisLabels = (0, import_util.bindCrosshairAxisLabels)(chart, baseTheme);
146
160
  chart.render();
147
161
  hasRendered = true;
148
162
  };
149
163
  const destroy = () => {
164
+ cleanupAnnotations == null ? void 0 : cleanupAnnotations();
165
+ cleanupAnnotations = void 0;
150
166
  if (chart) {
151
167
  cleanupCrosshairAxisLabels == null ? void 0 : cleanupCrosshairAxisLabels();
152
168
  cleanupCrosshairAxisLabels = null;
@@ -24,7 +24,7 @@ __export(liquid_exports, {
24
24
  module.exports = __toCommonJS(liquid_exports);
25
25
  var import_g2 = require("@antv/g2");
26
26
  var import_g22 = require("../../theme/g2");
27
- var import_tokens = require("../../util/tokens");
27
+ var import_util = require("../../util");
28
28
  var DEFAULT_WIDTH = 640;
29
29
  var DEFAULT_HEIGHT = 480;
30
30
  var Liquid = (options) => {
@@ -70,7 +70,7 @@ var Liquid = (options) => {
70
70
  contentStroke: backgroundColor,
71
71
  contentStrokeOpacity: 0.92,
72
72
  contentLineWidth: baseTheme === "dark" ? 3 : 2.5,
73
- contentFontFamily: import_tokens.CHART_FONT_FAMILY,
73
+ contentFontFamily: import_util.CHART_FONT_FAMILY,
74
74
  contentFontWeight: 600,
75
75
  contentLetterSpacing: -0.8,
76
76
  contentFontVariantNumeric: "tabular-nums",
@@ -24,7 +24,7 @@ __export(mindmap_exports, {
24
24
  module.exports = __toCommonJS(mindmap_exports);
25
25
  var import_g6 = require("@antv/g6");
26
26
  var import_g62 = require("../../theme/g6");
27
- var import_components = require("../../util/components");
27
+ var import_util = require("../../util");
28
28
  function toG6TreeData(node) {
29
29
  return {
30
30
  id: node.name,
@@ -100,7 +100,7 @@ var Mindmap = (options) => {
100
100
  }
101
101
  containerEl.innerHTML = "";
102
102
  const appearance = (0, import_g62.getThemeObject)("mindmap", theme, localStyle);
103
- const graphTitle = (0, import_components.getGraphTitle)(title, subtitle, appearance.titleStyle);
103
+ const graphTitle = (0, import_util.getGraphTitle)(title, subtitle, appearance.titleStyle);
104
104
  const { theme: rendererTheme } = appearance;
105
105
  const baseTheme = appearance.baseTheme;
106
106
  const colors = appearance.colors;
@@ -1,3 +1,4 @@
1
+ import type { RendererAnnotation } from '../../annotation/registry';
1
2
  import type { GraphData, ThemeStyle, VisualizationOptions, VisualizationTheme } from '../../types';
2
3
  export type NetworkGraphNode = GraphData['nodes'][number];
3
4
  export type NetworkGraphEdge = GraphData['edges'][number];
@@ -13,6 +14,7 @@ export interface NetworkGraphConfig {
13
14
  title?: string;
14
15
  subtitle?: string;
15
16
  style?: ThemeStyle;
17
+ annotations?: RendererAnnotation<NetworkGraphNode | NetworkGraphEdge, 'g6', 'network-graph'>[];
16
18
  }
17
19
  /**
18
20
  * NetworkGraphInstance represents a network graph instance with render and destroy methods.
@@ -23,11 +23,14 @@ __export(network_graph_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(network_graph_exports);
25
25
  var import_g6 = require("@antv/g6");
26
+ var import_annotation = require("../../annotation");
27
+ var import_annotation2 = require("../../theme/annotation");
26
28
  var import_g62 = require("../../theme/g6");
27
- var import_components = require("../../util/components");
29
+ var import_util = require("../../util");
28
30
  var NetworkGraph = (options) => {
29
31
  const { container, width, height, theme: chartTheme = "default" } = options;
30
32
  let graph = null;
33
+ let cleanupAnnotations;
31
34
  const render = (config) => {
32
35
  const {
33
36
  data = { nodes: [], edges: [] },
@@ -39,11 +42,12 @@ var NetworkGraph = (options) => {
39
42
  } = config;
40
43
  const { nodes = [], edges = [] } = data;
41
44
  if (graph) {
45
+ cleanupAnnotations == null ? void 0 : cleanupAnnotations();
42
46
  graph.destroy();
43
47
  graph = null;
44
48
  }
45
49
  const appearance = (0, import_g62.getThemeObject)("network-graph", theme, localStyle);
46
- const graphTitle = (0, import_components.getGraphTitle)(title, subtitle, appearance.titleStyle);
50
+ const graphTitle = (0, import_util.getGraphTitle)(title, subtitle, appearance.titleStyle);
47
51
  const { theme: rendererTheme } = appearance;
48
52
  const baseTheme = appearance.baseTheme;
49
53
  const colors = appearance.colors;
@@ -73,7 +77,14 @@ var NetworkGraph = (options) => {
73
77
  labelText: node.name
74
78
  }
75
79
  }));
76
- const edgeData = edges.map((edge) => ({
80
+ const edgeIds = edges.map((_, index) => {
81
+ let id = `gpt-vis-edge-${index}`;
82
+ while (nodes.some((node) => node.name === id))
83
+ id = `_${id}`;
84
+ return id;
85
+ });
86
+ const edgeData = edges.map((edge, index) => ({
87
+ id: edgeIds[index],
77
88
  source: edge.source,
78
89
  target: edge.target,
79
90
  data: { label: edge.name ?? "" },
@@ -149,9 +160,19 @@ var NetworkGraph = (options) => {
149
160
  behaviors: ["drag-canvas", "drag-element", "click-select"],
150
161
  plugins: graphTitle.plugins
151
162
  });
163
+ cleanupAnnotations = (0, import_annotation.bindAnnotations)({
164
+ renderer: "g6",
165
+ graph,
166
+ annotations: config.annotations,
167
+ data: { nodes, edges },
168
+ edgeIds,
169
+ defaults: (0, import_annotation2.getAnnotationDefaults)("network-graph", theme, localStyle)
170
+ });
152
171
  graph.render();
153
172
  };
154
173
  const destroy = () => {
174
+ cleanupAnnotations == null ? void 0 : cleanupAnnotations();
175
+ cleanupAnnotations = void 0;
155
176
  if (graph) {
156
177
  graph.destroy();
157
178
  graph = null;
@@ -24,7 +24,7 @@ __export(organization_chart_exports, {
24
24
  module.exports = __toCommonJS(organization_chart_exports);
25
25
  var import_g6 = require("@antv/g6");
26
26
  var import_g62 = require("../../theme/g6");
27
- var import_components = require("../../util/components");
27
+ var import_util = require("../../util");
28
28
  var NODE_WIDTH = 160;
29
29
  var NODE_HEIGHT_WITH_DESC = 72;
30
30
  var NODE_HEIGHT_NO_DESC = 40;
@@ -56,7 +56,7 @@ var OrganizationChart = (options) => {
56
56
  }
57
57
  containerEl.innerHTML = "";
58
58
  const appearance = (0, import_g62.getThemeObject)("organization-chart", theme, localStyle);
59
- const graphTitle = (0, import_components.getGraphTitle)(title, subtitle, appearance.titleStyle);
59
+ const graphTitle = (0, import_util.getGraphTitle)(title, subtitle, appearance.titleStyle);
60
60
  const { theme: rendererTheme } = appearance;
61
61
  const baseTheme = appearance.baseTheme;
62
62
  const colors = appearance.colors;
@@ -1,3 +1,4 @@
1
+ import type { RendererAnnotation } from '../../annotation/registry';
1
2
  import type { ThemeStyle, VisualizationOptions, VisualizationTheme } from '../../types';
2
3
  /**
3
4
  * PieDataItem is the type for each data item in the pie chart.
@@ -17,6 +18,7 @@ export interface PieConfig {
17
18
  title?: string;
18
19
  subtitle?: string;
19
20
  style?: ThemeStyle;
21
+ annotations?: RendererAnnotation<PieDataItem, 'g2', 'pie'>[];
20
22
  }
21
23
  /**
22
24
  * PieInstance represents a pie chart instance with render and destroy methods.
@@ -23,14 +23,13 @@ __export(pie_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(pie_exports);
25
25
  var import_g2 = require("@antv/g2");
26
+ var import_annotation = require("../../annotation");
26
27
  var import_g22 = require("../../theme/g2");
27
28
  var import_util = require("../../util");
28
- var import_components = require("../../util/components");
29
- var import_interaction = require("../../util/interaction");
30
- var import_tokens = require("../../util/tokens");
31
29
  var Pie = (options) => {
32
30
  const { container, width, height, theme: chartTheme = "default" } = options;
33
31
  let chart = null;
32
+ let cleanupAnnotations;
34
33
  let hasRendered = false;
35
34
  const PERCENTAGE_PRECISION_MULTIPLIER = 1e4;
36
35
  const render = (config) => {
@@ -43,6 +42,7 @@ var Pie = (options) => {
43
42
  style: localStyle = {}
44
43
  } = config;
45
44
  if (chart) {
45
+ cleanupAnnotations == null ? void 0 : cleanupAnnotations();
46
46
  chart.destroy();
47
47
  }
48
48
  const sumValue = data.reduce((sum, item) => sum + item.value, 0);
@@ -50,7 +50,7 @@ var Pie = (options) => {
50
50
  const { theme: rendererTheme } = appearance;
51
51
  const intervalMark = {
52
52
  fillOpacity: 1,
53
- stroke: (0, import_tokens.getChartVisualTokens)(rendererTheme.type).separator,
53
+ stroke: (0, import_util.getChartVisualTokens)(rendererTheme.type).separator,
54
54
  lineWidth: 2,
55
55
  ...appearance.mark.interval
56
56
  };
@@ -78,14 +78,15 @@ var Pie = (options) => {
78
78
  scale: {
79
79
  color: { range: colors }
80
80
  },
81
- legend: (0, import_components.getColorLegend)(true),
82
- labels: (0, import_components.getDataLabels)(rendererTheme, {
81
+ legend: (0, import_util.getColorLegend)(true),
82
+ labels: (0, import_util.getDataLabels)(rendererTheme, {
83
83
  defaultVisible: data.length <= 8,
84
84
  text: (d) => {
85
85
  const percentage = sumValue ? Math.round(d.value / sumValue * 100 * PERCENTAGE_PRECISION_MULTIPLIER) / PERCENTAGE_PRECISION_MULTIPLIER : 0;
86
86
  const formattedPercentage = Number(percentage.toFixed(1)).toString();
87
87
  return `${d.category}: ${formattedPercentage}%`;
88
88
  },
89
+ style: { annotationNativePercentage: true },
89
90
  position: "outside",
90
91
  contrast: "outside",
91
92
  transform: [{ type: "exceedAdjust", offsetX: 4, offsetY: 4 }, { type: "overlapHide" }]
@@ -100,26 +101,36 @@ var Pie = (options) => {
100
101
  },
101
102
  interaction: {
102
103
  tooltip: true,
103
- elementHighlight: { delay: import_tokens.CHART_STYLE_DEFAULTS.interactionDelay },
104
+ elementHighlight: { delay: import_util.CHART_STYLE_DEFAULTS.interactionDelay },
104
105
  elementHoverScale: {
105
- ...(0, import_interaction.getElementHoverScaleInteraction)(rendererTheme.type),
106
+ ...(0, import_util.getElementHoverScaleInteraction)(rendererTheme.type),
106
107
  shadow: false
107
108
  },
108
109
  elementSelect: { single: true }
109
110
  },
110
111
  state: {
111
- active: { fillOpacity: 1, lineWidth: 3 },
112
+ active: { fillOpacity: 1 },
112
113
  inactive: { fillOpacity: 0.3 },
113
- selected: { fillOpacity: 1, lineWidth: 3 }
114
+ selected: { fillOpacity: 1 }
114
115
  },
115
116
  style: intervalMark,
116
117
  theme: rendererTheme
117
118
  };
118
119
  chart.options(chartOptions);
120
+ cleanupAnnotations = (0, import_annotation.bindAnnotations)({
121
+ renderer: "g2",
122
+ chartType: "pie",
123
+ chart,
124
+ annotations: config.annotations,
125
+ mapping: { x: "category", y: "value", data },
126
+ themeObject: appearance
127
+ });
119
128
  chart.render();
120
129
  hasRendered = true;
121
130
  };
122
131
  const destroy = () => {
132
+ cleanupAnnotations == null ? void 0 : cleanupAnnotations();
133
+ cleanupAnnotations = void 0;
123
134
  if (chart) {
124
135
  chart.destroy();
125
136
  chart = null;