@astrato-io/visualizations 0.6.5 → 0.7.0

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