@astrato-io/visualizations 0.6.4 → 0.6.5

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 (149) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/THIRD_PARTY_NOTICES.md +94 -4
  3. package/chunks/ClickAwayListener-BbeNMAvj.js +52 -0
  4. package/chunks/{LinearProgress-CUZ0D8_t.js → LinearProgress-B1FeWaen.js} +54 -54
  5. package/chunks/app-filter-bar.compiler-BGJ7HAbr.js +64 -0
  6. package/chunks/bar.compiler-CT0ZbQKc.js +374 -0
  7. package/chunks/{src-Cum_2NLV.js → builder-B6dWSIdD.js} +5779 -5635
  8. package/chunks/{coloring-C16AUZEi.js → coloring-B1XAfg6b.js} +234 -233
  9. package/chunks/{src-BC7cGcJ-.js → definitions-D3OVqmXl.js} +438 -360
  10. package/chunks/{escobar-BGqT1EsE.js → escobar-eDjtGpkC.js} +4645 -4619
  11. package/chunks/filter.compiler-DBsyRBJt.js +70 -0
  12. package/chunks/{filtering-Yq4DEa0t.js → filtering-tqjAyJH5.js} +432 -313
  13. package/chunks/{grouping-type-BX_9Ix5q.js → grouping-type-On4s9Thj.js} +1 -1
  14. package/chunks/handlers-VTBfIZYZ.js +13072 -0
  15. package/chunks/isEqual-BDxAhUo8.js +7514 -0
  16. package/chunks/line.compiler-CzdM5Ld0.js +198 -0
  17. package/chunks/{metadata-CPXdYoln.js → metadata-BGElBy5Z.js} +1 -1
  18. package/chunks/number.compiler-G-R7y16P.js +53 -0
  19. package/chunks/{src-C0LgoUWY.js → operations-CTNUX6Sy.js} +9576 -9432
  20. package/chunks/{range-DrzdfBX4.js → range-CiwTbMig.js} +2 -2
  21. package/chunks/{registry-CExpGJ1N.js → registry-CsQQzukD.js} +153 -153
  22. package/chunks/{requirements-DNhuShLS.js → requirements-DYjZCFyf.js} +1 -1
  23. package/chunks/{shared-CKDL4hx9.js → shared-CBvcC5YV.js} +460 -413
  24. package/chunks/{standalone-D5vnf-9y.js → standalone-0M4HlmDW2.js} +823 -822
  25. package/chunks/standalone-0ashe9w1.js +411 -0
  26. package/chunks/{standalone-C85u7U6I.js → standalone-B7jax8wa.js} +93 -94
  27. package/chunks/standalone-BK0VYU-l.js +463 -0
  28. package/chunks/{standalone-BDCwI6Hn.js → standalone-BMIbT1b2.js} +815 -815
  29. package/chunks/standalone-BZV5vOwA.js +6 -0
  30. package/chunks/standalone-BhDrWj4p.js +1980 -0
  31. package/chunks/{standalone-CNyNHKVx.js → standalone-BtSHCp2U2.js} +97 -98
  32. package/chunks/{standalone-CDQnr6qT.js → standalone-BvaKdky9.js} +95 -96
  33. package/chunks/standalone-BwtM31-f.js +2 -0
  34. package/chunks/{standalone-CY57qwZ-.js → standalone-C3gg736V.js} +153 -153
  35. package/chunks/{standalone-DFPva_ku.js → standalone-CC1VUjO32.js} +60 -60
  36. package/chunks/{standalone-CCNtaJ7s.js → standalone-C_rYnZ0N.js} +41 -41
  37. package/chunks/{standalone-CZynjFG7.js → standalone-CoLrAxRV.js} +3701 -3482
  38. package/chunks/{standalone-jiz0L2Dg.js → standalone-DC-aUgXC.js} +104 -104
  39. package/chunks/standalone-DCtRoTWg.js +675 -0
  40. package/chunks/standalone-DUDFTBqL.js +833 -0
  41. package/chunks/standalone-DhZkX9Td.js +2 -0
  42. package/chunks/{standalone-Dx3MLlrO.js → standalone-DtLElfuM.js} +141 -141
  43. package/chunks/{standalone-BmfMt74U.js → standalone-G9Q4Uczu.js} +192 -192
  44. package/chunks/{standalone-BH5NqDwp.js → standalone-JuLF-OoH.js} +390 -391
  45. package/chunks/standalone-_DeX21JJ.js +383 -0
  46. package/chunks/{standalone-lBm9hQ-q.js → standalone-gFhKZh8m.js} +34 -34
  47. package/chunks/standalone-tDNy-SFH.js +281 -0
  48. package/chunks/{standalone-rJ45Zfl1.js → standalone-v1oxfU20.js} +10 -10
  49. package/chunks/{standalone-BYm1UjLr.js → standalone-vzBY6q0I2.js} +18 -18
  50. package/chunks/table.compiler-tb914oj3.js +222 -0
  51. package/chunks/{ui-D1HQNIBy.js → ui-DQWtv2iM.js} +13485 -3973
  52. package/chunks/{useFieldName-oqQ3bvnO.js → useFieldName-BvdcoJRl.js} +1 -1
  53. package/chunks/{utils-Ba9T0TqC.js → utils-Bg7K-t6K.js} +7306 -6024
  54. package/chunks/{src-DvX5LU9T.js → view-Bn83C8d9.js} +2555 -4831
  55. package/definitions.js +3 -3
  56. package/docs/operations/astrato-app-filter-bar.md +17 -17
  57. package/docs/operations/bar.md +989 -1071
  58. package/docs/operations/combo.md +717 -738
  59. package/docs/operations/date-picker.md +25 -25
  60. package/docs/operations/distribution-gauge.md +471 -607
  61. package/docs/operations/dot.md +787 -879
  62. package/docs/operations/filter.md +139 -163
  63. package/docs/operations/gauge.md +491 -627
  64. package/docs/operations/heatMap.md +834 -916
  65. package/docs/operations/histogram.md +166 -180
  66. package/docs/operations/iframe.md +5 -5
  67. package/docs/operations/image.md +16 -16
  68. package/docs/operations/index.md +12 -12
  69. package/docs/operations/line.md +811 -888
  70. package/docs/operations/number.md +470 -536
  71. package/docs/operations/pie.md +825 -958
  72. package/docs/operations/radar.md +599 -679
  73. package/docs/operations/sankey.md +462 -584
  74. package/docs/operations/scatter.md +823 -929
  75. package/docs/operations/shape.md +34 -34
  76. package/docs/operations/simpleTextObject.md +18 -25
  77. package/docs/operations/slider.md +33 -43
  78. package/docs/operations/table.md +1160 -1150
  79. package/docs/operations/tree.md +354 -361
  80. package/docs/operations/treemap.md +545 -637
  81. package/docs/operations/waterfall.md +369 -379
  82. package/docs/operations/word-cloud.md +512 -583
  83. package/getters.js +3 -3
  84. package/index.js +51 -51
  85. package/metadata.js +3 -3
  86. package/operations.js +7 -7
  87. package/package.json +80 -86
  88. package/src/definitions/index.d.ts +2 -2
  89. package/src/definitions/{shared/lib → model/definitions}/available-fields.d.ts +0 -1
  90. package/src/definitions/{shared/lib/compilers/index.d.ts → model/definitions/compilers/compile.d.ts} +1 -1
  91. package/src/definitions/model/definitions/data-item-resolution.d.ts +19 -0
  92. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1341 -0
  93. package/src/definitions/model/definitions/descriptors/json-schema.d.ts +2 -0
  94. package/src/definitions/model/definitions/diagnostics.d.ts +5 -0
  95. package/src/definitions/model/definitions/field-suggestions.d.ts +2 -0
  96. package/src/definitions/model/definitions/index.d.ts +23 -0
  97. package/src/definitions/{shared/lib → model/definitions}/registry/compile.d.ts +1 -1
  98. package/src/definitions/model/definitions/registry/descriptor-registry.d.ts +3 -0
  99. package/src/definitions/model/definitions/schema-registry.d.ts +660 -0
  100. package/src/definitions/{shared/lib → model/definitions}/schemas/broad-chart.schema.d.ts +1 -1
  101. package/src/definitions/{shared/lib → model/definitions}/schemas/common.schema.d.ts +0 -1
  102. package/src/definitions/model/definitions/schemas/index.d.ts +9 -0
  103. package/src/definitions/{shared/lib → model/definitions}/schemas/object.schema.d.ts +6 -6
  104. package/src/definitions/{shared/lib → model/definitions}/types/definition.types.d.ts +1 -1
  105. package/src/definitions/model/definitions/types/index.d.ts +3 -0
  106. package/src/definitions/{shared/lib/registry → model/definitions}/validation.d.ts +1 -1
  107. package/chunks/Radio-Ciu-F4CU.js +0 -957
  108. package/chunks/ToggleButton-BCJc3Jlc.js +0 -153
  109. package/chunks/_baseFlatten-DPXPOrea.js +0 -7076
  110. package/chunks/app-filter-bar.compiler-j_CVoWTa.js +0 -55
  111. package/chunks/bar.compiler-oqaPzIut.js +0 -370
  112. package/chunks/data-item-resolution-1lvYB5ln.js +0 -53
  113. package/chunks/event-bus-KiSiCJrC.js +0 -2683
  114. package/chunks/filter.compiler-CuLtc_02.js +0 -60
  115. package/chunks/gauge-target-type-BkKXAqkX.js +0 -4
  116. package/chunks/interfaces-VUY4_yVO.js +0 -8742
  117. package/chunks/line-settings-DfYTUyPz.js +0 -4
  118. package/chunks/line.compiler-BpA_6Tc7.js +0 -188
  119. package/chunks/number.compiler-DbkWcG4S.js +0 -44
  120. package/chunks/pie-uv42Eqal.js +0 -10
  121. package/chunks/src-Dun_jXtz.js +0 -10295
  122. package/chunks/standalone-87YV_m9n.js +0 -687
  123. package/chunks/standalone-BLVAWLNJ.js +0 -385
  124. package/chunks/standalone-BPomtAVs.js +0 -2
  125. package/chunks/standalone-BXyBcUOQ.js +0 -2
  126. package/chunks/standalone-BllF4rDp.js +0 -383
  127. package/chunks/standalone-BqWyrnZI.js +0 -281
  128. package/chunks/standalone-DQxxNwF8.js +0 -675
  129. package/chunks/standalone-DS9T0FZ-.js +0 -830
  130. package/chunks/standalone-DzixzZAL.js +0 -411
  131. package/chunks/standalone-QJ1kKMnO.js +0 -6
  132. package/chunks/table.compiler-BrXkm4Fz.js +0 -213
  133. package/chunks/toInteger-DVZr-D1j.js +0 -11
  134. package/chunks/treemap-x_zmJoG7.js +0 -23
  135. package/chunks/types-dVVCsDWD.js +0 -4
  136. package/chunks/view-CLqWMV7Z.js +0 -156
  137. package/src/definitions/shared/index.d.ts +0 -5
  138. package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +0 -587
  139. package/src/definitions/shared/lib/registry/index.d.ts +0 -3
  140. package/src/definitions/shared/lib/schemas/index.d.ts +0 -9
  141. package/src/definitions/shared/lib/types/index.d.ts +0 -3
  142. package/src/definitions/{shared/lib → model/definitions}/schemas/app-filter-bar.schema.d.ts +0 -0
  143. package/src/definitions/{shared/lib → model/definitions}/schemas/bar.schema.d.ts +0 -0
  144. package/src/definitions/{shared/lib → model/definitions}/schemas/filter.schema.d.ts +0 -0
  145. package/src/definitions/{shared/lib → model/definitions}/schemas/line.schema.d.ts +0 -0
  146. package/src/definitions/{shared/lib → model/definitions}/schemas/number.schema.d.ts +0 -0
  147. package/src/definitions/{shared/lib → model/definitions}/schemas/table.schema.d.ts +4 -4
  148. /package/src/definitions/{shared/lib → model/definitions}/types/compilation.types.d.ts +0 -0
  149. /package/src/definitions/{shared/lib → model/definitions}/types/descriptor.types.d.ts +0 -0
