@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
@@ -1,675 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { Do as t, La as n, No as r, Oa as i, Pn as a, Po as o, Ta as s, Ti as c, Xs as l, Ya as u, cc as d, jo as f, oo as p, pc as m, qs as h, r as g, sa as _, ti as v, ui as y, wa as b } from "./interfaces-VUY4_yVO.js";
3
- import { I as x, Ki as S, P as C, Zt as w, d as T, o as E, pn as ee, wi as D } from "./utils-Ba9T0TqC.js";
4
- import { $ as O, $t as k, At as A, Bt as j, Ct as M, Dt as N, Ft as P, H as te, It as F, Jt as ne, M as re, Mt as ie, Nt as ae, Ot as I, Qt as L, R, St as z, Tt as oe, U as B, W as V, Wt as H, X as se, Xt as ce, Yt as le, Z as ue, Zt as de, _t as fe, an as pe, ht as U, i as me, in as W, j as he, jt as ge, ln as _e, n as ve, nn as ye, nt as be, on as xe, ot as Se, q as Ce, rn as G, un as K, yt as we, z as Te, zt as Ee } from "./escobar-BGqT1EsE.js";
5
- import { t as De } from "./coloring-C16AUZEi.js";
6
- import { t as Oe } from "./set-coloring-datafield-B3uIS1Pe.js";
7
- var ke = /* @__PURE__ */ e(S()), Ae = (e, t, i, a, o, s, l, u) => {
8
- let d = [], f = [], p = e.measures.filter((e) => c(e)), m = {
9
- ...t.axis.measure,
10
- ...t.fonts
11
- }, h = [];
12
- if (u) {
13
- let e = F(K.Text, u);
14
- h.push(e);
15
- }
16
- let g = p.filter((e) => e.role === n.SCATTER_HORIZONTAL), _ = p.filter((e) => e.role === n.SCATTER_VERTICAL), y = e.measures.filter((e) => e.role === n.SCATTER_HORIZONTAL), b = e.measures.filter((e) => e.role === n.SCATTER_VERTICAL), x = g[0], S = _[0], C = {};
17
- if (x) {
18
- let t = r.Bottom, n = e.axes?.primaryMeasure || C;
19
- if (d.push(Ee(L.XAxisScale, n, m, t, x.formatter)), e.axes?.primaryMeasure?.showAxisName) {
20
- let r = v(y, e.enableAlternate, s?.isPrintMode);
21
- f.push(j(g, r, t, m, n.colors?.title, n.axisTitle, n.titleFontSize));
22
- }
23
- }
24
- if (S) {
25
- let t = r.Left, n = e.axes?.secondaryMeasure || C;
26
- if (d.push(Ee(L.YAxisScale, n, m, t, S.formatter)), e.axes?.secondaryMeasure?.showAxisName) {
27
- let r = v(b, e.enableAlternate, s?.isPrintMode);
28
- f.push(j(_, r, t, m, n.colors?.title, n.axisTitle, n.titleFontSize));
29
- }
30
- }
31
- return {
32
- ...i,
33
- components: [
34
- ...i.components,
35
- ...d,
36
- ...f
37
- ],
38
- interactions: i.interactions ? [...i.collections, ...h] : [...h]
39
- };
40
- }, je = (e, t) => {
41
- let r = e.dimensions.filter((e) => c(e)), i = e.measures.filter((e) => c(e)), a = r.filter((e) => e.role === u.SCATTER_DIMENSION), o = i.filter((e) => e.role === n.SCATTER_SIZE), s = a[0], d = o[0], { coloring: f } = e || {};
42
- switch (f?.type) {
43
- case l.Categorical: return M(e, t);
44
- case l.Gradient: return oe(e, d);
45
- case l.Single: return m(s.dataItem);
46
- default: return null;
47
- }
48
- }, Me = (e, t, r, i, o, s, d) => {
49
- let f = e.dimensions.filter((e) => c(e)), p = e.measures.filter((e) => c(e)), h = f.filter((e) => e.role === u.SCATTER_DIMENSION), v = p.filter((e) => e.role === n.SCATTER_HORIZONTAL), y = p.filter((e) => e.role === n.SCATTER_VERTICAL), x = p.filter((e) => e.role === n.SCATTER_SIZE), S = h[0], C = v[0], w = y[0], T = x[0], E = {}, { coloring: D } = e || {}, O = f.length < 2 && e.scatterSettings?.spatialHeatmap?.show, k = O && !D?.fieldId ? null : je(e, d);
50
- switch (D?.type) {
51
- case l.Categorical:
52
- E = z(Oe(e, k), t, E, null, d);
53
- break;
54
- case l.Gradient:
55
- E = z(Oe(e, k), t, E, null, d);
56
- break;
57
- case l.Single: {
58
- let n = m(S.dataItem);
59
- E[l.Single] = {
60
- data: { extract: { field: n } },
61
- range: [e?.coloring?.color ?? t.colors.brandColors[0]],
62
- type: W.CategoricalColor,
63
- label: (e) => S?.formatter?.format ? ee(S.formatter, e.datum.value) : e.datum.label
64
- };
65
- break;
66
- }
67
- default: break;
68
- }
69
- if (O) {
70
- E[L.Density] = {
71
- data: k ? { field: k } : void 0,
72
- min: 0,
73
- max: (t) => (t.data?.fields?.[0] ? t.data.fields[0].max() : 1) * a(e.scatterSettings.spatialHeatmap.maxDensity ?? _.heatmapMaxDensity),
74
- nice: !0
75
- }, E[L.DensityInverted] = {
76
- ...E[L.Density],
77
- invert: !0
78
- };
79
- let n = [...g(D.type, t), ...D.customGradient ? [D.customGradient] : []].find((e) => e.id === (D.palette ?? t.colors.defaultGradient ?? b.id))?.colors;
80
- E[L.DensityGradient] = {
81
- ...E[L.Density],
82
- range: n ?? b.colors,
83
- type: W.SequentialColor
84
- }, k && U(r, 0, { density: { field: k } });
85
- } else k && U(r, 0, { color: { field: k } });
86
- let A = m(C?.dataItem), j = m(w?.dataItem), M = m(T?.dataItem), N = te(e?.axes?.primaryMeasure?.axisRange, !0), P = V(N);
87
- E[L.XAxisScale] = {
88
- type: W.Linear,
89
- data: { field: A },
90
- invert: B(!1, e?.axes?.primaryMeasure),
91
- nice: !P && xe.scale.nice,
92
- expandMax: .06,
93
- ...N
94
- };
95
- let F = te(e?.axes?.secondaryMeasure?.axisRange, !0), ne = V(F);
96
- return E[L.YAxisScale] = {
97
- type: W.Linear,
98
- data: { fields: [j] },
99
- invert: B(!0, e?.axes?.secondaryMeasure),
100
- nice: !ne && xe.scale.nice,
101
- expandMax: .06,
102
- ...F
103
- }, T && (E[M] = {
104
- type: W.Linear,
105
- data: { field: M }
106
- }), {
107
- ...r,
108
- scales: E
109
- };
110
- }, q = "spatial-heatmap", Ne = "shape", J = (e) => {
111
- let n = e.scatterSettings?.shape ?? t.Circle;
112
- return `${K.Point}-${n}`;
113
- }, Pe = (e, t, r, i, a, o) => {
114
- let s = e.dimensions.filter((e) => c(e)), l = e.measures.filter((e) => c(e)), d = re((e.supportingMeasures ?? []).filter((e) => c(e))), f = s.filter((e) => e.role === u.SCATTER_IMAGE), p = l.filter((e) => e.role === n.SCATTER_HORIZONTAL), h = l.filter((e) => e.role === n.SCATTER_VERTICAL), g = l.filter((e) => e.role === n.SCATTER_SIZE), _ = f[0], v = p[0], y = h[0], b = g[0], x = m(v?.dataItem), S = m(y?.dataItem);
115
- U(r, 0, {
116
- x: { field: x },
117
- y: { field: S },
118
- [x]: { field: x },
119
- [S]: { field: S },
120
- ...d
121
- });
122
- let C = e.scatterSettings?.pointSize ?? .1, w = {};
123
- if (b) {
124
- let t = m(b.dataItem);
125
- w = { field: t }, C = (t) => {
126
- let n = e.scatterSettings?.pointSize ?? 0, r = e.scatterSettings?.maxPointSize ?? Math.max(n, 1);
127
- return t.resources.scale(m(b.dataItem))(t.datum.size.value) * (r - n) + n;
128
- }, U(r, 0, {
129
- size: w,
130
- [t]: { field: t }
131
- });
132
- }
133
- let T;
134
- return _ ? (U(r, 0, { imageUrl: { field: m(_.dataItem) } }), T = [Fe(e, t, C, o, !0, a), Le(e, C, o)]) : T = e.scatterSettings?.spatialHeatmap?.show ? [Ie(e, t, r, C, o, a)] : [Fe(e, t, C, o, !1, a)], {
135
- ...r,
136
- components: [...r.components, ...T]
137
- };
138
- }, Fe = (e, n, r, i, a, o) => {
139
- let s = new De(e, n, o?.[0]?.itemsNotAffectedByFiltering), c = e.scatterSettings?.shape ?? t.Circle, l = e.scatterSettings?.stroke;
140
- return {
141
- type: K.Point,
142
- layout: { displayOrder: P.VisualizationElement },
143
- key: J(e),
144
- data: { collection: L.Collection },
145
- animations: {
146
- enabled: !a,
147
- presetId: "scatter-chart"
148
- },
149
- settings: {
150
- x: {
151
- scale: L.XAxisScale,
152
- ref: "x"
153
- },
154
- y: {
155
- scale: L.YAxisScale,
156
- ref: "y"
157
- },
158
- opacity: a ? 0 : .8,
159
- stroke: l?.color,
160
- strokeWidth: l?.enabled ? l.width : 0,
161
- shape: c,
162
- size: r,
163
- fill: a ? "transparent" : s.getColorDefinition({
164
- overwriteSources: [s.MAIN_FIELD, "color"],
165
- ref: "color"
166
- }),
167
- tag: Ne
168
- },
169
- brush: a ? null : H([""], i, { valuePickerMode: i?.valuePickerMode })
170
- };
171
- }, Ie = (e, t, n, r, i, a) => {
172
- let o = n.scales[L.Density]?.data, s = n.collections?.[0]?.data?.extract?.[0]?.props?.density?.field && o?.field ? {
173
- scale: L.Density,
174
- ref: "density"
175
- } : {
176
- scale: L.Density,
177
- fn: ({ scale: e }) => e(1)
178
- };
179
- return {
180
- type: K.Heatmap,
181
- layout: { displayOrder: P.VisualizationElement },
182
- key: "spatial-heatmap",
183
- animations: a?.[0]?.items?.length < 1e3 ? { enabled: !0 } : void 0,
184
- data: { collection: L.Collection },
185
- settings: {
186
- point: {
187
- x: {
188
- scale: L.XAxisScale,
189
- ref: "x"
190
- },
191
- y: {
192
- scale: L.YAxisScale,
193
- ref: "y"
194
- },
195
- size: r,
196
- density: s
197
- },
198
- gradient: L.DensityGradient,
199
- blur: e.scatterSettings.spatialHeatmap.blur,
200
- minOpacity: 1e-4
201
- },
202
- brush: i?.disable?.brushing ? void 0 : { consume: [{
203
- context: G.Selection,
204
- data: [""],
205
- mode: _e.And,
206
- style: { inactive: { opacity: .1 } }
207
- }] }
208
- };
209
- }, Le = (e, t, n) => ({
210
- type: K.DomPoint,
211
- layout: { displayOrder: P.VisualizationElement },
212
- key: K.DomPoint,
213
- data: { collection: L.Collection },
214
- settings: {
215
- x: {
216
- scale: L.XAxisScale,
217
- ref: "x"
218
- },
219
- y: {
220
- scale: L.YAxisScale,
221
- ref: "y"
222
- },
223
- opacity: .8,
224
- size: t,
225
- url: { ref: "imageUrl" },
226
- renderCallback: (...e) => {
227
- e.length === 0 && n.onRenderDone();
228
- },
229
- borderWidth: e.scatterSettings?.borderWidth,
230
- borderColor: e.scatterSettings?.borderColor
231
- },
232
- brush: H([""], n, { valuePickerMode: n?.valuePickerMode })
233
- }), Re = (e, t, n) => {
234
- let { measures: r, grid: i = [] } = e, a = i.filter((e) => e.enabled).map((e) => {
235
- let n = d(r[0].dataItem, e.dataItem);
236
- return we(e, n ? "x" : "y", n ? L.XAxisScale : L.YAxisScale, t);
237
- }).filter((e) => !!e);
238
- return {
239
- ...n,
240
- components: [...n.components, ...a]
241
- };
242
- }, ze = (e, t, n) => {
243
- let r = [], i = [];
244
- if (!e.refLines?.x && !e.refLines?.y) return n;
245
- if (e.refLines.x) {
246
- let n = e.refLines.x.map((e) => Se(e, L.XAxisScale, t));
247
- r.push(...n);
248
- }
249
- if (e.refLines.y) {
250
- let n = e.refLines.y.map((e) => Se(e, L.YAxisScale, t));
251
- i.push(...n);
252
- }
253
- let a = {
254
- type: K.RefLine,
255
- layout: { displayOrder: P.RefLine },
256
- lines: {
257
- x: r,
258
- y: i
259
- }
260
- };
261
- return {
262
- ...n,
263
- components: [...n.components, a]
264
- };
265
- }, Be = "scatter-reference-areas", Y = "scatter-reference-area", Ve = y("scatter-reference-areas-stage", "#6B7280"), X = (e) => {
266
- if (e == null) return null;
267
- let t = a(e);
268
- if (t === null) return null;
269
- let n = typeof t == "number" ? t : Number(t);
270
- return Number.isNaN(n) ? null : n;
271
- }, He = (e) => {
272
- if (e == null) return;
273
- let t = a(e);
274
- if (t === null || typeof t != "string") return;
275
- let n = t.trim();
276
- return n.length > 0 ? n : void 0;
277
- }, Ue = (e, t) => {
278
- if (e.enabled === !1) return;
279
- let n = X(e.xMin), r = X(e.xMax), i = X(e.yMin), a = X(e.yMax);
280
- if (n === null || r === null || i === null || a === null) {
281
- Ve.warn("Skipping reference area due to incomplete bounds", {
282
- id: e.id,
283
- index: t
284
- });
285
- return;
286
- }
287
- let o = He(e.label), s = e.fillColor ?? _.referenceArea.fillColor, c = e.border?.enabled ?? _.referenceArea.border?.enabled ?? !1, l = c ? e.border?.color ?? _.referenceArea.border?.color ?? void 0 : void 0, u = c ? e.border?.width ?? _.referenceArea.border?.width ?? 1 : void 0, [d, f] = n <= r ? [n, r] : [r, n], [p, m] = i <= a ? [i, a] : [a, i], h = e.labelMode ?? _.referenceArea.labelMode, g = e.labelPlacement ?? _.referenceArea.labelPlacement, v = e.labelColor ?? _.referenceArea.labelColor, y = e.labelFontSize ?? _.referenceArea.labelFontSize;
288
- return {
289
- id: e.id,
290
- label: o,
291
- labelMode: h,
292
- labelPlacement: g,
293
- labelColor: v,
294
- labelFontSize: y,
295
- xMin: d,
296
- xMax: f,
297
- yMin: p,
298
- yMax: m,
299
- fillColor: s,
300
- borderColor: l,
301
- borderWidth: u
302
- };
303
- }, We = (e) => {
304
- let t = {
305
- id: { value: e.id },
306
- labelMode: { value: e.labelMode },
307
- labelPlacement: { value: e.labelPlacement },
308
- labelColor: { value: e.labelColor },
309
- labelFontSize: { value: e.labelFontSize },
310
- start: { value: e.yMin },
311
- end: { value: e.yMax },
312
- binStart: { value: e.xMin },
313
- binEnd: { value: e.xMax },
314
- xMin: { value: e.xMin },
315
- xMax: { value: e.xMax },
316
- yMin: { value: e.yMin },
317
- yMax: { value: e.yMax },
318
- fillColor: { value: e.fillColor }
319
- };
320
- return e.label && (t.label = { value: e.label }), e.borderColor && (t.borderColor = { value: e.borderColor }), typeof e.borderWidth == "number" && (t.borderWidth = { value: e.borderWidth }), t;
321
- }, Ge = (e) => {
322
- switch (e) {
323
- case f.TopLeft: return {
324
- align: 0,
325
- justify: 0
326
- };
327
- case f.Top: return {
328
- align: .5,
329
- justify: 0
330
- };
331
- case f.TopRight: return {
332
- align: 1,
333
- justify: 0
334
- };
335
- case f.Left: return {
336
- align: 0,
337
- justify: .5
338
- };
339
- case f.Right: return {
340
- align: 1,
341
- justify: .5
342
- };
343
- case f.BottomLeft: return {
344
- align: 0,
345
- justify: 1
346
- };
347
- case f.Bottom: return {
348
- align: .5,
349
- justify: 1
350
- };
351
- case f.BottomRight: return {
352
- align: 1,
353
- justify: 1
354
- };
355
- case f.Center:
356
- default: return {
357
- align: .5,
358
- justify: .5
359
- };
360
- }
361
- }, Ke = (e, t, n) => {
362
- if (e.labelMode !== p.Fixed || !e.label) return null;
363
- let { align: r, justify: i } = Ge(e.labelPlacement), a = _.referenceArea.labelColor, o = _.referenceArea.labelFontSize, s = e.labelColor ?? a, c = e.labelFontSize ?? o;
364
- return {
365
- type: K.Labels,
366
- key: `${Y}-${e.id}-label`,
367
- layout: { displayOrder: t },
368
- settings: { sources: [{
369
- component: `${Y}-${e.id}`,
370
- selector: ye.Rect,
371
- strategy: {
372
- type: "rows",
373
- settings: {
374
- align: r,
375
- justify: i,
376
- fontSize: c,
377
- fontFamily: n.fonts?.general?.fontFamily,
378
- padding: 2,
379
- labels: [{
380
- label: () => e.label ?? "",
381
- fill: s
382
- }]
383
- }
384
- }
385
- }] },
386
- animations: { enabled: !1 },
387
- brush: null
388
- };
389
- }, qe = (e, t, n) => {
390
- let r = {
391
- orientation: o.Vertical,
392
- major: {
393
- scale: L.XAxisScale,
394
- ref: "binEnd",
395
- binStart: { ref: "binStart" },
396
- binEnd: { ref: "binEnd" }
397
- },
398
- minor: {
399
- scale: L.YAxisScale,
400
- ref: "end"
401
- },
402
- minor0: {
403
- scale: L.YAxisScale,
404
- ref: "start"
405
- },
406
- box: {
407
- fill: e.fillColor ?? _.referenceArea.fillColor,
408
- opacity: 1,
409
- stroke: e.borderColor ?? "transparent",
410
- strokeWidth: e.borderWidth ?? 0,
411
- ignoreOutOfBounds: !0
412
- }
413
- };
414
- return {
415
- type: K.Box,
416
- key: `${Y}-${e.id}`,
417
- layout: { displayOrder: t },
418
- data: {
419
- collection: Be,
420
- filter: (e, t) => t === n
421
- },
422
- settings: r,
423
- animations: { enabled: !1 },
424
- brush: null
425
- };
426
- }, Je = (e, t, n) => {
427
- let r = e.referenceAreas ?? [];
428
- if (!r.length) return n;
429
- let i = r.map(Ue).filter((e) => e !== void 0);
430
- if (!i.length) return n;
431
- let a = i.map(We), o = n.collections ? [...n.collections] : [];
432
- o.push({
433
- key: Be,
434
- data: {
435
- items: a,
436
- map: ({ value: e }) => e,
437
- extract: []
438
- }
439
- });
440
- let s = n.components ? [...n.components] : [], c = i.length;
441
- return i.forEach((e, n) => {
442
- let r = P.ReferenceArea + (c - n) * .001, i = qe(e, r, n);
443
- s.push(i);
444
- let a = Ke(e, r + 5e-4, t);
445
- a && s.push(a);
446
- }), {
447
- ...n,
448
- collections: o,
449
- components: s
450
- };
451
- }, Ye = (e, t, n) => {
452
- let r = t.data.value, i = e.filter((e) => c(e)).filter((e) => e.role === u.SCATTER_DIMENSION)[0];
453
- return i?.formatter && (r = n.formatter(i.formatter)(r)), `${r}`;
454
- }, Z = (e) => typeof e == "string" && e.startsWith("scatter-reference-area") && !e.endsWith("-label"), Q = (e) => {
455
- let t = e.data?.labelMode;
456
- if (typeof t == "string") return t;
457
- if (t && typeof t == "object" && "value" in t) {
458
- let e = t.value;
459
- if (typeof e == "string") return e;
460
- }
461
- }, $ = (e) => {
462
- let t = e.data?.label, n;
463
- if (typeof t == "string") n = t;
464
- else if (t && typeof t == "object" && t && "value" in t) {
465
- let e = t.value;
466
- n = typeof e == "string" ? e : void 0;
467
- }
468
- if (!n) return;
469
- let r = n.trim();
470
- return r.length > 0 ? r : void 0;
471
- }, Xe = (e) => ({
472
- title: e,
473
- props: []
474
- }), Ze = (e, t, n) => {
475
- let r = {
476
- filter: (t) => {
477
- let n = [
478
- J(e),
479
- R,
480
- q
481
- ];
482
- return t.filter((e) => e.key ? Z(e.key) ? Q(e) !== p.Fixed && !!$(e) : n.includes(e.key) : !1);
483
- },
484
- placement: {
485
- type: "pointer",
486
- area: "target"
487
- }
488
- };
489
- if (n.components.find((e) => e.key === "spatial-heatmap")) {
490
- let e = ({ node: e, resources: t }) => ({
491
- title: e.data.label,
492
- props: [
493
- "x",
494
- "y",
495
- "size",
496
- "density"
497
- ].filter((t) => !!e.data[t]?.source?.field).map((n) => ({
498
- label: t.dataset("").field(e.data[n].source.field)?.title(),
499
- value: e.data[n].label
500
- }))
501
- });
502
- r.extract = (t) => {
503
- if (Z(t.node.key)) {
504
- let e = $(t.node), n = Q(t.node);
505
- if (e && n !== p.Fixed) return Xe(e);
506
- }
507
- return e(t);
508
- };
509
- let t = O();
510
- r.content = ({ h: e, data: n }) => {
511
- if (n.length > 8) {
512
- let e = n.length;
513
- n = n.slice(0, 5), n.push({
514
- title: `+ ${e - n.length} more`,
515
- props: []
516
- });
517
- }
518
- return t({
519
- h: e,
520
- data: n
521
- });
522
- };
523
- } else {
524
- let n = ue(e, t, be, Ye);
525
- r.extract = (e) => {
526
- if (Z(e.node.key)) {
527
- let t = $(e.node), n = Q(e.node);
528
- if (t && n !== p.Fixed) return Xe(t);
529
- }
530
- return n(e);
531
- };
532
- }
533
- return se(e, t, n, r, "tooltip", void 0, {
534
- componentKeys: [J(e)],
535
- yieldToComponentKeys: [R, q]
536
- });
537
- }, Qe = (e, t, n) => {
538
- let r = e?.measures[0], i = {
539
- showAxisTooltip: e?.axes?.primaryMeasure?.showAxisTooltip,
540
- formatter: r?.formatter,
541
- scale: le(e),
542
- key: I.Measure,
543
- settings: { direction: A(e) }
544
- }, a = e?.measures[1], [o, s] = ae([i, {
545
- showAxisTooltip: e?.axes?.secondaryMeasure?.showAxisTooltip,
546
- formatter: a?.formatter,
547
- scale: ce(e, a),
548
- key: I.MeasureSec,
549
- settings: {
550
- direction: ie(e),
551
- labelDock: ge(de(e), a?.secondaryAxis)
552
- }
553
- }]);
554
- return {
555
- ...n,
556
- components: [...n.components ?? [], ...o],
557
- interactions: [...n.interactions ?? [], ...s]
558
- };
559
- }, $e = (e, t, n) => Ce(e, t, n), et = (e) => {
560
- try {
561
- return !!e && k(e);
562
- } catch {
563
- return !1;
564
- }
565
- }, tt = (e, t, n, r, a, o) => {
566
- if (o?.disable?.brushing || o?.disable?.brushingLasso) return n;
567
- let s = et(t?.colors?.sheetBackgroundColor) ? i.white : i.mainDarkNavy, c = e.scatterSettings?.lasso, l = c?.strokeColor ?? s, u = {
568
- type: K.Lasso,
569
- key: K.Lasso,
570
- layout: { displayOrder: P.VisualizationElement + 1 },
571
- settings: {
572
- brush: { components: [{
573
- key: J(e),
574
- contexts: [G.Selection],
575
- action: "toggle"
576
- }, {
577
- key: q,
578
- contexts: [G.Selection],
579
- action: "toggle"
580
- }] },
581
- lasso: {
582
- strokeWidth: 2,
583
- strokeDasharray: "4",
584
- stroke: l
585
- },
586
- snapIndicator: { stroke: l },
587
- startPoint: {
588
- r: 3,
589
- fill: c?.startPointColor ?? i.secondaryPurple,
590
- stroke: l
591
- }
592
- }
593
- }, d = {
594
- type: "native",
595
- key: `${K.Lasso}-interaction`,
596
- events: {
597
- mousedown(e) {
598
- this.chart.component(K.Lasso).emit("lassoStart", { center: {
599
- x: e.clientX,
600
- y: e.clientY
601
- } });
602
- },
603
- mousemove(e) {
604
- this.chart.component(K.Lasso).emit("lassoMove", { center: {
605
- x: e.clientX,
606
- y: e.clientY
607
- } });
608
- },
609
- mouseup(e) {
610
- this.chart.component(K.Lasso).emit("lassoEnd", { center: {
611
- x: e.clientX,
612
- y: e.clientY
613
- } });
614
- }
615
- }
616
- };
617
- return {
618
- ...n,
619
- components: [...n.components, u],
620
- interactions: [...n.interactions, d]
621
- };
622
- }, nt = (e, t, n, r, i, a) => {
623
- let o = e.scatterSettings?.spatialHeatmap?.show && e.dimensions.length < 2;
624
- if (!e.pointLabeling?.enabled || o) return n;
625
- let s = e.pointLabeling, c = 4 + (e.scatterSettings?.stroke?.enabled ? e.scatterSettings.stroke.width / 2 : 0), l = Te({
626
- targetComponentKeys: [J(e)],
627
- targetSelector: `.${Ne}`,
628
- offset: c,
629
- fontSize: ne(e.pointLabeling?.fontSize)
630
- }, s, a, t);
631
- return {
632
- ...n,
633
- components: [...n.components, l]
634
- };
635
- }, rt = (...e) => {
636
- let t = fe(...e), n = t.components.find((e) => e.type === pe.SequentialLegend), i = t.scales[L.Density];
637
- return n && i && (n.settings.fill = L.DensityGradient, n.settings.major = [r.Left, r.Right].includes(n.layout.dock) ? L.DensityInverted : L.Density), t;
638
- }, it = class extends he {
639
- constructor() {
640
- super([
641
- N,
642
- Me,
643
- Re,
644
- Je,
645
- Pe,
646
- Ae,
647
- ze,
648
- rt,
649
- $e,
650
- nt,
651
- Ze,
652
- tt,
653
- Qe
654
- ]);
655
- }
656
- preCompile(e) {
657
- let t = e.dimensions.filter((e) => c(e)), r = e.measures.filter((e) => c(e)), i = t.filter((e) => e.role === u.SCATTER_DIMENSION), a = r.filter((e) => e.role === n.SCATTER_HORIZONTAL), o = r.filter((e) => e.role === n.SCATTER_VERTICAL), s = i[0], l = a[0], d = o[0];
658
- if (!s || !l || !d) throw Error("Scatter chart requires at least 1 scatter dimension, 1 horizontal measure, and 1 vertical measure.");
659
- }
660
- }, at = D(), ot = w(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
661
- let a = C(), [o] = (0, ke.useState)(() => new it()), c = T(), { activeKey: l } = E(), u = x(), d = {
662
- ...i,
663
- valuePickerMode: !!l
664
- }, f = t || s, p = o.compile(e, f, n, r, {
665
- ...d,
666
- onRenderDone: c
667
- }, h.Scatter, a, u, ve());
668
- return p ? /* @__PURE__ */ (0, at.jsx)(me, {
669
- config: d,
670
- definition: p,
671
- size: r,
672
- vSpec: e
673
- }) : null;
674
- });
675
- export { ot as ScatterChart };