@tabler/charts 0.0.0-stage → 0.0.1-alpha.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 (324) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +248 -2
  3. package/dist/annotations-Bp7HwtF5.d.ts +86 -0
  4. package/dist/annotations-BszTTjf9.js +202 -0
  5. package/dist/annotations-BszTTjf9.js.map +1 -0
  6. package/dist/annotations-DpETO8dE.cjs +213 -0
  7. package/dist/annotations-DpETO8dE.cjs.map +1 -0
  8. package/dist/annotations-lyt0I3HU.d.cts +86 -0
  9. package/dist/annotations.cjs +14 -0
  10. package/dist/annotations.cjs.map +1 -0
  11. package/dist/annotations.d.cts +2 -0
  12. package/dist/annotations.d.ts +2 -0
  13. package/dist/annotations.js +12 -0
  14. package/dist/annotations.js.map +1 -0
  15. package/dist/area-BFvkc-ZM.d.cts +20 -0
  16. package/dist/area-DQsLERhx.js +26 -0
  17. package/dist/area-DQsLERhx.js.map +1 -0
  18. package/dist/area-DaO4MQl4.d.ts +20 -0
  19. package/dist/area-sHCE3pg5.cjs +31 -0
  20. package/dist/area-sHCE3pg5.cjs.map +1 -0
  21. package/dist/area.cjs +3 -0
  22. package/dist/area.d.cts +2 -0
  23. package/dist/area.d.ts +2 -0
  24. package/dist/area.js +2 -0
  25. package/dist/band-DTcNDAFO.d.cts +50 -0
  26. package/dist/band-DTcNDAFO.d.ts +50 -0
  27. package/dist/bar-C-7zR2qp.cjs +243 -0
  28. package/dist/bar-C-7zR2qp.cjs.map +1 -0
  29. package/dist/bar-DGuUN3nc.cjs +67 -0
  30. package/dist/bar-DGuUN3nc.cjs.map +1 -0
  31. package/dist/bar-DM16NUvV.js +56 -0
  32. package/dist/bar-DM16NUvV.js.map +1 -0
  33. package/dist/bar-DdsDxk3W.d.ts +43 -0
  34. package/dist/bar-a0h9KC8A.d.cts +43 -0
  35. package/dist/bar-jZEoao74.js +238 -0
  36. package/dist/bar-jZEoao74.js.map +1 -0
  37. package/dist/bar.cjs +3 -0
  38. package/dist/bar.d.cts +2 -0
  39. package/dist/bar.d.ts +2 -0
  40. package/dist/bar.js +2 -0
  41. package/dist/candlestick-B5r1w3kc.cjs +150 -0
  42. package/dist/candlestick-B5r1w3kc.cjs.map +1 -0
  43. package/dist/candlestick-BKdPyorY.d.cts +44 -0
  44. package/dist/candlestick-BnUG1SGi.d.ts +44 -0
  45. package/dist/candlestick-DuXwAFID.js +145 -0
  46. package/dist/candlestick-DuXwAFID.js.map +1 -0
  47. package/dist/candlestick.cjs +11 -0
  48. package/dist/candlestick.cjs.map +1 -0
  49. package/dist/candlestick.d.cts +2 -0
  50. package/dist/candlestick.d.ts +2 -0
  51. package/dist/candlestick.js +10 -0
  52. package/dist/candlestick.js.map +1 -0
  53. package/dist/cartesian-BoDfgBCV.cjs +900 -0
  54. package/dist/cartesian-BoDfgBCV.cjs.map +1 -0
  55. package/dist/cartesian-Cr0AF0nG.js +709 -0
  56. package/dist/cartesian-Cr0AF0nG.js.map +1 -0
  57. package/dist/chart-BF2CK9I_.js +790 -0
  58. package/dist/chart-BF2CK9I_.js.map +1 -0
  59. package/dist/chart-CowF_lWY.cjs +903 -0
  60. package/dist/chart-CowF_lWY.cjs.map +1 -0
  61. package/dist/chart-Qa417fJo.d.cts +927 -0
  62. package/dist/chart-iJGxMz9z.d.ts +927 -0
  63. package/dist/circle-BQMuAfls.cjs +12 -0
  64. package/dist/circle-BQMuAfls.cjs.map +1 -0
  65. package/dist/circle-Z7YfCoCM.js +7 -0
  66. package/dist/circle-Z7YfCoCM.js.map +1 -0
  67. package/dist/clean-Byl6kzf0.cjs +115 -0
  68. package/dist/clean-Byl6kzf0.cjs.map +1 -0
  69. package/dist/clean-o1vDEhFV.js +56 -0
  70. package/dist/clean-o1vDEhFV.js.map +1 -0
  71. package/dist/core-C7fPm6t7.cjs +976 -0
  72. package/dist/core-C7fPm6t7.cjs.map +1 -0
  73. package/dist/core-CjgbhS_v.d.ts +219 -0
  74. package/dist/core-CnGFKojH.d.cts +219 -0
  75. package/dist/core-plobgBC7.js +875 -0
  76. package/dist/core-plobgBC7.js.map +1 -0
  77. package/dist/core.cjs +113 -0
  78. package/dist/core.d.cts +20 -0
  79. package/dist/core.d.ts +20 -0
  80. package/dist/core.js +24 -0
  81. package/dist/dates-Btm7Zm6W.cjs +32 -0
  82. package/dist/dates-Btm7Zm6W.cjs.map +1 -0
  83. package/dist/dates-CG-FvioW.js +27 -0
  84. package/dist/dates-CG-FvioW.js.map +1 -0
  85. package/dist/decimate-BGg9XgF0.d.ts +17 -0
  86. package/dist/decimate-C87cl_Sp.js +84 -0
  87. package/dist/decimate-C87cl_Sp.js.map +1 -0
  88. package/dist/decimate-CNSpgGa5.d.cts +17 -0
  89. package/dist/decimate-tLhDk1ys.cjs +95 -0
  90. package/dist/decimate-tLhDk1ys.cjs.map +1 -0
  91. package/dist/decimate.cjs +14 -0
  92. package/dist/decimate.cjs.map +1 -0
  93. package/dist/decimate.d.cts +2 -0
  94. package/dist/decimate.d.ts +2 -0
  95. package/dist/decimate.js +12 -0
  96. package/dist/decimate.js.map +1 -0
  97. package/dist/dom-CLF868Qs.cjs +222 -0
  98. package/dist/dom-CLF868Qs.cjs.map +1 -0
  99. package/dist/dom-vP3IcMak.js +175 -0
  100. package/dist/dom-vP3IcMak.js.map +1 -0
  101. package/dist/export-chart-9w8t3rjZ.js +232 -0
  102. package/dist/export-chart-9w8t3rjZ.js.map +1 -0
  103. package/dist/export-chart-BhhYgksr.cjs +249 -0
  104. package/dist/export-chart-BhhYgksr.cjs.map +1 -0
  105. package/dist/export.cjs +18 -0
  106. package/dist/export.cjs.map +1 -0
  107. package/dist/export.d.cts +2 -0
  108. package/dist/export.d.ts +2 -0
  109. package/dist/export.js +15 -0
  110. package/dist/export.js.map +1 -0
  111. package/dist/extent-BAMZo0Nq.js +19 -0
  112. package/dist/extent-BAMZo0Nq.js.map +1 -0
  113. package/dist/extent-DsFWvAHJ.cjs +24 -0
  114. package/dist/extent-DsFWvAHJ.cjs.map +1 -0
  115. package/dist/fade-Cs74puQS.cjs +217 -0
  116. package/dist/fade-Cs74puQS.cjs.map +1 -0
  117. package/dist/fade-D3NxH5Qg.js +200 -0
  118. package/dist/fade-D3NxH5Qg.js.map +1 -0
  119. package/dist/features-BclHgg2W.cjs +48 -0
  120. package/dist/features-BclHgg2W.cjs.map +1 -0
  121. package/dist/features-wASyHGic.js +25 -0
  122. package/dist/features-wASyHGic.js.map +1 -0
  123. package/dist/format-B0yKXBTH.cjs +183 -0
  124. package/dist/format-B0yKXBTH.cjs.map +1 -0
  125. package/dist/format-lStwuc1L.js +142 -0
  126. package/dist/format-lStwuc1L.js.map +1 -0
  127. package/dist/gauge-CEfkWXSu.cjs +235 -0
  128. package/dist/gauge-CEfkWXSu.cjs.map +1 -0
  129. package/dist/gauge-Cu9jttC0.d.ts +65 -0
  130. package/dist/gauge-Cu_OFxBd.d.cts +65 -0
  131. package/dist/gauge-_ljQHrMN.js +230 -0
  132. package/dist/gauge-_ljQHrMN.js.map +1 -0
  133. package/dist/gauge.cjs +3 -0
  134. package/dist/gauge.d.cts +2 -0
  135. package/dist/gauge.d.ts +2 -0
  136. package/dist/gauge.js +2 -0
  137. package/dist/heatmap-BK18EBgJ.cjs +247 -0
  138. package/dist/heatmap-BK18EBgJ.cjs.map +1 -0
  139. package/dist/heatmap-BwS-y0c6.d.cts +81 -0
  140. package/dist/heatmap-DSZ2bVIa.js +242 -0
  141. package/dist/heatmap-DSZ2bVIa.js.map +1 -0
  142. package/dist/heatmap-PhLPXIg1.d.ts +81 -0
  143. package/dist/heatmap.cjs +3 -0
  144. package/dist/heatmap.d.cts +2 -0
  145. package/dist/heatmap.d.ts +2 -0
  146. package/dist/heatmap.js +2 -0
  147. package/dist/hydrate-CTTmQy0x.d.cts +10 -0
  148. package/dist/hydrate-CxwTXDqO.cjs +60 -0
  149. package/dist/hydrate-CxwTXDqO.cjs.map +1 -0
  150. package/dist/hydrate-CzfxLfTv.d.ts +10 -0
  151. package/dist/hydrate-DDNIHYv_.js +55 -0
  152. package/dist/hydrate-DDNIHYv_.js.map +1 -0
  153. package/dist/hydrate.cjs +13 -0
  154. package/dist/hydrate.cjs.map +1 -0
  155. package/dist/hydrate.d.cts +2 -0
  156. package/dist/hydrate.d.ts +2 -0
  157. package/dist/hydrate.js +12 -0
  158. package/dist/hydrate.js.map +1 -0
  159. package/dist/index.cjs +211 -0
  160. package/dist/index.cjs.map +1 -0
  161. package/dist/index.d.cts +45 -0
  162. package/dist/index.d.ts +45 -0
  163. package/dist/index.js +113 -0
  164. package/dist/index.js.map +1 -0
  165. package/dist/layout-B3hiqVEw.js +69 -0
  166. package/dist/layout-B3hiqVEw.js.map +1 -0
  167. package/dist/layout-CtMBhNd9.cjs +98 -0
  168. package/dist/layout-CtMBhNd9.cjs.map +1 -0
  169. package/dist/line-B3Ed6u7j.js +120 -0
  170. package/dist/line-B3Ed6u7j.js.map +1 -0
  171. package/dist/line-CMDGH6q5.d.cts +47 -0
  172. package/dist/line-D5kb8e6w.d.ts +47 -0
  173. package/dist/line-fQbtP_jL.cjs +131 -0
  174. package/dist/line-fQbtP_jL.cjs.map +1 -0
  175. package/dist/line.cjs +14 -0
  176. package/dist/line.cjs.map +1 -0
  177. package/dist/line.d.cts +2 -0
  178. package/dist/line.d.ts +2 -0
  179. package/dist/line.js +13 -0
  180. package/dist/line.js.map +1 -0
  181. package/dist/log-CaofN3-n.d.cts +48 -0
  182. package/dist/log-CaofN3-n.d.ts +48 -0
  183. package/dist/log-axis-83rSpvL5.cjs +130 -0
  184. package/dist/log-axis-83rSpvL5.cjs.map +1 -0
  185. package/dist/log-axis-B_uvvOFc.js +113 -0
  186. package/dist/log-axis-B_uvvOFc.js.map +1 -0
  187. package/dist/log.cjs +17 -0
  188. package/dist/log.cjs.map +1 -0
  189. package/dist/log.d.cts +2 -0
  190. package/dist/log.d.ts +2 -0
  191. package/dist/log.js +16 -0
  192. package/dist/log.js.map +1 -0
  193. package/dist/morph-BMxz3X2b.d.cts +10 -0
  194. package/dist/morph-BMxz3X2b.d.ts +10 -0
  195. package/dist/morph-Bgg-24l8.js +36 -0
  196. package/dist/morph-Bgg-24l8.js.map +1 -0
  197. package/dist/morph-CqYDu1bY.cjs +41 -0
  198. package/dist/morph-CqYDu1bY.cjs.map +1 -0
  199. package/dist/morph.cjs +14 -0
  200. package/dist/morph.cjs.map +1 -0
  201. package/dist/morph.d.cts +2 -0
  202. package/dist/morph.d.ts +2 -0
  203. package/dist/morph.js +13 -0
  204. package/dist/morph.js.map +1 -0
  205. package/dist/named-BWWb5LQJ.cjs +50 -0
  206. package/dist/named-BWWb5LQJ.cjs.map +1 -0
  207. package/dist/named-DE15TOgh.js +33 -0
  208. package/dist/named-DE15TOgh.js.map +1 -0
  209. package/dist/path-CwB28da0.d.cts +29 -0
  210. package/dist/path-CwB28da0.d.ts +29 -0
  211. package/dist/patterns-DtgcnA8o.js +85 -0
  212. package/dist/patterns-DtgcnA8o.js.map +1 -0
  213. package/dist/patterns-LfcQAWCy.cjs +102 -0
  214. package/dist/patterns-LfcQAWCy.cjs.map +1 -0
  215. package/dist/patterns.cjs +15 -0
  216. package/dist/patterns.cjs.map +1 -0
  217. package/dist/patterns.d.cts +2 -0
  218. package/dist/patterns.d.ts +2 -0
  219. package/dist/patterns.js +12 -0
  220. package/dist/patterns.js.map +1 -0
  221. package/dist/pie-B8UlOZiq.d.ts +58 -0
  222. package/dist/pie-C1Pa6W_l.cjs +211 -0
  223. package/dist/pie-C1Pa6W_l.cjs.map +1 -0
  224. package/dist/pie-DnQQmxkk.d.cts +58 -0
  225. package/dist/pie-RnMTQWMS.js +200 -0
  226. package/dist/pie-RnMTQWMS.js.map +1 -0
  227. package/dist/pie.cjs +4 -0
  228. package/dist/pie.d.cts +2 -0
  229. package/dist/pie.d.ts +2 -0
  230. package/dist/pie.js +2 -0
  231. package/dist/point-shapes-CGl4dugc.cjs +166 -0
  232. package/dist/point-shapes-CGl4dugc.cjs.map +1 -0
  233. package/dist/point-shapes-DI84NNpI.js +155 -0
  234. package/dist/point-shapes-DI84NNpI.js.map +1 -0
  235. package/dist/point-shapes.cjs +15 -0
  236. package/dist/point-shapes.cjs.map +1 -0
  237. package/dist/point-shapes.d.cts +2 -0
  238. package/dist/point-shapes.d.ts +2 -0
  239. package/dist/point-shapes.js +13 -0
  240. package/dist/point-shapes.js.map +1 -0
  241. package/dist/radar-BB13CGmq.d.cts +60 -0
  242. package/dist/radar-CYPab_I4.js +285 -0
  243. package/dist/radar-CYPab_I4.js.map +1 -0
  244. package/dist/radar-CoGUNNSb.cjs +290 -0
  245. package/dist/radar-CoGUNNSb.cjs.map +1 -0
  246. package/dist/radar-pFI6fvOq.d.ts +60 -0
  247. package/dist/radar.cjs +3 -0
  248. package/dist/radar.d.cts +2 -0
  249. package/dist/radar.d.ts +2 -0
  250. package/dist/radar.js +2 -0
  251. package/dist/sankey-B4PNKusJ.js +420 -0
  252. package/dist/sankey-B4PNKusJ.js.map +1 -0
  253. package/dist/sankey-B9JYnx7e.d.cts +67 -0
  254. package/dist/sankey-Bacx4fVe.cjs +425 -0
  255. package/dist/sankey-Bacx4fVe.cjs.map +1 -0
  256. package/dist/sankey-Bm518bqL.d.ts +67 -0
  257. package/dist/sankey.cjs +3 -0
  258. package/dist/sankey.d.cts +2 -0
  259. package/dist/sankey.d.ts +2 -0
  260. package/dist/sankey.js +2 -0
  261. package/dist/scatter-Bl7nasE6.d.ts +61 -0
  262. package/dist/scatter-DgMN9zRy.cjs +250 -0
  263. package/dist/scatter-DgMN9zRy.cjs.map +1 -0
  264. package/dist/scatter-DrJ8xYz4.d.cts +61 -0
  265. package/dist/scatter-kgtgR318.js +245 -0
  266. package/dist/scatter-kgtgR318.js.map +1 -0
  267. package/dist/scatter.cjs +3 -0
  268. package/dist/scatter.d.cts +2 -0
  269. package/dist/scatter.d.ts +2 -0
  270. package/dist/scatter.js +2 -0
  271. package/dist/sparkline-BG13V4Pz.d.cts +43 -0
  272. package/dist/sparkline-BQzt27Fr.js +171 -0
  273. package/dist/sparkline-BQzt27Fr.js.map +1 -0
  274. package/dist/sparkline-BS9-hltA.cjs +176 -0
  275. package/dist/sparkline-BS9-hltA.cjs.map +1 -0
  276. package/dist/sparkline-iWuXbKpd.d.ts +43 -0
  277. package/dist/sparkline.cjs +3 -0
  278. package/dist/sparkline.d.cts +2 -0
  279. package/dist/sparkline.d.ts +2 -0
  280. package/dist/sparkline.js +2 -0
  281. package/dist/stack-CpR6RGKd.d.cts +6 -0
  282. package/dist/stack-CpR6RGKd.d.ts +6 -0
  283. package/dist/stack-DRbwTeF3.js +66 -0
  284. package/dist/stack-DRbwTeF3.js.map +1 -0
  285. package/dist/stack-DVhJWaki.cjs +77 -0
  286. package/dist/stack-DVhJWaki.cjs.map +1 -0
  287. package/dist/style.css +2 -0
  288. package/dist/sweep-Duowaput.cjs +369 -0
  289. package/dist/sweep-Duowaput.cjs.map +1 -0
  290. package/dist/sweep-WSgn2etB.js +334 -0
  291. package/dist/sweep-WSgn2etB.js.map +1 -0
  292. package/dist/time-CHjiY9Q4.d.ts +112 -0
  293. package/dist/time-CNVnt-B2.d.cts +112 -0
  294. package/dist/time-axis-Bc9eHX1r.js +365 -0
  295. package/dist/time-axis-Bc9eHX1r.js.map +1 -0
  296. package/dist/time-axis-VSX34_Tb.cjs +382 -0
  297. package/dist/time-axis-VSX34_Tb.cjs.map +1 -0
  298. package/dist/time.cjs +22 -0
  299. package/dist/time.cjs.map +1 -0
  300. package/dist/time.d.cts +2 -0
  301. package/dist/time.d.ts +2 -0
  302. package/dist/time.js +20 -0
  303. package/dist/time.js.map +1 -0
  304. package/dist/tween-BCYd0RTY.js +40 -0
  305. package/dist/tween-BCYd0RTY.js.map +1 -0
  306. package/dist/tween-CIGBlryn.cjs +51 -0
  307. package/dist/tween-CIGBlryn.cjs.map +1 -0
  308. package/dist/value-labels-B0WJoJ7x.cjs +134 -0
  309. package/dist/value-labels-B0WJoJ7x.cjs.map +1 -0
  310. package/dist/value-labels-IZIQPhfk.js +123 -0
  311. package/dist/value-labels-IZIQPhfk.js.map +1 -0
  312. package/dist/value-labels.cjs +14 -0
  313. package/dist/value-labels.cjs.map +1 -0
  314. package/dist/value-labels.d.cts +2 -0
  315. package/dist/value-labels.d.ts +2 -0
  316. package/dist/value-labels.js +12 -0
  317. package/dist/value-labels.js.map +1 -0
  318. package/dist/vnode-BUflsBsa.d.cts +66 -0
  319. package/dist/vnode-BUflsBsa.d.ts +66 -0
  320. package/dist/vnode-CkQ27Cxe.cjs +110 -0
  321. package/dist/vnode-CkQ27Cxe.cjs.map +1 -0
  322. package/dist/vnode-tCWItoUH.js +93 -0
  323. package/dist/vnode-tCWItoUH.js.map +1 -0
  324. package/package.json +310 -3
