@astrato-io/visualizations 0.6.4 → 0.7.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 (220) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/README.md +32 -2
  3. package/THIRD_PARTY_NOTICES.md +68 -205
  4. package/VISUALIZATION_DEFINITIONS.md +68 -114
  5. package/chunks/Button-BrGKp9Nm.js +110 -0
  6. package/chunks/DefaultPropsProvider-BsfB7QTn.js +257 -0
  7. package/chunks/FieldTypeIcon-Drs6hSJF.js +22 -0
  8. package/chunks/{LinearProgress-CUZ0D8_t.js → LinearProgress-VtfFx2vJ.js} +51 -51
  9. package/chunks/MenuOption-ByRqhRdX.js +3934 -0
  10. package/chunks/Title-CO5dP1ma.js +1691 -0
  11. package/chunks/ToggleButton-KOBAimC1.js +112 -0
  12. package/chunks/app-filter-bar.compiler-TwVTeoj5.js +64 -0
  13. package/chunks/bar.compiler-DuQg8EUb.js +374 -0
  14. package/chunks/builder-DEDvNq1k.js +201 -0
  15. package/chunks/{color-settings-ZIvgNTq1.js → color-rules-CN7TcGrC.js} +2 -6
  16. package/chunks/color-settings-3VRlf_Vw.js +6 -0
  17. package/chunks/colorManipulator-D8Pjy1pf.js +45 -0
  18. package/chunks/coloring-CncX_JRX.js +278 -0
  19. package/chunks/{src-BC7cGcJ-.js → definitions-BPJQTx16.js} +650 -464
  20. package/chunks/{escobar-BGqT1EsE.js → escobar-DRhRMYRE.js} +6282 -4931
  21. package/chunks/event-bus-CrLB-Y8z.js +3 -0
  22. package/chunks/extend-preset-CUFNpmPe.js +4398 -0
  23. package/chunks/filter.compiler-w27dlv0C.js +70 -0
  24. package/chunks/filtering-cc7WqWpg.js +1153 -0
  25. package/chunks/handlers-TOT-7INo.js +12871 -0
  26. package/chunks/icon-picker-styles-CoJmwTRi.js +2246 -0
  27. package/chunks/isEqual-B8loyPsC.js +12 -0
  28. package/chunks/label-format-type-weq1XfcX.js +8 -0
  29. package/chunks/line.compiler-Ct1WhN2p.js +198 -0
  30. package/chunks/logger-DpQtYQnX.js +1163 -0
  31. package/chunks/lookup-BWllin0q.js +36 -0
  32. package/chunks/{metadata-CPXdYoln.js → metadata-WABZrt7Y.js} +1 -1
  33. package/chunks/number.compiler-D8TPly-4.js +53 -0
  34. package/chunks/{src-C0LgoUWY.js → operations-Dh4v1Ovt.js} +7716 -7541
  35. package/chunks/{range-DrzdfBX4.js → range-Bi-7zT0k.js} +2 -2
  36. package/chunks/registry-KervaxqJ.js +31 -0
  37. package/chunks/render-wrappers-OEmtaM8g.js +2 -0
  38. package/chunks/{registry-CExpGJ1N.js → requirements-PAoRaJyb.js} +294 -326
  39. package/chunks/responsive.styles-DSiOGD7u.js +82 -0
  40. package/chunks/shared-Bn4N5QcZ.js +1218 -0
  41. package/chunks/src-77e3mC7i.js +391 -0
  42. package/chunks/standalone-B55oyW6c.js +689 -0
  43. package/chunks/{standalone-CY57qwZ-.js → standalone-BDhPQtzQ.js} +386 -352
  44. package/chunks/{standalone-BDCwI6Hn.js → standalone-BGkmozIb.js} +1108 -953
  45. package/chunks/standalone-BMTCb10X.js +179 -0
  46. package/chunks/standalone-BXKRE_Se.js +468 -0
  47. package/chunks/standalone-Bes8srx1.js +354 -0
  48. package/chunks/standalone-BjZp0QMe.js +2 -0
  49. package/chunks/{standalone-BH5NqDwp.js → standalone-BlMIwpEe.js} +687 -573
  50. package/chunks/{standalone-CCNtaJ7s.js → standalone-C8ZAEutO.js} +44 -43
  51. package/chunks/standalone-C8qAelL4.js +2 -0
  52. package/chunks/standalone-CJvIXsQE.js +743 -0
  53. package/chunks/standalone-CLmGb7nn2.js +355 -0
  54. package/chunks/{ui-D1HQNIBy.js → standalone-CM5XcAN5.js} +15946 -17658
  55. package/chunks/standalone-CXNP6-xD.js +420 -0
  56. package/chunks/{standalone-BYm1UjLr.js → standalone-D5Q5ngsD.js} +59 -57
  57. package/chunks/standalone-DLlyRIE6.js +287 -0
  58. package/chunks/standalone-DMcI1afI.js +396 -0
  59. package/chunks/{standalone-jiz0L2Dg.js → standalone-DN4S1MjT.js} +1113 -1094
  60. package/chunks/{standalone-QJ1kKMnO.js → standalone-DT0wKji7.js} +2 -2
  61. package/chunks/{standalone-D5vnf-9y.js → standalone-DVTJwsTY.js} +1110 -1035
  62. package/chunks/standalone-DW6NT205.js +518 -0
  63. package/chunks/standalone-DYQIQH4c.js +2095 -0
  64. package/chunks/standalone-D__XCp-h.js +1003 -0
  65. package/chunks/standalone-XTgSsTAa.js +354 -0
  66. package/chunks/standalone-XuGksArp.js +68 -0
  67. package/chunks/{standalone-CNyNHKVx.js → standalone-we5D5MIn.js} +176 -172
  68. package/chunks/table.compiler-DMeeHxb6.js +222 -0
  69. package/chunks/useFieldName-Cjn9KCVp.js +7 -0
  70. package/chunks/useSlotProps-DLbQp4lc.js +166 -0
  71. package/chunks/{utils-Ba9T0TqC.js → utils-vdmi_2PK.js} +6266 -6517
  72. package/chunks/{src-DvX5LU9T.js → view-BuwQugKb.js} +2893 -5956
  73. package/chunks/visualization-filters-Cc4KU-l-.js +7455 -0
  74. package/chunks/web-components-DqClFkgO.js +1185 -0
  75. package/chunks/with-html-element-D0uY2zjI.js +7328 -0
  76. package/definitions.js +3 -3
  77. package/docs/operations/astrato-app-filter-bar.md +17 -17
  78. package/docs/operations/bar.md +1006 -1071
  79. package/docs/operations/combo.md +717 -738
  80. package/docs/operations/date-picker.md +27 -27
  81. package/docs/operations/distribution-gauge.md +471 -607
  82. package/docs/operations/dot.md +787 -879
  83. package/docs/operations/filter.md +139 -163
  84. package/docs/operations/gauge.md +491 -627
  85. package/docs/operations/heatMap.md +834 -916
  86. package/docs/operations/histogram.md +166 -180
  87. package/docs/operations/iframe.md +5 -5
  88. package/docs/operations/image.md +16 -16
  89. package/docs/operations/index.md +12 -12
  90. package/docs/operations/line.md +811 -888
  91. package/docs/operations/number.md +470 -536
  92. package/docs/operations/pie.md +825 -958
  93. package/docs/operations/radar.md +599 -679
  94. package/docs/operations/sankey.md +462 -584
  95. package/docs/operations/scatter.md +823 -929
  96. package/docs/operations/shape.md +34 -34
  97. package/docs/operations/simpleTextObject.md +18 -25
  98. package/docs/operations/slider.md +33 -43
  99. package/docs/operations/table.md +1177 -1150
  100. package/docs/operations/tree.md +404 -397
  101. package/docs/operations/treemap.md +595 -673
  102. package/docs/operations/waterfall.md +369 -379
  103. package/docs/operations/word-cloud.md +512 -583
  104. package/getters.js +7 -7
  105. package/index.js +3 -1183
  106. package/metadata.js +18 -18
  107. package/operations.js +13 -13
  108. package/package.json +133 -88
  109. package/render.js +10 -0
  110. package/src/charts/bar.d.ts +1 -0
  111. package/src/charts/combo.d.ts +1 -0
  112. package/src/charts/dot.d.ts +1 -0
  113. package/src/charts/gauge-distribution.d.ts +1 -0
  114. package/src/charts/gauge.d.ts +1 -0
  115. package/src/charts/heat-map.d.ts +1 -0
  116. package/src/charts/histogram.d.ts +1 -0
  117. package/src/charts/line.d.ts +1 -0
  118. package/src/charts/pie.d.ts +1 -0
  119. package/src/charts/radar.d.ts +1 -0
  120. package/src/charts/sankey.d.ts +1 -0
  121. package/src/charts/scatter.d.ts +1 -0
  122. package/src/charts/table.d.ts +1 -0
  123. package/src/charts/tree.d.ts +1 -0
  124. package/src/charts/treemap.d.ts +1 -0
  125. package/src/charts/waterfall.d.ts +1 -0
  126. package/src/charts/word-cloud.d.ts +1 -0
  127. package/src/definitions/index.d.ts +2 -2
  128. package/src/definitions/{shared/lib → model/definitions}/available-fields.d.ts +0 -1
  129. package/src/definitions/{shared/lib/compilers/index.d.ts → model/definitions/compilers/compile.d.ts} +1 -1
  130. package/src/definitions/model/definitions/data-item-resolution.d.ts +19 -0
  131. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1364 -0
  132. package/src/definitions/model/definitions/descriptors/json-schema.d.ts +2 -0
  133. package/src/definitions/model/definitions/diagnostics.d.ts +5 -0
  134. package/src/definitions/model/definitions/field-suggestions.d.ts +2 -0
  135. package/src/definitions/model/definitions/index.d.ts +23 -0
  136. package/src/definitions/{shared/lib → model/definitions}/registry/compile.d.ts +1 -1
  137. package/src/definitions/model/definitions/registry/descriptor-registry.d.ts +3 -0
  138. package/src/definitions/model/definitions/schema-registry.d.ts +660 -0
  139. package/src/definitions/{shared/lib → model/definitions}/schemas/broad-chart.schema.d.ts +1 -1
  140. package/src/definitions/{shared/lib → model/definitions}/schemas/common.schema.d.ts +0 -1
  141. package/src/definitions/model/definitions/schemas/index.d.ts +9 -0
  142. package/src/definitions/{shared/lib → model/definitions}/schemas/object.schema.d.ts +8 -8
  143. package/src/definitions/{shared/lib → model/definitions}/types/compilation.types.d.ts +10 -0
  144. package/src/definitions/{shared/lib → model/definitions}/types/definition.types.d.ts +1 -1
  145. package/src/definitions/model/definitions/types/index.d.ts +3 -0
  146. package/src/definitions/{shared/lib/registry → model/definitions}/validation.d.ts +1 -1
  147. package/src/getters/index.d.ts +3 -3
  148. package/src/index.d.ts +1 -1
  149. package/src/objects/app-filter-bar.d.ts +1 -0
  150. package/src/objects/date-picker.d.ts +1 -0
  151. package/src/objects/filter.d.ts +1 -0
  152. package/src/objects/iframe.d.ts +1 -0
  153. package/src/objects/image.d.ts +1 -0
  154. package/src/objects/number.d.ts +1 -0
  155. package/src/objects/shape.d.ts +1 -0
  156. package/src/objects/slider.d.ts +1 -0
  157. package/src/objects/text.d.ts +1 -0
  158. package/src/operations/index.d.ts +3 -3
  159. package/src/registry/create-visualization-registry.d.ts +5 -0
  160. package/src/render/index.d.ts +34 -0
  161. package/src/runtime/index.d.ts +2 -2
  162. package/src/types.d.ts +9 -4
  163. package/src/web-components/index.d.ts +3 -3
  164. package/chunks/Radio-Ciu-F4CU.js +0 -957
  165. package/chunks/ToggleButton-BCJc3Jlc.js +0 -153
  166. package/chunks/_baseFlatten-DPXPOrea.js +0 -7076
  167. package/chunks/app-filter-bar.compiler-j_CVoWTa.js +0 -55
  168. package/chunks/bar.compiler-oqaPzIut.js +0 -370
  169. package/chunks/coloring-C16AUZEi.js +0 -663
  170. package/chunks/data-item-resolution-1lvYB5ln.js +0 -53
  171. package/chunks/event-bus-KiSiCJrC.js +0 -2683
  172. package/chunks/events-WZut5Ow6.js +0 -4
  173. package/chunks/filter.compiler-CuLtc_02.js +0 -60
  174. package/chunks/filtering-Yq4DEa0t.js +0 -953
  175. package/chunks/gauge-target-type-BkKXAqkX.js +0 -4
  176. package/chunks/grouping-type-BX_9Ix5q.js +0 -3
  177. package/chunks/interfaces-VUY4_yVO.js +0 -8742
  178. package/chunks/line-settings-DfYTUyPz.js +0 -4
  179. package/chunks/line.compiler-BpA_6Tc7.js +0 -188
  180. package/chunks/number.compiler-DbkWcG4S.js +0 -44
  181. package/chunks/pie-uv42Eqal.js +0 -10
  182. package/chunks/requirements-DNhuShLS.js +0 -6
  183. package/chunks/shared-CKDL4hx9.js +0 -1171
  184. package/chunks/src-Cum_2NLV.js +0 -12145
  185. package/chunks/src-Dun_jXtz.js +0 -10295
  186. package/chunks/standalone-87YV_m9n.js +0 -687
  187. package/chunks/standalone-BLVAWLNJ.js +0 -385
  188. package/chunks/standalone-BPomtAVs.js +0 -2
  189. package/chunks/standalone-BXyBcUOQ.js +0 -2
  190. package/chunks/standalone-BllF4rDp.js +0 -383
  191. package/chunks/standalone-BmfMt74U.js +0 -726
  192. package/chunks/standalone-BqWyrnZI.js +0 -281
  193. package/chunks/standalone-C85u7U6I.js +0 -340
  194. package/chunks/standalone-CDQnr6qT.js +0 -345
  195. package/chunks/standalone-CZynjFG7.js +0 -12979
  196. package/chunks/standalone-DFPva_ku.js +0 -299
  197. package/chunks/standalone-DQxxNwF8.js +0 -675
  198. package/chunks/standalone-DS9T0FZ-.js +0 -830
  199. package/chunks/standalone-Dx3MLlrO.js +0 -512
  200. package/chunks/standalone-DzixzZAL.js +0 -411
  201. package/chunks/standalone-lBm9hQ-q.js +0 -179
  202. package/chunks/standalone-rJ45Zfl1.js +0 -68
  203. package/chunks/table.compiler-BrXkm4Fz.js +0 -213
  204. package/chunks/toInteger-DVZr-D1j.js +0 -11
  205. package/chunks/treemap-x_zmJoG7.js +0 -23
  206. package/chunks/types-dVVCsDWD.js +0 -4
  207. package/chunks/useFieldName-oqQ3bvnO.js +0 -7
  208. package/chunks/view-CLqWMV7Z.js +0 -156
  209. package/src/definitions/shared/index.d.ts +0 -5
  210. package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +0 -587
  211. package/src/definitions/shared/lib/registry/index.d.ts +0 -3
  212. package/src/definitions/shared/lib/schemas/index.d.ts +0 -9
  213. package/src/definitions/shared/lib/types/index.d.ts +0 -3
  214. package/src/definitions/{shared/lib → model/definitions}/schemas/app-filter-bar.schema.d.ts +0 -0
  215. package/src/definitions/{shared/lib → model/definitions}/schemas/bar.schema.d.ts +0 -0
  216. package/src/definitions/{shared/lib → model/definitions}/schemas/filter.schema.d.ts +0 -0
  217. package/src/definitions/{shared/lib → model/definitions}/schemas/line.schema.d.ts +0 -0
  218. package/src/definitions/{shared/lib → model/definitions}/schemas/number.schema.d.ts +0 -0
  219. package/src/definitions/{shared/lib → model/definitions}/schemas/table.schema.d.ts +4 -4
  220. /package/src/definitions/{shared/lib → model/definitions}/types/descriptor.types.d.ts +0 -0
