@astrato-io/visualizations 0.9.0 → 0.10.1
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 +10 -0
- package/README.md +7 -3
- package/THIRD_PARTY_NOTICES.md +163 -14
- package/VISUALIZATION_DEFINITIONS.md +376 -36
- package/chunks/{Button-5CxPEACP.js → Button-Dn3rJrYf.js} +4 -4
- package/chunks/{CircularProgress-DFS-LQb7.js → CircularProgress-BFeu06Yb.js} +39 -39
- package/chunks/FieldTypeIcon-DrMoGpHJ.js +22 -0
- package/chunks/{LinearProgress-CjIQfkNA.js → LinearProgress-ClO6GUjN.js} +9 -9
- package/chunks/{MenuOption-Cb7B7x6z.js → MenuOption-Czc34u4q.js} +143 -142
- package/chunks/{Title-CtFw1bVg.js → Title-BgYnaVTR.js} +22 -22
- package/chunks/_createAggregator-BMu9uRax.js +50 -0
- package/chunks/{app-filter-bar.compiler-B9775gLJ.js → app-filter-bar.compiler-CVir0wkl.js} +10 -10
- package/chunks/bar-layout-C_UgRlVl.js +9 -0
- package/chunks/{bar.compiler-B7wlH_Ro.js → bar.compiler-DYuFdi9J.js} +100 -82
- package/chunks/{builder-Dxo7D7c6.js → builder-C-TKA-My.js} +70 -37
- package/chunks/color-rules-DYJL4fIW.js +15 -0
- package/chunks/color-settings-DJFoFTip.js +5 -0
- package/chunks/{coloring-B-Wa8D5P.js → coloring-BtnPiQ_o.js} +37 -37
- package/chunks/createSimplePaletteValueFilter--zrZxRV9.js +2005 -0
- package/chunks/defaults-Dtk7fg3C.js +3 -0
- package/chunks/{definitions-DNpzD9tY.js → definitions-CT304NDn.js} +655 -417
- package/chunks/{escobar-C4Nm3eJ7.js → escobar-CvEV2ES1.js} +7441 -7127
- package/chunks/{extend-preset-BVKFtoe-.js → extend-preset-D9-JP92b.js} +998 -933
- package/chunks/{filter.compiler-BlS3zoy_.js → filter.compiler-CXeZznks.js} +7 -7
- package/chunks/{filtering-CGuLpg7u.js → filtering-8_bFv-jb.js} +333 -377
- package/chunks/handlers-C6CZ0XJA.js +15399 -0
- package/chunks/{icon-picker-styles-DYQgVEKG.js → icon-picker-styles-BXiJ1SZS.js} +11 -11
- package/chunks/isEqual-D8Ay63xR.js +16 -0
- package/chunks/{isFocusVisible-B1_z03UT.js → isFocusVisible-Bu8gGZu5.js} +1 -1
- package/chunks/label-format-type-C46pzgx7.js +17 -0
- package/chunks/{line.compiler-Bo9i9qag.js → line.compiler-DmHpmQCC.js} +9 -9
- package/chunks/{logger-3lng-wOw.js → logger-DdZpR7xZ.js} +79 -72
- package/chunks/map.compiler-Q_Y1Pvat.js +343 -0
- package/chunks/{metadata-Fmx1swpK.js → metadata-BQm_TXI1.js} +1 -1
- package/chunks/{number.compiler-CdLd5aGW.js → number.compiler-DQdg6zTy.js} +7 -7
- package/chunks/operations-DKQWuLL7.js +31315 -0
- package/chunks/{range-CzO4isKK.js → range-BdhzvYQ_.js} +2 -2
- package/chunks/{react-dom-BwZT0N3F.js → react-dom-BGP4tbXV.js} +70 -70
- package/chunks/{render-wrappers-CAuvgMxi.js → render-wrappers-BZpyDnJy.js} +1 -1
- package/chunks/{requirements-CYpVh65U.js → requirements-e8Fe96ag.js} +60 -58
- package/chunks/shared-C_2F90xq.js +1337 -0
- package/chunks/standalone-4MsKiqs0.js +355 -0
- package/chunks/standalone-B794g9pE.js +1012 -0
- package/chunks/{standalone-C6XDHYAM.js → standalone-B8ZSqauS.js} +110 -110
- package/chunks/{standalone-5DnapeHH.js → standalone-BA2YXyJS.js} +126 -124
- package/chunks/{standalone-CXniic5x.js → standalone-BDrXVxlP.js} +6 -5
- package/chunks/{standalone-B6s_xG2u.js → standalone-BE_ONgiG.js} +116 -116
- package/chunks/{standalone-CPUiiWNP.js → standalone-BTY3w_JA.js} +37 -37
- package/chunks/standalone-BgumbdaJ2.js +357 -0
- package/chunks/{standalone-DWPfdP0A.js → standalone-BkbiH-o8.js} +482 -482
- package/chunks/standalone-Blh4qejk.js +689 -0
- package/chunks/standalone-CXY4FpF7.js +773 -0
- package/chunks/{standalone-BvWdpUL3.js → standalone-CY_kjarf.js} +34 -31
- package/chunks/{standalone-DuwTOBXH.js → standalone-CaTxAydz.js} +587 -587
- package/chunks/{standalone-BDrQMxLi.js → standalone-Cc98Pdr6.js} +1799 -1015
- package/chunks/{standalone-DMCwtebn.js → standalone-Cl0TSfqC.js} +125 -125
- package/chunks/{standalone-CoQxJ6ov.js → standalone-CsoMmE9T.js} +778 -778
- package/chunks/standalone-DH0xTEes.js +2 -0
- package/chunks/{standalone-LFVgLhia.js → standalone-DHRalbVO.js} +311 -303
- package/chunks/standalone-DNh9NcMa.js +580 -0
- package/chunks/standalone-DcnHjNnC.js +2 -0
- package/chunks/{standalone-r4ObFvys.js → standalone-DflyWtuR.js} +217 -215
- package/chunks/standalone-DrHdGkY7.js +762 -0
- package/chunks/standalone-c_rROMtx.js +287 -0
- package/chunks/standalone-drcFLeN6.js +6 -0
- package/chunks/{standalone-CNkHsynO.js → standalone-wOWRCpdn.js} +54 -56
- package/chunks/{standalone-Cu73fzSr.js → standalone-z0o52o5t.js} +5128 -4908
- package/chunks/{table.compiler-C1qjqXaT.js → table.compiler-COaHE9VD.js} +18 -18
- package/chunks/{useFieldName-mWrD_uk_.js → useFieldName-CdnCWzhd.js} +1 -1
- package/chunks/{utils-DYYD4Zzf.js → utils-DganVptf.js} +4758 -4747
- package/chunks/{view-7fH6mGmY.js → view-Bzlros43.js} +2021 -1665
- package/chunks/{visualization-filters-mVnsnvLP.js → visualization-filters-D7i6oh1Z.js} +3177 -2425
- package/chunks/{with-html-element-B0Clt4jY.js → with-html-element-CiIhFEa5.js} +3740 -3547
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +303 -2
- package/docs/operations/combo.md +262 -1
- package/docs/operations/date-picker.md +1 -1
- package/docs/operations/distribution-gauge.md +1 -1
- package/docs/operations/dot.md +148 -1
- package/docs/operations/filter.md +1 -1
- package/docs/operations/gauge.md +1 -1
- package/docs/operations/heatMap.md +1 -1
- package/docs/operations/histogram.md +262 -1
- package/docs/operations/iframe.md +1 -1
- package/docs/operations/image.md +1 -1
- package/docs/operations/index.md +7 -7
- package/docs/operations/line.md +280 -1
- package/docs/operations/number.md +1 -1
- package/docs/operations/pie.md +1 -1
- package/docs/operations/radar.md +1 -1
- package/docs/operations/sankey.md +1 -1
- package/docs/operations/scatter.md +148 -1
- package/docs/operations/shape.md +1 -1
- package/docs/operations/simpleTextObject.md +1 -1
- package/docs/operations/slider.md +1 -1
- package/docs/operations/table.md +374 -157
- package/docs/operations/tree.md +1 -1
- package/docs/operations/treemap.md +1 -1
- package/docs/operations/waterfall.md +1 -1
- package/docs/operations/word-cloud.md +1 -1
- package/getters.js +2 -2
- package/index.js +482 -434
- package/metadata.js +2 -2
- package/operations.js +5 -5
- package/package.json +72 -67
- package/src/definitions/index.d.ts +7 -1
- package/src/definitions/model/definitions/available-fields.d.ts +2 -2
- package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
- package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +219 -7
- package/src/definitions/model/definitions/index.d.ts +2 -1
- package/src/definitions/model/definitions/schema-registry.d.ts +305 -0
- package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -0
- package/src/definitions/model/definitions/schemas/common.schema.d.ts +4 -3
- package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
- package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
- package/src/definitions/model/definitions/types/compilation.types.d.ts +9 -1
- package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
- package/src/definitions/model/definitions/types/index.d.ts +1 -1
- package/src/index.d.ts +1 -1
- package/src/operations/index.d.ts +1 -1
- package/src/types.d.ts +17 -13
- package/chunks/FieldTypeIcon-pSVQFemC.js +0 -22
- package/chunks/ToggleButton-Br9HCPCv.js +0 -150
- package/chunks/color-rules-CN7TcGrC.js +0 -6
- package/chunks/color-settings-3VRlf_Vw.js +0 -6
- package/chunks/handlers-CMbyj5y1.js +0 -12930
- package/chunks/isEqual-DBg_b35N.js +0 -12
- package/chunks/label-format-type-weq1XfcX.js +0 -8
- package/chunks/operations-HSqnCRvv.js +0 -26324
- package/chunks/shared-DFoJxjVN.js +0 -1218
- package/chunks/standalone-530a5lvf.js +0 -1003
- package/chunks/standalone-B4jrf4KE.js +0 -354
- package/chunks/standalone-BMoJXGYe.js +0 -2
- package/chunks/standalone-BfvGggeM2.js +0 -355
- package/chunks/standalone-CMJJIi9v.js +0 -2
- package/chunks/standalone-C_Jd4gkj.js +0 -6
- package/chunks/standalone-CiaaibTa.js +0 -518
- package/chunks/standalone-DBeXQrwH.js +0 -468
- package/chunks/standalone-DpSRmAWx.js +0 -287
- package/chunks/standalone-kzAhwH19.js +0 -689
- package/chunks/standalone-mb7LwEiq.js +0 -3874
- /package/chunks/{src-BOS6SqkZ2.js → src-BOS6SqkZ.js} +0 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { o as e, r as t } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
+
import { Fc as n, Ks as r, Lo as i, Oa as a, Qa as o, Qr as s, Ys as c, sa as l, yc as u, za as d } from "./visualization-filters-D7i6oh1Z.js";
|
|
3
|
+
import { Ht as f, N as p, Ut as m, ci as h, jt as g, zr as _ } from "./utils-DganVptf.js";
|
|
4
|
+
import { g_ as v } from "./handlers-C6CZ0XJA.js";
|
|
5
|
+
import { n as y } from "./label-format-type-C46pzgx7.js";
|
|
6
|
+
import "./logger-DdZpR7xZ.js";
|
|
7
|
+
import { At as b, Ct as x, L as S, Mt as C, N as ee, Qt as w, Ut as T, _ as E, bn as D, fn as te, gn as O, i as ne, kt as re, mn as k, on as ie, v as A } from "./escobar-CvEV2ES1.js";
|
|
8
|
+
import { t as j } from "./coloring-BtnPiQ_o.js";
|
|
9
|
+
import { t as M } from "./set-coloring-datafield-B3uIS1Pe.js";
|
|
10
|
+
var N = /* @__PURE__ */ e(h()), P = {
|
|
11
|
+
outerRadius: .95,
|
|
12
|
+
cornerRadius: 10,
|
|
13
|
+
additionalTextAnchorHeight: 50,
|
|
14
|
+
barMinWidth: 1,
|
|
15
|
+
barMaxWidth: 200,
|
|
16
|
+
minScaleValue: 0,
|
|
17
|
+
maxScaleValue: 100,
|
|
18
|
+
scalePadding: 1,
|
|
19
|
+
backgroundBarOpacity: .2,
|
|
20
|
+
barWidthRadiusPadding: .2,
|
|
21
|
+
maxBarWidthOfRadius: .15,
|
|
22
|
+
gaugeCollectionKey: "Gauge-Collection"
|
|
23
|
+
}, F = (e) => e.gaugeSettings?.barMode ?? !1, I = (e) => e.gaugeSettings?.comparisonMode ?? !1, ae = (e) => {
|
|
24
|
+
let { coloring: t } = e || {};
|
|
25
|
+
return t?.type === u.Categorical || t?.type === u.Single ? b(e, []) ?? "" : C(e) ?? "";
|
|
26
|
+
}, L = (e, t, r) => {
|
|
27
|
+
let a = { ...re(M(e, ae(e) ?? ""), t, {}) }, o = e.gaugeSettings?.barPadding ?? O.scale.padding;
|
|
28
|
+
a = ee(e, a, o);
|
|
29
|
+
let c = e.dimensions.filter(s), l = e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE);
|
|
30
|
+
return !c.length && F(e) ? a.onlyMeasures = {
|
|
31
|
+
data: I(e) ? { extract: { field: l[0] ? n(l[0].dataItem) : "" } } : l.map((e) => n(e.dataItem)),
|
|
32
|
+
type: k.Band,
|
|
33
|
+
padding: o
|
|
34
|
+
} : I(e) || (a.onlyMeasures = {
|
|
35
|
+
data: { fields: l.map((e) => n(e.dataItem)) },
|
|
36
|
+
include: [0],
|
|
37
|
+
expand: .05
|
|
38
|
+
}), F(e) && (a.barScale = {
|
|
39
|
+
min: P.minScaleValue - P.scalePadding,
|
|
40
|
+
max: P.maxScaleValue + P.scalePadding,
|
|
41
|
+
invert: e.gaugeSettings?.orientation === i.Vertical
|
|
42
|
+
}), {
|
|
43
|
+
...r,
|
|
44
|
+
scales: a
|
|
45
|
+
};
|
|
46
|
+
}, R = (e, t, r, i, a) => {
|
|
47
|
+
if (!a) return r;
|
|
48
|
+
let o = e.dimensions.filter(s), c = e.measures.filter(s), l = A((e.supportingMeasures ?? []).filter(s)), u = c.filter((e) => e.role === d.GAUGE_VALUE), f = o[0], p = u[0], { targetType: m } = e.gaugeSettings ?? {}, h = F(e), g = f?.dataItem ?? p?.dataItem;
|
|
49
|
+
if (!g) return r;
|
|
50
|
+
let _ = [], v = P.minScaleValue;
|
|
51
|
+
if (I(e) ? _.push(...B(e, g, a, l)) : f ? _.push(...z(e, g, a, l)) : _.push(...V(e, a, l)), h) {
|
|
52
|
+
let t = n(p.dataItem), r = {
|
|
53
|
+
field: n(g),
|
|
54
|
+
props: {
|
|
55
|
+
actual: { field: t },
|
|
56
|
+
color: t,
|
|
57
|
+
start: v,
|
|
58
|
+
end: P.maxScaleValue,
|
|
59
|
+
background: !0,
|
|
60
|
+
...l
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
(m === y.Data || m === y.Manual) && (r.props ??= {}, r.props.target = W(e, a)), c.forEach((e) => {
|
|
64
|
+
r.props ??= {};
|
|
65
|
+
let t = `measure-${n(e.dataItem)}`;
|
|
66
|
+
r.props[t] = { field: n(e.dataItem) };
|
|
67
|
+
}), _.push(r);
|
|
68
|
+
}
|
|
69
|
+
let b = [{
|
|
70
|
+
key: P.gaugeCollectionKey,
|
|
71
|
+
data: { extract: _ }
|
|
72
|
+
}];
|
|
73
|
+
return {
|
|
74
|
+
...r,
|
|
75
|
+
collections: b
|
|
76
|
+
};
|
|
77
|
+
}, z = (e, t, r, i) => {
|
|
78
|
+
let a = e.measures.filter(s), o = a.filter((e) => e.role === d.GAUGE_VALUE), c = a.filter((e) => e.role === d.GAUGE_TARGET), l = o[0], u = c[0], { targetType: f } = e.gaugeSettings, p = F(e), m = [], h = n(l.dataItem);
|
|
79
|
+
return p || m.push({
|
|
80
|
+
field: n(t),
|
|
81
|
+
props: {
|
|
82
|
+
actual: { field: h },
|
|
83
|
+
[h]: { field: h },
|
|
84
|
+
color: h,
|
|
85
|
+
...i
|
|
86
|
+
}
|
|
87
|
+
}), m.push({
|
|
88
|
+
field: n(t),
|
|
89
|
+
props: {
|
|
90
|
+
actual: { field: h },
|
|
91
|
+
start: p ? P.minScaleValue : void 0,
|
|
92
|
+
end: p ? { getValue: H(e, r) } : void 0,
|
|
93
|
+
[h]: { field: h },
|
|
94
|
+
color: h,
|
|
95
|
+
...i
|
|
96
|
+
}
|
|
97
|
+
}), (f === y.Data || f === y.Manual) && m.forEach((t) => {
|
|
98
|
+
t.props ??= {}, t.props.target = W(e, r), u && f === y.Data && (t.props[n(u.dataItem)] = { field: n(u.dataItem) });
|
|
99
|
+
}), m;
|
|
100
|
+
}, B = (e, t, r, i) => {
|
|
101
|
+
let a = F(e), o = e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE), c = o.reduce((e, t) => {
|
|
102
|
+
let r = n(t.dataItem);
|
|
103
|
+
return e[r] = { field: r }, e;
|
|
104
|
+
}, {});
|
|
105
|
+
return o.map((o, s) => {
|
|
106
|
+
let l = n(o.dataItem);
|
|
107
|
+
return {
|
|
108
|
+
field: n(t),
|
|
109
|
+
props: {
|
|
110
|
+
measure: { field: l },
|
|
111
|
+
color: l,
|
|
112
|
+
start: a ? P.minScaleValue : void 0,
|
|
113
|
+
end: a ? { getValue: H(e, r, s) } : void 0,
|
|
114
|
+
...c,
|
|
115
|
+
...i
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}, V = (e, t, r) => {
|
|
120
|
+
let i = F(e), a = [];
|
|
121
|
+
return e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE).forEach((o) => {
|
|
122
|
+
let s = n(o.dataItem), c = t[0].items[0][s], l = W(e, t, o), u = [];
|
|
123
|
+
u.push({
|
|
124
|
+
field: s,
|
|
125
|
+
props: {
|
|
126
|
+
measureValue: s,
|
|
127
|
+
measure: { field: s },
|
|
128
|
+
actual: { field: s },
|
|
129
|
+
color: s,
|
|
130
|
+
start: i ? P.minScaleValue : void 0,
|
|
131
|
+
end: i && typeof c == "number" && typeof l == "number" ? U(c, l) : void 0,
|
|
132
|
+
[s]: { field: s },
|
|
133
|
+
...r
|
|
134
|
+
}
|
|
135
|
+
}), u.push({
|
|
136
|
+
field: s,
|
|
137
|
+
props: {
|
|
138
|
+
measureValue: s,
|
|
139
|
+
measure: { field: s },
|
|
140
|
+
actual: { field: s },
|
|
141
|
+
color: s,
|
|
142
|
+
start: i ? P.minScaleValue : void 0,
|
|
143
|
+
end: i ? P.maxScaleValue : void 0,
|
|
144
|
+
background: !0,
|
|
145
|
+
[s]: { field: s },
|
|
146
|
+
...r
|
|
147
|
+
}
|
|
148
|
+
}), (e.gaugeSettings?.targetType ?? y.Auto) !== y.Auto && u.forEach((e) => {
|
|
149
|
+
e.props ??= {}, e.props.target = l;
|
|
150
|
+
}), a.push(...u);
|
|
151
|
+
}), a;
|
|
152
|
+
}, H = (e, t, r) => {
|
|
153
|
+
let i = e.measures.filter(s), a = i.filter((e) => e.role === d.GAUGE_VALUE), o = i.filter((e) => e.role === d.GAUGE_TARGET), c = a[0], l = o[0];
|
|
154
|
+
return (i, o, s) => {
|
|
155
|
+
if (!s) return P.minScaleValue;
|
|
156
|
+
let u = a.find((e, t) => t === r), d = u && s[n(u.dataItem)];
|
|
157
|
+
if (typeof d == "number" && d < 0) return P.minScaleValue;
|
|
158
|
+
let f = s[n(c.dataItem)], p;
|
|
159
|
+
if (p = e.gaugeSettings?.targetType === y.Data ? s[n(l?.dataItem)] : W(e, t), typeof f != "number" || typeof p != "number") return P.minScaleValue;
|
|
160
|
+
if (!I(e) || r === void 0) return U(f, p);
|
|
161
|
+
let m = 0, h = 0;
|
|
162
|
+
return a.forEach((e, t) => {
|
|
163
|
+
let i = Math.max(0, s[n(e.dataItem)]);
|
|
164
|
+
m += i, t <= r && (h += i);
|
|
165
|
+
}), h / m * P.maxScaleValue;
|
|
166
|
+
};
|
|
167
|
+
}, U = (e, t) => {
|
|
168
|
+
let n = t ? Math.max(0, e) / t : 1;
|
|
169
|
+
return Math.min(n, 1) * P.maxScaleValue;
|
|
170
|
+
}, W = (e, t, r) => {
|
|
171
|
+
let { targetType: i, targetValue: a } = e.gaugeSettings, o = e.measures.filter(s), c = o.filter((e) => e.role === d.GAUGE_TARGET)[0];
|
|
172
|
+
return i === y.Auto ? t[0].items.map((e) => o.map((t) => e[n(t.dataItem)])).reduce((e, t) => Math.max(...t, e), 0) * (1 + O.scale.padding) : c && i === y.Data ? { field: n(c.dataItem) } : r && i === y.PerMeasure ? r.targetValue ?? 0 : i === y.Manual ? a ?? 0 : 0;
|
|
173
|
+
}, G = {
|
|
174
|
+
Foreground: "foreground",
|
|
175
|
+
Background: "background"
|
|
176
|
+
}, K = (e, t, n = 0) => `${e}-${t}-${n}`, q = (e) => Math.min(P.maxBarWidthOfRadius, P.outerRadius / e), oe = (e, t, r) => {
|
|
177
|
+
let i = e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE);
|
|
178
|
+
return (e) => r !== void 0 && e.measure?.source?.field !== n(i[r]?.dataItem) ? !1 : e.background?.value ? t === G.Background : t === G.Foreground;
|
|
179
|
+
}, J = (e, t) => !t || e.coloring?.type === u.Single ? !1 : !I(e) || e.coloring?.type === u.Categorical, Y = (e, t, r, i, a, o, c, l) => {
|
|
180
|
+
let u = r.dimensions.filter(s)[0], f = new j(r, i, t?.[0]?.itemsNotAffectedByFiltering), p = f.getColorDefinition(J(r, u) ? { ref: f.MAIN_FIELD } : {}), m = (e, t = 0) => !I(r) && t === 1 || o && I(r) ? "transparent" : typeof p == "function" ? p(e) : p, h = q(c), g = Number(r.gaugeSettings?.size), _ = Number(r.gaugeSettings?.startAngle), v = isNaN(g) ? 360 : g ?? 360, b = isNaN(_) ? 0 : _ ?? 0, x = b + v, S = b / 180 * Math.PI, C = x / 180 * Math.PI;
|
|
181
|
+
return {
|
|
182
|
+
key: K(D.Pie, o ? G.Background : G.Foreground, a),
|
|
183
|
+
type: D.Pie,
|
|
184
|
+
animations: {
|
|
185
|
+
enabled: !0,
|
|
186
|
+
presetId: "pie-chart"
|
|
187
|
+
},
|
|
188
|
+
data: {
|
|
189
|
+
collection: P.gaugeCollectionKey,
|
|
190
|
+
filter: (t) => {
|
|
191
|
+
if (!u) {
|
|
192
|
+
let e = r.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE);
|
|
193
|
+
return I(r) || e[a] && t.measure?.source?.field === n(e[a].dataItem);
|
|
194
|
+
}
|
|
195
|
+
return `${t.value}` == `${e[n(u.dataItem)]}`;
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
settings: {
|
|
199
|
+
startAngle: S,
|
|
200
|
+
endAngle: C,
|
|
201
|
+
slice: {
|
|
202
|
+
cornerRadius: r.gaugeSettings?.cornerRadius ?? 10,
|
|
203
|
+
outerRadius: P.outerRadius - a * h,
|
|
204
|
+
innerRadius: P.outerRadius - (a + (1 - P.barWidthRadiusPadding)) * h,
|
|
205
|
+
fill: m,
|
|
206
|
+
strokeWidth: .1,
|
|
207
|
+
opacity: o ? P.backgroundBarOpacity : 1,
|
|
208
|
+
arc: (e, t = 0) => {
|
|
209
|
+
if (o) return +(t === 0);
|
|
210
|
+
if (I(r)) return e.datum.measure.value;
|
|
211
|
+
if ((r.gaugeSettings.targetType ?? y.Auto) !== y.Auto) return t === 0 ? e.datum.actual.value : Number(e.datum.target.value) - Number(e.datum.actual.value);
|
|
212
|
+
{
|
|
213
|
+
let n = e.resources.scale("onlyMeasures"), r = Number(n(e.datum.actual.value)) || 0;
|
|
214
|
+
return t === 0 ? r : 1 - r;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
brush: w([""], l, { overwriteOpacity: o ? P.backgroundBarOpacity : void 0 })
|
|
220
|
+
};
|
|
221
|
+
}, X = (e, t, r, o, c, l) => {
|
|
222
|
+
let u = e.dimensions.filter(s)[0], d = new j(e, t, r?.[0]?.itemsNotAffectedByFiltering), f;
|
|
223
|
+
f = o === G.Background && e.gaugeSettings?.backgroundBarColor ? e.gaugeSettings?.backgroundBarColor : d.getColorDefinition(J(e, u) ? { ref: d.MAIN_FIELD } : {}, !e.gaugeSettings?.backgroundBarColor && o === G.Background ? P.backgroundBarOpacity : void 0);
|
|
224
|
+
let p = u ? n(u.dataItem) : "onlyMeasures", m = !u && !I(e) ? "measureValue" : void 0, h = {
|
|
225
|
+
key: K(D.Box, o, c),
|
|
226
|
+
type: D.Box,
|
|
227
|
+
animations: { enabled: !0 },
|
|
228
|
+
data: {
|
|
229
|
+
collection: P.gaugeCollectionKey,
|
|
230
|
+
filter: oe(e, o, c)
|
|
231
|
+
},
|
|
232
|
+
settings: {
|
|
233
|
+
orientation: e.gaugeSettings.orientation ?? i.Horizontal,
|
|
234
|
+
major: {
|
|
235
|
+
scale: p,
|
|
236
|
+
ref: m
|
|
237
|
+
},
|
|
238
|
+
minor: { scale: "barScale" },
|
|
239
|
+
box: {
|
|
240
|
+
minWidthPx: 2,
|
|
241
|
+
fill: f,
|
|
242
|
+
rx: e.gaugeSettings?.barRadius ?? 0
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
brush: w([""], l, { disable: { triggers: o === G.Foreground } })
|
|
246
|
+
};
|
|
247
|
+
if (e.gaugeSettings?.strokeEnabled) {
|
|
248
|
+
let n = h.settings;
|
|
249
|
+
n && (n.box.stroke = e.gaugeSettings?.strokeColor || t.colors.brandColors[0], n.box.strokeWidth = e.gaugeSettings?.strokeWidth);
|
|
250
|
+
} else {
|
|
251
|
+
let e = h.settings;
|
|
252
|
+
e && (e.box.stroke = a.transparent);
|
|
253
|
+
}
|
|
254
|
+
return h;
|
|
255
|
+
}, se = (e, t, n, r, i, a) => {
|
|
256
|
+
if (!i) return n;
|
|
257
|
+
let o = [];
|
|
258
|
+
return o = F(e) ? Z(e, t, r, i, a) : ce(e, t, r, i, a), {
|
|
259
|
+
...n,
|
|
260
|
+
components: [...n.components, ...o]
|
|
261
|
+
};
|
|
262
|
+
}, ce = (e, t, n, r, i) => {
|
|
263
|
+
let a = e.dimensions.filter(s), o = e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE);
|
|
264
|
+
return !a[0] && !I(e) ? o.map((n, i) => [Y(r[0].items[0], r, e, t, i, !0, o.length), Y(r[0].items[0], r, e, t, i, !1, o.length)]).reduce((e, t) => e.concat(t), []) : r[0].items.map((n, a) => [Y(n, r, e, t, a, !0, r[0].items.length, i), Y(n, r, e, t, a, !1, r[0].items.length, i)]).reduce((e, t) => e.concat(t), []);
|
|
265
|
+
}, Z = (e, t, n, r, i) => {
|
|
266
|
+
let a = e.dimensions.filter(s), o = e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE), c = a[0], l = [];
|
|
267
|
+
if (I(e)) for (let n = o.length - 1; n >= 0; n--) l.push(X(e, t, r, G.Foreground, n, i));
|
|
268
|
+
else if (c) l = [X(e, t, r, G.Background, void 0, i), X(e, t, r, G.Foreground, void 0, i)];
|
|
269
|
+
else for (let n = o.length - 1; n >= 0; n--) l.push(X(e, t, r, G.Background, n)), l.push(X(e, t, r, G.Foreground, n));
|
|
270
|
+
return l;
|
|
271
|
+
}, le = (e, t, n) => {
|
|
272
|
+
let r = e.dimensions.filter(s), i = e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE);
|
|
273
|
+
if (!e.gaugeSettings?.barMode || !r.length && e.gaugeSettings?.comparisonMode) return n;
|
|
274
|
+
let a = [];
|
|
275
|
+
return r.length ? (e.gaugeSettings?.showDimensionLabels !== !1 && r[0] && a.push(Q(!1, t, r[0].formatter, "dimension", void 0, e.gaugeSettings)), !e.gaugeSettings?.comparisonMode && e.gaugeSettings?.showValueLabels !== !1 && i[0] && a.push(Q(!0, t, i[0].formatter, "value", void 0, e.gaugeSettings))) : e.gaugeSettings?.showValueLabels !== !1 && i.forEach((n, r) => {
|
|
276
|
+
a.push(Q(!0, t, n.formatter, String(r), r, e.gaugeSettings));
|
|
277
|
+
}), {
|
|
278
|
+
...n,
|
|
279
|
+
components: [...n.components, ...a]
|
|
280
|
+
};
|
|
281
|
+
}, Q = (e, t, n, r, a, o) => {
|
|
282
|
+
let s = +!!e, c = {
|
|
283
|
+
type: "bar",
|
|
284
|
+
settings: {
|
|
285
|
+
direction: o?.orientation === i.Vertical ? "up" : "right",
|
|
286
|
+
fontSize: ie(o?.labelFontSize),
|
|
287
|
+
fontFamily: t.fonts.general.fontFamily,
|
|
288
|
+
labels: [{
|
|
289
|
+
label: (t) => t.data ? e ? ue(t.data.actual.value, n, t) : `${m(n, t.data?.label)}` : "",
|
|
290
|
+
placements: e ? [{
|
|
291
|
+
position: v.Outside,
|
|
292
|
+
fill: "#000",
|
|
293
|
+
justify: 0
|
|
294
|
+
}, {
|
|
295
|
+
position: v.Inside,
|
|
296
|
+
fill: "#fff",
|
|
297
|
+
justify: s
|
|
298
|
+
}] : [{
|
|
299
|
+
position: v.Inside,
|
|
300
|
+
fill: "#fff",
|
|
301
|
+
justify: s
|
|
302
|
+
}]
|
|
303
|
+
}]
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
return {
|
|
307
|
+
type: D.Labels,
|
|
308
|
+
key: `gauge-bar-labels-${r}`,
|
|
309
|
+
layout: { displayOrder: T.Labels },
|
|
310
|
+
settings: { sources: [{
|
|
311
|
+
component: K(D.Box, G.Foreground, a),
|
|
312
|
+
selector: te.Rect,
|
|
313
|
+
strategy: c
|
|
314
|
+
}] },
|
|
315
|
+
animations: {
|
|
316
|
+
enabled: !0,
|
|
317
|
+
presetId: "chart-labels"
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
}, ue = (e, t, n) => e === null ? "-" : typeof t != "string" && o(t) ? f(t.format, t)(e, void 0, n.data) : `${m(t, e)}`, de = (e, t, n, r) => x(e, t, n, r), fe = (e, t, n, r, i) => {
|
|
321
|
+
if (!i) return n;
|
|
322
|
+
let a = e.dimensions.filter(s), o = e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE), c = a[0], l = F(e), u = I(e), f = l ? D.Box : D.Pie, p = l && !u ? G.Background : G.Foreground, m = ((l || !c ? o : i[0]?.items) || []).map((e, t) => K(f, p, t));
|
|
323
|
+
return S(e, t, n, {
|
|
324
|
+
filter: (e) => e.filter((e) => m.findIndex((t) => t === e.key) !== -1),
|
|
325
|
+
placement: {
|
|
326
|
+
type: l ? "bounds" : "slice",
|
|
327
|
+
area: "target"
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}, pe = class extends E {
|
|
331
|
+
constructor() {
|
|
332
|
+
super([
|
|
333
|
+
R,
|
|
334
|
+
L,
|
|
335
|
+
se,
|
|
336
|
+
le,
|
|
337
|
+
de,
|
|
338
|
+
fe
|
|
339
|
+
]);
|
|
340
|
+
}
|
|
341
|
+
preCompile(e) {
|
|
342
|
+
if (!(e.measures ?? []).filter(s).filter((e) => e.role === d.GAUGE_VALUE).length) throw Error("Charts w/o measures are not supported ATM.");
|
|
343
|
+
}
|
|
344
|
+
}, me = _(), $ = g(({ vSpec: e, vTheme: t, data: n, elementSize: i, vizProperties: a }) => {
|
|
345
|
+
let o = p(), [s] = (0, N.useState)(() => new pe());
|
|
346
|
+
if (!e || !(c(e) || r(e)) || !i) return null;
|
|
347
|
+
let u = t || l, d = s.compile(e, u, n, i, a, e.type, o);
|
|
348
|
+
return d ? /* @__PURE__ */ (0, me.jsx)(ne, {
|
|
349
|
+
config: a,
|
|
350
|
+
definition: d,
|
|
351
|
+
size: i,
|
|
352
|
+
vSpec: e
|
|
353
|
+
}) : null;
|
|
354
|
+
}), he = /* @__PURE__ */ t({ GaugeChart: () => $ });
|
|
355
|
+
export { $ as n, he as t };
|