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