@@ -1,675 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { Do as t, La as n, No as r, Oa as i, Pn as a, Po as o, Ta as s, Ti as c, Xs as l, Ya as u, cc as d, jo as f, oo as p, pc as m, qs as h, r as g, sa as _, ti as v, ui as y, wa as b } from "./interfaces-VUY4_yVO.js";
3
- import { I as x, Ki as S, P as C, Zt as w, d as T, o as E, pn as ee, wi as D } from "./utils-Ba9T0TqC.js";
4
- import { $ as O, $t as k, At as A, Bt as j, Ct as M, Dt as N, Ft as P, H as te, It as F, Jt as ne, M as re, Mt as ie, Nt as ae, Ot as I, Qt as L, R, St as z, Tt as oe, U as B, W as V, Wt as H, X as se, Xt as ce, Yt as le, Z as ue, Zt as de, _t as fe, an as pe, ht as U, i as me, in as W, j as he, jt as ge, ln as _e, n as ve, nn as ye, nt as be, on as xe, ot as Se, q as Ce, rn as G, un as K, yt as we, z as Te, zt as Ee } from "./escobar-BGqT1EsE.js";
5
- import { t as De } from "./coloring-C16AUZEi.js";
6
- import { t as Oe } from "./set-coloring-datafield-B3uIS1Pe.js";
7
- var ke = /* @__PURE__ */ e(S()), Ae = (e, t, i, a, o, s, l, u) => {
8
- let d = [], f = [], p = e.measures.filter((e) => c(e)), m = {
9
- ...t.axis.measure,
10
- ...t.fonts
11
- }, h = [];
12
- if (u) {
13
- let e = F(K.Text, u);
14
- h.push(e);
15
- }
16
- let g = p.filter((e) => e.role === n.SCATTER_HORIZONTAL), _ = p.filter((e) => e.role === n.SCATTER_VERTICAL), y = e.measures.filter((e) => e.role === n.SCATTER_HORIZONTAL), b = e.measures.filter((e) => e.role === n.SCATTER_VERTICAL), x = g[0], S = _[0], C = {};
17
- if (x) {
18
- let t = r.Bottom, n = e.axes?.primaryMeasure || C;
19
- if (d.push(Ee(L.XAxisScale, n, m, t, x.formatter)), e.axes?.primaryMeasure?.showAxisName) {
20
- let r = v(y, e.enableAlternate, s?.isPrintMode);
21
- f.push(j(g, r, t, m, n.colors?.title, n.axisTitle, n.titleFontSize));
22
- }
23
- }
24
- if (S) {
25
- let t = r.Left, n = e.axes?.secondaryMeasure || C;
26
- if (d.push(Ee(L.YAxisScale, n, m, t, S.formatter)), e.axes?.secondaryMeasure?.showAxisName) {
27
- let r = v(b, e.enableAlternate, s?.isPrintMode);
28
- f.push(j(_, r, t, m, n.colors?.title, n.axisTitle, n.titleFontSize));
29
- }
30
- }
31
- return {
32
- ...i,
33
- components: [
34
- ...i.components,
35
- ...d,
36
- ...f
37
- ],
38
- interactions: i.interactions ? [...i.collections, ...h] : [...h]
39
- };
40
- }, je = (e, t) => {
41
- let r = e.dimensions.filter((e) => c(e)), i = e.measures.filter((e) => c(e)), a = r.filter((e) => e.role === u.SCATTER_DIMENSION), o = i.filter((e) => e.role === n.SCATTER_SIZE), s = a[0], d = o[0], { coloring: f } = e || {};
42
- switch (f?.type) {
43
- case l.Categorical: return M(e, t);
44
- case l.Gradient: return oe(e, d);
45
- case l.Single: return m(s.dataItem);
46
- default: return null;
47
- }
48
- }, Me = (e, t, r, i, o, s, d) => {
49
- let f = e.dimensions.filter((e) => c(e)), p = e.measures.filter((e) => c(e)), h = f.filter((e) => e.role === u.SCATTER_DIMENSION), v = p.filter((e) => e.role === n.SCATTER_HORIZONTAL), y = p.filter((e) => e.role === n.SCATTER_VERTICAL), x = p.filter((e) => e.role === n.SCATTER_SIZE), S = h[0], C = v[0], w = y[0], T = x[0], E = {}, { coloring: D } = e || {}, O = f.length < 2 && e.scatterSettings?.spatialHeatmap?.show, k = O && !D?.fieldId ? null : je(e, d);
50
- switch (D?.type) {
51
- case l.Categorical:
52
- E = z(Oe(e, k), t, E, null, d);
53
- break;
54
- case l.Gradient:
55
- E = z(Oe(e, k), t, E, null, d);
56
- break;
57
- case l.Single: {
58
- let n = m(S.dataItem);
59
- E[l.Single] = {
60
- data: { extract: { field: n } },
61
- range: [e?.coloring?.color ?? t.colors.brandColors[0]],
62
- type: W.CategoricalColor,
63
- label: (e) => S?.formatter?.format ? ee(S.formatter, e.datum.value) : e.datum.label
64
- };
65
- break;
66
- }
67
- default: break;
68
- }
69
- if (O) {
70
- E[L.Density] = {
71
- data: k ? { field: k } : void 0,
72
- min: 0,
73
- max: (t) => (t.data?.fields?.[0] ? t.data.fields[0].max() : 1) * a(e.scatterSettings.spatialHeatmap.maxDensity ?? _.heatmapMaxDensity),
74
- nice: !0
75
- }, E[L.DensityInverted] = {
76
- ...E[L.Density],
77
- invert: !0
78
- };
79
- let n = [...g(D.type, t), ...D.customGradient ? [D.customGradient] : []].find((e) => e.id === (D.palette ?? t.colors.defaultGradient ?? b.id))?.colors;
80
- E[L.DensityGradient] = {
81
- ...E[L.Density],
82
- range: n ?? b.colors,
83
- type: W.SequentialColor
84
- }, k && U(r, 0, { density: { field: k } });
85
- } else k && U(r, 0, { color: { field: k } });
86
- let A = m(C?.dataItem), j = m(w?.dataItem), M = m(T?.dataItem), N = te(e?.axes?.primaryMeasure?.axisRange, !0), P = V(N);
87
- E[L.XAxisScale] = {
88
- type: W.Linear,
89
- data: { field: A },
90
- invert: B(!1, e?.axes?.primaryMeasure),
91
- nice: !P && xe.scale.nice,
92
- expandMax: .06,
93
- ...N
94
- };
95
- let F = te(e?.axes?.secondaryMeasure?.axisRange, !0), ne = V(F);
96
- return E[L.YAxisScale] = {
97
- type: W.Linear,
98
- data: { fields: [j] },
99
- invert: B(!0, e?.axes?.secondaryMeasure),
100
- nice: !ne && xe.scale.nice,
101
- expandMax: .06,
102
- ...F
103
- }, T && (E[M] = {
104
- type: W.Linear,
105
- data: { field: M }
106
- }), {
107
- ...r,
108
- scales: E
109
- };
110
- }, q = "spatial-heatmap", Ne = "shape", J = (e) => {
111
- let n = e.scatterSettings?.shape ?? t.Circle;
112
- return `${K.Point}-${n}`;
113
- }, Pe = (e, t, r, i, a, o) => {
114
- let s = e.dimensions.filter((e) => c(e)), l = e.measures.filter((e) => c(e)), d = re((e.supportingMeasures ?? []).filter((e) => c(e))), f = s.filter((e) => e.role === u.SCATTER_IMAGE), p = l.filter((e) => e.role === n.SCATTER_HORIZONTAL), h = l.filter((e) => e.role === n.SCATTER_VERTICAL), g = l.filter((e) => e.role === n.SCATTER_SIZE), _ = f[0], v = p[0], y = h[0], b = g[0], x = m(v?.dataItem), S = m(y?.dataItem);
115
- U(r, 0, {
116
- x: { field: x },
117
- y: { field: S },
118
- [x]: { field: x },
119
- [S]: { field: S },
120
- ...d
121
- });
122
- let C = e.scatterSettings?.pointSize ?? .1, w = {};
123
- if (b) {
124
- let t = m(b.dataItem);
125
- w = { field: t }, C = (t) => {
126
- let n = e.scatterSettings?.pointSize ?? 0, r = e.scatterSettings?.maxPointSize ?? Math.max(n, 1);
127
- return t.resources.scale(m(b.dataItem))(t.datum.size.value) * (r - n) + n;
128
- }, U(r, 0, {
129
- size: w,
130
- [t]: { field: t }
131
- });
132
- }
133
- let T;
134
- return _ ? (U(r, 0, { imageUrl: { field: m(_.dataItem) } }), T = [Fe(e, t, C, o, !0, a), Le(e, C, o)]) : T = e.scatterSettings?.spatialHeatmap?.show ? [Ie(e, t, r, C, o, a)] : [Fe(e, t, C, o, !1, a)], {
135
- ...r,
136
- components: [...r.components, ...T]
137
- };
138
- }, Fe = (e, n, r, i, a, o) => {
139
- let s = new De(e, n, o?.[0]?.itemsNotAffectedByFiltering), c = e.scatterSettings?.shape ?? t.Circle, l = e.scatterSettings?.stroke;
140
- return {
141
- type: K.Point,
142
- layout: { displayOrder: P.VisualizationElement },
143
- key: J(e),
144
- data: { collection: L.Collection },
145
- animations: {
146
- enabled: !a,
147
- presetId: "scatter-chart"
148
- },
149
- settings: {
150
- x: {
151
- scale: L.XAxisScale,
152
- ref: "x"
153
- },
154
- y: {
155
- scale: L.YAxisScale,
156
- ref: "y"
157
- },
158
- opacity: a ? 0 : .8,
159
- stroke: l?.color,
160
- strokeWidth: l?.enabled ? l.width : 0,
161
- shape: c,
162
- size: r,
163
- fill: a ? "transparent" : s.getColorDefinition({
164
- overwriteSources: [s.MAIN_FIELD, "color"],
165
- ref: "color"
166
- }),
167
- tag: Ne
168
- },
169
- brush: a ? null : H([""], i, { valuePickerMode: i?.valuePickerMode })
170
- };
171
- }, Ie = (e, t, n, r, i, a) => {
172
- let o = n.scales[L.Density]?.data, s = n.collections?.[0]?.data?.extract?.[0]?.props?.density?.field && o?.field ? {
173
- scale: L.Density,
174
- ref: "density"
175
- } : {
176
- scale: L.Density,
177
- fn: ({ scale: e }) => e(1)
178
- };
179
- return {
180
- type: K.Heatmap,
181
- layout: { displayOrder: P.VisualizationElement },
182
- key: "spatial-heatmap",
183
- animations: a?.[0]?.items?.length < 1e3 ? { enabled: !0 } : void 0,
184
- data: { collection: L.Collection },
185
- settings: {
186
- point: {
187
- x: {
188
- scale: L.XAxisScale,
189
- ref: "x"
190
- },
191
- y: {
192
- scale: L.YAxisScale,
193
- ref: "y"
194
- },
195
- size: r,
196
- density: s
197
- },
198
- gradient: L.DensityGradient,
199
- blur: e.scatterSettings.spatialHeatmap.blur,
200
- minOpacity: 1e-4
201
- },
202
- brush: i?.disable?.brushing ? void 0 : { consume: [{
203
- context: G.Selection,
204
- data: [""],
205
- mode: _e.And,
206
- style: { inactive: { opacity: .1 } }
207
- }] }
208
- };
209
- }, Le = (e, t, n) => ({
210
- type: K.DomPoint,
211
- layout: { displayOrder: P.VisualizationElement },
212
- key: K.DomPoint,
213
- data: { collection: L.Collection },
214
- settings: {
215
- x: {
216
- scale: L.XAxisScale,
217
- ref: "x"
218
- },
219
- y: {
220
- scale: L.YAxisScale,
221
- ref: "y"
222
- },
223
- opacity: .8,
224
- size: t,
225
- url: { ref: "imageUrl" },
226
- renderCallback: (...e) => {
227
- e.length === 0 && n.onRenderDone();
228
- },
229
- borderWidth: e.scatterSettings?.borderWidth,
230
- borderColor: e.scatterSettings?.borderColor
231
- },
232
- brush: H([""], n, { valuePickerMode: n?.valuePickerMode })
233
- }), Re = (e, t, n) => {
234
- let { measures: r, grid: i = [] } = e, a = i.filter((e) => e.enabled).map((e) => {
235
- let n = d(r[0].dataItem, e.dataItem);
236
- return we(e, n ? "x" : "y", n ? L.XAxisScale : L.YAxisScale, t);
237
- }).filter((e) => !!e);
238
- return {
239
- ...n,
240
- components: [...n.components, ...a]
241
- };
242
- }, ze = (e, t, n) => {
243
- let r = [], i = [];
244
- if (!e.refLines?.x && !e.refLines?.y) return n;
245
- if (e.refLines.x) {
246
- let n = e.refLines.x.map((e) => Se(e, L.XAxisScale, t));
247
- r.push(...n);
248
- }
249
- if (e.refLines.y) {
250
- let n = e.refLines.y.map((e) => Se(e, L.YAxisScale, t));
251
- i.push(...n);
252
- }
253
- let a = {
254
- type: K.RefLine,
255
- layout: { displayOrder: P.RefLine },
256
- lines: {
257
- x: r,
258
- y: i
259
- }
260
- };
261
- return {
262
- ...n,
263
- components: [...n.components, a]
264
- };
265
- }, Be = "scatter-reference-areas", Y = "scatter-reference-area", Ve = y("scatter-reference-areas-stage", "#6B7280"), X = (e) => {
266
- if (e == null) return null;
267
- let t = a(e);
268
- if (t === null) return null;
269
- let n = typeof t == "number" ? t : Number(t);
270
- return Number.isNaN(n) ? null : n;
271
- }, He = (e) => {
272
- if (e == null) return;
273
- let t = a(e);
274
- if (t === null || typeof t != "string") return;
275
- let n = t.trim();
276
- return n.length > 0 ? n : void 0;
277
- }, Ue = (e, t) => {
278
- if (e.enabled === !1) return;
279
- let n = X(e.xMin), r = X(e.xMax), i = X(e.yMin), a = X(e.yMax);
280
- if (n === null || r === null || i === null || a === null) {
281
- Ve.warn("Skipping reference area due to incomplete bounds", {
282
- id: e.id,
283
- index: t
284
- });
285
- return;
286
- }
287
- let o = He(e.label), s = e.fillColor ?? _.referenceArea.fillColor, c = e.border?.enabled ?? _.referenceArea.border?.enabled ?? !1, l = c ? e.border?.color ?? _.referenceArea.border?.color ?? void 0 : void 0, u = c ? e.border?.width ?? _.referenceArea.border?.width ?? 1 : void 0, [d, f] = n <= r ? [n, r] : [r, n], [p, m] = i <= a ? [i, a] : [a, i], h = e.labelMode ?? _.referenceArea.labelMode, g = e.labelPlacement ?? _.referenceArea.labelPlacement, v = e.labelColor ?? _.referenceArea.labelColor, y = e.labelFontSize ?? _.referenceArea.labelFontSize;
288
- return {
289
- id: e.id,
290
- label: o,
291
- labelMode: h,
292
- labelPlacement: g,
293
- labelColor: v,
294
- labelFontSize: y,
295
- xMin: d,
296
- xMax: f,
297
- yMin: p,
298
- yMax: m,
299
- fillColor: s,
300
- borderColor: l,
301
- borderWidth: u
302
- };
303
- }, We = (e) => {
304
- let t = {
305
- id: { value: e.id },
306
- labelMode: { value: e.labelMode },
307
- labelPlacement: { value: e.labelPlacement },
308
- labelColor: { value: e.labelColor },
309
- labelFontSize: { value: e.labelFontSize },
310
- start: { value: e.yMin },
311
- end: { value: e.yMax },
312
- binStart: { value: e.xMin },
313
- binEnd: { value: e.xMax },
314
- xMin: { value: e.xMin },
315
- xMax: { value: e.xMax },
316
- yMin: { value: e.yMin },
317
- yMax: { value: e.yMax },
318
- fillColor: { value: e.fillColor }
319
- };
320
- return e.label && (t.label = { value: e.label }), e.borderColor && (t.borderColor = { value: e.borderColor }), typeof e.borderWidth == "number" && (t.borderWidth = { value: e.borderWidth }), t;
321
- }, Ge = (e) => {
322
- switch (e) {
323
- case f.TopLeft: return {
324
- align: 0,
325
- justify: 0
326
- };
327
- case f.Top: return {
328
- align: .5,
329
- justify: 0
330
- };
331
- case f.TopRight: return {
332
- align: 1,
333
- justify: 0
334
- };
335
- case f.Left: return {
336
- align: 0,
337
- justify: .5
338
- };
339
- case f.Right: return {
340
- align: 1,
341
- justify: .5
342
- };
343
- case f.BottomLeft: return {
344
- align: 0,
345
- justify: 1
346
- };
347
- case f.Bottom: return {
348
- align: .5,
349
- justify: 1
350
- };
351
- case f.BottomRight: return {
352
- align: 1,
353
- justify: 1
354
- };
355
- case f.Center:
356
- default: return {
357
- align: .5,
358
- justify: .5
359
- };
360
- }
361
- }, Ke = (e, t, n) => {
362
- if (e.labelMode !== p.Fixed || !e.label) return null;
363
- let { align: r, justify: i } = Ge(e.labelPlacement), a = _.referenceArea.labelColor, o = _.referenceArea.labelFontSize, s = e.labelColor ?? a, c = e.labelFontSize ?? o;
364
- return {
365
- type: K.Labels,
366
- key: `${Y}-${e.id}-label`,
367
- layout: { displayOrder: t },
368
- settings: { sources: [{
369
- component: `${Y}-${e.id}`,
370
- selector: ye.Rect,
371
- strategy: {
372
- type: "rows",
373
- settings: {
374
- align: r,
375
- justify: i,
376
- fontSize: c,
377
- fontFamily: n.fonts?.general?.fontFamily,
378
- padding: 2,
379
- labels: [{
380
- label: () => e.label ?? "",
381
- fill: s
382
- }]
383
- }
384
- }
385
- }] },
386
- animations: { enabled: !1 },
387
- brush: null
388
- };
389
- }, qe = (e, t, n) => {
390
- let r = {
391
- orientation: o.Vertical,
392
- major: {
393
- scale: L.XAxisScale,
394
- ref: "binEnd",
395
- binStart: { ref: "binStart" },
396
- binEnd: { ref: "binEnd" }
397
- },
398
- minor: {
399
- scale: L.YAxisScale,
400
- ref: "end"
401
- },
402
- minor0: {
403
- scale: L.YAxisScale,
404
- ref: "start"
405
- },
406
- box: {
407
- fill: e.fillColor ?? _.referenceArea.fillColor,
408
- opacity: 1,
409
- stroke: e.borderColor ?? "transparent",
410
- strokeWidth: e.borderWidth ?? 0,
411
- ignoreOutOfBounds: !0
412
- }
413
- };
414
- return {
415
- type: K.Box,
416
- key: `${Y}-${e.id}`,
417
- layout: { displayOrder: t },
418
- data: {
419
- collection: Be,
420
- filter: (e, t) => t === n
421
- },
422
- settings: r,
423
- animations: { enabled: !1 },
424
- brush: null
425
- };
426
- }, Je = (e, t, n) => {
427
- let r = e.referenceAreas ?? [];
428
- if (!r.length) return n;
429
- let i = r.map(Ue).filter((e) => e !== void 0);
430
- if (!i.length) return n;
431
- let a = i.map(We), o = n.collections ? [...n.collections] : [];
432
- o.push({
433
- key: Be,
434
- data: {
435
- items: a,
436
- map: ({ value: e }) => e,
437
- extract: []
438
- }
439
- });
440
- let s = n.components ? [...n.components] : [], c = i.length;
441
- return i.forEach((e, n) => {
442
- let r = P.ReferenceArea + (c - n) * .001, i = qe(e, r, n);
443
- s.push(i);
444
- let a = Ke(e, r + 5e-4, t);
445
- a && s.push(a);
446
- }), {
447
- ...n,
448
- collections: o,
449
- components: s
450
- };
451
- }, Ye = (e, t, n) => {
452
- let r = t.data.value, i = e.filter((e) => c(e)).filter((e) => e.role === u.SCATTER_DIMENSION)[0];
453
- return i?.formatter && (r = n.formatter(i.formatter)(r)), `${r}`;
454
- }, Z = (e) => typeof e == "string" && e.startsWith("scatter-reference-area") && !e.endsWith("-label"), Q = (e) => {
455
- let t = e.data?.labelMode;
456
- if (typeof t == "string") return t;
457
- if (t && typeof t == "object" && "value" in t) {
458
- let e = t.value;
459
- if (typeof e == "string") return e;
460
- }
461
- }, $ = (e) => {
462
- let t = e.data?.label, n;
463
- if (typeof t == "string") n = t;
464
- else if (t && typeof t == "object" && t && "value" in t) {
465
- let e = t.value;
466
- n = typeof e == "string" ? e : void 0;
467
- }
468
- if (!n) return;
469
- let r = n.trim();
470
- return r.length > 0 ? r : void 0;
471
- }, Xe = (e) => ({
472
- title: e,
473
- props: []
474
- }), Ze = (e, t, n) => {
475
- let r = {
476
- filter: (t) => {
477
- let n = [
478
- J(e),
479
- R,
480
- q
481
- ];
482
- return t.filter((e) => e.key ? Z(e.key) ? Q(e) !== p.Fixed && !!$(e) : n.includes(e.key) : !1);
483
- },
484
- placement: {
485
- type: "pointer",
486
- area: "target"
487
- }
488
- };
489
- if (n.components.find((e) => e.key === "spatial-heatmap")) {
490
- let e = ({ node: e, resources: t }) => ({
491
- title: e.data.label,
492
- props: [
493
- "x",
494
- "y",
495
- "size",
496
- "density"
497
- ].filter((t) => !!e.data[t]?.source?.field).map((n) => ({
498
- label: t.dataset("").field(e.data[n].source.field)?.title(),
499
- value: e.data[n].label
500
- }))
501
- });
502
- r.extract = (t) => {
503
- if (Z(t.node.key)) {
504
- let e = $(t.node), n = Q(t.node);
505
- if (e && n !== p.Fixed) return Xe(e);
506
- }
507
- return e(t);
508
- };
509
- let t = O();
510
- r.content = ({ h: e, data: n }) => {
511
- if (n.length > 8) {
512
- let e = n.length;
513
- n = n.slice(0, 5), n.push({
514
- title: `+ ${e - n.length} more`,
515
- props: []
516
- });
517
- }
518
- return t({
519
- h: e,
520
- data: n
521
- });
522
- };
523
- } else {
524
- let n = ue(e, t, be, Ye);
525
- r.extract = (e) => {
526
- if (Z(e.node.key)) {
527
- let t = $(e.node), n = Q(e.node);
528
- if (t && n !== p.Fixed) return Xe(t);
529
- }
530
- return n(e);
531
- };
532
- }
533
- return se(e, t, n, r, "tooltip", void 0, {
534
- componentKeys: [J(e)],
535
- yieldToComponentKeys: [R, q]
536
- });
537
- }, Qe = (e, t, n) => {
538
- let r = e?.measures[0], i = {
539
- showAxisTooltip: e?.axes?.primaryMeasure?.showAxisTooltip,
540
- formatter: r?.formatter,
541
- scale: le(e),
542
- key: I.Measure,
543
- settings: { direction: A(e) }
544
- }, a = e?.measures[1], [o, s] = ae([i, {
545
- showAxisTooltip: e?.axes?.secondaryMeasure?.showAxisTooltip,
546
- formatter: a?.formatter,
547
- scale: ce(e, a),
548
- key: I.MeasureSec,
549
- settings: {
550
- direction: ie(e),
551
- labelDock: ge(de(e), a?.secondaryAxis)
552
- }
553
- }]);
554
- return {
555
- ...n,
556
- components: [...n.components ?? [], ...o],
557
- interactions: [...n.interactions ?? [], ...s]
558
- };
559
- }, $e = (e, t, n) => Ce(e, t, n), et = (e) => {
560
- try {
561
- return !!e && k(e);
562
- } catch {
563
- return !1;
564
- }
565
- }, tt = (e, t, n, r, a, o) => {
566
- if (o?.disable?.brushing || o?.disable?.brushingLasso) return n;
567
- let s = et(t?.colors?.sheetBackgroundColor) ? i.white : i.mainDarkNavy, c = e.scatterSettings?.lasso, l = c?.strokeColor ?? s, u = {
568
- type: K.Lasso,
569
- key: K.Lasso,
570
- layout: { displayOrder: P.VisualizationElement + 1 },
571
- settings: {
572
- brush: { components: [{
573
- key: J(e),
574
- contexts: [G.Selection],
575
- action: "toggle"
576
- }, {
577
- key: q,
578
- contexts: [G.Selection],
579
- action: "toggle"
580
- }] },
581
- lasso: {
582
- strokeWidth: 2,
583
- strokeDasharray: "4",
584
- stroke: l
585
- },
586
- snapIndicator: { stroke: l },
587
- startPoint: {
588
- r: 3,
589
- fill: c?.startPointColor ?? i.secondaryPurple,
590
- stroke: l
591
- }
592
- }
593
- }, d = {
594
- type: "native",
595
- key: `${K.Lasso}-interaction`,
596
- events: {
597
- mousedown(e) {
598
- this.chart.component(K.Lasso).emit("lassoStart", { center: {
599
- x: e.clientX,
600
- y: e.clientY
601
- } });
602
- },
603
- mousemove(e) {
604
- this.chart.component(K.Lasso).emit("lassoMove", { center: {
605
- x: e.clientX,
606
- y: e.clientY
607
- } });
608
- },
609
- mouseup(e) {
610
- this.chart.component(K.Lasso).emit("lassoEnd", { center: {
611
- x: e.clientX,
612
- y: e.clientY
613
- } });
614
- }
615
- }
616
- };
617
- return {
618
- ...n,
619
- components: [...n.components, u],
620
- interactions: [...n.interactions, d]
621
- };
622
- }, nt = (e, t, n, r, i, a) => {
623
- let o = e.scatterSettings?.spatialHeatmap?.show && e.dimensions.length < 2;
624
- if (!e.pointLabeling?.enabled || o) return n;
625
- let s = e.pointLabeling, c = 4 + (e.scatterSettings?.stroke?.enabled ? e.scatterSettings.stroke.width / 2 : 0), l = Te({
626
- targetComponentKeys: [J(e)],
627
- targetSelector: `.${Ne}`,
628
- offset: c,
629
- fontSize: ne(e.pointLabeling?.fontSize)
630
- }, s, a, t);
631
- return {
632
- ...n,
633
- components: [...n.components, l]
634
- };
635
- }, rt = (...e) => {
636
- let t = fe(...e), n = t.components.find((e) => e.type === pe.SequentialLegend), i = t.scales[L.Density];
637
- return n && i && (n.settings.fill = L.DensityGradient, n.settings.major = [r.Left, r.Right].includes(n.layout.dock) ? L.DensityInverted : L.Density), t;
638
- }, it = class extends he {
639
- constructor() {
640
- super([
641
- N,
642
- Me,
643
- Re,
644
- Je,
645
- Pe,
646
- Ae,
647
- ze,
648
- rt,
649
- $e,
650
- nt,
651
- Ze,
652
- tt,
653
- Qe
654
- ]);
655
- }
656
- preCompile(e) {
657
- let t = e.dimensions.filter((e) => c(e)), r = e.measures.filter((e) => c(e)), i = t.filter((e) => e.role === u.SCATTER_DIMENSION), a = r.filter((e) => e.role === n.SCATTER_HORIZONTAL), o = r.filter((e) => e.role === n.SCATTER_VERTICAL), s = i[0], l = a[0], d = o[0];
658
- if (!s || !l || !d) throw Error("Scatter chart requires at least 1 scatter dimension, 1 horizontal measure, and 1 vertical measure.");
659
- }
660
- }, at = D(), ot = w(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
661
- let a = C(), [o] = (0, ke.useState)(() => new it()), c = T(), { activeKey: l } = E(), u = x(), d = {
662
- ...i,
663
- valuePickerMode: !!l
664
- }, f = t || s, p = o.compile(e, f, n, r, {
665
- ...d,
666
- onRenderDone: c
667
- }, h.Scatter, a, u, ve());
668
- return p ? /* @__PURE__ */ (0, at.jsx)(me, {
669
- config: d,
670
- definition: p,
671
- size: r,
672
- vSpec: e
673
- }) : null;
674
- });
675
- export { ot as ScatterChart };