@astrato-io/visualizations 0.11.0 → 0.12.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 (135) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +129 -4
  3. package/VISUALIZATION_DEFINITIONS.md +3 -1
  4. package/chunks/{Button-CPG4WX8X.js → Button-CQdoKSXX.js} +3 -3
  5. package/chunks/{CircularProgress-PSLW8HmD.js → CircularProgress-DpT1lwWw.js} +18 -18
  6. package/chunks/FieldTypeIcon-Cg4F9Q5D.js +22 -0
  7. package/chunks/{LinearProgress-KQ2EQlGL.js → LinearProgress-B7S0Q26A.js} +8 -8
  8. package/chunks/{MenuOption-B-6K7kks.js → MenuOption-DpKFJxmo.js} +133 -133
  9. package/chunks/{Title-BmvwZYkh.js → Title-m5damhc0.js} +10 -10
  10. package/chunks/{_createAggregator-CFmH6gUN.js → _createAggregator-BA8_iU9q.js} +7 -7
  11. package/chunks/{app-filter-bar.compiler-BY5-T16I.js → app-filter-bar.compiler--T4Qz3Wu.js} +3 -3
  12. package/chunks/{bar-layout-BNou0dZF.js → bar-layout-OFhxn2Go.js} +2 -2
  13. package/chunks/{bar.compiler-BkhO7sDd.js → bar.compiler-hWZBYYvV.js} +62 -62
  14. package/chunks/{builder-CNjuqD2z.js → builder-7w_bgV_h.js} +31 -31
  15. package/chunks/{coloring-BOiP0rmn.js → coloring-Cd6p0GQJ.js} +88 -83
  16. package/chunks/{createSimplePaletteValueFilter-BkgQ7MFE.js → createSimplePaletteValueFilter-CiJT8s1s.js} +55 -55
  17. package/chunks/defaults-CMFqXvaJ.js +3 -0
  18. package/chunks/{definitions-AS9GcavE.js → definitions-DTauTjIX.js} +412 -406
  19. package/chunks/{escobar-cQ1eQ64G.js → escobar-CMvphKSK.js} +4787 -4717
  20. package/chunks/{extend-preset-BlCbcXKR.js → extend-preset-BpXttHFk.js} +371 -372
  21. package/chunks/{filter.compiler-CI7dDNM1.js → filter.compiler-DOGFweJz.js} +4 -4
  22. package/chunks/{filtering-Dwi7hDPZ.js → filtering-NOnDcGbo.js} +183 -183
  23. package/chunks/handlers-CyYFSfhM.js +15393 -0
  24. package/chunks/{icon-picker-styles-CBlxEu3s.js → icon-picker-styles-DuSERhBU.js} +2 -2
  25. package/chunks/{isEqual-BdHo6wqq.js → isEqual-4f8yUUtC.js} +1 -1
  26. package/chunks/{isFocusVisible-C1nlVUwL.js → isFocusVisible-Czm70MGc.js} +1 -1
  27. package/chunks/line.compiler-B-4H55_T.js +203 -0
  28. package/chunks/{logger-Bc-DqDM_.js → logger-Cioob-QV.js} +71 -70
  29. package/chunks/{map.compiler-CRO6XpdI.js → map.compiler-Cv5V6EhF.js} +13 -13
  30. package/chunks/measure-axis-label-format-COy8U_dd.js +27 -0
  31. package/chunks/{measure-format-default-B6ghxih7.js → measure-format-default-B_kuGSzi.js} +7 -3
  32. package/chunks/{metadata-CtkvZEhS.js → metadata-dGSe5UWy.js} +5 -5
  33. package/chunks/{number.compiler-kV4lobCZ.js → number.compiler-D7nMcEMv.js} +8 -8
  34. package/chunks/{operations-COl9wgqi.js → operations-CgfehCad.js} +11462 -11223
  35. package/chunks/{range-CMJ5yc5Z.js → range-Dmwp9kVB.js} +2 -2
  36. package/chunks/{react-dom-BjsCbYHq.js → react-dom-CfuL-m78.js} +24 -24
  37. package/chunks/{render-wrappers-DFHi3Wkr.js → render-wrappers--g-zPFBW.js} +1 -1
  38. package/chunks/{requirements-C5YLmHKe.js → requirements-DHayNJ2C.js} +83 -83
  39. package/chunks/{shared-DyqxOie0.js → shared-DoEN9nNM.js} +282 -277
  40. package/chunks/standalone-B3hRGgYi.js +773 -0
  41. package/chunks/{standalone-BYK2U0Vd.js → standalone-BPNXgFft.js} +380 -380
  42. package/chunks/standalone-BPTT8XEu.js +424 -0
  43. package/chunks/standalone-BgAeHROc.js +2 -0
  44. package/chunks/{standalone-I5kRIsp8.js → standalone-BkQxag7M.js} +81 -81
  45. package/chunks/{standalone-DYVYccmY.js → standalone-Bxa3x6dg.js} +913 -913
  46. package/chunks/standalone-C0If-V6O.js +773 -0
  47. package/chunks/standalone-C1TOyflX.js +287 -0
  48. package/chunks/{standalone-DaNxWIKn.js → standalone-CE5PwJN0.js} +21 -21
  49. package/chunks/{standalone-K2OvRAQM.js → standalone-CG7IFN6n.js} +121 -121
  50. package/chunks/{standalone-Db_HNuWx.js → standalone-CKlgGu80.js} +44 -44
  51. package/chunks/standalone-CNf-oA2U.js +355 -0
  52. package/chunks/{standalone-9jrQ3zJT.js → standalone-CXPdWFlw.js} +10 -10
  53. package/chunks/{standalone-c4CPN6ug.js → standalone-Cf0_5tbu.js} +5783 -5785
  54. package/chunks/{standalone-Bp4G3MDx.js → standalone-DMi4-Vp3.js} +118 -118
  55. package/chunks/{standalone-BrjtMIdd.js → standalone-DTEX67C8.js} +108 -108
  56. package/chunks/{standalone-iOnJhCvA.js → standalone-DU46-kYv.js} +181 -181
  57. package/chunks/standalone-Dbn3jSH6.js +690 -0
  58. package/chunks/{standalone-CS5VGoja.js → standalone-DdcAL_k_.js} +833 -837
  59. package/chunks/standalone-DwCIA0UG.js +1057 -0
  60. package/chunks/standalone-Dz13tl3P.js +357 -0
  61. package/chunks/{standalone-CIjNYyya.js → standalone-H9GFzFk_.js} +937 -938
  62. package/chunks/{standalone-ChfEHb28.js → standalone-MduR0qre.js} +1279 -1279
  63. package/chunks/standalone-ejTz66P3.js +2 -0
  64. package/chunks/{standalone-D9k5SCd8.js → standalone-keB-0wK3.js} +189 -189
  65. package/chunks/{standalone-Bsfz5vnJ.js → standalone-nnkuQd0K.js} +35 -35
  66. package/chunks/standalone-vGGR6Vcn.js +6 -0
  67. package/chunks/{table.compiler-CMH_dtYs.js → table.compiler-mS4UvhLT.js} +12 -12
  68. package/chunks/theme-MYp6Rj1J.js +232 -0
  69. package/chunks/{useFieldName-BfxBzhhH.js → useFieldName-AdSak4Ch.js} +1 -1
  70. package/chunks/{utils-BdJrEeIQ.js → utils-CUKgR7it.js} +3265 -3133
  71. package/chunks/{view-Q-_XIrWE.js → view-BeYwpcVD.js} +478 -478
  72. package/chunks/{visualization-filters-BwS0xUqs.js → visualization-filters-B9qik5_K.js} +2706 -2384
  73. package/chunks/{with-html-element-D_ooGNWI.js → with-html-element-1GSeLT59.js} +3888 -3870
  74. package/definitions.js +2 -2
  75. package/docs/operations/astrato-app-filter-bar.md +1 -1
  76. package/docs/operations/bar.md +115 -32
  77. package/docs/operations/combo.md +50 -17
  78. package/docs/operations/date-picker.md +4 -4
  79. package/docs/operations/distribution-gauge.md +18 -16
  80. package/docs/operations/dot.md +107 -24
  81. package/docs/operations/filter.md +10 -8
  82. package/docs/operations/gauge.md +20 -18
  83. package/docs/operations/heatMap.md +73 -21
  84. package/docs/operations/histogram.md +45 -12
  85. package/docs/operations/iframe.md +1 -1
  86. package/docs/operations/image.md +1 -1
  87. package/docs/operations/index.md +11 -11
  88. package/docs/operations/line.md +57 -24
  89. package/docs/operations/map.md +16 -16
  90. package/docs/operations/number.md +10 -9
  91. package/docs/operations/pie.md +23 -21
  92. package/docs/operations/radar.md +13 -11
  93. package/docs/operations/sankey.md +19 -17
  94. package/docs/operations/scatter.md +111 -28
  95. package/docs/operations/shape.md +5 -5
  96. package/docs/operations/simpleTextObject.md +4 -4
  97. package/docs/operations/slider.md +1 -1
  98. package/docs/operations/table.md +27 -25
  99. package/docs/operations/tree.md +5 -3
  100. package/docs/operations/treemap.md +70 -18
  101. package/docs/operations/waterfall.md +40 -7
  102. package/docs/operations/word-cloud.md +69 -17
  103. package/getters.js +2 -2
  104. package/index.js +474 -525
  105. package/metadata.js +2 -2
  106. package/operations.js +24 -17
  107. package/package.json +71 -72
  108. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1 -1
  109. package/src/definitions/model/definitions/schema-registry.d.ts +13 -12
  110. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -2
  111. package/src/definitions/model/definitions/schemas/common.schema.d.ts +5 -4
  112. package/src/definitions/model/definitions/schemas/line.schema.d.ts +3 -2
  113. package/src/definitions/model/definitions/schemas/number.schema.d.ts +1 -1
  114. package/src/definitions/model/definitions/schemas/table.schema.d.ts +14 -14
  115. package/src/index.d.ts +1 -1
  116. package/src/operations/index.d.ts +11 -1
  117. package/src/types.d.ts +166 -1
  118. package/chunks/FieldTypeIcon-5k2bkqd0.js +0 -22
  119. package/chunks/category-axis-D1OVyMrr.js +0 -20
  120. package/chunks/color-rules-DYJL4fIW.js +0 -15
  121. package/chunks/color-settings-DJFoFTip.js +0 -5
  122. package/chunks/defaults-B5_8S-J-.js +0 -3
  123. package/chunks/handlers-C63NVo7i.js +0 -15433
  124. package/chunks/line.compiler-DCv3h42f.js +0 -198
  125. package/chunks/standalone-06i1wmIX.js +0 -6
  126. package/chunks/standalone-B6zUvxNQ.js +0 -357
  127. package/chunks/standalone-Be5APcVv.js +0 -762
  128. package/chunks/standalone-BuXpKMnc.js +0 -2
  129. package/chunks/standalone-CUGt2FUF.js +0 -2
  130. package/chunks/standalone-CnF2OYLQ.js +0 -355
  131. package/chunks/standalone-CznEEiq3.js +0 -422
  132. package/chunks/standalone-DcuE8KBa.js +0 -287
  133. package/chunks/standalone-pCrzBiTy.js +0 -773
  134. package/chunks/standalone-qrZaimgC.js +0 -689
  135. package/chunks/standalone-yqDJ8h3K.js +0 -1012
