@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.
- package/CHANGELOG.md +30 -1
- package/README.md +148 -5
- package/THIRD_PARTY_NOTICES.md +494 -0
- package/VISUALIZATION_DEFINITIONS.md +9 -146
- package/chunks/{Button-Dn3rJrYf.js → Button-CQdoKSXX.js} +3 -3
- package/chunks/{CircularProgress-BFeu06Yb.js → CircularProgress-DpT1lwWw.js} +20 -20
- package/chunks/FieldTypeIcon-Cg4F9Q5D.js +22 -0
- package/chunks/{LinearProgress-ClO6GUjN.js → LinearProgress-B7S0Q26A.js} +14 -14
- package/chunks/{MenuOption-Czc34u4q.js → MenuOption-DpKFJxmo.js} +167 -167
- package/chunks/{Title-BgYnaVTR.js → Title-m5damhc0.js} +37 -37
- package/chunks/{_createAggregator-BMu9uRax.js → _createAggregator-BA8_iU9q.js} +17 -17
- package/chunks/{app-filter-bar.compiler-CVir0wkl.js → app-filter-bar.compiler--T4Qz3Wu.js} +8 -8
- package/chunks/{bar-layout-C_UgRlVl.js → bar-layout-OFhxn2Go.js} +2 -2
- package/chunks/{bar.compiler-DYuFdi9J.js → bar.compiler-hWZBYYvV.js} +71 -69
- package/chunks/{builder-C-TKA-My.js → builder-7w_bgV_h.js} +106 -55
- package/chunks/{coloring-BtnPiQ_o.js → coloring-Cd6p0GQJ.js} +93 -88
- package/chunks/{createSimplePaletteValueFilter--zrZxRV9.js → createSimplePaletteValueFilter-CiJT8s1s.js} +169 -169
- package/chunks/defaults-CMFqXvaJ.js +3 -0
- package/chunks/{definitions-CT304NDn.js → definitions-DTauTjIX.js} +399 -398
- package/chunks/{escobar-CvEV2ES1.js → escobar-CMvphKSK.js} +4949 -4879
- package/chunks/{extend-preset-D9-JP92b.js → extend-preset-BpXttHFk.js} +449 -450
- package/chunks/{filter.compiler-CXeZznks.js → filter.compiler-DOGFweJz.js} +10 -10
- package/chunks/{filtering-8_bFv-jb.js → filtering-NOnDcGbo.js} +241 -241
- package/chunks/handlers-CyYFSfhM.js +15393 -0
- package/chunks/{icon-picker-styles-BXiJ1SZS.js → icon-picker-styles-DuSERhBU.js} +8 -8
- package/chunks/{isEqual-D8Ay63xR.js → isEqual-4f8yUUtC.js} +1 -1
- package/chunks/{isFocusVisible-Bu8gGZu5.js → isFocusVisible-Czm70MGc.js} +9 -9
- package/chunks/line.compiler-B-4H55_T.js +203 -0
- package/chunks/linear-Bq_r9l5S.js +264 -0
- package/chunks/{logger-DdZpR7xZ.js → logger-Cioob-QV.js} +74 -73
- package/chunks/{lookup-BWllin0q.js → lookup-B3tWH2hX.js} +1 -0
- package/chunks/{map.compiler-Q_Y1Pvat.js → map.compiler-Cv5V6EhF.js} +40 -40
- package/chunks/measure-axis-label-format-COy8U_dd.js +27 -0
- package/chunks/measure-format-default-B_kuGSzi.js +26 -0
- package/chunks/{metadata-BQm_TXI1.js → metadata-dGSe5UWy.js} +5 -5
- package/chunks/number.compiler-D7nMcEMv.js +57 -0
- package/chunks/{operations-DKQWuLL7.js → operations-CgfehCad.js} +11397 -11114
- package/chunks/{range-BdhzvYQ_.js → range-Dmwp9kVB.js} +2 -2
- package/chunks/{react-dom-BGP4tbXV.js → react-dom-CfuL-m78.js} +82 -82
- package/chunks/{render-wrappers-BZpyDnJy.js → render-wrappers--g-zPFBW.js} +1 -1
- package/chunks/{requirements-e8Fe96ag.js → requirements-DHayNJ2C.js} +245 -221
- package/chunks/{shared-C_2F90xq.js → shared-DoEN9nNM.js} +505 -494
- package/chunks/standalone-B3hRGgYi.js +773 -0
- package/chunks/{standalone-BkbiH-o8.js → standalone-BPNXgFft.js} +498 -759
- package/chunks/standalone-BPTT8XEu.js +424 -0
- package/chunks/standalone-BgAeHROc.js +2 -0
- package/chunks/{standalone-BE_ONgiG.js → standalone-BkQxag7M.js} +102 -102
- package/chunks/{standalone-Cc98Pdr6.js → standalone-Bxa3x6dg.js} +872 -872
- package/chunks/standalone-C0If-V6O.js +773 -0
- package/chunks/standalone-C1TOyflX.js +287 -0
- package/chunks/{standalone-CY_kjarf.js → standalone-CE5PwJN0.js} +18 -18
- package/chunks/{standalone-B8ZSqauS.js → standalone-CG7IFN6n.js} +120 -120
- package/chunks/{standalone-wOWRCpdn.js → standalone-CKlgGu80.js} +49 -49
- package/chunks/standalone-CNf-oA2U.js +355 -0
- package/chunks/{standalone-BDrXVxlP.js → standalone-CXPdWFlw.js} +14 -14
- package/chunks/{standalone-z0o52o5t.js → standalone-Cf0_5tbu.js} +5567 -5568
- package/chunks/{standalone-Cl0TSfqC.js → standalone-DMi4-Vp3.js} +122 -122
- package/chunks/{standalone-DNh9NcMa.js → standalone-DTEX67C8.js} +154 -154
- package/chunks/{standalone-DHRalbVO.js → standalone-DU46-kYv.js} +279 -279
- package/chunks/standalone-Dbn3jSH6.js +690 -0
- package/chunks/{standalone-CsoMmE9T.js → standalone-DdcAL_k_.js} +839 -843
- package/chunks/standalone-DwCIA0UG.js +1057 -0
- package/chunks/standalone-Dz13tl3P.js +357 -0
- package/chunks/standalone-H9GFzFk_.js +8377 -0
- package/chunks/{standalone-CaTxAydz.js → standalone-MduR0qre.js} +2227 -1000
- package/chunks/standalone-ejTz66P3.js +2 -0
- package/chunks/{standalone-DflyWtuR.js → standalone-keB-0wK3.js} +216 -216
- package/chunks/{standalone-BTY3w_JA.js → standalone-nnkuQd0K.js} +28 -28
- package/chunks/standalone-vGGR6Vcn.js +6 -0
- package/chunks/{table.compiler-COaHE9VD.js → table.compiler-mS4UvhLT.js} +31 -31
- package/chunks/theme-MYp6Rj1J.js +232 -0
- package/chunks/{useFieldName-CdnCWzhd.js → useFieldName-AdSak4Ch.js} +1 -1
- package/chunks/{utils-DganVptf.js → utils-CUKgR7it.js} +4216 -4070
- package/chunks/{view-Bzlros43.js → view-BeYwpcVD.js} +1561 -1561
- package/chunks/{visualization-filters-D7i6oh1Z.js → visualization-filters-B9qik5_K.js} +2683 -2342
- package/chunks/{with-html-element-CiIhFEa5.js → with-html-element-1GSeLT59.js} +3712 -3682
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +144 -32
- package/docs/operations/combo.md +79 -17
- package/docs/operations/date-picker.md +4 -4
- package/docs/operations/distribution-gauge.md +18 -16
- package/docs/operations/dot.md +107 -24
- package/docs/operations/filter.md +10 -8
- package/docs/operations/gauge.md +20 -18
- package/docs/operations/heatMap.md +73 -21
- package/docs/operations/histogram.md +45 -12
- package/docs/operations/iframe.md +1 -1
- package/docs/operations/image.md +1 -1
- package/docs/operations/index.md +12 -11
- package/docs/operations/line.md +86 -24
- package/docs/operations/map.md +5274 -0
- package/docs/operations/number.md +10 -9
- package/docs/operations/pie.md +23 -21
- package/docs/operations/radar.md +13 -11
- package/docs/operations/sankey.md +19 -17
- package/docs/operations/scatter.md +111 -28
- package/docs/operations/shape.md +5 -5
- package/docs/operations/simpleTextObject.md +4 -4
- package/docs/operations/slider.md +1 -1
- package/docs/operations/table.md +27 -25
- package/docs/operations/tree.md +5 -3
- package/docs/operations/treemap.md +70 -18
- package/docs/operations/waterfall.md +40 -7
- package/docs/operations/word-cloud.md +69 -17
- package/getters.js +3 -3
- package/index.js +585 -612
- package/metadata.js +2 -2
- package/operations.js +25 -18
- package/package.json +74 -70
- package/src/definitions/index.d.ts +1 -7
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +3 -48
- package/src/definitions/model/definitions/schema-registry.d.ts +15 -14
- package/src/definitions/model/definitions/schemas/bar.schema.d.ts +3 -3
- package/src/definitions/model/definitions/schemas/broad-chart.schema.d.ts +2 -2
- package/src/definitions/model/definitions/schemas/common.schema.d.ts +19 -6
- package/src/definitions/model/definitions/schemas/index.d.ts +1 -1
- package/src/definitions/model/definitions/schemas/line.schema.d.ts +4 -3
- package/src/definitions/model/definitions/schemas/number.schema.d.ts +1 -1
- package/src/definitions/model/definitions/schemas/table.schema.d.ts +14 -14
- package/src/index.d.ts +1 -1
- package/src/operations/index.d.ts +11 -1
- package/src/types.d.ts +166 -1
- package/src/visualization-catalog.d.ts +3 -0
- package/styles.css +1 -1
- package/chunks/FieldTypeIcon-DrMoGpHJ.js +0 -22
- package/chunks/color-rules-DYJL4fIW.js +0 -15
- package/chunks/color-settings-DJFoFTip.js +0 -5
- package/chunks/defaults-Dtk7fg3C.js +0 -3
- package/chunks/handlers-C6CZ0XJA.js +0 -15399
- package/chunks/line.compiler-DmHpmQCC.js +0 -198
- package/chunks/number.compiler-DQdg6zTy.js +0 -53
- package/chunks/standalone-4MsKiqs0.js +0 -355
- package/chunks/standalone-B794g9pE.js +0 -1012
- package/chunks/standalone-BA2YXyJS.js +0 -422
- package/chunks/standalone-BgumbdaJ2.js +0 -357
- package/chunks/standalone-Blh4qejk.js +0 -689
- package/chunks/standalone-CXY4FpF7.js +0 -773
- package/chunks/standalone-DH0xTEes.js +0 -2
- package/chunks/standalone-DcnHjNnC.js +0 -2
- package/chunks/standalone-DrHdGkY7.js +0 -762
- package/chunks/standalone-c_rROMtx.js +0 -287
- package/chunks/standalone-drcFLeN6.js +0 -6
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
+
import { $c as t, Ac as n, Oo as r, Pt as i, Sa as a, To as o, Xc as s, cs as c, di as l, gr as u, hl as d, ms as f, po as p, ss as m, u as h } from "./visualization-filters-B9qik5_K.js";
|
|
3
|
+
import { I as g, Kt as _, Mt as v, P as y, R as b, Ur as x, W as S, fi as C, tn as w } from "./utils-CUKgR7it.js";
|
|
4
|
+
import { S_ as T, x_ as E } from "./handlers-CyYFSfhM.js";
|
|
5
|
+
import "./logger-Cioob-QV.js";
|
|
6
|
+
import { At as D, En as O, Ht as k, It as ee, Kt as A, Mn as j, P as te, Wt as M, _ as N, an as P, hn as F, i as ne, jn as re, kt as ie, mn as ae, nn as oe, on as I, pn as L, qt as se, t as ce, un as le, v as ue, vn as R, wn as z } from "./escobar-CMvphKSK.js";
|
|
7
|
+
import { t as B } from "./coloring-Cd6p0GQJ.js";
|
|
8
|
+
import { t as V } from "./debounce-fn-CUixuz45.js";
|
|
9
|
+
import { t as H } from "./set-coloring-datafield-B3uIS1Pe.js";
|
|
10
|
+
import { r as U } from "./builder-7w_bgV_h.js";
|
|
11
|
+
var W = 100, G = (e, t, n) => {
|
|
12
|
+
let r = e.element.getBoundingClientRect(), i = {
|
|
13
|
+
x: t.clientX - r.left,
|
|
14
|
+
y: t.clientY - r.top
|
|
15
|
+
};
|
|
16
|
+
return e.chart?.shapesAt(i, {
|
|
17
|
+
components: [{
|
|
18
|
+
key: n,
|
|
19
|
+
opts: { propagation: "stop" }
|
|
20
|
+
}],
|
|
21
|
+
propagation: "stop"
|
|
22
|
+
})?.[0];
|
|
23
|
+
}, de = (e, t) => {
|
|
24
|
+
let n = null, r = V((r, i) => {
|
|
25
|
+
let a = G(r, i, e);
|
|
26
|
+
!a && n && (t(e, "mouseleave", n.key, i, n), n = null), a?.data?._ID && n?.data?._ID && a.data._ID !== n.data._ID && (t(e, "mouseleave", n.key, i, n), n = null), a && (t(e, "mousemove", a.key, i, a), n = a);
|
|
27
|
+
}, W), i = V((r) => {
|
|
28
|
+
n &&= (t(e, "mouseleave", n.key, r, n), null);
|
|
29
|
+
}, W);
|
|
30
|
+
return {
|
|
31
|
+
type: "native",
|
|
32
|
+
key: "action-events-interaction",
|
|
33
|
+
events: {
|
|
34
|
+
click(n) {
|
|
35
|
+
let r = G(this, n, e);
|
|
36
|
+
r && t(e, "click", r.key, n, r);
|
|
37
|
+
},
|
|
38
|
+
mousemove(e) {
|
|
39
|
+
r(this, e);
|
|
40
|
+
},
|
|
41
|
+
mouseleave(e) {
|
|
42
|
+
i(e);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}, K = /* @__PURE__ */ e(C()), fe = c.Rectangle, q = (e) => ({
|
|
47
|
+
shape: e?.heatMapSettings?.shape ?? fe,
|
|
48
|
+
minSize: e?.heatMapSettings?.minSize ?? .1,
|
|
49
|
+
maxSize: e?.heatMapSettings?.maxSize ?? 1
|
|
50
|
+
}), pe = (e, t, n, r, i, a, o, s) => {
|
|
51
|
+
let c = [], { shape: l } = q(e), u = `${j.Point}-${l}`;
|
|
52
|
+
if ((e?.enableEmitEvents ?? !1) && s) {
|
|
53
|
+
let e = de(u, s);
|
|
54
|
+
c.push(e);
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
...n,
|
|
58
|
+
interactions: n.interactions ? [...n.interactions, ...c] : [...c]
|
|
59
|
+
};
|
|
60
|
+
}, me = (e, t, n) => {
|
|
61
|
+
let r = e.dimensions.filter(l), i = r.filter((e) => e.role === o.HEAT_MAP_HORIZONTAL), a = r.filter((e) => e.role === o.HEAT_MAP_VERTICAL), s = i[0], c = a[0], [u, d] = se([{
|
|
62
|
+
showAxisTooltip: e?.axes?.dimension?.showAxisTooltip,
|
|
63
|
+
formatter: s?.formatter,
|
|
64
|
+
scale: F(e),
|
|
65
|
+
key: k.Dimension,
|
|
66
|
+
settings: { direction: M(e) }
|
|
67
|
+
}, {
|
|
68
|
+
showAxisTooltip: e?.axes?.secondaryDimension?.showAxisTooltip,
|
|
69
|
+
formatter: c?.formatter,
|
|
70
|
+
scale: R.YAxisScale,
|
|
71
|
+
key: k.DimensionSec,
|
|
72
|
+
settings: {
|
|
73
|
+
direction: A(e),
|
|
74
|
+
isVerticalDimension: !0
|
|
75
|
+
}
|
|
76
|
+
}]);
|
|
77
|
+
return {
|
|
78
|
+
...n,
|
|
79
|
+
components: [...n.components ?? [], ...u],
|
|
80
|
+
interactions: [...n.interactions ?? [], ...d]
|
|
81
|
+
};
|
|
82
|
+
}, he = (e, t, n, r, i, a, s, c) => {
|
|
83
|
+
let d = [], m = [], g = [];
|
|
84
|
+
if (c) {
|
|
85
|
+
let e = oe(j.Text, c);
|
|
86
|
+
g.push(e);
|
|
87
|
+
}
|
|
88
|
+
let _ = e.dimensions.filter((e) => e.role === o.HEAT_MAP_HORIZONTAL), v = _.filter(l), y = e.dimensions.filter((e) => e.role === o.HEAT_MAP_VERTICAL), b = y.filter(l), x = {
|
|
89
|
+
...t.axis.dimension,
|
|
90
|
+
...t.fonts,
|
|
91
|
+
chart: h(t)
|
|
92
|
+
}, S = {
|
|
93
|
+
...t.axis.measure,
|
|
94
|
+
...t.fonts,
|
|
95
|
+
chart: h(t)
|
|
96
|
+
}, C = v[0], w = b[0], T = e.measures.filter((e) => e.role === p.HEAT_MAP_COLOR), E = T.filter(l), D = {};
|
|
97
|
+
if (C) {
|
|
98
|
+
let t = e.axes?.dimension || D, n = t.secondaryAxis ? f.Top : f.Bottom;
|
|
99
|
+
if (d.push(P(R.XAxisScale, t, x, n, C.formatter, a)), t.showAxisName) {
|
|
100
|
+
let r = u(_, e.enableAlternate, a?.isPrintMode);
|
|
101
|
+
m.push(I(v, r, n, x, t.colors?.title, t.axisTitle ? t.axisTitle : L(C, s), t.titleFontSize));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (w) {
|
|
105
|
+
let t = e.axes?.secondaryDimension || D, n = t.secondaryAxis ? f.Right : f.Left;
|
|
106
|
+
if (d.push(P(R.YAxisScale, t, x, n, w.formatter, a)), t.showAxisName) {
|
|
107
|
+
let r = u(y, e.enableAlternate, a?.isPrintMode);
|
|
108
|
+
m.push(I(b, r, n, x, t.colors?.title, t.axisTitle ? t.axisTitle : L(w, s), t.titleFontSize));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (T.length > 1) {
|
|
112
|
+
let t = e.axes?.primaryMeasure || {}, n = u(T, e.enableAlternate, a?.isPrintMode);
|
|
113
|
+
m.push(I(E, n, f.Right, S, t.colors?.title, t.axisTitle, t.titleFontSize));
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
...n,
|
|
117
|
+
components: [
|
|
118
|
+
...n.components,
|
|
119
|
+
...d,
|
|
120
|
+
...m
|
|
121
|
+
],
|
|
122
|
+
interactions: [...n.interactions ?? [], ...g]
|
|
123
|
+
};
|
|
124
|
+
}, ge = /* @__PURE__ */ e(i()), _e = (e) => (t, n) => t.value === e ? -1 : +(n.value === e), ve = (e) => (t, n) => t.value === e ? 1 : n.value === e ? -1 : 0, J = (e, t = 0) => (n, r) => {
|
|
125
|
+
let i = e ? n[e] : n, a = e ? r[e] : r;
|
|
126
|
+
return i.value !== a.value && i.value === null ? -t : i.value !== a.value && a.value === null ? t : i.value === a.value ? 0 : i.value < a.value ? -t : t;
|
|
127
|
+
}, ye = (e) => (t, n) => {
|
|
128
|
+
let r = 0;
|
|
129
|
+
for (let i = 0; i < e.length; i++) if (r = e[i](t, n), r !== 0) return r;
|
|
130
|
+
return r;
|
|
131
|
+
}, be = (e) => {
|
|
132
|
+
let t = e.aggregation?.funcName;
|
|
133
|
+
return t && [
|
|
134
|
+
"SUM",
|
|
135
|
+
"MIN",
|
|
136
|
+
"MAX",
|
|
137
|
+
"AVG"
|
|
138
|
+
].includes(t) ? t.toLowerCase() : t === "COUNT" ? "sum" : "avg";
|
|
139
|
+
}, Y = (e, t, n) => {
|
|
140
|
+
let r = n?.sortingOrder ?? [], i = r.findIndex((t) => d(t.dataItem) === d(e));
|
|
141
|
+
if (i < 0) return;
|
|
142
|
+
let a = r[i], o = l(a), s = (o ? r.slice(0, i) : r).filter((e) => e.fieldType === "measure" && l(e));
|
|
143
|
+
if (a) {
|
|
144
|
+
let e, r = [];
|
|
145
|
+
n?.topN?.enabled && n.topN.showOthers && ((0, ge.default)(n.topN.dimensionIdx) || n.topN.dimensionIdx === t) && (e = n.topN.othersPosition === T.First ? _e(n.topN.othersLabel?.stringLabel ?? "Others") : n.topN.othersPosition === T.Last ? ve(n.topN.othersLabel?.stringLabel ?? "Others") : void 0, e && r.push(e));
|
|
146
|
+
let i = {};
|
|
147
|
+
return s.forEach((e, t) => {
|
|
148
|
+
let n = `m${t}`;
|
|
149
|
+
r.push(J(n, e.sortDirection === m.Asc ? 1 : -1)), i[n] = {
|
|
150
|
+
field: d(e.dataItem),
|
|
151
|
+
reduce: be(e.dataItem)
|
|
152
|
+
};
|
|
153
|
+
}), o && r.push(J("", a.sortDirection === m.Asc ? 1 : -1)), {
|
|
154
|
+
props: i,
|
|
155
|
+
sort: ye(r)
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}, xe = (e, n, r) => {
|
|
159
|
+
let i = e.dimensions.filter(l), a = e.measures.filter(l), s = i.filter((e) => e.role === o.HEAT_MAP_HORIZONTAL), c = i.filter((e) => e.role === o.HEAT_MAP_VERTICAL), u = a.filter((e) => e.role === p.HEAT_MAP_COLOR), f = a.filter((e) => e.role === p.HEAT_MAP_SIZE), m = s[0], h = c[0], g = u[0], _ = f[0], { coloring: v } = e || {}, y = v?.fieldId;
|
|
160
|
+
e.coloring?.type === t.Gradient && (y ||= d(g.dataItem)), y && ie(r, 0, { color: { field: y } });
|
|
161
|
+
let b = ee(H(e, y ?? null), n, {});
|
|
162
|
+
if (m) {
|
|
163
|
+
let t = Y(m.dataItem, 0, e.querySettings);
|
|
164
|
+
b[R.XAxisScale] = {
|
|
165
|
+
data: {
|
|
166
|
+
extract: {
|
|
167
|
+
field: d(m.dataItem),
|
|
168
|
+
trackBy: (e) => e,
|
|
169
|
+
reduce: "first",
|
|
170
|
+
props: t?.props
|
|
171
|
+
},
|
|
172
|
+
sort: t?.sort
|
|
173
|
+
},
|
|
174
|
+
type: O.Band
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
if (h) {
|
|
178
|
+
let t = Y(h.dataItem, 1, e.querySettings);
|
|
179
|
+
b[R.YAxisScale] = {
|
|
180
|
+
data: {
|
|
181
|
+
extract: {
|
|
182
|
+
field: d(h.dataItem),
|
|
183
|
+
trackBy: (e) => e,
|
|
184
|
+
reduce: "first",
|
|
185
|
+
props: t?.props
|
|
186
|
+
},
|
|
187
|
+
sort: t?.sort
|
|
188
|
+
},
|
|
189
|
+
type: O.Band
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
let x = d(g.dataItem);
|
|
193
|
+
if (b[x] = { data: { field: x } }, _) {
|
|
194
|
+
let e = d(_.dataItem);
|
|
195
|
+
b[e] = {
|
|
196
|
+
type: O.Linear,
|
|
197
|
+
data: { extract: { field: e } }
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
...r,
|
|
202
|
+
scales: b
|
|
203
|
+
};
|
|
204
|
+
}, X = {
|
|
205
|
+
measure: "measure",
|
|
206
|
+
group: "group",
|
|
207
|
+
size: "size"
|
|
208
|
+
}, Se = (e, t, n) => {
|
|
209
|
+
let r = e.dimensions.filter(l), i = e.measures.filter(l), a = ue((e.supportingMeasures ?? []).filter(l)), s = r.filter((e) => e.role === o.HEAT_MAP_HORIZONTAL), c = r.filter((e) => e.role === o.HEAT_MAP_VERTICAL), u = i.filter((e) => e.role === p.HEAT_MAP_COLOR), f = i.filter((e) => e.role === p.HEAT_MAP_SIZE);
|
|
210
|
+
if (!r.length) return n;
|
|
211
|
+
let m = s[0], h = c[0], g = u[0], _ = f[0], v = d(g?.dataItem), y = d(_?.dataItem), b = d(m?.dataItem), x = d(h?.dataItem), S = {
|
|
212
|
+
[X.measure]: { field: v },
|
|
213
|
+
[X.group]: { field: x },
|
|
214
|
+
[X.size]: _ ? { field: y } : void 0,
|
|
215
|
+
secondColorOverwrite: { field: x },
|
|
216
|
+
...a
|
|
217
|
+
};
|
|
218
|
+
v && (S[v] = { field: v }), y && (S[y] = { field: y });
|
|
219
|
+
let C = [{
|
|
220
|
+
key: R.Collection,
|
|
221
|
+
data: { extract: [{
|
|
222
|
+
field: b,
|
|
223
|
+
props: S
|
|
224
|
+
}] }
|
|
225
|
+
}];
|
|
226
|
+
return {
|
|
227
|
+
...n,
|
|
228
|
+
collections: C
|
|
229
|
+
};
|
|
230
|
+
}, Ce = (e, n, r, i, a, o) => {
|
|
231
|
+
let s = e.measures.filter(l), c = s.filter((e) => e.role === p.HEAT_MAP_COLOR), u = s.filter((e) => e.role === p.HEAT_MAP_SIZE), f = c[0], m = u[0], { shape: h, minSize: g, maxSize: _ } = q(e), v = _;
|
|
232
|
+
m && (v = (e) => e.resources.scale(d(m.dataItem))(e.datum.size.value) * (_ - g) + g);
|
|
233
|
+
let y = new B(e, n, a?.[0]?.itemsNotAffectedByFiltering), b = {
|
|
234
|
+
type: j.Point,
|
|
235
|
+
key: `${j.Point}-${h}`,
|
|
236
|
+
data: { collection: R.Collection },
|
|
237
|
+
settings: {
|
|
238
|
+
x: { scale: R.XAxisScale },
|
|
239
|
+
y: {
|
|
240
|
+
scale: R.YAxisScale,
|
|
241
|
+
ref: X.group
|
|
242
|
+
},
|
|
243
|
+
fill: y.getColorDefinition({
|
|
244
|
+
ref: "color",
|
|
245
|
+
overwriteSources: [
|
|
246
|
+
y.MAIN_FIELD,
|
|
247
|
+
"secondColorOverwrite",
|
|
248
|
+
"color"
|
|
249
|
+
],
|
|
250
|
+
dataItemId: e.coloring?.type === t.Single ? d(f?.dataItem) : null
|
|
251
|
+
}),
|
|
252
|
+
shape: h,
|
|
253
|
+
size: v
|
|
254
|
+
},
|
|
255
|
+
animations: {
|
|
256
|
+
enabled: !0,
|
|
257
|
+
presetId: "simple-opacity"
|
|
258
|
+
},
|
|
259
|
+
brush: le(["", X.group], o, void 0, re.AndSubset)
|
|
260
|
+
};
|
|
261
|
+
return {
|
|
262
|
+
...r,
|
|
263
|
+
components: [...r.components, b]
|
|
264
|
+
};
|
|
265
|
+
}, Z = {
|
|
266
|
+
top: 0,
|
|
267
|
+
bottom: 0,
|
|
268
|
+
left: 2,
|
|
269
|
+
right: 2
|
|
270
|
+
}, we = (e, t, n, r) => {
|
|
271
|
+
let i;
|
|
272
|
+
return d(e.dataItem) === d(n.dataItem) ? i = r?.measure : d(t.dataItem) === d(n.dataItem) && (i = r?.size), i ? i.value === null ? "-" : i.label ?? "" : "";
|
|
273
|
+
}, Q = (e, t, n, r) => {
|
|
274
|
+
if (d(e.dataItem) === d(n.dataItem)) return r.measure?.value;
|
|
275
|
+
if (d(t.dataItem) === d(n.dataItem)) return r.size?.value;
|
|
276
|
+
}, Te = (e, t, n) => {
|
|
277
|
+
let i, a = e.measures.filter(l), o = a.filter((e) => e.role === p.HEAT_MAP_COLOR), s = a.filter((e) => e.role === p.HEAT_MAP_SIZE), u = o[0], d = s[0], { shape: f } = q(e), m;
|
|
278
|
+
switch (f) {
|
|
279
|
+
case c.Circle:
|
|
280
|
+
m = z.Circle;
|
|
281
|
+
break;
|
|
282
|
+
case c.Square:
|
|
283
|
+
case c.Rectangle:
|
|
284
|
+
case c.Bar:
|
|
285
|
+
m = z.Rect;
|
|
286
|
+
break;
|
|
287
|
+
default: m = z.Path;
|
|
288
|
+
}
|
|
289
|
+
if (u?.dataLabels?.show) i = u;
|
|
290
|
+
else if (d?.dataLabels?.show) i = d;
|
|
291
|
+
else return n;
|
|
292
|
+
let g = {
|
|
293
|
+
type: j.Labels,
|
|
294
|
+
key: "heat-map-label",
|
|
295
|
+
settings: { sources: [{
|
|
296
|
+
component: `${j.Point}-${f}`,
|
|
297
|
+
selector: m,
|
|
298
|
+
strategy: {
|
|
299
|
+
type: "bar",
|
|
300
|
+
settings: {
|
|
301
|
+
direction: "right",
|
|
302
|
+
fontFamily: t.fonts.general.fontFamily,
|
|
303
|
+
fontSize: ae(i.dataLabels?.size, h(t).fontSizes.dataLabel),
|
|
304
|
+
labels: [{
|
|
305
|
+
label({ data: e, formatter: t }) {
|
|
306
|
+
if (!e) return "";
|
|
307
|
+
let n = we(u, d, i, e);
|
|
308
|
+
if (r(i.formatter)) {
|
|
309
|
+
let t = Q(u, d, i, e);
|
|
310
|
+
return t === null ? "-" : t === void 0 ? "" : _(i.formatter.format, i.formatter)(t, void 0, e);
|
|
311
|
+
}
|
|
312
|
+
return i.formatter && typeof t == "function" && n && n !== "-" ? t(i.formatter)(n) : n;
|
|
313
|
+
},
|
|
314
|
+
placements: [{
|
|
315
|
+
position: E.Inside,
|
|
316
|
+
fill: "#fff",
|
|
317
|
+
align: .5,
|
|
318
|
+
justify: .5,
|
|
319
|
+
padding: Z
|
|
320
|
+
}, {
|
|
321
|
+
position: E.Inside,
|
|
322
|
+
fill: "#000",
|
|
323
|
+
align: .5,
|
|
324
|
+
justify: .5,
|
|
325
|
+
padding: Z
|
|
326
|
+
}]
|
|
327
|
+
}]
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}] },
|
|
331
|
+
animations: {
|
|
332
|
+
enabled: !0,
|
|
333
|
+
presetId: "chart-labels"
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
return {
|
|
337
|
+
...n,
|
|
338
|
+
components: [...n?.components ?? [], g]
|
|
339
|
+
};
|
|
340
|
+
}, Ee = (e, t, n) => {
|
|
341
|
+
let { shape: r } = q(e), i = `${j.Point}-${r}`;
|
|
342
|
+
return te(e, t, n, {
|
|
343
|
+
filter: (e) => e.filter((e) => e.key === i),
|
|
344
|
+
placement: {
|
|
345
|
+
type: "pointer",
|
|
346
|
+
area: "target"
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}, De = class extends N {
|
|
350
|
+
constructor() {
|
|
351
|
+
super([
|
|
352
|
+
Se,
|
|
353
|
+
xe,
|
|
354
|
+
he,
|
|
355
|
+
Ce,
|
|
356
|
+
D,
|
|
357
|
+
Ee,
|
|
358
|
+
Te,
|
|
359
|
+
me,
|
|
360
|
+
pe
|
|
361
|
+
]);
|
|
362
|
+
}
|
|
363
|
+
preCompile(e) {
|
|
364
|
+
let t = e.dimensions.filter(l), n = e.measures.filter(l), r = t.filter((e) => e.role === o.HEAT_MAP_HORIZONTAL), i = t.filter((e) => e.role === o.HEAT_MAP_VERTICAL), a = n.filter((e) => e.role === p.HEAT_MAP_COLOR), s = r[0], c = i[0], u = a[0];
|
|
365
|
+
if (!s || !c || !u) throw Error("Charts w/o horizontal or vertical dimension or color measure are not supported ATM.");
|
|
366
|
+
}
|
|
367
|
+
}, Oe = ({ id: e, clientX: t, clientY: n, vBackendAPI: r, ...i }) => {
|
|
368
|
+
let { top: a, left: o } = r.daedalus.convertCoordinatesToContainerPosition(t, n);
|
|
369
|
+
U({
|
|
370
|
+
id: e,
|
|
371
|
+
top: a,
|
|
372
|
+
left: o,
|
|
373
|
+
...i
|
|
374
|
+
}, { vBackendAPI: r });
|
|
375
|
+
}, $ = (e, t, n, r, i) => {
|
|
376
|
+
let a, o, [s, c, l, u] = r, f = s.name, p = c.name, m = l.name, h = n.data.value, g = n.data.group.value, _ = n.data.measure.value;
|
|
377
|
+
if (u) {
|
|
378
|
+
let e = d(u);
|
|
379
|
+
a = n.data[e].value, o = u.name;
|
|
380
|
+
}
|
|
381
|
+
Oe({
|
|
382
|
+
id: e,
|
|
383
|
+
clientX: t.clientX,
|
|
384
|
+
clientY: t.clientY,
|
|
385
|
+
xAxisValue: h,
|
|
386
|
+
yAxisValue: g,
|
|
387
|
+
measureColorValue: _,
|
|
388
|
+
measureSizeValue: a,
|
|
389
|
+
xAxisName: f,
|
|
390
|
+
yAxisName: p,
|
|
391
|
+
measureColorName: m,
|
|
392
|
+
measureSizeName: o,
|
|
393
|
+
vBackendAPI: i
|
|
394
|
+
});
|
|
395
|
+
}, ke = (e) => U({ id: "onCellLeave" }, { vBackendAPI: e }), Ae = () => {
|
|
396
|
+
let e = w(), t = b(), n = S();
|
|
397
|
+
return (0, K.useCallback)((r, i, a, o, s) => {
|
|
398
|
+
let c;
|
|
399
|
+
switch (i) {
|
|
400
|
+
case "click":
|
|
401
|
+
r === j.Text ? c = ce(r, n, o, a) : s?.key && o && $("onCellClick", o, s, t, e);
|
|
402
|
+
break;
|
|
403
|
+
case "mousemove":
|
|
404
|
+
if (!o || !s) break;
|
|
405
|
+
$("onCellHover", o, s, t, e);
|
|
406
|
+
break;
|
|
407
|
+
case "mouseleave":
|
|
408
|
+
ke(e);
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
c && e.emitEvent(c.action, c.payload);
|
|
412
|
+
}, [e, t]);
|
|
413
|
+
}, je = x(), Me = v(({ vSpec: e, vTheme: t, data: r, elementSize: i, vizProperties: o }) => {
|
|
414
|
+
let c = y(), [l] = (0, K.useState)(() => new De()), u = g(), d = Ae();
|
|
415
|
+
if (!e || !n(e) || !i) return null;
|
|
416
|
+
let f = t || a, p = l.compile(e, f, r, i, o, s.HeatMap, c, u, d);
|
|
417
|
+
return p ? /* @__PURE__ */ (0, je.jsx)(ne, {
|
|
418
|
+
config: o,
|
|
419
|
+
definition: p,
|
|
420
|
+
size: i,
|
|
421
|
+
vSpec: e
|
|
422
|
+
}) : null;
|
|
423
|
+
});
|
|
424
|
+
export { Me as HeatMapChart };
|