@astrato-io/visualizations 0.0.0-stage → 0.6.4
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.
- package/CHANGELOG.md +23 -0
- package/LICENSE +93 -0
- package/README.md +843 -2
- package/THIRD_PARTY_NOTICES.md +8387 -0
- package/VISUALIZATION_DEFINITIONS.md +2378 -0
- package/chunks/LinearProgress-CUZ0D8_t.js +253 -0
- package/chunks/Radio-Ciu-F4CU.js +957 -0
- package/chunks/ToggleButton-BCJc3Jlc.js +153 -0
- package/chunks/_baseFlatten-DPXPOrea.js +7076 -0
- package/chunks/accessors-DemrDevR.js +128 -0
- package/chunks/app-filter-bar.compiler-j_CVoWTa.js +55 -0
- package/chunks/bar.compiler-oqaPzIut.js +370 -0
- package/chunks/color-settings-ZIvgNTq1.js +10 -0
- package/chunks/coloring-C16AUZEi.js +663 -0
- package/chunks/data-item-resolution-1lvYB5ln.js +53 -0
- package/chunks/debounce-fn-CUixuz45.js +7 -0
- package/chunks/escobar-BGqT1EsE.js +34580 -0
- package/chunks/event-bus-KiSiCJrC.js +2683 -0
- package/chunks/events-WZut5Ow6.js +4 -0
- package/chunks/extend-BKUkc4_i.js +37 -0
- package/chunks/filter.compiler-CuLtc_02.js +60 -0
- package/chunks/filtering-Yq4DEa0t.js +953 -0
- package/chunks/gauge-target-type-BkKXAqkX.js +4 -0
- package/chunks/grouping-type-BX_9Ix5q.js +3 -0
- package/chunks/interfaces-VUY4_yVO.js +8742 -0
- package/chunks/line-settings-DfYTUyPz.js +4 -0
- package/chunks/line.compiler-BpA_6Tc7.js +188 -0
- package/chunks/metadata-CPXdYoln.js +28 -0
- package/chunks/number.compiler-DbkWcG4S.js +44 -0
- package/chunks/pie-uv42Eqal.js +10 -0
- package/chunks/range-DrzdfBX4.js +22 -0
- package/chunks/registry-CExpGJ1N.js +920 -0
- package/chunks/requirements-DNhuShLS.js +6 -0
- package/chunks/rolldown-runtime-DleVn1XH.js +28 -0
- package/chunks/set-coloring-datafield-B3uIS1Pe.js +8 -0
- package/chunks/shared-CKDL4hx9.js +1171 -0
- package/chunks/src-BC7cGcJ-.js +2024 -0
- package/chunks/src-BOS6SqkZ.js +67 -0
- package/chunks/src-C0LgoUWY.js +26105 -0
- package/chunks/src-Cum_2NLV.js +12145 -0
- package/chunks/src-D9XogOrc.js +422 -0
- package/chunks/src-Dun_jXtz.js +10295 -0
- package/chunks/src-DvX5LU9T.js +14742 -0
- package/chunks/standalone-87YV_m9n.js +687 -0
- package/chunks/standalone-BDCwI6Hn.js +4619 -0
- package/chunks/standalone-BH5NqDwp.js +1763 -0
- package/chunks/standalone-BLVAWLNJ.js +385 -0
- package/chunks/standalone-BPomtAVs.js +2 -0
- package/chunks/standalone-BXyBcUOQ.js +2 -0
- package/chunks/standalone-BYm1UjLr.js +140 -0
- package/chunks/standalone-BllF4rDp.js +383 -0
- package/chunks/standalone-BmfMt74U.js +726 -0
- package/chunks/standalone-BqWyrnZI.js +281 -0
- package/chunks/standalone-C85u7U6I.js +340 -0
- package/chunks/standalone-CCNtaJ7s.js +741 -0
- package/chunks/standalone-CDQnr6qT.js +345 -0
- package/chunks/standalone-CNyNHKVx.js +674 -0
- package/chunks/standalone-CY57qwZ-.js +1129 -0
- package/chunks/standalone-CZynjFG7.js +12979 -0
- package/chunks/standalone-D5vnf-9y.js +3943 -0
- package/chunks/standalone-DFPva_ku.js +299 -0
- package/chunks/standalone-DQxxNwF8.js +675 -0
- package/chunks/standalone-DS9T0FZ-.js +830 -0
- package/chunks/standalone-Dx3MLlrO.js +512 -0
- package/chunks/standalone-DzixzZAL.js +411 -0
- package/chunks/standalone-QJ1kKMnO.js +6 -0
- package/chunks/standalone-jiz0L2Dg.js +3855 -0
- package/chunks/standalone-lBm9hQ-q.js +179 -0
- package/chunks/standalone-rJ45Zfl1.js +68 -0
- package/chunks/stroke-dash-UgMEcCS4.js +6 -0
- package/chunks/table.compiler-BrXkm4Fz.js +213 -0
- package/chunks/toInteger-DVZr-D1j.js +11 -0
- package/chunks/treemap-x_zmJoG7.js +23 -0
- package/chunks/typeof-CJDtcySz.js +13 -0
- package/chunks/types-dVVCsDWD.js +4 -0
- package/chunks/ui-D1HQNIBy.js +54039 -0
- package/chunks/url-utils-B17gj_mr.js +5501 -0
- package/chunks/useFieldName-oqQ3bvnO.js +7 -0
- package/chunks/utils-Ba9T0TqC.js +31097 -0
- package/chunks/view-CLqWMV7Z.js +156 -0
- package/definitions.js +3 -0
- package/docs/operations/astrato-app-filter-bar.md +161 -0
- package/docs/operations/bar.md +7050 -0
- package/docs/operations/combo.md +5825 -0
- package/docs/operations/date-picker.md +644 -0
- package/docs/operations/distribution-gauge.md +3218 -0
- package/docs/operations/dot.md +5662 -0
- package/docs/operations/filter.md +1507 -0
- package/docs/operations/gauge.md +3452 -0
- package/docs/operations/heatMap.md +6026 -0
- package/docs/operations/histogram.md +1870 -0
- package/docs/operations/iframe.md +56 -0
- package/docs/operations/image.md +177 -0
- package/docs/operations/index.md +46 -0
- package/docs/operations/line.md +6468 -0
- package/docs/operations/number.md +3969 -0
- package/docs/operations/pie.md +6089 -0
- package/docs/operations/radar.md +4646 -0
- package/docs/operations/sankey.md +3210 -0
- package/docs/operations/scatter.md +6075 -0
- package/docs/operations/shape.md +315 -0
- package/docs/operations/simpleTextObject.md +706 -0
- package/docs/operations/slider.md +230 -0
- package/docs/operations/table.md +8790 -0
- package/docs/operations/tree.md +2874 -0
- package/docs/operations/treemap.md +3619 -0
- package/docs/operations/waterfall.md +2938 -0
- package/docs/operations/word-cloud.md +3071 -0
- package/getters.js +18 -0
- package/index.js +1183 -0
- package/metadata.js +20 -0
- package/operations.js +64 -0
- package/package.json +191 -4
- package/src/definitions/index.d.ts +2 -0
- package/src/definitions/shared/index.d.ts +5 -0
- package/src/definitions/shared/lib/available-fields.d.ts +36 -0
- package/src/definitions/shared/lib/compilers/index.d.ts +7 -0
- package/src/definitions/shared/lib/registry/compile.d.ts +2 -0
- package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +587 -0
- package/src/definitions/shared/lib/registry/index.d.ts +3 -0
- package/src/definitions/shared/lib/registry/validation.d.ts +3 -0
- package/src/definitions/shared/lib/schemas/app-filter-bar.schema.d.ts +22 -0
- package/src/definitions/shared/lib/schemas/bar.schema.d.ts +73 -0
- package/src/definitions/shared/lib/schemas/broad-chart.schema.d.ts +68 -0
- package/src/definitions/shared/lib/schemas/common.schema.d.ts +304 -0
- package/src/definitions/shared/lib/schemas/filter.schema.d.ts +22 -0
- package/src/definitions/shared/lib/schemas/index.d.ts +9 -0
- package/src/definitions/shared/lib/schemas/line.schema.d.ts +72 -0
- package/src/definitions/shared/lib/schemas/number.schema.d.ts +21 -0
- package/src/definitions/shared/lib/schemas/object.schema.d.ts +215 -0
- package/src/definitions/shared/lib/schemas/table.schema.d.ts +458 -0
- package/src/definitions/shared/lib/types/compilation.types.d.ts +36 -0
- package/src/definitions/shared/lib/types/definition.types.d.ts +2 -0
- package/src/definitions/shared/lib/types/descriptor.types.d.ts +39 -0
- package/src/definitions/shared/lib/types/index.d.ts +3 -0
- package/src/getters/index.d.ts +30 -0
- package/src/index.d.ts +4 -0
- package/src/metadata/index.d.ts +4 -0
- package/src/operations/index.d.ts +30 -0
- package/src/registry/index.d.ts +6 -0
- package/src/runtime/index.d.ts +2 -0
- package/src/types.d.ts +307 -0
- package/src/visualization-catalog.d.ts +82 -0
- package/src/web-components/index.d.ts +12 -0
- package/styles.css +2 -0
|
@@ -0,0 +1,675 @@
|
|
|
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 };
|