@antv/gpt-vis 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/README.md +261 -137
  2. package/README.zh-CN.md +263 -116
  3. package/dist/cjs/annotation/components/bottom-n.d.ts +2 -0
  4. package/dist/cjs/annotation/components/bottom-n.js +57 -0
  5. package/dist/cjs/annotation/components/centroid.d.ts +2 -0
  6. package/dist/cjs/annotation/components/centroid.js +75 -0
  7. package/dist/cjs/annotation/components/connector.d.ts +25 -0
  8. package/dist/cjs/annotation/components/connector.js +298 -0
  9. package/dist/cjs/annotation/components/contribution.d.ts +3 -0
  10. package/dist/cjs/annotation/components/contribution.js +136 -0
  11. package/dist/cjs/annotation/components/crossing.d.ts +3 -0
  12. package/dist/cjs/annotation/components/crossing.js +504 -0
  13. package/dist/cjs/annotation/components/event.d.ts +2 -0
  14. package/dist/cjs/annotation/components/event.js +62 -0
  15. package/dist/cjs/annotation/components/first.d.ts +2 -0
  16. package/dist/cjs/annotation/components/first.js +42 -0
  17. package/dist/cjs/annotation/components/group.d.ts +3 -0
  18. package/dist/cjs/annotation/components/group.js +73 -0
  19. package/dist/cjs/annotation/components/highlight.d.ts +14 -0
  20. package/dist/cjs/annotation/components/highlight.js +552 -0
  21. package/dist/cjs/annotation/components/index.d.ts +34 -0
  22. package/dist/cjs/annotation/components/index.js +128 -0
  23. package/dist/cjs/annotation/components/last.d.ts +2 -0
  24. package/dist/cjs/annotation/components/last.js +42 -0
  25. package/dist/cjs/annotation/components/max-x.d.ts +2 -0
  26. package/dist/cjs/annotation/components/max-x.js +41 -0
  27. package/dist/cjs/annotation/components/max-y.d.ts +2 -0
  28. package/dist/cjs/annotation/components/max-y.js +41 -0
  29. package/dist/cjs/annotation/components/mean.d.ts +2 -0
  30. package/dist/cjs/annotation/components/mean.js +50 -0
  31. package/dist/cjs/annotation/components/median.d.ts +2 -0
  32. package/dist/cjs/annotation/components/median.js +49 -0
  33. package/dist/cjs/annotation/components/min-x.d.ts +2 -0
  34. package/dist/cjs/annotation/components/min-x.js +41 -0
  35. package/dist/cjs/annotation/components/min-y.d.ts +2 -0
  36. package/dist/cjs/annotation/components/min-y.js +41 -0
  37. package/dist/cjs/annotation/components/outlier.d.ts +3 -0
  38. package/dist/cjs/annotation/components/outlier.js +83 -0
  39. package/dist/cjs/annotation/components/path.d.ts +20 -0
  40. package/dist/cjs/annotation/components/path.js +147 -0
  41. package/dist/cjs/annotation/components/peak.d.ts +2 -0
  42. package/dist/cjs/annotation/components/peak.js +42 -0
  43. package/dist/cjs/annotation/components/point.d.ts +26 -0
  44. package/dist/cjs/annotation/components/point.js +241 -0
  45. package/dist/cjs/annotation/components/quadrant.d.ts +3 -0
  46. package/dist/cjs/annotation/components/quadrant.js +97 -0
  47. package/dist/cjs/annotation/components/quantile.d.ts +2 -0
  48. package/dist/cjs/annotation/components/quantile.js +49 -0
  49. package/dist/cjs/annotation/components/range-inside.d.ts +2 -0
  50. package/dist/cjs/annotation/components/range-inside.js +65 -0
  51. package/dist/cjs/annotation/components/range-outside.d.ts +2 -0
  52. package/dist/cjs/annotation/components/range-outside.js +65 -0
  53. package/dist/cjs/annotation/components/range-x.d.ts +2 -0
  54. package/dist/cjs/annotation/components/range-x.js +39 -0
  55. package/dist/cjs/annotation/components/range-y.d.ts +2 -0
  56. package/dist/cjs/annotation/components/range-y.js +39 -0
  57. package/dist/cjs/annotation/components/range.d.ts +15 -0
  58. package/dist/cjs/annotation/components/range.js +87 -0
  59. package/dist/cjs/annotation/components/target.d.ts +2 -0
  60. package/dist/cjs/annotation/components/target.js +51 -0
  61. package/dist/cjs/annotation/components/text.d.ts +15 -0
  62. package/dist/cjs/annotation/components/text.js +74 -0
  63. package/dist/cjs/annotation/components/threshold-highlight.d.ts +3 -0
  64. package/dist/cjs/annotation/components/threshold-highlight.js +223 -0
  65. package/dist/cjs/annotation/components/threshold-x.d.ts +2 -0
  66. package/dist/cjs/annotation/components/threshold-x.js +39 -0
  67. package/dist/cjs/annotation/components/threshold-y.d.ts +2 -0
  68. package/dist/cjs/annotation/components/threshold-y.js +40 -0
  69. package/dist/cjs/annotation/components/top-n.d.ts +2 -0
  70. package/dist/cjs/annotation/components/top-n.js +57 -0
  71. package/dist/cjs/annotation/components/valley.d.ts +2 -0
  72. package/dist/cjs/annotation/components/valley.js +42 -0
  73. package/dist/cjs/annotation/index.d.ts +1 -0
  74. package/dist/cjs/annotation/index.js +29 -0
  75. package/dist/cjs/annotation/label.d.ts +38 -0
  76. package/dist/cjs/annotation/label.js +347 -0
  77. package/dist/cjs/annotation/layout.d.ts +12 -0
  78. package/dist/cjs/annotation/layout.js +142 -0
  79. package/dist/cjs/annotation/merge.d.ts +19 -0
  80. package/dist/cjs/annotation/merge.js +60 -0
  81. package/dist/cjs/annotation/registry.d.ts +190 -0
  82. package/dist/cjs/annotation/registry.js +134 -0
  83. package/dist/cjs/annotation/runtime/g2.d.ts +90 -0
  84. package/dist/cjs/annotation/runtime/g2.js +521 -0
  85. package/dist/cjs/annotation/runtime/g6.d.ts +40 -0
  86. package/dist/cjs/annotation/runtime/g6.js +310 -0
  87. package/dist/cjs/annotation/runtime/index.d.ts +11 -0
  88. package/dist/cjs/annotation/runtime/index.js +41 -0
  89. package/dist/cjs/annotation/runtime/summary.d.ts +17 -0
  90. package/dist/cjs/annotation/runtime/summary.js +39 -0
  91. package/dist/cjs/annotation/runtime/table.d.ts +16 -0
  92. package/dist/cjs/annotation/runtime/table.js +39 -0
  93. package/dist/cjs/annotation/utils.d.ts +40 -0
  94. package/dist/cjs/annotation/utils.js +275 -0
  95. package/dist/cjs/theme/annotation.d.ts +236 -0
  96. package/dist/cjs/theme/annotation.js +167 -0
  97. package/dist/cjs/theme/g2.js +13 -15
  98. package/dist/cjs/theme/g6.js +2 -2
  99. package/dist/cjs/theme/summary.js +2 -2
  100. package/dist/cjs/types/annotation.d.ts +310 -0
  101. package/dist/cjs/types/annotation.js +17 -0
  102. package/dist/cjs/types/index.d.ts +1 -0
  103. package/dist/cjs/util/axis.d.ts +28 -0
  104. package/dist/cjs/util/axis.js +184 -0
  105. package/dist/cjs/util/components.d.ts +0 -10
  106. package/dist/cjs/util/components.js +9 -64
  107. package/dist/cjs/util/index.d.ts +7 -4
  108. package/dist/cjs/util/index.js +53 -9
  109. package/dist/cjs/vis/area/index.d.ts +2 -0
  110. package/dist/cjs/vis/area/index.js +30 -13
  111. package/dist/cjs/vis/bar/index.d.ts +2 -0
  112. package/dist/cjs/vis/bar/index.js +37 -7
  113. package/dist/cjs/vis/boxplot/index.js +14 -3
  114. package/dist/cjs/vis/column/index.d.ts +2 -0
  115. package/dist/cjs/vis/column/index.js +28 -9
  116. package/dist/cjs/vis/dual-axes/index.js +9 -9
  117. package/dist/cjs/vis/fishbone-diagram/index.js +2 -2
  118. package/dist/cjs/vis/flow-diagram/index.js +2 -2
  119. package/dist/cjs/vis/funnel/index.js +10 -13
  120. package/dist/cjs/vis/histogram/index.js +2 -2
  121. package/dist/cjs/vis/indented-tree/index.js +2 -2
  122. package/dist/cjs/vis/line/index.d.ts +2 -0
  123. package/dist/cjs/vis/line/index.js +26 -10
  124. package/dist/cjs/vis/liquid/index.js +2 -2
  125. package/dist/cjs/vis/mindmap/index.js +2 -2
  126. package/dist/cjs/vis/network-graph/index.d.ts +2 -0
  127. package/dist/cjs/vis/network-graph/index.js +24 -3
  128. package/dist/cjs/vis/organization-chart/index.js +2 -2
  129. package/dist/cjs/vis/pie/index.d.ts +2 -0
  130. package/dist/cjs/vis/pie/index.js +21 -10
  131. package/dist/cjs/vis/radar/index.js +4 -6
  132. package/dist/cjs/vis/sankey/index.js +14 -1
  133. package/dist/cjs/vis/scatter/index.d.ts +10 -3
  134. package/dist/cjs/vis/scatter/index.js +18 -7
  135. package/dist/cjs/vis/summary/index.d.ts +9 -2
  136. package/dist/cjs/vis/summary/index.js +25 -8
  137. package/dist/cjs/vis/table/index.d.ts +2 -0
  138. package/dist/cjs/vis/table/index.js +48 -30
  139. package/dist/cjs/vis/venn/index.js +2 -2
  140. package/dist/cjs/vis/violin/index.js +14 -3
  141. package/dist/cjs/vis/waterfall/index.js +17 -9
  142. package/dist/cjs/vis/word-cloud/index.js +4 -6
  143. package/dist/cjs/vis-wrapper/index.js +2 -1
  144. package/dist/esm/annotation/components/bottom-n.d.ts +2 -0
  145. package/dist/esm/annotation/components/bottom-n.js +42 -0
  146. package/dist/esm/annotation/components/centroid.d.ts +2 -0
  147. package/dist/esm/annotation/components/centroid.js +73 -0
  148. package/dist/esm/annotation/components/connector.d.ts +25 -0
  149. package/dist/esm/annotation/components/connector.js +332 -0
  150. package/dist/esm/annotation/components/contribution.d.ts +3 -0
  151. package/dist/esm/annotation/components/contribution.js +174 -0
  152. package/dist/esm/annotation/components/crossing.d.ts +3 -0
  153. package/dist/esm/annotation/components/crossing.js +665 -0
  154. package/dist/esm/annotation/components/event.d.ts +2 -0
  155. package/dist/esm/annotation/components/event.js +46 -0
  156. package/dist/esm/annotation/components/first.d.ts +2 -0
  157. package/dist/esm/annotation/components/first.js +18 -0
  158. package/dist/esm/annotation/components/group.d.ts +3 -0
  159. package/dist/esm/annotation/components/group.js +64 -0
  160. package/dist/esm/annotation/components/highlight.d.ts +14 -0
  161. package/dist/esm/annotation/components/highlight.js +838 -0
  162. package/dist/esm/annotation/components/index.d.ts +34 -0
  163. package/dist/esm/annotation/components/index.js +34 -0
  164. package/dist/esm/annotation/components/last.d.ts +2 -0
  165. package/dist/esm/annotation/components/last.js +18 -0
  166. package/dist/esm/annotation/components/max-x.d.ts +2 -0
  167. package/dist/esm/annotation/components/max-x.js +17 -0
  168. package/dist/esm/annotation/components/max-y.d.ts +2 -0
  169. package/dist/esm/annotation/components/max-y.js +17 -0
  170. package/dist/esm/annotation/components/mean.d.ts +2 -0
  171. package/dist/esm/annotation/components/mean.js +40 -0
  172. package/dist/esm/annotation/components/median.d.ts +2 -0
  173. package/dist/esm/annotation/components/median.js +32 -0
  174. package/dist/esm/annotation/components/min-x.d.ts +2 -0
  175. package/dist/esm/annotation/components/min-x.js +17 -0
  176. package/dist/esm/annotation/components/min-y.d.ts +2 -0
  177. package/dist/esm/annotation/components/min-y.js +17 -0
  178. package/dist/esm/annotation/components/outlier.d.ts +3 -0
  179. package/dist/esm/annotation/components/outlier.js +98 -0
  180. package/dist/esm/annotation/components/path.d.ts +20 -0
  181. package/dist/esm/annotation/components/path.js +165 -0
  182. package/dist/esm/annotation/components/peak.d.ts +2 -0
  183. package/dist/esm/annotation/components/peak.js +20 -0
  184. package/dist/esm/annotation/components/point.d.ts +26 -0
  185. package/dist/esm/annotation/components/point.js +277 -0
  186. package/dist/esm/annotation/components/quadrant.d.ts +3 -0
  187. package/dist/esm/annotation/components/quadrant.js +83 -0
  188. package/dist/esm/annotation/components/quantile.d.ts +2 -0
  189. package/dist/esm/annotation/components/quantile.js +32 -0
  190. package/dist/esm/annotation/components/range-inside.d.ts +2 -0
  191. package/dist/esm/annotation/components/range-inside.js +55 -0
  192. package/dist/esm/annotation/components/range-outside.d.ts +2 -0
  193. package/dist/esm/annotation/components/range-outside.js +55 -0
  194. package/dist/esm/annotation/components/range-x.d.ts +2 -0
  195. package/dist/esm/annotation/components/range-x.js +15 -0
  196. package/dist/esm/annotation/components/range-y.d.ts +2 -0
  197. package/dist/esm/annotation/components/range-y.js +15 -0
  198. package/dist/esm/annotation/components/range.d.ts +15 -0
  199. package/dist/esm/annotation/components/range.js +92 -0
  200. package/dist/esm/annotation/components/target.d.ts +2 -0
  201. package/dist/esm/annotation/components/target.js +44 -0
  202. package/dist/esm/annotation/components/text.d.ts +15 -0
  203. package/dist/esm/annotation/components/text.js +78 -0
  204. package/dist/esm/annotation/components/threshold-highlight.d.ts +3 -0
  205. package/dist/esm/annotation/components/threshold-highlight.js +297 -0
  206. package/dist/esm/annotation/components/threshold-x.d.ts +2 -0
  207. package/dist/esm/annotation/components/threshold-x.js +23 -0
  208. package/dist/esm/annotation/components/threshold-y.d.ts +2 -0
  209. package/dist/esm/annotation/components/threshold-y.js +24 -0
  210. package/dist/esm/annotation/components/top-n.d.ts +2 -0
  211. package/dist/esm/annotation/components/top-n.js +42 -0
  212. package/dist/esm/annotation/components/valley.d.ts +2 -0
  213. package/dist/esm/annotation/components/valley.js +20 -0
  214. package/dist/esm/annotation/index.d.ts +1 -0
  215. package/dist/esm/annotation/index.js +1 -0
  216. package/dist/esm/annotation/label.d.ts +38 -0
  217. package/dist/esm/annotation/label.js +449 -0
  218. package/dist/esm/annotation/layout.d.ts +12 -0
  219. package/dist/esm/annotation/layout.js +182 -0
  220. package/dist/esm/annotation/merge.d.ts +19 -0
  221. package/dist/esm/annotation/merge.js +67 -0
  222. package/dist/esm/annotation/registry.d.ts +190 -0
  223. package/dist/esm/annotation/registry.js +220 -0
  224. package/dist/esm/annotation/runtime/g2.d.ts +90 -0
  225. package/dist/esm/annotation/runtime/g2.js +754 -0
  226. package/dist/esm/annotation/runtime/g6.d.ts +40 -0
  227. package/dist/esm/annotation/runtime/g6.js +447 -0
  228. package/dist/esm/annotation/runtime/index.d.ts +11 -0
  229. package/dist/esm/annotation/runtime/index.js +26 -0
  230. package/dist/esm/annotation/runtime/summary.d.ts +17 -0
  231. package/dist/esm/annotation/runtime/summary.js +21 -0
  232. package/dist/esm/annotation/runtime/table.d.ts +16 -0
  233. package/dist/esm/annotation/runtime/table.js +21 -0
  234. package/dist/esm/annotation/utils.d.ts +40 -0
  235. package/dist/esm/annotation/utils.js +370 -0
  236. package/dist/esm/theme/annotation.d.ts +236 -0
  237. package/dist/esm/theme/annotation.js +186 -0
  238. package/dist/esm/theme/g2.js +2 -10
  239. package/dist/esm/theme/g6.js +1 -1
  240. package/dist/esm/theme/summary.js +1 -1
  241. package/dist/esm/types/annotation.d.ts +310 -0
  242. package/dist/esm/types/annotation.js +1 -0
  243. package/dist/esm/types/index.d.ts +1 -0
  244. package/dist/esm/util/axis.d.ts +28 -0
  245. package/dist/esm/util/axis.js +222 -0
  246. package/dist/esm/util/components.d.ts +0 -10
  247. package/dist/esm/util/components.js +24 -69
  248. package/dist/esm/util/index.d.ts +7 -4
  249. package/dist/esm/util/index.js +7 -4
  250. package/dist/esm/vis/area/index.d.ts +2 -0
  251. package/dist/esm/vis/area/index.js +32 -9
  252. package/dist/esm/vis/bar/index.d.ts +2 -0
  253. package/dist/esm/vis/bar/index.js +37 -6
  254. package/dist/esm/vis/boxplot/index.js +10 -2
  255. package/dist/esm/vis/column/index.d.ts +2 -0
  256. package/dist/esm/vis/column/index.js +33 -12
  257. package/dist/esm/vis/dual-axes/index.js +10 -10
  258. package/dist/esm/vis/fishbone-diagram/index.js +1 -1
  259. package/dist/esm/vis/flow-diagram/index.js +1 -1
  260. package/dist/esm/vis/funnel/index.js +2 -7
  261. package/dist/esm/vis/histogram/index.js +4 -3
  262. package/dist/esm/vis/indented-tree/index.js +1 -1
  263. package/dist/esm/vis/line/index.d.ts +2 -0
  264. package/dist/esm/vis/line/index.js +31 -9
  265. package/dist/esm/vis/liquid/index.js +1 -1
  266. package/dist/esm/vis/mindmap/index.js +1 -1
  267. package/dist/esm/vis/network-graph/index.d.ts +2 -0
  268. package/dist/esm/vis/network-graph/index.js +29 -2
  269. package/dist/esm/vis/organization-chart/index.js +1 -1
  270. package/dist/esm/vis/pie/index.d.ts +2 -0
  271. package/dist/esm/vis/pie/index.js +25 -8
  272. package/dist/esm/vis/radar/index.js +1 -3
  273. package/dist/esm/vis/sankey/index.js +15 -1
  274. package/dist/esm/vis/scatter/index.d.ts +10 -3
  275. package/dist/esm/vis/scatter/index.js +28 -5
  276. package/dist/esm/vis/summary/index.d.ts +9 -2
  277. package/dist/esm/vis/summary/index.js +31 -13
  278. package/dist/esm/vis/table/index.d.ts +2 -0
  279. package/dist/esm/vis/table/index.js +50 -33
  280. package/dist/esm/vis/venn/index.js +1 -1
  281. package/dist/esm/vis/violin/index.js +10 -2
  282. package/dist/esm/vis/waterfall/index.js +16 -13
  283. package/dist/esm/vis/word-cloud/index.js +1 -3
  284. package/dist/esm/vis-wrapper/index.js +2 -1
  285. package/dist/umd/index.min.js +1 -1
  286. package/package.json +2 -2
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/annotation/components/range-inside.ts
20
+ var range_inside_exports = {};
21
+ __export(range_inside_exports, {
22
+ rangeInside: () => rangeInside
23
+ });
24
+ module.exports = __toCommonJS(range_inside_exports);
25
+ var import_utils = require("../utils");
26
+ var import_highlight = require("./highlight");
27
+ var import_range = require("./range");
28
+ var rangeInside = {
29
+ g2: (annotations, { mapping }) => annotations.flatMap((annotation) => {
30
+ var _a, _b;
31
+ const rows = (0, import_utils.selectRows)(mapping.data, annotation.data);
32
+ const field = mapping.y;
33
+ const selected = (0, import_utils.selectRange)(rows, field, annotation.range, false);
34
+ return [
35
+ ...import_range.range.create({
36
+ data: { [field]: annotation.range },
37
+ style: {
38
+ fill: ((_a = annotation.style) == null ? void 0 : _a.fill) ?? ((_b = annotation.style) == null ? void 0 : _b.stroke)
39
+ }
40
+ }),
41
+ ...selected.flatMap(
42
+ (row) => import_highlight.highlight.create({
43
+ data: [row],
44
+ label: annotation.label ?? `Inside range: ${row[field]}`,
45
+ style: annotation.style
46
+ })
47
+ )
48
+ ];
49
+ }),
50
+ table: (annotations, { data }) => annotations.flatMap((annotation) => {
51
+ const rows = (0, import_utils.selectRows)(data, annotation.data.row);
52
+ const field = annotation.data.field;
53
+ return (0, import_utils.selectRange)(rows, field, annotation.range, false).flatMap(
54
+ (row) => import_highlight.highlight.create({
55
+ data: [{ row, column: annotation.data.column }],
56
+ label: annotation.label ?? `Inside range: ${row[field]}`,
57
+ style: annotation.style
58
+ })
59
+ );
60
+ })
61
+ };
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
64
+ rangeInside
65
+ });
@@ -0,0 +1,2 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ export declare const rangeOutside: AnnotationComponent<'rangeOutside', 'g2' | 'table'>;
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/annotation/components/range-outside.ts
20
+ var range_outside_exports = {};
21
+ __export(range_outside_exports, {
22
+ rangeOutside: () => rangeOutside
23
+ });
24
+ module.exports = __toCommonJS(range_outside_exports);
25
+ var import_utils = require("../utils");
26
+ var import_highlight = require("./highlight");
27
+ var import_range = require("./range");
28
+ var rangeOutside = {
29
+ g2: (annotations, { mapping }) => annotations.flatMap((annotation) => {
30
+ var _a, _b;
31
+ const rows = (0, import_utils.selectRows)(mapping.data, annotation.data);
32
+ const field = mapping.y;
33
+ const selected = (0, import_utils.selectRange)(rows, field, annotation.range, true);
34
+ return [
35
+ ...import_range.range.create({
36
+ data: { [field]: annotation.range },
37
+ style: {
38
+ fill: ((_a = annotation.style) == null ? void 0 : _a.fill) ?? ((_b = annotation.style) == null ? void 0 : _b.stroke)
39
+ }
40
+ }),
41
+ ...selected.flatMap(
42
+ (row) => import_highlight.highlight.create({
43
+ data: [row],
44
+ label: annotation.label ?? `Outside range: ${row[field]}`,
45
+ style: annotation.style
46
+ })
47
+ )
48
+ ];
49
+ }),
50
+ table: (annotations, { data }) => annotations.flatMap((annotation) => {
51
+ const rows = (0, import_utils.selectRows)(data, annotation.data.row);
52
+ const field = annotation.data.field;
53
+ return (0, import_utils.selectRange)(rows, field, annotation.range, true).flatMap(
54
+ (row) => import_highlight.highlight.create({
55
+ data: [{ row, column: annotation.data.column }],
56
+ label: annotation.label ?? `Outside range: ${row[field]}`,
57
+ style: annotation.style
58
+ })
59
+ );
60
+ })
61
+ };
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
64
+ rangeOutside
65
+ });
@@ -0,0 +1,2 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ export declare const rangeX: AnnotationComponent<'rangeX'>;
@@ -0,0 +1,39 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/annotation/components/range-x.ts
20
+ var range_x_exports = {};
21
+ __export(range_x_exports, {
22
+ rangeX: () => rangeX
23
+ });
24
+ module.exports = __toCommonJS(range_x_exports);
25
+ var import_utils = require("../utils");
26
+ var import_range = require("./range");
27
+ var rangeX = {
28
+ g2: (annotations, { mapping }) => annotations.flatMap(
29
+ (annotation) => import_range.range.create({
30
+ data: (0, import_utils.axisRange)(mapping.x, annotation.range),
31
+ label: annotation.label ?? `X range: ${annotation.range.join("–")}`,
32
+ style: annotation.style
33
+ })
34
+ )
35
+ };
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ rangeX
39
+ });
@@ -0,0 +1,2 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ export declare const rangeY: AnnotationComponent<'rangeY'>;
@@ -0,0 +1,39 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/annotation/components/range-y.ts
20
+ var range_y_exports = {};
21
+ __export(range_y_exports, {
22
+ rangeY: () => rangeY
23
+ });
24
+ module.exports = __toCommonJS(range_y_exports);
25
+ var import_utils = require("../utils");
26
+ var import_range = require("./range");
27
+ var rangeY = {
28
+ g2: (annotations, { mapping }) => annotations.flatMap(
29
+ (annotation) => import_range.range.create({
30
+ data: (0, import_utils.axisRange)(mapping.y, annotation.range),
31
+ label: annotation.label ?? `Y range: ${annotation.range.join("–")}`,
32
+ style: annotation.style
33
+ })
34
+ )
35
+ };
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ rangeY
39
+ });
@@ -0,0 +1,15 @@
1
+ import type { Annotation } from '../../types/annotation';
2
+ import type { Point } from '../layout';
3
+ import type { AnnotationComponent } from '../registry';
4
+ import type { G2AnnotationContext } from '../runtime';
5
+ /** Axis bounds, including the full band at either end; omitted axes span the plot. */
6
+ export declare const range: AnnotationComponent<'range', 'g2'> & {
7
+ create: typeof createRange;
8
+ };
9
+ type Bounds = (context: Pick<G2AnnotationContext<object>, 'axisValue'>) => [Point, Point];
10
+ declare function createRange<T extends object>(options: Omit<Extract<Annotation<T>, {
11
+ type: 'range';
12
+ }>, 'type'>, bounds?: Bounds): Extract<Annotation<T>, {
13
+ type: 'range';
14
+ }>[];
15
+ export {};
@@ -0,0 +1,87 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/annotation/components/range.ts
20
+ var range_exports = {};
21
+ __export(range_exports, {
22
+ range: () => range
23
+ });
24
+ module.exports = __toCommonJS(range_exports);
25
+ var range = {
26
+ create: createRange,
27
+ g2: () => drawG2
28
+ };
29
+ var positions = /* @__PURE__ */ new WeakMap();
30
+ function createRange(options, bounds) {
31
+ const annotation = { ...options, type: "range" };
32
+ if (bounds)
33
+ positions.set(annotation, bounds);
34
+ return [annotation];
35
+ }
36
+ var drawG2 = (annotations, context) => {
37
+ const { mapping, defaults } = context;
38
+ return {
39
+ marks: annotations.map((annotation) => {
40
+ var _a, _b, _c, _d, _e, _f;
41
+ const x = annotation.data[mapping.x];
42
+ const y = annotation.data[mapping.y];
43
+ return context.createMark(annotation, {
44
+ nativeType: x && y ? "range" : x !== void 0 ? "rangeX" : "rangeY",
45
+ zIndex: -1,
46
+ clip: true,
47
+ decorate: (element) => element.setAttribute("annotationIgnoreObstacle", true),
48
+ style: {
49
+ stroke: ((_a = annotation.style) == null ? void 0 : _a.stroke) ?? "none",
50
+ lineWidth: ((_b = annotation.style) == null ? void 0 : _b.lineWidth) ?? defaults.lineWidth.range,
51
+ lineDash: (_c = annotation.style) == null ? void 0 : _c.lineDash,
52
+ fill: ((_d = annotation.style) == null ? void 0 : _d.fill) ?? ((_e = annotation.style) == null ? void 0 : _e.stroke) ?? defaults.stroke,
53
+ fillOpacity: ((_f = annotation.style) == null ? void 0 : _f.fillOpacity) ?? defaults.fillOpacity
54
+ },
55
+ geometry: (native) => (_index, scale, value, coordinate) => {
56
+ const position = positions.get(annotation);
57
+ if (position) {
58
+ const [from, to] = position(context);
59
+ return native(
60
+ [0],
61
+ scale,
62
+ { ...value, x: [from[0]], x1: [to[0]], y: [from[1]], y1: [to[1]] },
63
+ coordinate
64
+ );
65
+ }
66
+ if (!context.onlyAxisFields(annotation.data))
67
+ throw new Error("Invalid annotation: range only accepts axis fields.");
68
+ const bounds = (values, axis) => {
69
+ if (!values)
70
+ return [0, 1];
71
+ const a = context.axisValue(axis, values[0], false);
72
+ const b = context.axisValue(axis, values[1], false);
73
+ const end = context.bandWidth(axis, values[a < b ? 1 : 0]);
74
+ return [Math.min(a, b), Math.max(a, b) + end];
75
+ };
76
+ const [x0, x1] = bounds(x, "x");
77
+ const [y0, y1] = bounds(y, "y");
78
+ return native([0], scale, { ...value, x: [x0], x1: [x1], y: [y0], y1: [y1] }, coordinate);
79
+ }
80
+ });
81
+ })
82
+ };
83
+ };
84
+ // Annotate the CommonJS export names for ESM import in node:
85
+ 0 && (module.exports = {
86
+ range
87
+ });
@@ -0,0 +1,2 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ export declare const target: AnnotationComponent<'target'>;
@@ -0,0 +1,51 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target2, all) => {
6
+ for (var name in all)
7
+ __defProp(target2, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/annotation/components/target.ts
20
+ var target_exports = {};
21
+ __export(target_exports, {
22
+ target: () => target
23
+ });
24
+ module.exports = __toCommonJS(target_exports);
25
+ var import_utils = require("../utils");
26
+ var import_path = require("./path");
27
+ var target = {
28
+ g2: (annotations, { mapping }) => annotations.flatMap((annotation) => {
29
+ const field = (0, import_utils.annotationField)(mapping, annotation.axis);
30
+ if (annotation.target !== void 0 && annotation.data !== void 0)
31
+ throw new Error("Invalid annotation: target needs either a fixed target or a path.");
32
+ if (annotation.target === void 0) {
33
+ if (!Array.isArray(annotation.data) || annotation.data.length < 2)
34
+ throw new Error("Invalid annotation: target path needs at least two positions.");
35
+ for (const position of annotation.data) {
36
+ (0, import_utils.axisPosition)(mapping.x, position[mapping.x]);
37
+ (0, import_utils.finiteValue)(position[mapping.y], mapping.y);
38
+ }
39
+ } else
40
+ (0, import_utils.finiteValue)(annotation.target, "target");
41
+ return import_path.path.create({
42
+ data: annotation.target === void 0 ? annotation.data : (0, import_utils.axisPosition)(field, annotation.target),
43
+ label: annotation.label ?? (annotation.target === void 0 ? "Target" : `Target: ${(0, import_utils.formatNumber)(annotation.target)}`),
44
+ style: { lineDash: [4, 4], ...annotation.style }
45
+ });
46
+ })
47
+ };
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ target
51
+ });
@@ -0,0 +1,15 @@
1
+ import type { Annotation } from '../../types/annotation';
2
+ import type { Point } from '../layout';
3
+ import type { AnnotationComponent } from '../registry';
4
+ import type { G2AnnotationContext } from '../runtime';
5
+ /** Standalone text stays at the supplied anchor and participates as a fixed layout obstacle. */
6
+ export declare const text: AnnotationComponent<'text', 'g2' | 'g6'> & {
7
+ create: typeof createText;
8
+ };
9
+ type Position = (context: Pick<G2AnnotationContext<object>, 'axisValue'>, coordinate: Parameters<G2AnnotationContext<object>['position']>[1]) => Point | undefined;
10
+ declare function createText<T extends object>(options: Omit<Extract<Annotation<T>, {
11
+ type: 'text';
12
+ }>, 'type'>, position?: Position): Extract<Annotation<T>, {
13
+ type: 'text';
14
+ }>[];
15
+ export {};
@@ -0,0 +1,74 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/annotation/components/text.ts
20
+ var text_exports = {};
21
+ __export(text_exports, {
22
+ text: () => text
23
+ });
24
+ module.exports = __toCommonJS(text_exports);
25
+ var text = {
26
+ create: createText,
27
+ g2: () => drawG2,
28
+ g6: () => drawG6
29
+ };
30
+ var positions = /* @__PURE__ */ new WeakMap();
31
+ function createText(options, position) {
32
+ const annotation = { ...options, type: "text" };
33
+ if (position)
34
+ positions.set(annotation, position);
35
+ return [annotation];
36
+ }
37
+ var drawG2 = (annotations, context) => {
38
+ return {
39
+ marks: annotations.map(
40
+ (annotation) => context.createMark(annotation, {
41
+ nativeType: "text",
42
+ zIndex: 1,
43
+ encode: { text: () => annotation.label },
44
+ label: false,
45
+ style: {
46
+ ...context.getTextStyle(annotation),
47
+ textAlign: "center",
48
+ textBaseline: "middle",
49
+ stroke: "none",
50
+ lineWidth: 0
51
+ },
52
+ geometry: (native) => (_index, scale, value, coordinate) => {
53
+ const position = positions.get(annotation);
54
+ const point = position ? position(context, coordinate) : context.position(annotation.data, coordinate);
55
+ if (!point)
56
+ return [[], []];
57
+ return native([0], scale, { ...value, x: [point[0]], y: [point[1]] }, coordinate);
58
+ }
59
+ })
60
+ )
61
+ };
62
+ };
63
+ var drawG6 = (annotations, context) => {
64
+ for (const annotation of annotations) {
65
+ const point = context.position(annotation.data);
66
+ if (point)
67
+ context.label(annotation, point, { standalone: true });
68
+ }
69
+ return {};
70
+ };
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ text
74
+ });
@@ -0,0 +1,3 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ /** Emphasize the native portion above or below a threshold, with a shared reference line. */
3
+ export declare const thresholdHighlight: AnnotationComponent<'thresholdHighlight', 'g2' | 'table'>;