@antv/gpt-vis 1.3.2 → 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 (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 +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/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 +9 -2
  276. package/dist/esm/vis/summary/index.js +31 -13
  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,277 @@
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
5
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
6
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
7
+ 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); }
8
+ 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; }
9
+ 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; }
10
+ 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; }
11
+ 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; }
12
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
+ 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); }
14
+ import { createPointPulse } from "../utils";
15
+
16
+ /** Mark geometry and point halos belong to the same capability on both rendering stacks. */
17
+ export var point = {
18
+ create: createPoint,
19
+ g2: function g2() {
20
+ return drawG2;
21
+ },
22
+ g6: function g6() {
23
+ return drawG6;
24
+ }
25
+ };
26
+ var presets = new WeakMap();
27
+
28
+ /** Internal presets preserve native observations or specialize semantic markers without public options. */
29
+ function createPoint(options, preset) {
30
+ if (Array.isArray(options.data) && !options.data.length) return [];
31
+ var annotation = _objectSpread(_objectSpread({}, options), {}, {
32
+ type: 'point'
33
+ });
34
+ if (preset) presets.set(annotation, preset);
35
+ return [annotation];
36
+ }
37
+ var drawG2 = function drawG2(annotations, context) {
38
+ var defaults = context.defaults;
39
+ // G2 copies attributes onto retained shapes when updating native marks.
40
+ var owner = Symbol('point');
41
+ var disposed = false;
42
+ var pulse;
43
+ var update = function update() {
44
+ var _pulse;
45
+ if (disposed) return;
46
+ var scene = context.getScene();
47
+ // Native exit elements remain mounted until their transition cleanup finishes.
48
+ var elements = scene.querySelectorAll('.element').filter(function (element) {
49
+ return !element.__removed__;
50
+ });
51
+ var points = elements.filter(function (element) {
52
+ var _element$getAttribute;
53
+ return ((_element$getAttribute = element.getAttribute('annotationPoint')) === null || _element$getAttribute === void 0 ? void 0 : _element$getAttribute.owner) === owner;
54
+ });
55
+ (_pulse = pulse) === null || _pulse === void 0 || _pulse.clear();
56
+ if (!points.length) return;
57
+ var centers = elements.flatMap(function (element) {
58
+ if (element.markType !== 'point' || !element.isVisible()) return [];
59
+ var _element$getLocalBoun = element.getLocalBounds(),
60
+ halfExtents = _element$getLocalBoun.halfExtents;
61
+ if (!halfExtents[0] && !halfExtents[1]) return [];
62
+ var points = element.__data__.points;
63
+ var a = points[0],
64
+ b = points[points.length - 1];
65
+ return [[(a[0] + b[0]) / 2, (a[1] + b[1]) / 2]];
66
+ });
67
+ var _iterator = _createForOfIteratorHelper(points),
68
+ _step;
69
+ try {
70
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
71
+ var element = _step.value;
72
+ var _element$getAttribute2 = element.getAttribute('annotationPoint'),
73
+ anchor = _element$getAttribute2.anchor,
74
+ size = _element$getAttribute2.size,
75
+ color = _element$getAttribute2.color,
76
+ fill = _element$getAttribute2.fill,
77
+ stroke = _element$getAttribute2.stroke,
78
+ animated = _element$getAttribute2.pulse,
79
+ halo = _element$getAttribute2.halo;
80
+ var covered = fill === undefined && hasPointAt(centers, anchor);
81
+ element.setAttribute('fill', fill !== null && fill !== void 0 ? fill : covered ? 'transparent' : color);
82
+ element.setAttribute('stroke', covered ? 'transparent' : stroke);
83
+ if (halo) {
84
+ var _pulse2;
85
+ (_pulse2 = pulse) !== null && _pulse2 !== void 0 ? _pulse2 : pulse = createPointPulse(scene, defaults.pulse, update);
86
+ pulse.add(element.parentNode, anchor, size, color, animated);
87
+ }
88
+ }
89
+ } catch (err) {
90
+ _iterator.e(err);
91
+ } finally {
92
+ _iterator.f();
93
+ }
94
+ };
95
+ return {
96
+ update: update,
97
+ cleanup: function cleanup() {
98
+ var _pulse3;
99
+ disposed = true;
100
+ (_pulse3 = pulse) === null || _pulse3 === void 0 || _pulse3.destroy();
101
+ },
102
+ marks: annotations.map(function (annotation) {
103
+ var _annotation$style$siz, _annotation$style, _annotation$style$str, _annotation$style2, _ref, _preset$outline, _annotation$style3, _preset$shape, _annotation$style$lin, _annotation$style4, _annotation$style$fil, _annotation$style5;
104
+ var preset = presets.get(annotation);
105
+ var useSourceGeometry = preset === null || preset === void 0 ? void 0 : preset.useSourceGeometry;
106
+ var size = (_annotation$style$siz = (_annotation$style = annotation.style) === null || _annotation$style === void 0 ? void 0 : _annotation$style.size) !== null && _annotation$style$siz !== void 0 ? _annotation$style$siz : defaults.size;
107
+ var stroke = (_annotation$style$str = (_annotation$style2 = annotation.style) === null || _annotation$style2 === void 0 ? void 0 : _annotation$style2.stroke) !== null && _annotation$style$str !== void 0 ? _annotation$style$str : defaults.stroke;
108
+ var outline = (_ref = (_preset$outline = preset === null || preset === void 0 ? void 0 : preset.outline) !== null && _preset$outline !== void 0 ? _preset$outline : (_annotation$style3 = annotation.style) === null || _annotation$style3 === void 0 ? void 0 : _annotation$style3.stroke) !== null && _ref !== void 0 ? _ref : defaults.pointStroke;
109
+ var shape = (_preset$shape = preset === null || preset === void 0 ? void 0 : preset.shape) !== null && _preset$shape !== void 0 ? _preset$shape : defaults.shape;
110
+ var radius = size * ((preset === null || preset === void 0 ? void 0 : preset.halo) === false ? 1 : defaults.pulse.endScale);
111
+ var resolved = [];
112
+ return context.createMark(annotation, {
113
+ nativeType: 'point',
114
+ shape: shape,
115
+ zIndex: preset === null || preset === void 0 ? void 0 : preset.zIndex,
116
+ encode: {
117
+ size: size
118
+ },
119
+ data: preset !== null && preset !== void 0 && preset.positions ? function (coordinate) {
120
+ var _preset$visible;
121
+ resolved = ((_preset$visible = preset.visible) === null || _preset$visible === void 0 ? void 0 : _preset$visible.call(preset)) === false ? [] : preset.positions(context, coordinate);
122
+ return resolved.map(function (position) {
123
+ return {
124
+ position: position
125
+ };
126
+ });
127
+ } : undefined,
128
+ labelGap: radius,
129
+ label: {
130
+ annotationPreferSide: true,
131
+ connectorStroke: stroke
132
+ },
133
+ style: {
134
+ shape: shape,
135
+ stroke: outline,
136
+ lineWidth: (_annotation$style$lin = (_annotation$style4 = annotation.style) === null || _annotation$style4 === void 0 ? void 0 : _annotation$style4.lineWidth) !== null && _annotation$style$lin !== void 0 ? _annotation$style$lin : defaults.lineWidth.point,
137
+ fill: (_annotation$style$fil = (_annotation$style5 = annotation.style) === null || _annotation$style5 === void 0 ? void 0 : _annotation$style5.fill) !== null && _annotation$style$fil !== void 0 ? _annotation$style$fil : 'transparent',
138
+ fillOpacity: preset === null || preset === void 0 ? void 0 : preset.fillOpacity
139
+ },
140
+ decorate: function decorate(element, points) {
141
+ var _annotation$style6;
142
+ var _points = _slicedToArray(points, 2),
143
+ a = _points[0],
144
+ _points$ = _points[1],
145
+ b = _points$ === void 0 ? a : _points$;
146
+ var fill = (_annotation$style6 = annotation.style) === null || _annotation$style6 === void 0 ? void 0 : _annotation$style6.fill;
147
+ var anchor = [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];
148
+ element.setAttribute('annotationBounds', {
149
+ x: anchor[0] - radius,
150
+ y: anchor[1] - radius,
151
+ width: radius * 2,
152
+ height: radius * 2
153
+ });
154
+ element.setAttribute('annotationPoint', {
155
+ owner: owner,
156
+ anchor: anchor,
157
+ size: size,
158
+ color: useSourceGeometry ? fill !== null && fill !== void 0 ? fill : context.color(Array.isArray(annotation.data) ? annotation.data[0] : annotation.data) : fill && fill !== 'none' && fill !== 'transparent' ? fill : stroke,
159
+ fill: fill,
160
+ stroke: outline,
161
+ pulse: annotation.pulse,
162
+ halo: (preset === null || preset === void 0 ? void 0 : preset.halo) !== false
163
+ });
164
+ },
165
+ geometry: function geometry(native) {
166
+ return function (_index, scale, value, coordinate) {
167
+ var _preset$visible2;
168
+ if ((preset === null || preset === void 0 || (_preset$visible2 = preset.visible) === null || _preset$visible2 === void 0 ? void 0 : _preset$visible2.call(preset)) === false) return [[], []];
169
+ var data = Array.isArray(annotation.data) ? annotation.data : [annotation.data];
170
+ var positions = preset !== null && preset !== void 0 && preset.positions ? resolved : data.map(function (datum) {
171
+ return context.position(datum, coordinate, !!useSourceGeometry);
172
+ });
173
+ // Resolved anchors are positions, even when the source view exposes interval ends.
174
+ var channels = _objectSpread({}, value);
175
+ for (var _i = 0, _arr = ['x1', 'y1', 'dx', 'dy']; _i < _arr.length; _i++) {
176
+ var key = _arr[_i];
177
+ delete channels[key];
178
+ }
179
+ return native(positions.flatMap(function (p, i) {
180
+ return p ? [i] : [];
181
+ }), scale, _objectSpread(_objectSpread({}, channels), {}, {
182
+ x: positions.map(function (p) {
183
+ var _p$;
184
+ return (_p$ = p === null || p === void 0 ? void 0 : p[0]) !== null && _p$ !== void 0 ? _p$ : 0;
185
+ }),
186
+ y: positions.map(function (p) {
187
+ var _p$2;
188
+ return (_p$2 = p === null || p === void 0 ? void 0 : p[1]) !== null && _p$2 !== void 0 ? _p$2 : 0;
189
+ })
190
+ }), coordinate);
191
+ };
192
+ }
193
+ });
194
+ })
195
+ };
196
+ };
197
+ var drawG6 = function drawG6(annotations, context) {
198
+ var defaults = context.defaults;
199
+ var _iterator2 = _createForOfIteratorHelper(annotations),
200
+ _step2;
201
+ try {
202
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
203
+ var annotation = _step2.value;
204
+ var _iterator3 = _createForOfIteratorHelper(Array.isArray(annotation.data) ? annotation.data : [annotation.data]),
205
+ _step3;
206
+ try {
207
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
208
+ var _annotation$style$siz2, _annotation$style7, _annotation$style$str2, _annotation$style8, _annotation$style9, _annotation$style$lin2, _annotation$style10, _annotation$style$str3, _annotation$style11, _annotation$style$fil2, _annotation$style12;
209
+ var data = _step3.value;
210
+ var anchor = context.position(data);
211
+ if (!anchor) continue;
212
+ var _anchor = _slicedToArray(anchor, 2),
213
+ x = _anchor[0],
214
+ y = _anchor[1];
215
+ var r = (_annotation$style$siz2 = (_annotation$style7 = annotation.style) === null || _annotation$style7 === void 0 ? void 0 : _annotation$style7.size) !== null && _annotation$style$siz2 !== void 0 ? _annotation$style$siz2 : defaults.size;
216
+ var halo = r * defaults.pulse.endScale;
217
+ context.boxes.push({
218
+ x: x - halo,
219
+ y: y - halo,
220
+ width: halo * 2,
221
+ height: halo * 2
222
+ });
223
+ var stroke = (_annotation$style$str2 = (_annotation$style8 = annotation.style) === null || _annotation$style8 === void 0 ? void 0 : _annotation$style8.stroke) !== null && _annotation$style$str2 !== void 0 ? _annotation$style$str2 : defaults.stroke;
224
+ var covered = ((_annotation$style9 = annotation.style) === null || _annotation$style9 === void 0 ? void 0 : _annotation$style9.fill) === undefined && hasPointAt(context.centers, anchor);
225
+ var paint = {
226
+ lineWidth: (_annotation$style$lin2 = (_annotation$style10 = annotation.style) === null || _annotation$style10 === void 0 ? void 0 : _annotation$style10.lineWidth) !== null && _annotation$style$lin2 !== void 0 ? _annotation$style$lin2 : defaults.lineWidth.point,
227
+ stroke: covered ? 'transparent' : (_annotation$style$str3 = (_annotation$style11 = annotation.style) === null || _annotation$style11 === void 0 ? void 0 : _annotation$style11.stroke) !== null && _annotation$style$str3 !== void 0 ? _annotation$style$str3 : defaults.pointStroke,
228
+ fill: (_annotation$style$fil2 = (_annotation$style12 = annotation.style) === null || _annotation$style12 === void 0 ? void 0 : _annotation$style12.fill) !== null && _annotation$style$fil2 !== void 0 ? _annotation$style$fil2 : covered ? 'transparent' : stroke
229
+ };
230
+ context.pulse().add(context.root, anchor, r, paint.fill !== 'none' && paint.fill !== 'transparent' ? paint.fill : stroke, annotation.pulse);
231
+ var shape = defaults.shape;
232
+ if (shape === 'square' || shape === 'hollowSquare') context.add('rect', _objectSpread(_objectSpread({}, paint), {}, {
233
+ x: x - r,
234
+ y: y - r,
235
+ width: 2 * r,
236
+ height: 2 * r
237
+ }));else if (shape === 'diamond' || shape === 'hollowDiamond') context.add('path', _objectSpread(_objectSpread({}, paint), {}, {
238
+ d: [['M', x, y - r * 1.5], ['L', x + r, y], ['L', x, y + r * 1.5], ['L', x - r, y], ['Z']]
239
+ }));else if (shape === 'triangle' || shape === 'hollowTriangle') context.add('path', _objectSpread(_objectSpread({}, paint), {}, {
240
+ d: [['M', x, y - r], ['L', x + r, y + r], ['L', x - r, y + r], ['Z']]
241
+ }));else if (shape === 'triangleDown') context.add('path', _objectSpread(_objectSpread({}, paint), {}, {
242
+ d: [['M', x, y + r], ['L', x + r, y - r], ['L', x - r, y - r], ['Z']]
243
+ }));else if (['point', 'circle', 'hollow', 'hollowCircle'].includes(shape)) context.add('circle', _objectSpread(_objectSpread({}, paint), {}, {
244
+ cx: x,
245
+ cy: y,
246
+ r: r
247
+ }));else throw new Error("Unsupported annotation point shape: ".concat(shape, "."));
248
+ context.label(annotation, anchor, {
249
+ gap: halo
250
+ });
251
+ }
252
+ } catch (err) {
253
+ _iterator3.e(err);
254
+ } finally {
255
+ _iterator3.f();
256
+ }
257
+ }
258
+ } catch (err) {
259
+ _iterator2.e(err);
260
+ } finally {
261
+ _iterator2.f();
262
+ }
263
+ return {};
264
+ };
265
+
266
+ /** Allow only floating-point differences between mapped renderer coordinates. */
267
+ function hasPointAt(points, _ref2) {
268
+ var _ref3 = _slicedToArray(_ref2, 2),
269
+ x = _ref3[0],
270
+ y = _ref3[1];
271
+ return points.some(function (_ref4) {
272
+ var _ref5 = _slicedToArray(_ref4, 2),
273
+ px = _ref5[0],
274
+ py = _ref5[1];
275
+ return Math.hypot(px - x, py - y) < 1e-6;
276
+ });
277
+ }
@@ -0,0 +1,3 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ /** Four named decision regions share the chart's numeric dividers and theme. */
3
+ export declare const quadrant: AnnotationComponent<'quadrant'>;
@@ -0,0 +1,83 @@
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 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; }
3
+ 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; }
4
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+ 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; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
+ 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); }
11
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
12
+ 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."); }
13
+ 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); }
14
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
15
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
16
+ 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; }
17
+ import { axisPosition, finiteValue } from "../utils";
18
+ import { path } from "./path";
19
+ import { range } from "./range";
20
+ import { text } from "./text";
21
+
22
+ /** Four named decision regions share the chart's numeric dividers and theme. */
23
+ export var quadrant = {
24
+ g2: function g2(annotations, _ref) {
25
+ var mapping = _ref.mapping,
26
+ defaults = _ref.defaults;
27
+ return annotations.flatMap(function (annotation) {
28
+ if (!annotation.data || Object.keys(annotation.data).some(function (key) {
29
+ return key !== mapping.x && key !== mapping.y;
30
+ })) throw new Error('Invalid annotation: quadrant needs both axis coordinates.');
31
+ var x = finiteValue(annotation.data[mapping.x], mapping.x);
32
+ var y = finiteValue(annotation.data[mapping.y], mapping.y);
33
+ var hidden = annotation.label === '';
34
+ var regions = ['topRight', 'topLeft', 'bottomLeft', 'bottomRight'].flatMap(function (name, i) {
35
+ var _annotation$labels$na, _annotation$labels, _annotation$style$fil, _annotation$style, _annotation$style$fil2, _annotation$style2, _annotation$style3, _annotation$style4;
36
+ var right = name.endsWith('Right');
37
+ var top = name.startsWith('top');
38
+ var bounds = function bounds(context) {
39
+ var splitX = Math.max(0, Math.min(1, context.axisValue('x', x)));
40
+ var splitY = Math.max(0, Math.min(1, context.axisValue('y', y)));
41
+ return [[right ? splitX : 0, top ? 0 : splitY], [right ? 1 : splitX, top ? splitY : 1]];
42
+ };
43
+ var label = hidden ? '' : (_annotation$labels$na = (_annotation$labels = annotation.labels) === null || _annotation$labels === void 0 ? void 0 : _annotation$labels[name]) !== null && _annotation$labels$na !== void 0 ? _annotation$labels$na : "".concat(right ? 'High' : 'Low', " ").concat(mapping.x, " \xB7 ").concat(top ? 'High' : 'Low', " ").concat(mapping.y);
44
+ return [].concat(_toConsumableArray(range.create({
45
+ data: _defineProperty(_defineProperty({}, mapping.x, [x, x]), mapping.y, [y, y]),
46
+ label: '',
47
+ style: {
48
+ fill: (_annotation$style$fil = (_annotation$style = annotation.style) === null || _annotation$style === void 0 ? void 0 : _annotation$style.fill) !== null && _annotation$style$fil !== void 0 ? _annotation$style$fil : defaults.palette[i % defaults.palette.length],
49
+ fillOpacity: (_annotation$style$fil2 = (_annotation$style2 = annotation.style) === null || _annotation$style2 === void 0 ? void 0 : _annotation$style2.fillOpacity) !== null && _annotation$style$fil2 !== void 0 ? _annotation$style$fil2 : 0.06
50
+ }
51
+ }, bounds)), _toConsumableArray(label ? text.create({
52
+ data: annotation.data,
53
+ label: label,
54
+ style: {
55
+ labelFill: (_annotation$style3 = annotation.style) === null || _annotation$style3 === void 0 ? void 0 : _annotation$style3.labelFill,
56
+ labelFontSize: (_annotation$style4 = annotation.style) === null || _annotation$style4 === void 0 ? void 0 : _annotation$style4.labelFontSize
57
+ }
58
+ }, function (context, coordinate) {
59
+ var _bounds = bounds(context),
60
+ _bounds2 = _slicedToArray(_bounds, 2),
61
+ from = _bounds2[0],
62
+ to = _bounds2[1];
63
+ if (to[0] <= from[0] || to[1] <= from[1]) return undefined;
64
+ var inset = Math.min((to[1] - from[1]) / 2, 18 / coordinate.getSize()[1]);
65
+ return [(from[0] + to[0]) / 2, from[1] + inset];
66
+ }) : []));
67
+ });
68
+ var dividers = ['x', 'y'].flatMap(function (axis) {
69
+ var _annotation$label;
70
+ var field = mapping[axis];
71
+ var value = axis === 'x' ? x : y;
72
+ return path.create({
73
+ data: axisPosition(field, value),
74
+ label: (_annotation$label = annotation.label) !== null && _annotation$label !== void 0 ? _annotation$label : "".concat(axis.toUpperCase(), ": ").concat(value),
75
+ style: _objectSpread({
76
+ lineDash: [4, 4]
77
+ }, annotation.style)
78
+ });
79
+ });
80
+ return [].concat(_toConsumableArray(regions), _toConsumableArray(dividers));
81
+ });
82
+ }
83
+ };
@@ -0,0 +1,2 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ export declare const quantile: AnnotationComponent<'quantile'>;
@@ -0,0 +1,32 @@
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 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; }
3
+ 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; }
4
+ 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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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); }
7
+ import { annotationField, axisPosition, formatNumber, numericRows, quantileValue, selectRows } from "../utils";
8
+ import { path } from "./path";
9
+ export var quantile = {
10
+ g2: function g2(annotations, _ref) {
11
+ var mapping = _ref.mapping;
12
+ return annotations.flatMap(function (annotation) {
13
+ var _annotation$label;
14
+ var field = annotationField(mapping, annotation.axis);
15
+ var values = numericRows(selectRows(mapping.data, annotation.data), field).map(function (_ref2) {
16
+ var value = _ref2.value;
17
+ return value;
18
+ });
19
+ var value = quantileValue(values.sort(function (a, b) {
20
+ return a - b;
21
+ }), annotation.p);
22
+ if (!values.length) return [];
23
+ return path.create({
24
+ data: axisPosition(field, value),
25
+ label: (_annotation$label = annotation.label) !== null && _annotation$label !== void 0 ? _annotation$label : "P".concat(formatNumber(annotation.p * 100), ": ").concat(formatNumber(value)),
26
+ style: _objectSpread({
27
+ lineDash: [4, 4]
28
+ }, annotation.style)
29
+ });
30
+ });
31
+ }
32
+ };
@@ -0,0 +1,2 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ export declare const rangeInside: AnnotationComponent<'rangeInside', 'g2' | 'table'>;
@@ -0,0 +1,55 @@
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 _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; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ 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); }
5
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
+ 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."); }
7
+ 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); }
8
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+ 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; }
11
+ import { selectRange, selectRows } from "../utils";
12
+ import { highlight } from "./highlight";
13
+ import { range } from "./range";
14
+ export var rangeInside = {
15
+ g2: function g2(annotations, _ref) {
16
+ var mapping = _ref.mapping;
17
+ return annotations.flatMap(function (annotation) {
18
+ var _annotation$style$fil, _annotation$style, _annotation$style2;
19
+ var rows = selectRows(mapping.data, annotation.data);
20
+ var field = mapping.y;
21
+ var selected = selectRange(rows, field, annotation.range, false);
22
+ return [].concat(_toConsumableArray(range.create({
23
+ data: _defineProperty({}, field, annotation.range),
24
+ style: {
25
+ fill: (_annotation$style$fil = (_annotation$style = annotation.style) === null || _annotation$style === void 0 ? void 0 : _annotation$style.fill) !== null && _annotation$style$fil !== void 0 ? _annotation$style$fil : (_annotation$style2 = annotation.style) === null || _annotation$style2 === void 0 ? void 0 : _annotation$style2.stroke
26
+ }
27
+ })), _toConsumableArray(selected.flatMap(function (row) {
28
+ var _annotation$label;
29
+ return highlight.create({
30
+ data: [row],
31
+ label: (_annotation$label = annotation.label) !== null && _annotation$label !== void 0 ? _annotation$label : "Inside range: ".concat(row[field]),
32
+ style: annotation.style
33
+ });
34
+ })));
35
+ });
36
+ },
37
+ table: function table(annotations, _ref2) {
38
+ var data = _ref2.data;
39
+ return annotations.flatMap(function (annotation) {
40
+ var rows = selectRows(data, annotation.data.row);
41
+ var field = annotation.data.field;
42
+ return selectRange(rows, field, annotation.range, false).flatMap(function (row) {
43
+ var _annotation$label2;
44
+ return highlight.create({
45
+ data: [{
46
+ row: row,
47
+ column: annotation.data.column
48
+ }],
49
+ label: (_annotation$label2 = annotation.label) !== null && _annotation$label2 !== void 0 ? _annotation$label2 : "Inside range: ".concat(row[field]),
50
+ style: annotation.style
51
+ });
52
+ });
53
+ });
54
+ }
55
+ };
@@ -0,0 +1,2 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ export declare const rangeOutside: AnnotationComponent<'rangeOutside', 'g2' | 'table'>;
@@ -0,0 +1,55 @@
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 _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; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ 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); }
5
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
+ 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."); }
7
+ 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); }
8
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+ 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; }
11
+ import { selectRange, selectRows } from "../utils";
12
+ import { highlight } from "./highlight";
13
+ import { range } from "./range";
14
+ export var rangeOutside = {
15
+ g2: function g2(annotations, _ref) {
16
+ var mapping = _ref.mapping;
17
+ return annotations.flatMap(function (annotation) {
18
+ var _annotation$style$fil, _annotation$style, _annotation$style2;
19
+ var rows = selectRows(mapping.data, annotation.data);
20
+ var field = mapping.y;
21
+ var selected = selectRange(rows, field, annotation.range, true);
22
+ return [].concat(_toConsumableArray(range.create({
23
+ data: _defineProperty({}, field, annotation.range),
24
+ style: {
25
+ fill: (_annotation$style$fil = (_annotation$style = annotation.style) === null || _annotation$style === void 0 ? void 0 : _annotation$style.fill) !== null && _annotation$style$fil !== void 0 ? _annotation$style$fil : (_annotation$style2 = annotation.style) === null || _annotation$style2 === void 0 ? void 0 : _annotation$style2.stroke
26
+ }
27
+ })), _toConsumableArray(selected.flatMap(function (row) {
28
+ var _annotation$label;
29
+ return highlight.create({
30
+ data: [row],
31
+ label: (_annotation$label = annotation.label) !== null && _annotation$label !== void 0 ? _annotation$label : "Outside range: ".concat(row[field]),
32
+ style: annotation.style
33
+ });
34
+ })));
35
+ });
36
+ },
37
+ table: function table(annotations, _ref2) {
38
+ var data = _ref2.data;
39
+ return annotations.flatMap(function (annotation) {
40
+ var rows = selectRows(data, annotation.data.row);
41
+ var field = annotation.data.field;
42
+ return selectRange(rows, field, annotation.range, true).flatMap(function (row) {
43
+ var _annotation$label2;
44
+ return highlight.create({
45
+ data: [{
46
+ row: row,
47
+ column: annotation.data.column
48
+ }],
49
+ label: (_annotation$label2 = annotation.label) !== null && _annotation$label2 !== void 0 ? _annotation$label2 : "Outside range: ".concat(row[field]),
50
+ style: annotation.style
51
+ });
52
+ });
53
+ });
54
+ }
55
+ };
@@ -0,0 +1,2 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ export declare const rangeX: AnnotationComponent<'rangeX'>;
@@ -0,0 +1,15 @@
1
+ import { axisRange } from "../utils";
2
+ import { range } from "./range";
3
+ export var rangeX = {
4
+ g2: function g2(annotations, _ref) {
5
+ var mapping = _ref.mapping;
6
+ return annotations.flatMap(function (annotation) {
7
+ var _annotation$label;
8
+ return range.create({
9
+ data: axisRange(mapping.x, annotation.range),
10
+ label: (_annotation$label = annotation.label) !== null && _annotation$label !== void 0 ? _annotation$label : "X range: ".concat(annotation.range.join('–')),
11
+ style: annotation.style
12
+ });
13
+ });
14
+ }
15
+ };
@@ -0,0 +1,2 @@
1
+ import type { AnnotationComponent } from '../registry';
2
+ export declare const rangeY: AnnotationComponent<'rangeY'>;
@@ -0,0 +1,15 @@
1
+ import { axisRange } from "../utils";
2
+ import { range } from "./range";
3
+ export var rangeY = {
4
+ g2: function g2(annotations, _ref) {
5
+ var mapping = _ref.mapping;
6
+ return annotations.flatMap(function (annotation) {
7
+ var _annotation$label;
8
+ return range.create({
9
+ data: axisRange(mapping.y, annotation.range),
10
+ label: (_annotation$label = annotation.label) !== null && _annotation$label !== void 0 ? _annotation$label : "Y range: ".concat(annotation.range.join('–')),
11
+ style: annotation.style
12
+ });
13
+ });
14
+ }
15
+ };
@@ -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 {};