@@ -0,0 +1,675 @@
1
+ import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { An as t, Ao as n, Eo as r, Fa as i, Ks as a, Mo as o, No as s, Sa as c, Si as l, Ta as u, Ys as d, Zr as f, fc as p, i as m, ia as h, io as g, oi as _, qa as v, sc as y, xa as b } from "./isEqual-BDxAhUo8.js";
3
+ import { $t as x, Ei as S, I as C, P as w, Yi as T, d as E, hn as ee, o as D } from "./utils-Bg7K-t6K.js";
4
+ import { $ as O, At as k, Bt as A, Ct as j, Dt as M, Ft as N, H as te, It as ne, Jt as P, M as re, Mt as ie, Nt as ae, Ot as F, Qt as I, R as oe, St as L, Tt as se, U as ce, W as le, Wt as R, X as ue, Xt as de, Yt as fe, Z as pe, Zt as me, _t as he, an as z, dn as B, en as ge, ht as V, i as _e, in as H, j as ve, jt as ye, n as be, nt as xe, on as Se, ot as U, q as Ce, rn as we, sn as W, un as Te, yt as Ee, z as De, zt as G } from "./escobar-eDjtGpkC.js";
5
+ import { t as Oe } from "./coloring-B1XAfg6b.js";
6
+ import { t as K } from "./set-coloring-datafield-B3uIS1Pe.js";
7
+ var ke = /* @__PURE__ */ e(T()), Ae = (e, t, n, r, a, s, c, u) => {
8
+ let d = [], p = [], m = e.measures.filter((e) => l(e)), h = {
9
+ ...t.axis.measure,
10
+ ...t.fonts
11
+ }, g = [];
12
+ if (u) {
13
+ let e = ne(B.Text, u);
14
+ g.push(e);
15
+ }
16
+ let _ = m.filter((e) => e.role === i.SCATTER_HORIZONTAL), v = m.filter((e) => e.role === i.SCATTER_VERTICAL), y = e.measures.filter((e) => e.role === i.SCATTER_HORIZONTAL), b = e.measures.filter((e) => e.role === i.SCATTER_VERTICAL), x = _[0], S = v[0], C = {};
17
+ if (x) {
18
+ let t = o.Bottom, n = e.axes?.primaryMeasure || C;
19
+ if (d.push(G(I.XAxisScale, n, h, t, x.formatter)), e.axes?.primaryMeasure?.showAxisName) {
20
+ let r = f(y, e.enableAlternate, s?.isPrintMode);
21
+ p.push(A(_, r, t, h, n.colors?.title, n.axisTitle, n.titleFontSize));
22
+ }
23
+ }
24
+ if (S) {
25
+ let t = o.Left, n = e.axes?.secondaryMeasure || C;
26
+ if (d.push(G(I.YAxisScale, n, h, t, S.formatter)), e.axes?.secondaryMeasure?.showAxisName) {
27
+ let r = f(b, e.enableAlternate, s?.isPrintMode);
28
+ p.push(A(v, r, t, h, n.colors?.title, n.axisTitle, n.titleFontSize));
29
+ }
30
+ }
31
+ return {
32
+ ...n,
33
+ components: [
34
+ ...n.components,
35
+ ...d,
36
+ ...p
37
+ ],
38
+ interactions: n.interactions ? [...n.collections, ...g] : [...g]
39
+ };
40
+ }, je = (e, t) => {
41
+ let n = e.dimensions.filter((e) => l(e)), r = e.measures.filter((e) => l(e)), a = n.filter((e) => e.role === v.SCATTER_DIMENSION), o = r.filter((e) => e.role === i.SCATTER_SIZE), s = a[0], c = o[0], { coloring: u } = e || {};
42
+ switch (u?.type) {
43
+ case d.Categorical: return j(e, t);
44
+ case d.Gradient: return se(e, c);
45
+ case d.Single: return p(s.dataItem);
46
+ default: return null;
47
+ }
48
+ }, Me = (e, n, r, a, o, s, c) => {
49
+ let u = e.dimensions.filter((e) => l(e)), f = e.measures.filter((e) => l(e)), g = u.filter((e) => e.role === v.SCATTER_DIMENSION), _ = f.filter((e) => e.role === i.SCATTER_HORIZONTAL), y = f.filter((e) => e.role === i.SCATTER_VERTICAL), x = f.filter((e) => e.role === i.SCATTER_SIZE), S = g[0], C = _[0], w = y[0], T = x[0], E = {}, { coloring: D } = e || {}, O = u.length < 2 && e.scatterSettings?.spatialHeatmap?.show, k = O && !D?.fieldId ? null : je(e, c);
50
+ switch (D?.type) {
51
+ case d.Categorical:
52
+ E = L(K(e, k), n, E, null, c);
53
+ break;
54
+ case d.Gradient:
55
+ E = L(K(e, k), n, E, null, c);
56
+ break;
57
+ case d.Single: {
58
+ let t = p(S.dataItem);
59
+ E[d.Single] = {
60
+ data: { extract: { field: t } },
61
+ range: [e?.coloring?.color ?? n.colors.brandColors[0]],
62
+ type: z.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[I.Density] = {
71
+ data: k ? { field: k } : void 0,
72
+ min: 0,
73
+ max: (n) => (n.data?.fields?.[0] ? n.data.fields[0].max() : 1) * t(e.scatterSettings.spatialHeatmap.maxDensity ?? h.heatmapMaxDensity),
74
+ nice: !0
75
+ }, E[I.DensityInverted] = {
76
+ ...E[I.Density],
77
+ invert: !0
78
+ };
79
+ let i = [...m(D.type, n), ...D.customGradient ? [D.customGradient] : []].find((e) => e.id === (D.palette ?? n.colors.defaultGradient ?? b.id))?.colors;
80
+ E[I.DensityGradient] = {
81
+ ...E[I.Density],
82
+ range: i ?? b.colors,
83
+ type: z.SequentialColor
84
+ }, k && V(r, 0, { density: { field: k } });
85
+ } else k && V(r, 0, { color: { field: k } });
86
+ let A = p(C?.dataItem), j = p(w?.dataItem), M = p(T?.dataItem), N = te(e?.axes?.primaryMeasure?.axisRange, !0), ne = le(N);
87
+ E[I.XAxisScale] = {
88
+ type: z.Linear,
89
+ data: { field: A },
90
+ invert: ce(!1, e?.axes?.primaryMeasure),
91
+ nice: !ne && W.scale.nice,
92
+ expandMax: .06,
93
+ ...N
94
+ };
95
+ let P = te(e?.axes?.secondaryMeasure?.axisRange, !0), re = le(P);
96
+ return E[I.YAxisScale] = {
97
+ type: z.Linear,
98
+ data: { fields: [j] },
99
+ invert: ce(!0, e?.axes?.secondaryMeasure),
100
+ nice: !re && W.scale.nice,
101
+ expandMax: .06,
102
+ ...P
103
+ }, T && (E[M] = {
104
+ type: z.Linear,
105
+ data: { field: M }
106
+ }), {
107
+ ...r,
108
+ scales: E
109
+ };
110
+ }, q = "spatial-heatmap", Ne = "shape", J = (e) => {
111
+ let t = e.scatterSettings?.shape ?? r.Circle;
112
+ return `${B.Point}-${t}`;
113
+ }, Pe = (e, t, n, r, a, o) => {
114
+ let s = e.dimensions.filter((e) => l(e)), c = e.measures.filter((e) => l(e)), u = re((e.supportingMeasures ?? []).filter((e) => l(e))), d = s.filter((e) => e.role === v.SCATTER_IMAGE), f = c.filter((e) => e.role === i.SCATTER_HORIZONTAL), m = c.filter((e) => e.role === i.SCATTER_VERTICAL), h = c.filter((e) => e.role === i.SCATTER_SIZE), g = d[0], _ = f[0], y = m[0], b = h[0], x = p(_?.dataItem), S = p(y?.dataItem);
115
+ V(n, 0, {
116
+ x: { field: x },
117
+ y: { field: S },
118
+ [x]: { field: x },
119
+ [S]: { field: S },
120
+ ...u
121
+ });
122
+ let C = e.scatterSettings?.pointSize ?? .1, w = {};
123
+ if (b) {
124
+ let t = p(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(p(b.dataItem))(t.datum.size.value) * (r - n) + n;
128
+ }, V(n, 0, {
129
+ size: w,
130
+ [t]: { field: t }
131
+ });
132
+ }
133
+ let T;
134
+ return g ? (V(n, 0, { imageUrl: { field: p(g.dataItem) } }), T = [Fe(e, t, C, o, !0, a), Le(e, C, o)]) : T = e.scatterSettings?.spatialHeatmap?.show ? [Ie(e, t, n, C, o, a)] : [Fe(e, t, C, o, !1, a)], {
135
+ ...n,
136
+ components: [...n.components, ...T]
137
+ };
138
+ }, Fe = (e, t, n, i, a, o) => {
139
+ let s = new Oe(e, t, o?.[0]?.itemsNotAffectedByFiltering), c = e.scatterSettings?.shape ?? r.Circle, l = e.scatterSettings?.stroke;
140
+ return {
141
+ type: B.Point,
142
+ layout: { displayOrder: N.VisualizationElement },
143
+ key: J(e),
144
+ data: { collection: I.Collection },
145
+ animations: {
146
+ enabled: !a,
147
+ presetId: "scatter-chart"
148
+ },
149
+ settings: {
150
+ x: {
151
+ scale: I.XAxisScale,
152
+ ref: "x"
153
+ },
154
+ y: {
155
+ scale: I.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: n,
163
+ fill: a ? "transparent" : s.getColorDefinition({
164
+ overwriteSources: [s.MAIN_FIELD, "color"],
165
+ ref: "color"
166
+ }),
167
+ tag: Ne
168
+ },
169
+ brush: a ? null : R([""], i, { valuePickerMode: i?.valuePickerMode })
170
+ };
171
+ }, Ie = (e, t, n, r, i, a) => {
172
+ let o = n.scales[I.Density]?.data, s = n.collections?.[0]?.data?.extract?.[0]?.props?.density?.field && o?.field ? {
173
+ scale: I.Density,
174
+ ref: "density"
175
+ } : {
176
+ scale: I.Density,
177
+ fn: ({ scale: e }) => e(1)
178
+ };
179
+ return {
180
+ type: B.Heatmap,
181
+ layout: { displayOrder: N.VisualizationElement },
182
+ key: "spatial-heatmap",
183
+ animations: a?.[0]?.items?.length < 1e3 ? { enabled: !0 } : void 0,
184
+ data: { collection: I.Collection },
185
+ settings: {
186
+ point: {
187
+ x: {
188
+ scale: I.XAxisScale,
189
+ ref: "x"
190
+ },
191
+ y: {
192
+ scale: I.YAxisScale,
193
+ ref: "y"
194
+ },
195
+ size: r,
196
+ density: s
197
+ },
198
+ gradient: I.DensityGradient,
199
+ blur: e.scatterSettings.spatialHeatmap.blur,
200
+ minOpacity: 1e-4
201
+ },
202
+ brush: i?.disable?.brushing ? void 0 : { consume: [{
203
+ context: H.Selection,
204
+ data: [""],
205
+ mode: Te.And,
206
+ style: { inactive: { opacity: .1 } }
207
+ }] }
208
+ };
209
+ }, Le = (e, t, n) => ({
210
+ type: B.DomPoint,
211
+ layout: { displayOrder: N.VisualizationElement },
212
+ key: B.DomPoint,
213
+ data: { collection: I.Collection },
214
+ settings: {
215
+ x: {
216
+ scale: I.XAxisScale,
217
+ ref: "x"
218
+ },
219
+ y: {
220
+ scale: I.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: R([""], 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 = y(r[0].dataItem, e.dataItem);
236
+ return Ee(e, n ? "x" : "y", n ? I.XAxisScale : I.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) => U(e, I.XAxisScale, t));
247
+ r.push(...n);
248
+ }
249
+ if (e.refLines.y) {
250
+ let n = e.refLines.y.map((e) => U(e, I.YAxisScale, t));
251
+ i.push(...n);
252
+ }
253
+ let a = {
254
+ type: B.RefLine,
255
+ layout: { displayOrder: N.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 = _("scatter-reference-areas-stage", "#6B7280"), X = (e) => {
266
+ if (e == null) return null;
267
+ let n = t(e);
268
+ if (n === null) return null;
269
+ let r = typeof n == "number" ? n : Number(n);
270
+ return Number.isNaN(r) ? null : r;
271
+ }, He = (e) => {
272
+ if (e == null) return;
273
+ let n = t(e);
274
+ if (n === null || typeof n != "string") return;
275
+ let r = n.trim();
276
+ return r.length > 0 ? r : 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 ?? h.referenceArea.fillColor, c = e.border?.enabled ?? h.referenceArea.border?.enabled ?? !1, l = c ? e.border?.color ?? h.referenceArea.border?.color ?? void 0 : void 0, u = c ? e.border?.width ?? h.referenceArea.border?.width ?? 1 : void 0, [d, f] = n <= r ? [n, r] : [r, n], [p, m] = i <= a ? [i, a] : [a, i], g = e.labelMode ?? h.referenceArea.labelMode, _ = e.labelPlacement ?? h.referenceArea.labelPlacement, v = e.labelColor ?? h.referenceArea.labelColor, y = e.labelFontSize ?? h.referenceArea.labelFontSize;
288
+ return {
289
+ id: e.id,
290
+ label: o,
291
+ labelMode: g,
292
+ labelPlacement: _,
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 n.TopLeft: return {
324
+ align: 0,
325
+ justify: 0
326
+ };
327
+ case n.Top: return {
328
+ align: .5,
329
+ justify: 0
330
+ };
331
+ case n.TopRight: return {
332
+ align: 1,
333
+ justify: 0
334
+ };
335
+ case n.Left: return {
336
+ align: 0,
337
+ justify: .5
338
+ };
339
+ case n.Right: return {
340
+ align: 1,
341
+ justify: .5
342
+ };
343
+ case n.BottomLeft: return {
344
+ align: 0,
345
+ justify: 1
346
+ };
347
+ case n.Bottom: return {
348
+ align: .5,
349
+ justify: 1
350
+ };
351
+ case n.BottomRight: return {
352
+ align: 1,
353
+ justify: 1
354
+ };
355
+ case n.Center:
356
+ default: return {
357
+ align: .5,
358
+ justify: .5
359
+ };
360
+ }
361
+ }, Ke = (e, t, n) => {
362
+ if (e.labelMode !== g.Fixed || !e.label) return null;
363
+ let { align: r, justify: i } = Ge(e.labelPlacement), a = h.referenceArea.labelColor, o = h.referenceArea.labelFontSize, s = e.labelColor ?? a, c = e.labelFontSize ?? o;
364
+ return {
365
+ type: B.Labels,
366
+ key: `${Y}-${e.id}-label`,
367
+ layout: { displayOrder: t },
368
+ settings: { sources: [{
369
+ component: `${Y}-${e.id}`,
370
+ selector: we.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: s.Vertical,
392
+ major: {
393
+ scale: I.XAxisScale,
394
+ ref: "binEnd",
395
+ binStart: { ref: "binStart" },
396
+ binEnd: { ref: "binEnd" }
397
+ },
398
+ minor: {
399
+ scale: I.YAxisScale,
400
+ ref: "end"
401
+ },
402
+ minor0: {
403
+ scale: I.YAxisScale,
404
+ ref: "start"
405
+ },
406
+ box: {
407
+ fill: e.fillColor ?? h.referenceArea.fillColor,
408
+ opacity: 1,
409
+ stroke: e.borderColor ?? "transparent",
410
+ strokeWidth: e.borderWidth ?? 0,
411
+ ignoreOutOfBounds: !0
412
+ }
413
+ };
414
+ return {
415
+ type: B.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 = N.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) => l(e)).filter((e) => e.role === v.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
+ oe,
480
+ q
481
+ ];
482
+ return t.filter((e) => e.key ? Z(e.key) ? Q(e) !== g.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 !== g.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 = pe(e, t, xe, Ye);
525
+ r.extract = (e) => {
526
+ if (Z(e.node.key)) {
527
+ let t = $(e.node), n = Q(e.node);
528
+ if (t && n !== g.Fixed) return Xe(t);
529
+ }
530
+ return n(e);
531
+ };
532
+ }
533
+ return ue(e, t, n, r, "tooltip", void 0, {
534
+ componentKeys: [J(e)],
535
+ yieldToComponentKeys: [oe, 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: fe(e),
542
+ key: F.Measure,
543
+ settings: { direction: k(e) }
544
+ }, a = e?.measures[1], [o, s] = ae([i, {
545
+ showAxisTooltip: e?.axes?.secondaryMeasure?.showAxisTooltip,
546
+ formatter: a?.formatter,
547
+ scale: de(e, a),
548
+ key: F.MeasureSec,
549
+ settings: {
550
+ direction: ie(e),
551
+ labelDock: ye(me(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 && ge(e);
562
+ } catch {
563
+ return !1;
564
+ }
565
+ }, tt = (e, t, n, r, i, a) => {
566
+ if (a?.disable?.brushing || a?.disable?.brushingLasso) return n;
567
+ let o = et(t?.colors?.sheetBackgroundColor) ? u.white : u.mainDarkNavy, s = e.scatterSettings?.lasso, c = s?.strokeColor ?? o, l = {
568
+ type: B.Lasso,
569
+ key: B.Lasso,
570
+ layout: { displayOrder: N.VisualizationElement + 1 },
571
+ settings: {
572
+ brush: { components: [{
573
+ key: J(e),
574
+ contexts: [H.Selection],
575
+ action: "toggle"
576
+ }, {
577
+ key: q,
578
+ contexts: [H.Selection],
579
+ action: "toggle"
580
+ }] },
581
+ lasso: {
582
+ strokeWidth: 2,
583
+ strokeDasharray: "4",
584
+ stroke: c
585
+ },
586
+ snapIndicator: { stroke: c },
587
+ startPoint: {
588
+ r: 3,
589
+ fill: s?.startPointColor ?? u.secondaryPurple,
590
+ stroke: c
591
+ }
592
+ }
593
+ }, d = {
594
+ type: "native",
595
+ key: `${B.Lasso}-interaction`,
596
+ events: {
597
+ mousedown(e) {
598
+ this.chart.component(B.Lasso).emit("lassoStart", { center: {
599
+ x: e.clientX,
600
+ y: e.clientY
601
+ } });
602
+ },
603
+ mousemove(e) {
604
+ this.chart.component(B.Lasso).emit("lassoMove", { center: {
605
+ x: e.clientX,
606
+ y: e.clientY
607
+ } });
608
+ },
609
+ mouseup(e) {
610
+ this.chart.component(B.Lasso).emit("lassoEnd", { center: {
611
+ x: e.clientX,
612
+ y: e.clientY
613
+ } });
614
+ }
615
+ }
616
+ };
617
+ return {
618
+ ...n,
619
+ components: [...n.components, l],
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 = De({
626
+ targetComponentKeys: [J(e)],
627
+ targetSelector: `.${Ne}`,
628
+ offset: c,
629
+ fontSize: P(e.pointLabeling?.fontSize)
630
+ }, s, a, t);
631
+ return {
632
+ ...n,
633
+ components: [...n.components, l]
634
+ };
635
+ }, rt = (...e) => {
636
+ let t = he(...e), n = t.components.find((e) => e.type === Se.SequentialLegend), r = t.scales[I.Density];
637
+ return n && r && (n.settings.fill = I.DensityGradient, n.settings.major = [o.Left, o.Right].includes(n.layout.dock) ? I.DensityInverted : I.Density), t;
638
+ }, it = class extends ve {
639
+ constructor() {
640
+ super([
641
+ M,
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) => l(e)), n = e.measures.filter((e) => l(e)), r = t.filter((e) => e.role === v.SCATTER_DIMENSION), a = n.filter((e) => e.role === i.SCATTER_HORIZONTAL), o = n.filter((e) => e.role === i.SCATTER_VERTICAL), s = r[0], c = a[0], u = o[0];
658
+ if (!s || !c || !u) throw Error("Scatter chart requires at least 1 scatter dimension, 1 horizontal measure, and 1 vertical measure.");
659
+ }
660
+ }, at = S(), ot = x(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
661
+ let o = w(), [s] = (0, ke.useState)(() => new it()), l = E(), { activeKey: u } = D(), d = C(), f = {
662
+ ...i,
663
+ valuePickerMode: !!u
664
+ }, p = t || c, m = s.compile(e, p, n, r, {
665
+ ...f,
666
+ onRenderDone: l
667
+ }, a.Scatter, o, d, be());
668
+ return m ? /* @__PURE__ */ (0, at.jsx)(_e, {
669
+ config: f,
670
+ definition: m,
671
+ size: r,
672
+ vSpec: e
673
+ }) : null;
674
+ });
675
+ export { ot as ScatterChart };