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