@@ -0,0 +1,250 @@
1
+ const require_layout = require("./layout-CtMBhNd9.cjs");
2
+ const require_vnode = require("./vnode-CkQ27Cxe.cjs");
3
+ const require_format = require("./format-B0yKXBTH.cjs");
4
+ const require_cartesian = require("./cartesian-BoDfgBCV.cjs");
5
+ const require_extent = require("./extent-DsFWvAHJ.cjs");
6
+ const require_clean = require("./clean-Byl6kzf0.cjs");
7
+ const require_named = require("./named-BWWb5LQJ.cjs");
8
+ const require_circle = require("./circle-BQMuAfls.cjs");
9
+ //#region src/charts/scatter.ts
10
+ /** Pointer distance (in pixels, beyond the radius) that still hits a point. */
11
+ const HIT_RADIUS = 24;
12
+ const EDGE = 8;
13
+ /** A point's bubble size, or `undefined` when it has none (or an invalid one). */
14
+ const sizeOf = (p) => p.size != null && Number.isFinite(p.size) && p.size > 0 ? p.size : void 0;
15
+ function renderScatter(options, ctx) {
16
+ const { width, height, fontSize, locale } = ctx;
17
+ const xOptions = options.x ?? {};
18
+ const yOptions = options.y ?? {};
19
+ const radius = options.radius ?? 4;
20
+ const points = options.data.series.filter((s) => !ctx.hidden.has(require_named.keyOf(s))).flatMap((s) => s.points);
21
+ const sizes = points.map(sizeOf).filter((v) => v !== void 0);
22
+ const maxSize = require_extent.extent(sizes)?.[1] ?? 0;
23
+ const rMin = options.size?.min ?? 4;
24
+ const rMax = options.size?.max ?? 24;
25
+ const bubble = (size) => size != null && size > 0 && maxSize > 0 ? rMin + (rMax - rMin) * Math.sqrt(size / maxSize) : radius;
26
+ const overhang = Math.max(radius, sizes.length ? rMax : 0) + 2;
27
+ const countY = require_cartesian.tickCount(yOptions, Math.max(2, Math.round(height / 60)));
28
+ const countX = require_cartesian.tickCount(xOptions, Math.max(2, Math.round(width / 80)));
29
+ const usable = (p) => require_cartesian.plottable(p.x, xOptions) && require_cartesian.plottable(p.y, yOptions);
30
+ const shown = points.filter(usable);
31
+ const xDomain = require_cartesian.domainOf(shown.map((p) => p.x), xOptions, false, countX);
32
+ const yDomain = require_cartesian.domainOf(shown.map((p) => p.y), yOptions, false, countY);
33
+ const showX = xOptions.show !== false;
34
+ const showY = yOptions.show !== false;
35
+ const ticksOf = (scale, axis, count) => require_cartesian.valueTicks(scale, axis, count, axis.format, locale);
36
+ const probeY = ticksOf(require_cartesian.valueScale(yDomain, [1, 0], yOptions), yOptions, countY);
37
+ const probeX = ticksOf(require_cartesian.valueScale(xDomain, [0, 1], xOptions), xOptions, countX);
38
+ const half = (tick) => showX && tick ? Math.ceil(require_layout.estimateTextWidth(tick.label, fontSize) / 2) : 0;
39
+ const pad = require_layout.insets(options.padding);
40
+ const margins = {
41
+ top: pad.top + Math.max(showY ? Math.ceil(fontSize * require_layout.LINE_HEIGHT / 2) : 0, overhang, EDGE / 2),
42
+ right: pad.right + Math.max(half(probeX[probeX.length - 1]), overhang, EDGE),
43
+ bottom: pad.bottom + Math.max(showX ? require_cartesian.axisSize("bottom", probeX, fontSize) : 0, overhang, EDGE / 2),
44
+ left: pad.left + Math.max(showY ? require_cartesian.axisSize("left", probeY, fontSize) : 0, half(probeX[0]), overhang)
45
+ };
46
+ const area = require_layout.innerRect(width, height, margins);
47
+ const x = require_cartesian.valueScale(xDomain, [area.x, area.x + area.width], xOptions);
48
+ const y = require_cartesian.valueScale(yDomain, [area.y + area.height, area.y], yOptions);
49
+ const xTicks = require_cartesian.thinTicks(ticksOf(x, xOptions, countX), "bottom", fontSize);
50
+ const yTicks = require_cartesian.thinTicks(ticksOf(y, yOptions, countY), "left", fontSize, 4);
51
+ const placed = [];
52
+ options.data.series.forEach((series, seriesIndex) => {
53
+ if (ctx.hidden.has(require_named.keyOf(series))) return;
54
+ series.points.forEach((point, pointIndex) => {
55
+ if (!usable(point)) return;
56
+ placed.push({
57
+ seriesIndex,
58
+ pointIndex,
59
+ point,
60
+ cx: x(point.x),
61
+ cy: y(point.y),
62
+ r: bubble(sizeOf(point))
63
+ });
64
+ });
65
+ });
66
+ placed.sort((a, b) => a.cx - b.cx);
67
+ const fx = require_format.formatDetail(xOptions.format, locale);
68
+ const fy = require_format.formatDetail(yOptions.format, locale);
69
+ const fs = require_format.formatNumber(void 0, locale);
70
+ const hitFor = (p, index) => {
71
+ const series = options.data.series[p.seriesIndex];
72
+ const sz = sizeOf(p.point);
73
+ const size = sz === void 0 ? "" : ` · ${fs(sz)}`;
74
+ const item = {
75
+ name: series.name,
76
+ seriesIndex: p.seriesIndex,
77
+ value: p.point.y,
78
+ text: `${fx(p.point.x)}, ${fy(p.point.y)}${size}`,
79
+ x: p.cx,
80
+ y: p.cy
81
+ };
82
+ if (series.color) item.color = series.color;
83
+ return {
84
+ index,
85
+ label: p.point.label ?? series.name,
86
+ title: p.point.label ?? "",
87
+ x: p.cx,
88
+ area,
89
+ items: [item],
90
+ seriesIndex: p.seriesIndex,
91
+ mark: {
92
+ d: require_circle.circlePath(require_layout.round(p.r + 4)),
93
+ x: p.cx,
94
+ y: p.cy
95
+ }
96
+ };
97
+ };
98
+ const interaction = {
99
+ count: placed.length,
100
+ hitIndex: (index) => {
101
+ const p = placed[index];
102
+ return p ? hitFor(p, index) : null;
103
+ },
104
+ hitTest(px, py) {
105
+ let lo = 0;
106
+ let hi = placed.length;
107
+ const reach = HIT_RADIUS + rMax;
108
+ while (lo < hi) {
109
+ const mid = lo + hi >> 1;
110
+ if (placed[mid].cx < px - reach) lo = mid + 1;
111
+ else hi = mid;
112
+ }
113
+ let best = -1;
114
+ let bestDistance = Number.POSITIVE_INFINITY;
115
+ for (let i = lo; i < placed.length; i++) {
116
+ const p = placed[i];
117
+ if (p.cx > px + reach) break;
118
+ const distance = Math.hypot(p.cx - px, p.cy - py) - p.r;
119
+ if (distance < bestDistance && distance <= HIT_RADIUS) {
120
+ best = i;
121
+ bestDistance = distance;
122
+ }
123
+ }
124
+ return best === -1 ? null : hitFor(placed[best], best);
125
+ }
126
+ };
127
+ ctx.onHitTest(interaction);
128
+ /** One path drawing a dot of `radius` at every point (two arcs each, or the series' shape). */
129
+ const shape = require_cartesian.markerShape(options);
130
+ const dotsPath = (dots, slot) => {
131
+ if (!dots.length) return null;
132
+ const r = require_layout.round(radius);
133
+ let d = "";
134
+ for (const p of dots) d += shape ? shape(slot, x(p.x), y(p.y), r) : `M${require_layout.round(x(p.x) - radius)},${require_layout.round(y(p.y))}a${r},${r},0,1,0,${2 * r},0a${r},${r},0,1,0,${-2 * r},0`;
135
+ return require_vnode.h("path", {
136
+ key: "dots",
137
+ class: ["tc-point tc-dots", shape && "tc-marker"],
138
+ d
139
+ });
140
+ };
141
+ const background = [];
142
+ if (yOptions.grid !== false) background.push(require_cartesian.grid({
143
+ direction: "y",
144
+ ticks: yTicks,
145
+ area
146
+ }));
147
+ if (xOptions.grid) background.push(require_cartesian.grid({
148
+ direction: "x",
149
+ ticks: xTicks,
150
+ area
151
+ }));
152
+ const clip = require_cartesian.plotClip(ctx, area, sizes.length ? 0 : overhang);
153
+ const groups = options.data.series.map((series, seriesIndex) => !ctx.hidden.has(require_named.keyOf(series)) && require_vnode.h("g", require_named.groupAttrs(series, seriesIndex), dotsPath(series.points.filter((p) => usable(p) && sizeOf(p) === void 0), seriesIndex), series.points.map((point, i) => usable(point) && sizeOf(point) !== void 0 && require_vnode.h("circle", {
154
+ key: i,
155
+ class: "tc-point tc-bubble",
156
+ cx: require_layout.round(x(point.x)),
157
+ cy: require_layout.round(y(point.y)),
158
+ r: require_layout.round(bubble(sizeOf(point)))
159
+ }))));
160
+ return [
161
+ require_vnode.h("defs", null, clip.def),
162
+ background,
163
+ require_vnode.h("g", {
164
+ key: "series",
165
+ class: "tc-series-list",
166
+ "clip-path": clip.url
167
+ }, groups),
168
+ showY && require_cartesian.axis({
169
+ position: "left",
170
+ ticks: yTicks,
171
+ area
172
+ }),
173
+ showX && require_cartesian.axis({
174
+ position: "bottom",
175
+ ticks: xTicks,
176
+ area
177
+ })
178
+ ];
179
+ }
180
+ function scatterTable(options, ctx, limit = Number.POSITIVE_INFINITY) {
181
+ const fx = require_format.formatDetail(options.x?.format, ctx.locale);
182
+ const fy = require_format.formatDetail(options.y?.format, ctx.locale);
183
+ const fs = require_format.formatNumber(void 0, ctx.locale);
184
+ const series = options.data.series.filter((s) => !ctx.hidden.has(require_named.keyOf(s)));
185
+ const withSize = series.some((s) => s.points.some((p) => p.size != null));
186
+ const withLabel = series.some((s) => s.points.some((p) => p.label != null));
187
+ const total = series.reduce((sum, s) => sum + s.points.length, 0);
188
+ let left = limit;
189
+ return {
190
+ columns: [
191
+ "",
192
+ ...withLabel ? ["Label"] : [],
193
+ "x",
194
+ "y",
195
+ ...withSize ? ["Size"] : []
196
+ ],
197
+ total,
198
+ rows: series.flatMap((s) => {
199
+ const take = s.points.slice(0, Math.max(0, left));
200
+ left -= take.length;
201
+ return take.map((p) => [
202
+ s.name,
203
+ ...withLabel ? [p.label ?? ""] : [],
204
+ fx(p.x),
205
+ fy(p.y),
206
+ ...withSize ? [sizeOf(p) === void 0 ? "–" : fs(sizeOf(p))] : []
207
+ ]);
208
+ })
209
+ };
210
+ }
211
+ /**
212
+ * Scatter chart: points on two value axes; give points a `size` for a
213
+ * bubble chart (area-proportional radii).
214
+ *
215
+ * ```ts
216
+ * new Chart('#el', {
217
+ * type: scatter,
218
+ * data: { series: [{ name: 'Cities', points: [{ x: 12, y: 3.4 }, { x: 18, y: 5.1 }] }] },
219
+ * })
220
+ * ```
221
+ */
222
+ const scatter = {
223
+ name: "scatter",
224
+ clean: require_clean.cleanData((data) => ({
225
+ ...require_clean.isRecord(data) ? data : {},
226
+ series: require_clean.records(require_clean.isRecord(data) && data.series, (s) => ({
227
+ ...require_clean.named(s),
228
+ points: require_clean.records(s.points, (p) => ({
229
+ ...p,
230
+ x: require_clean.finite(p.x),
231
+ y: require_clean.finite(p.y),
232
+ size: require_clean.finite(p.size) ?? void 0,
233
+ label: p.label == null ? void 0 : require_clean.text(p.label)
234
+ })).filter((p) => p.x !== null && p.y !== null)
235
+ }))
236
+ })),
237
+ render: renderScatter,
238
+ legend: (options) => require_named.legendItems(options.data.series),
239
+ table: scatterTable,
240
+ valueLabels: { format: (options) => options.y?.format }
241
+ };
242
+ //#endregion
243
+ Object.defineProperty(exports, "scatter", {
244
+ enumerable: true,
245
+ get: function() {
246
+ return scatter;
247
+ }
248
+ });
249
+
250
+ //# sourceMappingURL=scatter-DgMN9zRy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scatter-DgMN9zRy.cjs","names":["keyOf","extent","tickCount","plottable","domainOf","valueTicks","valueScale","estimateTextWidth","insets","LINE_HEIGHT","axisSize","innerRect","thinTicks","formatDetail","formatNumber","circlePath","round","markerShape","h","grid","plotClip","groupAttrs","axis","cleanData","isRecord","records","named","finite","text","legendItems"],"sources":["../src/charts/scatter.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext } from '../chart.ts'\nimport { axis, axisSize, type Tick, thinTicks } from '../components/axis.ts'\nimport { grid } from '../components/grid.ts'\nimport { formatDetail, formatNumber } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport {\n estimateTextWidth,\n type InsetsInput,\n innerRect,\n insets,\n LINE_HEIGHT,\n round,\n} from '../layout.ts'\nimport { extent } from '../scales/extent.ts'\nimport type { LinearScale } from '../scales/linear.ts'\nimport { circlePath } from '../shapes/circle.ts'\nimport { type ClassValue, h } from '../vnode.ts'\nimport {\n domainOf,\n markerShape,\n plotClip,\n plottable,\n tickCount,\n type ValueAxisOptions,\n valueScale,\n valueTicks,\n} from './cartesian.ts'\nimport { cleanData, finite, isRecord, named, records, text } from './clean.ts'\nimport { groupAttrs, keyOf, legendItems } from './named.ts'\n\n/** A point of a scatter or bubble chart. */\nexport interface ScatterPoint {\n x: number\n y: number\n /** Bubble size; the circle area is proportional to it. */\n size?: number\n /** Name shown in the tooltip and table (e.g. a country). */\n label?: string\n}\n\nexport interface ScatterSeries {\n name: string\n points: readonly ScatterPoint[]\n /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */\n id?: string\n /**\n * Custom color; overrides the palette slot via `--tc-series-color`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color?: string\n /** Extra classes on the series group. */\n class?: ClassValue\n /** Start hidden (toggle it back from the legend). */\n hidden?: boolean\n}\n\nexport interface ScatterOptions {\n data: { series: readonly ScatterSeries[] }\n /** Horizontal value axis. */\n x?: ValueAxisOptions\n /** Vertical value axis. */\n y?: ValueAxisOptions\n /** Radius of points without a size, in pixels. Defaults to `4`. */\n radius?: number\n /** Radius range for bubbles (points with `size`). Defaults to `{ min: 4, max: 24 }`. */\n size?: { min?: number; max?: number }\n /** Extra space around the plot area, in pixels. */\n padding?: InsetsInput\n}\n\n/** Pointer distance (in pixels, beyond the radius) that still hits a point. */\nconst HIT_RADIUS = 24\nconst EDGE = 8\n\ninterface Placed {\n seriesIndex: number\n pointIndex: number\n point: ScatterPoint\n cx: number\n cy: number\n r: number\n}\n\n/** A point's bubble size, or `undefined` when it has none (or an invalid one). */\nconst sizeOf = (p: ScatterPoint): number | undefined =>\n p.size != null && Number.isFinite(p.size) && p.size > 0 ? p.size : undefined\n\nfunction renderScatter(options: ScatterOptions, ctx: RenderContext) {\n const { width, height, fontSize, locale } = ctx\n const xOptions = options.x ?? {}\n const yOptions = options.y ?? {}\n const radius = options.radius ?? 4\n const visible = options.data.series.filter((s) => !ctx.hidden.has(keyOf(s)))\n const points = visible.flatMap((s) => s.points)\n const sizes = points.map(sizeOf).filter((v): v is number => v !== undefined)\n const maxSize = extent(sizes)?.[1] ?? 0\n const rMin = options.size?.min ?? 4\n const rMax = options.size?.max ?? 24\n // Area-proportional bubbles: the radius grows with the square root of the size.\n const bubble = (size: number | undefined) =>\n size != null && size > 0 && maxSize > 0\n ? rMin + (rMax - rMin) * Math.sqrt(size / maxSize)\n : radius\n const overhang = Math.max(radius, sizes.length ? rMax : 0) + 2\n\n const countY = tickCount(yOptions, Math.max(2, Math.round(height / 60)))\n const countX = tickCount(xOptions, Math.max(2, Math.round(width / 80)))\n // Only points that can be plotted on both axes take part.\n const usable = (p: ScatterPoint) => plottable(p.x, xOptions) && plottable(p.y, yOptions)\n const shown = points.filter(usable)\n const xDomain = domainOf(\n shown.map((p) => p.x),\n xOptions,\n false,\n countX,\n )\n const yDomain = domainOf(\n shown.map((p) => p.y),\n yOptions,\n false,\n countY,\n )\n\n const showX = xOptions.show !== false\n const showY = yOptions.show !== false\n // Linear or logarithmic, as each axis asks (see valueScale).\n const ticksOf = (scale: LinearScale, axis: ValueAxisOptions, count: number) =>\n valueTicks(scale, axis, count, axis.format, locale)\n const probeY = ticksOf(valueScale(yDomain, [1, 0], yOptions), yOptions, countY)\n const probeX = ticksOf(valueScale(xDomain, [0, 1], xOptions), xOptions, countX)\n const half = (tick: Tick | undefined) =>\n showX && tick ? Math.ceil(estimateTextWidth(tick.label, fontSize) / 2) : 0\n const pad = insets(options.padding)\n const margins = {\n top:\n pad.top + Math.max(showY ? Math.ceil((fontSize * LINE_HEIGHT) / 2) : 0, overhang, EDGE / 2),\n right: pad.right + Math.max(half(probeX[probeX.length - 1]), overhang, EDGE),\n bottom:\n pad.bottom + Math.max(showX ? axisSize('bottom', probeX, fontSize) : 0, overhang, EDGE / 2),\n left:\n pad.left +\n Math.max(showY ? axisSize('left', probeY, fontSize) : 0, half(probeX[0]), overhang),\n }\n const area = innerRect(width, height, margins)\n const x = valueScale(xDomain, [area.x, area.x + area.width], xOptions)\n const y = valueScale(yDomain, [area.y + area.height, area.y], yOptions)\n // Thinned like the ticks of the other charts: on a log axis they crowd at the end of each decade.\n const xTicks = thinTicks(ticksOf(x, xOptions, countX), 'bottom', fontSize)\n const yTicks = thinTicks(ticksOf(y, yOptions, countY), 'left', fontSize, 4)\n\n // Every visible point in pixels, sorted by x for fast nearest-point lookups.\n const placed: Placed[] = []\n options.data.series.forEach((series, seriesIndex) => {\n if (ctx.hidden.has(keyOf(series))) return\n series.points.forEach((point, pointIndex) => {\n if (!usable(point)) return\n placed.push({\n seriesIndex,\n pointIndex,\n point,\n cx: x(point.x),\n cy: y(point.y),\n r: bubble(sizeOf(point)),\n })\n })\n })\n placed.sort((a, b) => a.cx - b.cx)\n\n const fx = formatDetail(xOptions.format, locale)\n const fy = formatDetail(yOptions.format, locale)\n const fs = formatNumber(undefined, locale)\n const hitFor = (p: Placed, index: number): Hit => {\n const series = options.data.series[p.seriesIndex] as ScatterSeries\n const sz = sizeOf(p.point)\n const size = sz === undefined ? '' : ` · ${fs(sz)}`\n const item: HitItem = {\n name: series.name,\n seriesIndex: p.seriesIndex,\n value: p.point.y,\n text: `${fx(p.point.x)}, ${fy(p.point.y)}${size}`,\n x: p.cx,\n y: p.cy,\n }\n if (series.color) item.color = series.color\n return {\n index,\n label: p.point.label ?? series.name,\n title: p.point.label ?? '',\n x: p.cx,\n area,\n items: [item],\n seriesIndex: p.seriesIndex,\n mark: { d: circlePath(round(p.r + 4)), x: p.cx, y: p.cy },\n }\n }\n\n const interaction: Interaction = {\n count: placed.length,\n hitIndex: (index) => {\n const p = placed[index]\n return p ? hitFor(p, index) : null\n },\n hitTest(px, py) {\n // Binary search the first point within reach on x, then scan the window.\n let lo = 0\n let hi = placed.length\n const reach = HIT_RADIUS + rMax\n while (lo < hi) {\n const mid = (lo + hi) >> 1\n if ((placed[mid] as Placed).cx < px - reach) lo = mid + 1\n else hi = mid\n }\n let best = -1\n let bestDistance = Number.POSITIVE_INFINITY\n for (let i = lo; i < placed.length; i++) {\n const p = placed[i] as Placed\n if (p.cx > px + reach) break\n const distance = Math.hypot(p.cx - px, p.cy - py) - p.r\n if (distance < bestDistance && distance <= HIT_RADIUS) {\n best = i\n bestDistance = distance\n }\n }\n return best === -1 ? null : hitFor(placed[best] as Placed, best)\n },\n }\n ctx.onHitTest(interaction)\n\n /** One path drawing a dot of `radius` at every point (two arcs each, or the series' shape). */\n const shape = markerShape(options)\n const dotsPath = (dots: readonly ScatterPoint[], slot: number) => {\n if (!dots.length) return null\n const r = round(radius)\n let d = ''\n for (const p of dots) {\n d += shape\n ? shape(slot, x(p.x), y(p.y), r)\n : `M${round(x(p.x) - radius)},${round(y(p.y))}a${r},${r},0,1,0,${2 * r},0a${r},${r},0,1,0,${-2 * r},0`\n }\n return h('path', { key: 'dots', class: ['tc-point tc-dots', shape && 'tc-marker'], d })\n }\n\n const background = []\n if (yOptions.grid !== false) background.push(grid({ direction: 'y', ticks: yTicks, area }))\n if (xOptions.grid) background.push(grid({ direction: 'x', ticks: xTicks, area }))\n\n // Dots may reach a little past the plot edges; bubbles are cut at them (like\n // Chart.js), as a big one there would cover the axis labels.\n const clip = plotClip(ctx, area, sizes.length ? 0 : overhang)\n const groups = options.data.series.map(\n (series, seriesIndex) =>\n !ctx.hidden.has(keyOf(series)) &&\n h(\n 'g',\n groupAttrs(series, seriesIndex),\n // Plain points share one path per series: thousands of circles would\n // each cost the browser style and layout work. The path keeps its\n // commands while the point count does, so new data morphs. Bubbles\n // stay circles: each is see-through over the others.\n dotsPath(\n series.points.filter((p) => usable(p) && sizeOf(p) === undefined),\n seriesIndex,\n ),\n series.points.map(\n (point, i) =>\n usable(point) &&\n sizeOf(point) !== undefined &&\n h('circle', {\n key: i,\n class: 'tc-point tc-bubble',\n cx: round(x(point.x)),\n cy: round(y(point.y)),\n r: round(bubble(sizeOf(point))),\n }),\n ),\n ),\n )\n\n return [\n h('defs', null, clip.def),\n background,\n h('g', { key: 'series', class: 'tc-series-list', 'clip-path': clip.url }, groups),\n showY && axis({ position: 'left', ticks: yTicks, area }),\n showX && axis({ position: 'bottom', ticks: xTicks, area }),\n ]\n}\n\nfunction scatterTable(\n options: ScatterOptions,\n ctx: RenderContext,\n limit: number = Number.POSITIVE_INFINITY,\n): DataTable {\n const fx = formatDetail(options.x?.format, ctx.locale)\n const fy = formatDetail(options.y?.format, ctx.locale)\n const fs = formatNumber(undefined, ctx.locale)\n const series = options.data.series.filter((s) => !ctx.hidden.has(keyOf(s)))\n const withSize = series.some((s) => s.points.some((p) => p.size != null))\n const withLabel = series.some((s) => s.points.some((p) => p.label != null))\n const total = series.reduce((sum, s) => sum + s.points.length, 0)\n let left = limit\n return {\n columns: ['', ...(withLabel ? ['Label'] : []), 'x', 'y', ...(withSize ? ['Size'] : [])],\n total,\n rows: series.flatMap((s) => {\n const take = s.points.slice(0, Math.max(0, left))\n left -= take.length\n return take.map((p) => [\n s.name,\n ...(withLabel ? [p.label ?? ''] : []),\n fx(p.x),\n fy(p.y),\n ...(withSize ? [sizeOf(p) === undefined ? '–' : fs(sizeOf(p) as number)] : []),\n ])\n }),\n }\n}\n\n/**\n * Scatter chart: points on two value axes; give points a `size` for a\n * bubble chart (area-proportional radii).\n *\n * ```ts\n * new Chart('#el', {\n * type: scatter,\n * data: { series: [{ name: 'Cities', points: [{ x: 12, y: 3.4 }, { x: 18, y: 5.1 }] }] },\n * })\n * ```\n */\nexport const scatter: ChartType<ScatterOptions> = {\n name: 'scatter',\n clean: cleanData((data) => ({\n ...(isRecord(data) ? data : {}),\n series: records(isRecord(data) && data.series, (s) => ({\n ...named(s),\n points: records(s.points, (p) => ({\n ...p,\n x: finite(p.x),\n y: finite(p.y),\n size: finite(p.size) ?? undefined,\n label: p.label == null ? undefined : text(p.label),\n })).filter((p) => p.x !== null && p.y !== null),\n })),\n })),\n render: renderScatter,\n legend: (options) => legendItems(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,IAAI,CAAC;GAChD,QAAQ,KAAK;GACb,OAAO,KAAK,KAAK,MAAM;IACrB,EAAE;IACF,GAAI,YAAY,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC;IACnC,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAI,WAAW,CAAC,OAAO,CAAC,MAAM,KAAA,IAAY,MAAM,GAAG,OAAO,CAAC,CAAW,CAAC,IAAI,CAAC;GAC9E,CAAC;EACH,CAAC;CACH;AACF;;;;;;;;;;;;AAaA,MAAa,UAAqC;CAChD,MAAM;CACN,OAAOuB,cAAAA,WAAW,UAAU;EAC1B,GAAIC,cAAAA,SAAS,IAAI,IAAI,OAAO,CAAC;EAC7B,QAAQC,cAAAA,QAAQD,cAAAA,SAAS,IAAI,KAAK,KAAK,SAAS,OAAO;GACrD,GAAGE,cAAAA,MAAM,CAAC;GACV,QAAQD,cAAAA,QAAQ,EAAE,SAAS,OAAO;IAChC,GAAG;IACH,GAAGE,cAAAA,OAAO,EAAE,CAAC;IACb,GAAGA,cAAAA,OAAO,EAAE,CAAC;IACb,MAAMA,cAAAA,OAAO,EAAE,IAAI,KAAK,KAAA;IACxB,OAAO,EAAE,SAAS,OAAO,KAAA,IAAYC,cAAAA,KAAK,EAAE,KAAK;GACnD,EAAE,CAAC,CAAC,QAAQ,MAAM,EAAE,MAAM,QAAQ,EAAE,MAAM,IAAI;EAChD,EAAE;CACJ,EAAE;CACF,QAAQ;CACR,SAAS,YAAYC,cAAAA,YAAY,QAAQ,KAAK,MAAM;CACpD,OAAO;CACP,aAAa,EAAE,SAAS,YAAY,QAAQ,GAAG,OAAO;AACxD"}
@@ -0,0 +1,61 @@
1
+ import { a as InsetsInput } from "./annotations-lyt0I3HU.cjs";
2
+ import { a as ClassValue } from "./vnode-BUflsBsa.cjs";
3
+ import { a as ChartType, rt as ValueAxisOptions } from "./chart-Qa417fJo.cjs";
4
+ //#region src/charts/scatter.d.ts
5
+ /** A point of a scatter or bubble chart. */
6
+ interface ScatterPoint {
7
+ x: number;
8
+ y: number;
9
+ /** Bubble size; the circle area is proportional to it. */
10
+ size?: number;
11
+ /** Name shown in the tooltip and table (e.g. a country). */
12
+ label?: string;
13
+ }
14
+ interface ScatterSeries {
15
+ name: string;
16
+ points: readonly ScatterPoint[];
17
+ /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */
18
+ id?: string;
19
+ /**
20
+ * Custom color; overrides the palette slot via `--tc-series-color`.
21
+ * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.
22
+ */
23
+ color?: string;
24
+ /** Extra classes on the series group. */
25
+ class?: ClassValue;
26
+ /** Start hidden (toggle it back from the legend). */
27
+ hidden?: boolean;
28
+ }
29
+ interface ScatterOptions {
30
+ data: {
31
+ series: readonly ScatterSeries[];
32
+ };
33
+ /** Horizontal value axis. */
34
+ x?: ValueAxisOptions;
35
+ /** Vertical value axis. */
36
+ y?: ValueAxisOptions;
37
+ /** Radius of points without a size, in pixels. Defaults to `4`. */
38
+ radius?: number;
39
+ /** Radius range for bubbles (points with `size`). Defaults to `{ min: 4, max: 24 }`. */
40
+ size?: {
41
+ min?: number;
42
+ max?: number;
43
+ };
44
+ /** Extra space around the plot area, in pixels. */
45
+ padding?: InsetsInput;
46
+ }
47
+ /**
48
+ * Scatter chart: points on two value axes; give points a `size` for a
49
+ * bubble chart (area-proportional radii).
50
+ *
51
+ * ```ts
52
+ * new Chart('#el', {
53
+ * type: scatter,
54
+ * data: { series: [{ name: 'Cities', points: [{ x: 12, y: 3.4 }, { x: 18, y: 5.1 }] }] },
55
+ * })
56
+ * ```
57
+ */
58
+ declare const scatter: ChartType<ScatterOptions>;
59
+ //#endregion
60
+ export { scatter as i, ScatterPoint as n, ScatterSeries as r, ScatterOptions as t };
61
+ //# sourceMappingURL=scatter-DrJ8xYz4.d.cts.map
@@ -0,0 +1,245 @@
1
+ import { a as round, i as insets, n as estimateTextWidth, r as innerRect, t as LINE_HEIGHT } from "./layout-B3hiqVEw.js";
2
+ import { t as h } from "./vnode-tCWItoUH.js";
3
+ import { n as formatDetail, r as formatNumber } from "./format-lStwuc1L.js";
4
+ import { C as grid, O as thinTicks, T as axisSize, c as plotClip, h as tickCount, l as plottable, r as domainOf, s as markerShape, v as valueScale, w as axis, y as valueTicks } from "./cartesian-Cr0AF0nG.js";
5
+ import { t as extent } from "./extent-BAMZo0Nq.js";
6
+ import { a as isRecord, i as finite, l as records, s as named, t as cleanData, u as text } from "./clean-o1vDEhFV.js";
7
+ import { n as keyOf, r as legendItems, t as groupAttrs } from "./named-DE15TOgh.js";
8
+ import { t as circlePath } from "./circle-Z7YfCoCM.js";
9
+ //#region src/charts/scatter.ts
10
+ /** Pointer distance (in pixels, beyond the radius) that still hits a point. */
11
+ const HIT_RADIUS = 24;
12
+ const EDGE = 8;
13
+ /** A point's bubble size, or `undefined` when it has none (or an invalid one). */
14
+ const sizeOf = (p) => p.size != null && Number.isFinite(p.size) && p.size > 0 ? p.size : void 0;
15
+ function renderScatter(options, ctx) {
16
+ const { width, height, fontSize, locale } = ctx;
17
+ const xOptions = options.x ?? {};
18
+ const yOptions = options.y ?? {};
19
+ const radius = options.radius ?? 4;
20
+ const points = options.data.series.filter((s) => !ctx.hidden.has(keyOf(s))).flatMap((s) => s.points);
21
+ const sizes = points.map(sizeOf).filter((v) => v !== void 0);
22
+ const maxSize = extent(sizes)?.[1] ?? 0;
23
+ const rMin = options.size?.min ?? 4;
24
+ const rMax = options.size?.max ?? 24;
25
+ const bubble = (size) => size != null && size > 0 && maxSize > 0 ? rMin + (rMax - rMin) * Math.sqrt(size / maxSize) : radius;
26
+ const overhang = Math.max(radius, sizes.length ? rMax : 0) + 2;
27
+ const countY = tickCount(yOptions, Math.max(2, Math.round(height / 60)));
28
+ const countX = tickCount(xOptions, Math.max(2, Math.round(width / 80)));
29
+ const usable = (p) => plottable(p.x, xOptions) && plottable(p.y, yOptions);
30
+ const shown = points.filter(usable);
31
+ const xDomain = domainOf(shown.map((p) => p.x), xOptions, false, countX);
32
+ const yDomain = domainOf(shown.map((p) => p.y), yOptions, false, countY);
33
+ const showX = xOptions.show !== false;
34
+ const showY = yOptions.show !== false;
35
+ const ticksOf = (scale, axis, count) => valueTicks(scale, axis, count, axis.format, locale);
36
+ const probeY = ticksOf(valueScale(yDomain, [1, 0], yOptions), yOptions, countY);
37
+ const probeX = ticksOf(valueScale(xDomain, [0, 1], xOptions), xOptions, countX);
38
+ const half = (tick) => showX && tick ? Math.ceil(estimateTextWidth(tick.label, fontSize) / 2) : 0;
39
+ const pad = insets(options.padding);
40
+ const margins = {
41
+ top: pad.top + Math.max(showY ? Math.ceil(fontSize * LINE_HEIGHT / 2) : 0, overhang, EDGE / 2),
42
+ right: pad.right + Math.max(half(probeX[probeX.length - 1]), overhang, EDGE),
43
+ bottom: pad.bottom + Math.max(showX ? axisSize("bottom", probeX, fontSize) : 0, overhang, EDGE / 2),
44
+ left: pad.left + Math.max(showY ? axisSize("left", probeY, fontSize) : 0, half(probeX[0]), overhang)
45
+ };
46
+ const area = innerRect(width, height, margins);
47
+ const x = valueScale(xDomain, [area.x, area.x + area.width], xOptions);
48
+ const y = valueScale(yDomain, [area.y + area.height, area.y], yOptions);
49
+ const xTicks = thinTicks(ticksOf(x, xOptions, countX), "bottom", fontSize);
50
+ const yTicks = thinTicks(ticksOf(y, yOptions, countY), "left", fontSize, 4);
51
+ const placed = [];
52
+ options.data.series.forEach((series, seriesIndex) => {
53
+ if (ctx.hidden.has(keyOf(series))) return;
54
+ series.points.forEach((point, pointIndex) => {
55
+ if (!usable(point)) return;
56
+ placed.push({
57
+ seriesIndex,
58
+ pointIndex,
59
+ point,
60
+ cx: x(point.x),
61
+ cy: y(point.y),
62
+ r: bubble(sizeOf(point))
63
+ });
64
+ });
65
+ });
66
+ placed.sort((a, b) => a.cx - b.cx);
67
+ const fx = formatDetail(xOptions.format, locale);
68
+ const fy = formatDetail(yOptions.format, locale);
69
+ const fs = formatNumber(void 0, locale);
70
+ const hitFor = (p, index) => {
71
+ const series = options.data.series[p.seriesIndex];
72
+ const sz = sizeOf(p.point);
73
+ const size = sz === void 0 ? "" : ` · ${fs(sz)}`;
74
+ const item = {
75
+ name: series.name,
76
+ seriesIndex: p.seriesIndex,
77
+ value: p.point.y,
78
+ text: `${fx(p.point.x)}, ${fy(p.point.y)}${size}`,
79
+ x: p.cx,
80
+ y: p.cy
81
+ };
82
+ if (series.color) item.color = series.color;
83
+ return {
84
+ index,
85
+ label: p.point.label ?? series.name,
86
+ title: p.point.label ?? "",
87
+ x: p.cx,
88
+ area,
89
+ items: [item],
90
+ seriesIndex: p.seriesIndex,
91
+ mark: {
92
+ d: circlePath(round(p.r + 4)),
93
+ x: p.cx,
94
+ y: p.cy
95
+ }
96
+ };
97
+ };
98
+ const interaction = {
99
+ count: placed.length,
100
+ hitIndex: (index) => {
101
+ const p = placed[index];
102
+ return p ? hitFor(p, index) : null;
103
+ },
104
+ hitTest(px, py) {
105
+ let lo = 0;
106
+ let hi = placed.length;
107
+ const reach = HIT_RADIUS + rMax;
108
+ while (lo < hi) {
109
+ const mid = lo + hi >> 1;
110
+ if (placed[mid].cx < px - reach) lo = mid + 1;
111
+ else hi = mid;
112
+ }
113
+ let best = -1;
114
+ let bestDistance = Number.POSITIVE_INFINITY;
115
+ for (let i = lo; i < placed.length; i++) {
116
+ const p = placed[i];
117
+ if (p.cx > px + reach) break;
118
+ const distance = Math.hypot(p.cx - px, p.cy - py) - p.r;
119
+ if (distance < bestDistance && distance <= HIT_RADIUS) {
120
+ best = i;
121
+ bestDistance = distance;
122
+ }
123
+ }
124
+ return best === -1 ? null : hitFor(placed[best], best);
125
+ }
126
+ };
127
+ ctx.onHitTest(interaction);
128
+ /** One path drawing a dot of `radius` at every point (two arcs each, or the series' shape). */
129
+ const shape = markerShape(options);
130
+ const dotsPath = (dots, slot) => {
131
+ if (!dots.length) return null;
132
+ const r = round(radius);
133
+ let d = "";
134
+ for (const p of dots) d += shape ? shape(slot, x(p.x), y(p.y), r) : `M${round(x(p.x) - radius)},${round(y(p.y))}a${r},${r},0,1,0,${2 * r},0a${r},${r},0,1,0,${-2 * r},0`;
135
+ return h("path", {
136
+ key: "dots",
137
+ class: ["tc-point tc-dots", shape && "tc-marker"],
138
+ d
139
+ });
140
+ };
141
+ const background = [];
142
+ if (yOptions.grid !== false) background.push(grid({
143
+ direction: "y",
144
+ ticks: yTicks,
145
+ area
146
+ }));
147
+ if (xOptions.grid) background.push(grid({
148
+ direction: "x",
149
+ ticks: xTicks,
150
+ area
151
+ }));
152
+ const clip = plotClip(ctx, area, sizes.length ? 0 : overhang);
153
+ const groups = options.data.series.map((series, seriesIndex) => !ctx.hidden.has(keyOf(series)) && h("g", groupAttrs(series, seriesIndex), dotsPath(series.points.filter((p) => usable(p) && sizeOf(p) === void 0), seriesIndex), series.points.map((point, i) => usable(point) && sizeOf(point) !== void 0 && h("circle", {
154
+ key: i,
155
+ class: "tc-point tc-bubble",
156
+ cx: round(x(point.x)),
157
+ cy: round(y(point.y)),
158
+ r: round(bubble(sizeOf(point)))
159
+ }))));
160
+ return [
161
+ h("defs", null, clip.def),
162
+ background,
163
+ h("g", {
164
+ key: "series",
165
+ class: "tc-series-list",
166
+ "clip-path": clip.url
167
+ }, groups),
168
+ showY && axis({
169
+ position: "left",
170
+ ticks: yTicks,
171
+ area
172
+ }),
173
+ showX && axis({
174
+ position: "bottom",
175
+ ticks: xTicks,
176
+ area
177
+ })
178
+ ];
179
+ }
180
+ function scatterTable(options, ctx, limit = Number.POSITIVE_INFINITY) {
181
+ const fx = formatDetail(options.x?.format, ctx.locale);
182
+ const fy = formatDetail(options.y?.format, ctx.locale);
183
+ const fs = formatNumber(void 0, ctx.locale);
184
+ const series = options.data.series.filter((s) => !ctx.hidden.has(keyOf(s)));
185
+ const withSize = series.some((s) => s.points.some((p) => p.size != null));
186
+ const withLabel = series.some((s) => s.points.some((p) => p.label != null));
187
+ const total = series.reduce((sum, s) => sum + s.points.length, 0);
188
+ let left = limit;
189
+ return {
190
+ columns: [
191
+ "",
192
+ ...withLabel ? ["Label"] : [],
193
+ "x",
194
+ "y",
195
+ ...withSize ? ["Size"] : []
196
+ ],
197
+ total,
198
+ rows: series.flatMap((s) => {
199
+ const take = s.points.slice(0, Math.max(0, left));
200
+ left -= take.length;
201
+ return take.map((p) => [
202
+ s.name,
203
+ ...withLabel ? [p.label ?? ""] : [],
204
+ fx(p.x),
205
+ fy(p.y),
206
+ ...withSize ? [sizeOf(p) === void 0 ? "–" : fs(sizeOf(p))] : []
207
+ ]);
208
+ })
209
+ };
210
+ }
211
+ /**
212
+ * Scatter chart: points on two value axes; give points a `size` for a
213
+ * bubble chart (area-proportional radii).
214
+ *
215
+ * ```ts
216
+ * new Chart('#el', {
217
+ * type: scatter,
218
+ * data: { series: [{ name: 'Cities', points: [{ x: 12, y: 3.4 }, { x: 18, y: 5.1 }] }] },
219
+ * })
220
+ * ```
221
+ */
222
+ const scatter = {
223
+ name: "scatter",
224
+ clean: cleanData((data) => ({
225
+ ...isRecord(data) ? data : {},
226
+ series: records(isRecord(data) && data.series, (s) => ({
227
+ ...named(s),
228
+ points: records(s.points, (p) => ({
229
+ ...p,
230
+ x: finite(p.x),
231
+ y: finite(p.y),
232
+ size: finite(p.size) ?? void 0,
233
+ label: p.label == null ? void 0 : text(p.label)
234
+ })).filter((p) => p.x !== null && p.y !== null)
235
+ }))
236
+ })),
237
+ render: renderScatter,
238
+ legend: (options) => legendItems(options.data.series),
239
+ table: scatterTable,
240
+ valueLabels: { format: (options) => options.y?.format }
241
+ };
242
+ //#endregion
243
+ export { scatter as t };
244
+
245
+ //# sourceMappingURL=scatter-kgtgR318.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scatter-kgtgR318.js","names":[],"sources":["../src/charts/scatter.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext } from '../chart.ts'\nimport { axis, axisSize, type Tick, thinTicks } from '../components/axis.ts'\nimport { grid } from '../components/grid.ts'\nimport { formatDetail, formatNumber } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport {\n estimateTextWidth,\n type InsetsInput,\n innerRect,\n insets,\n LINE_HEIGHT,\n round,\n} from '../layout.ts'\nimport { extent } from '../scales/extent.ts'\nimport type { LinearScale } from '../scales/linear.ts'\nimport { circlePath } from '../shapes/circle.ts'\nimport { type ClassValue, h } from '../vnode.ts'\nimport {\n domainOf,\n markerShape,\n plotClip,\n plottable,\n tickCount,\n type ValueAxisOptions,\n valueScale,\n valueTicks,\n} from './cartesian.ts'\nimport { cleanData, finite, isRecord, named, records, text } from './clean.ts'\nimport { groupAttrs, keyOf, legendItems } from './named.ts'\n\n/** A point of a scatter or bubble chart. */\nexport interface ScatterPoint {\n x: number\n y: number\n /** Bubble size; the circle area is proportional to it. */\n size?: number\n /** Name shown in the tooltip and table (e.g. a country). */\n label?: string\n}\n\nexport interface ScatterSeries {\n name: string\n points: readonly ScatterPoint[]\n /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */\n id?: string\n /**\n * Custom color; overrides the palette slot via `--tc-series-color`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color?: string\n /** Extra classes on the series group. */\n class?: ClassValue\n /** Start hidden (toggle it back from the legend). */\n hidden?: boolean\n}\n\nexport interface ScatterOptions {\n data: { series: readonly ScatterSeries[] }\n /** Horizontal value axis. */\n x?: ValueAxisOptions\n /** Vertical value axis. */\n y?: ValueAxisOptions\n /** Radius of points without a size, in pixels. Defaults to `4`. */\n radius?: number\n /** Radius range for bubbles (points with `size`). Defaults to `{ min: 4, max: 24 }`. */\n size?: { min?: number; max?: number }\n /** Extra space around the plot area, in pixels. */\n padding?: InsetsInput\n}\n\n/** Pointer distance (in pixels, beyond the radius) that still hits a point. */\nconst HIT_RADIUS = 24\nconst EDGE = 8\n\ninterface Placed {\n seriesIndex: number\n pointIndex: number\n point: ScatterPoint\n cx: number\n cy: number\n r: number\n}\n\n/** A point's bubble size, or `undefined` when it has none (or an invalid one). */\nconst sizeOf = (p: ScatterPoint): number | undefined =>\n p.size != null && Number.isFinite(p.size) && p.size > 0 ? p.size : undefined\n\nfunction renderScatter(options: ScatterOptions, ctx: RenderContext) {\n const { width, height, fontSize, locale } = ctx\n const xOptions = options.x ?? {}\n const yOptions = options.y ?? {}\n const radius = options.radius ?? 4\n const visible = options.data.series.filter((s) => !ctx.hidden.has(keyOf(s)))\n const points = visible.flatMap((s) => s.points)\n const sizes = points.map(sizeOf).filter((v): v is number => v !== undefined)\n const maxSize = extent(sizes)?.[1] ?? 0\n const rMin = options.size?.min ?? 4\n const rMax = options.size?.max ?? 24\n // Area-proportional bubbles: the radius grows with the square root of the size.\n const bubble = (size: number | undefined) =>\n size != null && size > 0 && maxSize > 0\n ? rMin + (rMax - rMin) * Math.sqrt(size / maxSize)\n : radius\n const overhang = Math.max(radius, sizes.length ? rMax : 0) + 2\n\n const countY = tickCount(yOptions, Math.max(2, Math.round(height / 60)))\n const countX = tickCount(xOptions, Math.max(2, Math.round(width / 80)))\n // Only points that can be plotted on both axes take part.\n const usable = (p: ScatterPoint) => plottable(p.x, xOptions) && plottable(p.y, yOptions)\n const shown = points.filter(usable)\n const xDomain = domainOf(\n shown.map((p) => p.x),\n xOptions,\n false,\n countX,\n )\n const yDomain = domainOf(\n shown.map((p) => p.y),\n yOptions,\n false,\n countY,\n )\n\n const showX = xOptions.show !== false\n const showY = yOptions.show !== false\n // Linear or logarithmic, as each axis asks (see valueScale).\n const ticksOf = (scale: LinearScale, axis: ValueAxisOptions, count: number) =>\n valueTicks(scale, axis, count, axis.format, locale)\n const probeY = ticksOf(valueScale(yDomain, [1, 0], yOptions), yOptions, countY)\n const probeX = ticksOf(valueScale(xDomain, [0, 1], xOptions), xOptions, countX)\n const half = (tick: Tick | undefined) =>\n showX && tick ? Math.ceil(estimateTextWidth(tick.label, fontSize) / 2) : 0\n const pad = insets(options.padding)\n const margins = {\n top:\n pad.top + Math.max(showY ? Math.ceil((fontSize * LINE_HEIGHT) / 2) : 0, overhang, EDGE / 2),\n right: pad.right + Math.max(half(probeX[probeX.length - 1]), overhang, EDGE),\n bottom:\n pad.bottom + Math.max(showX ? axisSize('bottom', probeX, fontSize) : 0, overhang, EDGE / 2),\n left:\n pad.left +\n Math.max(showY ? axisSize('left', probeY, fontSize) : 0, half(probeX[0]), overhang),\n }\n const area = innerRect(width, height, margins)\n const x = valueScale(xDomain, [area.x, area.x + area.width], xOptions)\n const y = valueScale(yDomain, [area.y + area.height, area.y], yOptions)\n // Thinned like the ticks of the other charts: on a log axis they crowd at the end of each decade.\n const xTicks = thinTicks(ticksOf(x, xOptions, countX), 'bottom', fontSize)\n const yTicks = thinTicks(ticksOf(y, yOptions, countY), 'left', fontSize, 4)\n\n // Every visible point in pixels, sorted by x for fast nearest-point lookups.\n const placed: Placed[] = []\n options.data.series.forEach((series, seriesIndex) => {\n if (ctx.hidden.has(keyOf(series))) return\n series.points.forEach((point, pointIndex) => {\n if (!usable(point)) return\n placed.push({\n seriesIndex,\n pointIndex,\n point,\n cx: x(point.x),\n cy: y(point.y),\n r: bubble(sizeOf(point)),\n })\n })\n })\n placed.sort((a, b) => a.cx - b.cx)\n\n const fx = formatDetail(xOptions.format, locale)\n const fy = formatDetail(yOptions.format, locale)\n const fs = formatNumber(undefined, locale)\n const hitFor = (p: Placed, index: number): Hit => {\n const series = options.data.series[p.seriesIndex] as ScatterSeries\n const sz = sizeOf(p.point)\n const size = sz === undefined ? '' : ` · ${fs(sz)}`\n const item: HitItem = {\n name: series.name,\n seriesIndex: p.seriesIndex,\n value: p.point.y,\n text: `${fx(p.point.x)}, ${fy(p.point.y)}${size}`,\n x: p.cx,\n y: p.cy,\n }\n if (series.color) item.color = series.color\n return {\n index,\n label: p.point.label ?? series.name,\n title: p.point.label ?? '',\n x: p.cx,\n area,\n items: [item],\n seriesIndex: p.seriesIndex,\n mark: { d: circlePath(round(p.r + 4)), x: p.cx, y: p.cy },\n }\n }\n\n const interaction: Interaction = {\n count: placed.length,\n hitIndex: (index) => {\n const p = placed[index]\n return p ? hitFor(p, index) : null\n },\n hitTest(px, py) {\n // Binary search the first point within reach on x, then scan the window.\n let lo = 0\n let hi = placed.length\n const reach = HIT_RADIUS + rMax\n while (lo < hi) {\n const mid = (lo + hi) >> 1\n if ((placed[mid] as Placed).cx < px - reach) lo = mid + 1\n else hi = mid\n }\n let best = -1\n let bestDistance = Number.POSITIVE_INFINITY\n for (let i = lo; i < placed.length; i++) {\n const p = placed[i] as Placed\n if (p.cx > px + reach) break\n const distance = Math.hypot(p.cx - px, p.cy - py) - p.r\n if (distance < bestDistance && distance <= HIT_RADIUS) {\n best = i\n bestDistance = distance\n }\n }\n return best === -1 ? null : hitFor(placed[best] as Placed, best)\n },\n }\n ctx.onHitTest(interaction)\n\n /** One path drawing a dot of `radius` at every point (two arcs each, or the series' shape). */\n const shape = markerShape(options)\n const dotsPath = (dots: readonly ScatterPoint[], slot: number) => {\n if (!dots.length) return null\n const r = round(radius)\n let d = ''\n for (const p of dots) {\n d += shape\n ? shape(slot, x(p.x), y(p.y), r)\n : `M${round(x(p.x) - radius)},${round(y(p.y))}a${r},${r},0,1,0,${2 * r},0a${r},${r},0,1,0,${-2 * r},0`\n }\n return h('path', { key: 'dots', class: ['tc-point tc-dots', shape && 'tc-marker'], d })\n }\n\n const background = []\n if (yOptions.grid !== false) background.push(grid({ direction: 'y', ticks: yTicks, area }))\n if (xOptions.grid) background.push(grid({ direction: 'x', ticks: xTicks, area }))\n\n // Dots may reach a little past the plot edges; bubbles are cut at them (like\n // Chart.js), as a big one there would cover the axis labels.\n const clip = plotClip(ctx, area, sizes.length ? 0 : overhang)\n const groups = options.data.series.map(\n (series, seriesIndex) =>\n !ctx.hidden.has(keyOf(series)) &&\n h(\n 'g',\n groupAttrs(series, seriesIndex),\n // Plain points share one path per series: thousands of circles would\n // each cost the browser style and layout work. The path keeps its\n // commands while the point count does, so new data morphs. Bubbles\n // stay circles: each is see-through over the others.\n dotsPath(\n series.points.filter((p) => usable(p) && sizeOf(p) === undefined),\n seriesIndex,\n ),\n series.points.map(\n (point, i) =>\n usable(point) &&\n sizeOf(point) !== undefined &&\n h('circle', {\n key: i,\n class: 'tc-point tc-bubble',\n cx: round(x(point.x)),\n cy: round(y(point.y)),\n r: round(bubble(sizeOf(point))),\n }),\n ),\n ),\n )\n\n return [\n h('defs', null, clip.def),\n background,\n h('g', { key: 'series', class: 'tc-series-list', 'clip-path': clip.url }, groups),\n showY && axis({ position: 'left', ticks: yTicks, area }),\n showX && axis({ position: 'bottom', ticks: xTicks, area }),\n ]\n}\n\nfunction scatterTable(\n options: ScatterOptions,\n ctx: RenderContext,\n limit: number = Number.POSITIVE_INFINITY,\n): DataTable {\n const fx = formatDetail(options.x?.format, ctx.locale)\n const fy = formatDetail(options.y?.format, ctx.locale)\n const fs = formatNumber(undefined, ctx.locale)\n const series = options.data.series.filter((s) => !ctx.hidden.has(keyOf(s)))\n const withSize = series.some((s) => s.points.some((p) => p.size != null))\n const withLabel = series.some((s) => s.points.some((p) => p.label != null))\n const total = series.reduce((sum, s) => sum + s.points.length, 0)\n let left = limit\n return {\n columns: ['', ...(withLabel ? ['Label'] : []), 'x', 'y', ...(withSize ? ['Size'] : [])],\n total,\n rows: series.flatMap((s) => {\n const take = s.points.slice(0, Math.max(0, left))\n left -= take.length\n return take.map((p) => [\n s.name,\n ...(withLabel ? [p.label ?? ''] : []),\n fx(p.x),\n fy(p.y),\n ...(withSize ? [sizeOf(p) === undefined ? '–' : fs(sizeOf(p) as number)] : []),\n ])\n }),\n }\n}\n\n/**\n * Scatter chart: points on two value axes; give points a `size` for a\n * bubble chart (area-proportional radii).\n *\n * ```ts\n * new Chart('#el', {\n * type: scatter,\n * data: { series: [{ name: 'Cities', points: [{ x: 12, y: 3.4 }, { x: 18, y: 5.1 }] }] },\n * })\n * ```\n */\nexport const scatter: ChartType<ScatterOptions> = {\n name: 'scatter',\n clean: cleanData((data) => ({\n ...(isRecord(data) ? data : {}),\n series: records(isRecord(data) && data.series, (s) => ({\n ...named(s),\n points: records(s.points, (p) => ({\n ...p,\n x: finite(p.x),\n y: finite(p.y),\n size: finite(p.size) ?? undefined,\n label: p.label == null ? undefined : text(p.label),\n })).filter((p) => p.x !== null && p.y !== null),\n })),\n })),\n render: renderScatter,\n legend: (options) => legendItems(options.data.series),\n table: scatterTable,\n valueLabels: { format: (options) => options.y?.format },\n}\n"],"mappings":";;;;;;;;;;AAwEA,MAAM,aAAa;AACnB,MAAM,OAAO;;AAYb,MAAM,UAAU,MACd,EAAE,QAAQ,QAAQ,OAAO,SAAS,EAAE,IAAI,KAAK,EAAE,OAAO,IAAI,EAAE,OAAO,KAAA;AAErE,SAAS,cAAc,SAAyB,KAAoB;CAClE,MAAM,EAAE,OAAO,QAAQ,UAAU,WAAW;CAC5C,MAAM,WAAW,QAAQ,KAAK,CAAC;CAC/B,MAAM,WAAW,QAAQ,KAAK,CAAC;CAC/B,MAAM,SAAS,QAAQ,UAAU;CAEjC,MAAM,SADU,QAAQ,KAAK,OAAO,QAAQ,MAAM,CAAC,IAAI,OAAO,IAAI,MAAM,CAAC,CAAC,CACrD,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM;CAC9C,MAAM,QAAQ,OAAO,IAAI,MAAM,CAAC,CAAC,QAAQ,MAAmB,MAAM,KAAA,CAAS;CAC3E,MAAM,UAAU,OAAO,KAAK,CAAC,GAAG,MAAM;CACtC,MAAM,OAAO,QAAQ,MAAM,OAAO;CAClC,MAAM,OAAO,QAAQ,MAAM,OAAO;CAElC,MAAM,UAAU,SACd,QAAQ,QAAQ,OAAO,KAAK,UAAU,IAClC,QAAQ,OAAO,QAAQ,KAAK,KAAK,OAAO,OAAO,IAC/C;CACN,MAAM,WAAW,KAAK,IAAI,QAAQ,MAAM,SAAS,OAAO,CAAC,IAAI;CAE7D,MAAM,SAAS,UAAU,UAAU,KAAK,IAAI,GAAG,KAAK,MAAM,SAAS,EAAE,CAAC,CAAC;CACvE,MAAM,SAAS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,GAAG,OAAO,CAAC,CAAW,CAAC,IAAI,CAAC;GAC9E,CAAC;EACH,CAAC;CACH;AACF;;;;;;;;;;;;AAaA,MAAa,UAAqC;CAChD,MAAM;CACN,OAAO,WAAW,UAAU;EAC1B,GAAI,SAAS,IAAI,IAAI,OAAO,CAAC;EAC7B,QAAQ,QAAQ,SAAS,IAAI,KAAK,KAAK,SAAS,OAAO;GACrD,GAAG,MAAM,CAAC;GACV,QAAQ,QAAQ,EAAE,SAAS,OAAO;IAChC,GAAG;IACH,GAAG,OAAO,EAAE,CAAC;IACb,GAAG,OAAO,EAAE,CAAC;IACb,MAAM,OAAO,EAAE,IAAI,KAAK,KAAA;IACxB,OAAO,EAAE,SAAS,OAAO,KAAA,IAAY,KAAK,EAAE,KAAK;GACnD,EAAE,CAAC,CAAC,QAAQ,MAAM,EAAE,MAAM,QAAQ,EAAE,MAAM,IAAI;EAChD,EAAE;CACJ,EAAE;CACF,QAAQ;CACR,SAAS,YAAY,YAAY,QAAQ,KAAK,MAAM;CACpD,OAAO;CACP,aAAa,EAAE,SAAS,YAAY,QAAQ,GAAG,OAAO;AACxD"}
@@ -0,0 +1,3 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_scatter = require("./scatter-DgMN9zRy.cjs");
3
+ exports.scatter = require_scatter.scatter;
@@ -0,0 +1,2 @@
1
+ import { i as scatter, n as ScatterPoint, r as ScatterSeries, t as ScatterOptions } from "./scatter-DrJ8xYz4.cjs";
2
+ export { type ScatterOptions, type ScatterPoint, type ScatterSeries, scatter };
@@ -0,0 +1,2 @@
1
+ import { i as scatter, n as ScatterPoint, r as ScatterSeries, t as ScatterOptions } from "./scatter-Bl7nasE6.js";
2
+ export { type ScatterOptions, type ScatterPoint, type ScatterSeries, scatter };
@@ -0,0 +1,2 @@
1
+ import { t as scatter } from "./scatter-kgtgR318.js";
2
+ export { scatter };