@@ -0,0 +1,690 @@
1
+ import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { $c as t, Ro as n, Sa as r, To as i, Ua as a, Vc as o, Xc as s, Yi as c, Yr as l, cs as u, di as d, fs as f, gr as p, hl as m, hs as h, ms as g, o as _, po as v, tn as y, u as b, ul as x, xa as S } from "./visualization-filters-B9qik5_K.js";
3
+ import { I as C, Mt as w, P as T, Ur as E, f as D, fi as O, qt as ee, s as k } from "./utils-CUKgR7it.js";
4
+ import "./logger-Cioob-QV.js";
5
+ import { C as A, D as te, Dn as ne, E as re, En as j, F as M, Gt as N, Ht as P, It as F, Kt as I, L, Lt as ie, Mn as R, Nt as ae, O as z, On as B, P as oe, S as V, Tn as H, Vt as se, Wt as ce, _ as le, _n as ue, an as U, bn as de, bt as fe, en as W, gn as pe, gt as me, hn as he, i as ge, j as _e, jn as ve, jt as ye, kt as G, mn as be, n as xe, nn as Se, on as Ce, qt as we, un as Te, v as Ee, vn as K, wn as De, zt as Oe } from "./escobar-CMvphKSK.js";
6
+ import { t as ke } from "./coloring-Cd6p0GQJ.js";
7
+ import { t as Ae } from "./set-coloring-datafield-B3uIS1Pe.js";
8
+ var je = /* @__PURE__ */ e(O()), Me = (e, t, n, r, i, a, o, s) => {
9
+ let c = [], l = [], u = e.measures.filter((e) => d(e)), f = {
10
+ ...t.axis.measure,
11
+ ...t.fonts,
12
+ chart: b(t)
13
+ }, m = [];
14
+ if (s) {
15
+ let e = Se(R.Text, s);
16
+ m.push(e);
17
+ }
18
+ let h = u.filter((e) => e.role === v.SCATTER_HORIZONTAL), _ = u.filter((e) => e.role === v.SCATTER_VERTICAL), y = e.measures.filter((e) => e.role === v.SCATTER_HORIZONTAL), x = e.measures.filter((e) => e.role === v.SCATTER_VERTICAL), S = h[0], C = _[0], w = {};
19
+ if (S) {
20
+ let t = g.Bottom, n = e.axes?.primaryMeasure || w;
21
+ if (c.push(U(K.XAxisScale, n, f, t, S.formatter)), e.axes?.primaryMeasure?.showAxisName) {
22
+ let r = p(y, e.enableAlternate, a?.isPrintMode);
23
+ l.push(Ce(h, r, t, f, n.colors?.title, n.axisTitle, n.titleFontSize));
24
+ }
25
+ }
26
+ if (C) {
27
+ let t = g.Left, n = e.axes?.secondaryMeasure || w;
28
+ if (c.push(U(K.YAxisScale, n, f, t, C.formatter)), e.axes?.secondaryMeasure?.showAxisName) {
29
+ let r = p(x, e.enableAlternate, a?.isPrintMode);
30
+ l.push(Ce(_, r, t, f, n.colors?.title, n.axisTitle, n.titleFontSize));
31
+ }
32
+ }
33
+ return {
34
+ ...n,
35
+ components: [
36
+ ...n.components,
37
+ ...c,
38
+ ...l
39
+ ],
40
+ interactions: [...n.interactions ?? [], ...m]
41
+ };
42
+ }, Ne = (e, n) => {
43
+ let r = e.dimensions.filter((e) => d(e)), a = e.measures.filter((e) => d(e)), o = r.filter((e) => e.role === i.SCATTER_DIMENSION), s = a.filter((e) => e.role === v.SCATTER_SIZE), c = o[0], l = s[0], { coloring: u } = e || {};
44
+ switch (u?.type) {
45
+ case t.Categorical: return ie(e, n);
46
+ case t.Gradient: return Oe(e, l);
47
+ case t.Single: return m(c.dataItem);
48
+ default: return null;
49
+ }
50
+ }, Pe = (e, n, r, a, o, s, l) => {
51
+ let u = e.dimensions.filter((e) => d(e)), f = e.measures.filter((e) => d(e)), p = u.filter((e) => e.role === i.SCATTER_DIMENSION), h = f.filter((e) => e.role === v.SCATTER_HORIZONTAL), g = f.filter((e) => e.role === v.SCATTER_VERTICAL), b = f.filter((e) => e.role === v.SCATTER_SIZE), x = p[0], C = h[0], w = g[0], T = b[0], E = {}, { coloring: D } = e || {}, O = u.length < 2 && e.scatterSettings?.spatialHeatmap?.show, k = O && !D?.fieldId ? null : Ne(e, l);
52
+ switch (D?.type) {
53
+ case t.Categorical:
54
+ E = F(Ae(e, k), n, E, void 0, l);
55
+ break;
56
+ case t.Gradient:
57
+ E = F(Ae(e, k), n, E, void 0, l);
58
+ break;
59
+ case t.Single: {
60
+ let r = m(x.dataItem);
61
+ E[t.Single] = {
62
+ data: { extract: { field: r } },
63
+ range: [e?.coloring?.color ?? n.colors.brandColors[0]],
64
+ type: j.CategoricalColor,
65
+ label: (e) => x?.formatter?.format ? ee(x.formatter, e.datum.value) : e.datum.label
66
+ };
67
+ break;
68
+ }
69
+ default: break;
70
+ }
71
+ if (O) {
72
+ E[K.Density] = {
73
+ data: k ? { field: k } : void 0,
74
+ min: 0,
75
+ max: (t) => (t.data?.fields?.[0] ? t.data.fields[0].max() : 1) * (y(e.scatterSettings?.spatialHeatmap?.maxDensity ?? c.heatmapMaxDensity) ?? 0),
76
+ nice: !0
77
+ }, E[K.DensityInverted] = {
78
+ ...E[K.Density],
79
+ invert: !0
80
+ };
81
+ let i = [..._(D?.type ?? t.Gradient, n), ...D?.customGradient ? [D.customGradient] : []].find((e) => e.id === (D?.palette ?? n.colors.defaultGradient ?? S.id))?.colors;
82
+ E[K.DensityGradient] = {
83
+ ...E[K.Density],
84
+ range: i ?? S.colors,
85
+ type: j.SequentialColor
86
+ }, k && G(r, 0, { density: { field: k } });
87
+ } else k && G(r, 0, { color: { field: k } });
88
+ let A = m(C?.dataItem), ne = m(w?.dataItem), M = m(T?.dataItem), N = re(e?.axes?.primaryMeasure?.axisRange, !0), P = z(N);
89
+ E[K.XAxisScale] = {
90
+ type: j.Linear,
91
+ data: { field: A },
92
+ invert: te(!1, e?.axes?.primaryMeasure),
93
+ nice: !P && B.scale.nice,
94
+ expandMax: .06,
95
+ ...N
96
+ };
97
+ let I = re(e?.axes?.secondaryMeasure?.axisRange, !0), L = z(I);
98
+ return E[K.YAxisScale] = {
99
+ type: j.Linear,
100
+ data: { fields: [ne] },
101
+ invert: te(!0, e?.axes?.secondaryMeasure),
102
+ nice: !L && B.scale.nice,
103
+ expandMax: .06,
104
+ ...I
105
+ }, T && (E[M] = {
106
+ type: j.Linear,
107
+ data: { field: M }
108
+ }), {
109
+ ...r,
110
+ scales: E
111
+ };
112
+ }, q = "spatial-heatmap", Fe = "shape", J = (e) => {
113
+ let t = e.scatterSettings?.shape ?? u.Circle;
114
+ return `${R.Point}-${t}`;
115
+ }, Ie = (e, t, n, r, a, o) => {
116
+ let s = e.dimensions.filter((e) => d(e)), c = e.measures.filter((e) => d(e)), l = Ee((e.supportingMeasures ?? []).filter((e) => d(e))), u = s.filter((e) => e.role === i.SCATTER_IMAGE), f = c.filter((e) => e.role === v.SCATTER_HORIZONTAL), p = c.filter((e) => e.role === v.SCATTER_VERTICAL), h = c.filter((e) => e.role === v.SCATTER_SIZE), g = u[0], _ = f[0], y = p[0], b = h[0], x = m(_?.dataItem), S = m(y?.dataItem);
117
+ G(n, 0, {
118
+ x: { field: x },
119
+ y: { field: S },
120
+ [x]: { field: x },
121
+ [S]: { field: S },
122
+ ...l
123
+ });
124
+ let C = e.scatterSettings?.pointSize ?? .1, w = {};
125
+ if (b) {
126
+ let t = m(b.dataItem);
127
+ w = { field: t }, C = (t) => {
128
+ let n = e.scatterSettings?.pointSize ?? 0, r = e.scatterSettings?.maxPointSize ?? Math.max(n, 1);
129
+ return t.resources.scale(m(b.dataItem))(t.datum.size.value) * (r - n) + n;
130
+ }, G(n, 0, {
131
+ size: w,
132
+ [t]: { field: t }
133
+ });
134
+ }
135
+ let T;
136
+ return g ? (G(n, 0, { imageUrl: { field: m(g.dataItem) } }), T = [Le(e, t, C, o, !0, a), ze(e, C, o)]) : T = e.scatterSettings?.spatialHeatmap?.show ? [Re(e, t, n, C, o, a)] : [Le(e, t, C, o, !1, a)], {
137
+ ...n,
138
+ components: [...n.components, ...T]
139
+ };
140
+ }, Le = (e, t, n, r, i, a) => {
141
+ let o = new ke(e, t, a?.[0]?.itemsNotAffectedByFiltering), s = e.scatterSettings?.shape ?? u.Circle, c = e.scatterSettings?.stroke;
142
+ return {
143
+ type: R.Point,
144
+ layout: { displayOrder: W.VisualizationElement },
145
+ key: J(e),
146
+ data: { collection: K.Collection },
147
+ animations: {
148
+ enabled: !i,
149
+ presetId: "scatter-chart"
150
+ },
151
+ settings: {
152
+ x: {
153
+ scale: K.XAxisScale,
154
+ ref: "x"
155
+ },
156
+ y: {
157
+ scale: K.YAxisScale,
158
+ ref: "y"
159
+ },
160
+ opacity: i ? 0 : .8,
161
+ stroke: c?.color ?? void 0,
162
+ strokeWidth: c?.enabled ? c.width : 0,
163
+ shape: s,
164
+ size: n,
165
+ fill: i ? "transparent" : o.getColorDefinition({
166
+ overwriteSources: [o.MAIN_FIELD, "color"],
167
+ ref: "color"
168
+ }),
169
+ tag: Fe
170
+ },
171
+ brush: i ? null : Te([""], r, { valuePickerMode: r?.valuePickerMode })
172
+ };
173
+ }, Re = (e, t, n, r, i, a) => {
174
+ let o = n.scales[K.Density]?.data, s = a?.[0]?.items?.length, c = n.collections?.[0]?.data?.extract?.[0]?.props?.density?.field && o?.field ? {
175
+ scale: K.Density,
176
+ ref: "density"
177
+ } : {
178
+ scale: K.Density,
179
+ fn: ({ scale: e }) => {
180
+ let t = e?.(1);
181
+ return typeof t == "number" ? t : 1;
182
+ }
183
+ };
184
+ return {
185
+ type: R.Heatmap,
186
+ layout: { displayOrder: W.VisualizationElement },
187
+ key: "spatial-heatmap",
188
+ animations: s !== void 0 && s < 1e3 ? { enabled: !0 } : void 0,
189
+ data: { collection: K.Collection },
190
+ settings: {
191
+ point: {
192
+ x: {
193
+ scale: K.XAxisScale,
194
+ ref: "x"
195
+ },
196
+ y: {
197
+ scale: K.YAxisScale,
198
+ ref: "y"
199
+ },
200
+ size: r,
201
+ density: c
202
+ },
203
+ gradient: K.DensityGradient,
204
+ blur: e.scatterSettings?.spatialHeatmap?.blur,
205
+ minOpacity: 1e-4
206
+ },
207
+ brush: i?.disable?.brushing ? void 0 : { consume: [{
208
+ context: H.Selection,
209
+ data: [""],
210
+ mode: ve.And,
211
+ style: { inactive: { opacity: .1 } }
212
+ }] }
213
+ };
214
+ }, ze = (e, t, n) => ({
215
+ type: R.DomPoint,
216
+ layout: { displayOrder: W.VisualizationElement },
217
+ key: R.DomPoint,
218
+ data: { collection: K.Collection },
219
+ settings: {
220
+ x: {
221
+ scale: K.XAxisScale,
222
+ ref: "x"
223
+ },
224
+ y: {
225
+ scale: K.YAxisScale,
226
+ ref: "y"
227
+ },
228
+ opacity: .8,
229
+ size: t,
230
+ url: { ref: "imageUrl" },
231
+ renderCallback: (...e) => {
232
+ e.length === 0 && n?.onRenderDone?.();
233
+ },
234
+ borderWidth: e.scatterSettings?.borderWidth,
235
+ borderColor: e.scatterSettings?.borderColor ?? void 0
236
+ },
237
+ brush: Te([""], n, { valuePickerMode: n?.valuePickerMode })
238
+ }), Be = (e, t, n) => {
239
+ let { measures: r, grid: i = [] } = e, a = i.filter((e) => e.enabled).map((e) => {
240
+ let n = x(r[0].dataItem, e.dataItem);
241
+ return ae(e, n ? "x" : "y", n ? K.XAxisScale : K.YAxisScale, t);
242
+ }).filter((e) => !!e);
243
+ return {
244
+ ...n,
245
+ components: [...n.components, ...a]
246
+ };
247
+ }, Ve = (e, t, n) => {
248
+ let r = [], i = [];
249
+ if (!e.refLines?.x && !e.refLines?.y) return n;
250
+ if (e.refLines.x) {
251
+ let n = e.refLines.x.map((e) => fe(e, K.XAxisScale, t));
252
+ r.push(...n);
253
+ }
254
+ if (e.refLines.y) {
255
+ let n = e.refLines.y.map((e) => fe(e, K.YAxisScale, t));
256
+ i.push(...n);
257
+ }
258
+ let a = {
259
+ type: R.RefLine,
260
+ layout: { displayOrder: W.RefLine },
261
+ lines: {
262
+ x: r,
263
+ y: i
264
+ }
265
+ };
266
+ return {
267
+ ...n,
268
+ components: [...n.components, a]
269
+ };
270
+ }, He = "scatter-reference-areas", Y = "scatter-reference-area", Ue = l("scatter-reference-areas-stage", "#6B7280"), X = (e) => {
271
+ if (e == null) return null;
272
+ let t = y(e);
273
+ if (t === null) return null;
274
+ let n = typeof t == "number" ? t : Number(t);
275
+ return Number.isNaN(n) ? null : n;
276
+ }, We = (e) => {
277
+ if (e == null) return;
278
+ let t = y(e);
279
+ if (t === null || typeof t != "string") return;
280
+ let n = t.trim();
281
+ return n.length > 0 ? n : void 0;
282
+ }, Ge = (e, t) => {
283
+ if (e.enabled === !1) return;
284
+ let n = X(e.xMin), r = X(e.xMax), i = X(e.yMin), a = X(e.yMax);
285
+ if (n === null || r === null || i === null || a === null) {
286
+ Ue.warn("Skipping reference area due to incomplete bounds", {
287
+ id: e.id,
288
+ index: t
289
+ });
290
+ return;
291
+ }
292
+ let o = We(e.label), s = e.fillColor ?? c.referenceArea.fillColor, l = e.border?.enabled ?? c.referenceArea.border?.enabled ?? !1, u = l ? e.border?.color ?? c.referenceArea.border?.color ?? void 0 : void 0, d = l ? e.border?.width ?? c.referenceArea.border?.width ?? 1 : void 0, [f, p] = n <= r ? [n, r] : [r, n], [m, h] = i <= a ? [i, a] : [a, i], g = e.labelMode ?? c.referenceArea.labelMode, _ = e.labelPlacement ?? c.referenceArea.labelPlacement, v = e.labelColor ?? c.referenceArea.labelColor, y = e.labelFontSize ?? c.referenceArea.labelFontSize;
293
+ return {
294
+ id: e.id,
295
+ label: o,
296
+ labelMode: g,
297
+ labelPlacement: _,
298
+ labelColor: v,
299
+ labelFontSize: y,
300
+ xMin: f,
301
+ xMax: p,
302
+ yMin: m,
303
+ yMax: h,
304
+ fillColor: s,
305
+ borderColor: u,
306
+ borderWidth: d
307
+ };
308
+ }, Ke = (e) => {
309
+ let t = {
310
+ id: { value: e.id },
311
+ labelMode: { value: e.labelMode },
312
+ labelPlacement: { value: e.labelPlacement },
313
+ labelColor: { value: e.labelColor },
314
+ labelFontSize: { value: e.labelFontSize },
315
+ start: { value: e.yMin },
316
+ end: { value: e.yMax },
317
+ binStart: { value: e.xMin },
318
+ binEnd: { value: e.xMax },
319
+ xMin: { value: e.xMin },
320
+ xMax: { value: e.xMax },
321
+ yMin: { value: e.yMin },
322
+ yMax: { value: e.yMax },
323
+ fillColor: { value: e.fillColor }
324
+ };
325
+ 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;
326
+ }, qe = (e) => {
327
+ switch (e) {
328
+ case f.TopLeft: return {
329
+ align: 0,
330
+ justify: 0
331
+ };
332
+ case f.Top: return {
333
+ align: .5,
334
+ justify: 0
335
+ };
336
+ case f.TopRight: return {
337
+ align: 1,
338
+ justify: 0
339
+ };
340
+ case f.Left: return {
341
+ align: 0,
342
+ justify: .5
343
+ };
344
+ case f.Right: return {
345
+ align: 1,
346
+ justify: .5
347
+ };
348
+ case f.BottomLeft: return {
349
+ align: 0,
350
+ justify: 1
351
+ };
352
+ case f.Bottom: return {
353
+ align: .5,
354
+ justify: 1
355
+ };
356
+ case f.BottomRight: return {
357
+ align: 1,
358
+ justify: 1
359
+ };
360
+ case f.Center:
361
+ default: return {
362
+ align: .5,
363
+ justify: .5
364
+ };
365
+ }
366
+ }, Je = (e, t, r) => {
367
+ if (e.labelMode !== n.Fixed || !e.label) return null;
368
+ let { align: i, justify: a } = qe(e.labelPlacement), o = c.referenceArea.labelColor, s = c.referenceArea.labelFontSize, l = e.labelColor ?? o, u = e.labelFontSize ?? s;
369
+ return {
370
+ type: R.Labels,
371
+ key: `${Y}-${e.id}-label`,
372
+ layout: { displayOrder: t },
373
+ settings: { sources: [{
374
+ component: `${Y}-${e.id}`,
375
+ selector: De.Rect,
376
+ strategy: {
377
+ type: "rows",
378
+ settings: {
379
+ align: i,
380
+ justify: a,
381
+ fontSize: u,
382
+ fontFamily: r.fonts?.general?.fontFamily,
383
+ padding: 2,
384
+ labels: [{
385
+ label: () => e.label ?? "",
386
+ fill: l
387
+ }]
388
+ }
389
+ }
390
+ }] },
391
+ animations: { enabled: !1 },
392
+ brush: null
393
+ };
394
+ }, Ye = (e, t, n) => {
395
+ let r = {
396
+ orientation: h.Vertical,
397
+ major: {
398
+ scale: K.XAxisScale,
399
+ ref: "binEnd",
400
+ binStart: { ref: "binStart" },
401
+ binEnd: { ref: "binEnd" }
402
+ },
403
+ minor: {
404
+ scale: K.YAxisScale,
405
+ ref: "end"
406
+ },
407
+ minor0: {
408
+ scale: K.YAxisScale,
409
+ ref: "start"
410
+ },
411
+ box: {
412
+ fill: e.fillColor ?? c.referenceArea.fillColor,
413
+ opacity: 1,
414
+ stroke: e.borderColor ?? "transparent",
415
+ strokeWidth: e.borderWidth ?? 0,
416
+ ignoreOutOfBounds: !0
417
+ }
418
+ };
419
+ return {
420
+ type: R.Box,
421
+ key: `${Y}-${e.id}`,
422
+ layout: { displayOrder: t },
423
+ data: {
424
+ collection: He,
425
+ filter: (e, t) => t === n
426
+ },
427
+ settings: r,
428
+ animations: { enabled: !1 },
429
+ brush: null
430
+ };
431
+ }, Xe = (e, t, n) => {
432
+ let r = e.referenceAreas ?? [];
433
+ if (!r.length) return n;
434
+ let i = r.map(Ge).filter((e) => e !== void 0);
435
+ if (!i.length) return n;
436
+ let a = i.map(Ke), o = n.collections ? [...n.collections] : [];
437
+ o.push({
438
+ key: He,
439
+ data: {
440
+ items: a,
441
+ map: ({ value: e }) => e,
442
+ extract: []
443
+ }
444
+ });
445
+ let s = n.components ? [...n.components] : [], c = i.length;
446
+ return i.forEach((e, n) => {
447
+ let r = W.ReferenceArea + (c - n) * .001, i = Ye(e, r, n);
448
+ s.push(i);
449
+ let a = Je(e, r + 5e-4, t);
450
+ a && s.push(a);
451
+ }), {
452
+ ...n,
453
+ collections: o,
454
+ components: s
455
+ };
456
+ }, Ze = (e, t, n) => {
457
+ let r = t.data.value, a = e.filter((e) => d(e)).filter((e) => e.role === i.SCATTER_DIMENSION)[0];
458
+ return a?.formatter && (r = n.formatter(a.formatter)(r)), `${r}`;
459
+ }, Z = (e) => typeof e == "string" && e.startsWith("scatter-reference-area") && !e.endsWith("-label"), Q = (e) => {
460
+ let t = e.data?.labelMode;
461
+ if (typeof t == "string") return t;
462
+ if (t && typeof t == "object" && "value" in t) {
463
+ let e = t.value;
464
+ if (typeof e == "string") return e;
465
+ }
466
+ }, $ = (e) => {
467
+ let t = e.data?.label, n;
468
+ if (typeof t == "string") n = t;
469
+ else if (t && typeof t == "object" && t && "value" in t) {
470
+ let e = t.value;
471
+ n = typeof e == "string" ? e : void 0;
472
+ }
473
+ if (!n) return;
474
+ let r = n.trim();
475
+ return r.length > 0 ? r : void 0;
476
+ }, Qe = (e) => ({
477
+ title: e,
478
+ props: []
479
+ }), $e = (e, t, r) => {
480
+ let i = {
481
+ filter: (t) => {
482
+ let r = [
483
+ J(e),
484
+ V,
485
+ q
486
+ ];
487
+ return t.filter((e) => e.key ? Z(e.key) ? Q(e) !== n.Fixed && !!$(e) : r.includes(e.key) : !1);
488
+ },
489
+ placement: {
490
+ type: "pointer",
491
+ area: "target"
492
+ }
493
+ };
494
+ if (r.components.find((e) => e.key === "spatial-heatmap")) {
495
+ let e = ({ node: e, resources: t }) => ({
496
+ title: e.data.label,
497
+ props: [
498
+ "x",
499
+ "y",
500
+ "size",
501
+ "density"
502
+ ].flatMap((n) => {
503
+ let r = e.data[n], i = r?.source?.field;
504
+ return i ? [{
505
+ label: t.dataset("").field(i)?.title() ?? "",
506
+ value: r.label ?? ""
507
+ }] : [];
508
+ })
509
+ });
510
+ i.extract = (t) => {
511
+ if (Z(t.node.key)) {
512
+ let e = $(t.node), r = Q(t.node);
513
+ if (e && r !== n.Fixed) return Qe(e);
514
+ }
515
+ return e(t);
516
+ };
517
+ let r = L(t);
518
+ i.content = ({ h: e, data: t }) => {
519
+ if (t.length > 8) {
520
+ let e = t.length;
521
+ t = t.slice(0, 5), t.push({
522
+ title: `+ ${e - t.length} more`,
523
+ props: []
524
+ });
525
+ }
526
+ return r({
527
+ h: e,
528
+ data: t
529
+ });
530
+ };
531
+ } else {
532
+ let r = M(e, t, me, Ze);
533
+ i.extract = (e) => {
534
+ if (Z(e.node.key)) {
535
+ let t = $(e.node), r = Q(e.node);
536
+ if (t && r !== n.Fixed) return Qe(t);
537
+ }
538
+ return r(e);
539
+ };
540
+ }
541
+ return oe(e, t, r, i, "tooltip", void 0, {
542
+ componentKeys: [J(e)],
543
+ yieldToComponentKeys: [V, q]
544
+ });
545
+ }, et = (e, t, n) => {
546
+ let r = e?.measures[0], i = {
547
+ showAxisTooltip: e?.axes?.primaryMeasure?.showAxisTooltip,
548
+ formatter: r?.formatter,
549
+ scale: he(e),
550
+ key: P.Measure,
551
+ settings: { direction: ce(e) }
552
+ }, a = e?.measures[1], [o, s] = we([i, {
553
+ showAxisTooltip: e?.axes?.secondaryMeasure?.showAxisTooltip,
554
+ formatter: a?.formatter,
555
+ scale: pe(e, a),
556
+ key: P.MeasureSec,
557
+ settings: {
558
+ direction: I(e),
559
+ labelDock: N(ue(e), a?.secondaryAxis)
560
+ }
561
+ }]);
562
+ return {
563
+ ...n,
564
+ components: [...n.components ?? [], ...o],
565
+ interactions: [...n.interactions ?? [], ...s]
566
+ };
567
+ }, tt = (e, t, n) => _e(e, t, n), nt = (e) => {
568
+ try {
569
+ return !!e && de(e);
570
+ } catch {
571
+ return !1;
572
+ }
573
+ }, rt = (e, t, n, r, i, o) => {
574
+ if (o?.disable?.brushing || o?.disable?.brushingLasso) return n;
575
+ let s = nt(t?.colors?.sheetBackgroundColor) ? a.white : a.mainDarkNavy, c = e.scatterSettings?.lasso, l = c?.strokeColor ?? s, u = {
576
+ type: R.Lasso,
577
+ key: R.Lasso,
578
+ layout: { displayOrder: W.VisualizationElement + 1 },
579
+ settings: {
580
+ brush: { components: [{
581
+ key: J(e),
582
+ contexts: [H.Selection],
583
+ action: "toggle"
584
+ }, {
585
+ key: q,
586
+ contexts: [H.Selection],
587
+ action: "toggle"
588
+ }] },
589
+ lasso: {
590
+ strokeWidth: 2,
591
+ strokeDasharray: "4",
592
+ stroke: l
593
+ },
594
+ snapIndicator: { stroke: l },
595
+ startPoint: {
596
+ r: 3,
597
+ fill: c?.startPointColor ?? a.secondaryPurple,
598
+ stroke: l
599
+ }
600
+ }
601
+ }, d = {
602
+ type: "native",
603
+ key: `${R.Lasso}-interaction`,
604
+ events: {
605
+ mousedown(e) {
606
+ this.chart.component(R.Lasso).emit("lassoStart", { center: {
607
+ x: e.clientX,
608
+ y: e.clientY
609
+ } });
610
+ },
611
+ mousemove(e) {
612
+ this.chart.component(R.Lasso).emit("lassoMove", { center: {
613
+ x: e.clientX,
614
+ y: e.clientY
615
+ } });
616
+ },
617
+ mouseup(e) {
618
+ this.chart.component(R.Lasso).emit("lassoEnd", { center: {
619
+ x: e.clientX,
620
+ y: e.clientY
621
+ } });
622
+ }
623
+ }
624
+ };
625
+ return {
626
+ ...n,
627
+ components: [...n.components, u],
628
+ interactions: [...n.interactions ?? [], d]
629
+ };
630
+ }, it = (e, t, n, r, i, a) => {
631
+ let o = e.scatterSettings?.spatialHeatmap?.show && e.dimensions.length < 2;
632
+ if (!e.pointLabeling?.enabled || o) return n;
633
+ let s = e.pointLabeling, c = 4 + (e.scatterSettings?.stroke?.enabled ? e.scatterSettings.stroke.width / 2 : 0), l = A({
634
+ targetComponentKeys: [J(e)],
635
+ targetSelector: `.${Fe}`,
636
+ offset: c,
637
+ fontSize: be(e.pointLabeling?.fontSize, b(t).fontSizes.dataLabel)
638
+ }, s, a, t);
639
+ return l ? {
640
+ ...n,
641
+ components: [...n.components, l]
642
+ } : n;
643
+ }, at = (...e) => {
644
+ let t = ye(...e), n = t.components.find((e) => e.type === ne.SequentialLegend), r = t.scales[K.Density];
645
+ if (n && r) {
646
+ n.settings.fill = K.DensityGradient;
647
+ let e = n.layout?.dock;
648
+ n.settings.major = e === g.Left || e === g.Right ? K.DensityInverted : K.Density;
649
+ }
650
+ return t;
651
+ }, ot = class extends le {
652
+ constructor() {
653
+ super([
654
+ se,
655
+ Pe,
656
+ Be,
657
+ Xe,
658
+ Ie,
659
+ Me,
660
+ Ve,
661
+ at,
662
+ tt,
663
+ it,
664
+ $e,
665
+ rt,
666
+ et
667
+ ]);
668
+ }
669
+ preCompile(e) {
670
+ let t = e.dimensions.filter((e) => d(e)), n = e.measures.filter((e) => d(e)), r = t.filter((e) => e.role === i.SCATTER_DIMENSION), a = n.filter((e) => e.role === v.SCATTER_HORIZONTAL), o = n.filter((e) => e.role === v.SCATTER_VERTICAL), s = r[0], c = a[0], l = o[0];
671
+ if (!s || !c || !l) throw Error("Scatter chart requires at least 1 scatter dimension, 1 horizontal measure, and 1 vertical measure.");
672
+ }
673
+ }, st = E(), ct = w(({ vSpec: e, vTheme: t, data: n, elementSize: i, vizProperties: a }) => {
674
+ let c = T(), [l] = (0, je.useState)(() => new ot()), u = D(), { activeKey: d } = k(), f = C(), p = xe();
675
+ if (!e || !n || !i || !o(e)) return null;
676
+ let m = {
677
+ ...a,
678
+ valuePickerMode: !!d
679
+ }, h = t || r, g = l.compile(e, h, n, i, {
680
+ ...m,
681
+ onRenderDone: u
682
+ }, s.Scatter, c, f, p);
683
+ return g ? /* @__PURE__ */ (0, st.jsx)(ge, {
684
+ config: m,
685
+ definition: g,
686
+ size: i,
687
+ vSpec: e
688
+ }) : null;
689
+ });
690
+ export { ct as ScatterChart };