@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
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
import { o as e, r as t } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import { $i as n, Ds as r, Hi as i, Us as a, Za as o, es as s, fa as c, rs as l, zi as u, zr as d } from "./visualization-filters-mVnsnvLP.js";
|
|
3
|
-
import { Bt as f, N as p, Ot as m, ei as h, jr as g, zt as _ } from "./utils-DYYD4Zzf.js";
|
|
4
|
-
import { jm as v } from "./handlers-CMbyj5y1.js";
|
|
5
|
-
import { n as y } from "./label-format-type-weq1XfcX.js";
|
|
6
|
-
import "./logger-3lng-wOw.js";
|
|
7
|
-
import { Bt as b, Dt as x, Et as S, F as C, I as w, X as ee, Yt as T, _n as E, bt as D, dn as te, et as ne, i as re, kt as ie, ln as O, pn as k, rn as A } from "./escobar-C4Nm3eJ7.js";
|
|
8
|
-
import { t as j } from "./coloring-B-Wa8D5P.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 === r.Categorical || t?.type === r.Single ? x(e, []) ?? "" : ie(e) ?? "";
|
|
26
|
-
}, L = (e, t, r) => {
|
|
27
|
-
let i = { ...S(M(e, ae(e) ?? ""), t, {}) }, s = e.gaugeSettings?.barPadding ?? k.scale.padding;
|
|
28
|
-
i = ee(e, i, s);
|
|
29
|
-
let c = e.dimensions.filter(d), l = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
|
|
30
|
-
return !c.length && F(e) ? i.onlyMeasures = {
|
|
31
|
-
data: I(e) ? { extract: { field: l[0] ? a(l[0].dataItem) : "" } } : l.map((e) => a(e.dataItem)),
|
|
32
|
-
type: te.Band,
|
|
33
|
-
padding: s
|
|
34
|
-
} : I(e) || (i.onlyMeasures = {
|
|
35
|
-
data: { fields: l.map((e) => a(e.dataItem)) },
|
|
36
|
-
include: [0],
|
|
37
|
-
expand: .05
|
|
38
|
-
}), F(e) && (i.barScale = {
|
|
39
|
-
min: P.minScaleValue - P.scalePadding,
|
|
40
|
-
max: P.maxScaleValue + P.scalePadding,
|
|
41
|
-
invert: e.gaugeSettings?.orientation === o.Vertical
|
|
42
|
-
}), {
|
|
43
|
-
...r,
|
|
44
|
-
scales: i
|
|
45
|
-
};
|
|
46
|
-
}, R = (e, t, r, i, o) => {
|
|
47
|
-
if (!o) return r;
|
|
48
|
-
let s = e.dimensions.filter(d), c = e.measures.filter(d), l = w((e.supportingMeasures ?? []).filter(d)), u = c.filter((e) => e.role === n.GAUGE_VALUE), f = s[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, o, l)) : f ? _.push(...z(e, g, o, l)) : _.push(...V(e, o, l)), h) {
|
|
52
|
-
let t = a(p.dataItem), n = {
|
|
53
|
-
field: a(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) && (n.props ??= {}, n.props.target = W(e, o)), c.forEach((e) => {
|
|
64
|
-
n.props ??= {};
|
|
65
|
-
let t = `measure-${a(e.dataItem)}`;
|
|
66
|
-
n.props[t] = { field: a(e.dataItem) };
|
|
67
|
-
}), _.push(n);
|
|
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 o = e.measures.filter(d), s = o.filter((e) => e.role === n.GAUGE_VALUE), c = o.filter((e) => e.role === n.GAUGE_TARGET), l = s[0], u = c[0], { targetType: f } = e.gaugeSettings, p = F(e), m = [], h = a(l.dataItem);
|
|
79
|
-
return p || m.push({
|
|
80
|
-
field: a(t),
|
|
81
|
-
props: {
|
|
82
|
-
actual: { field: h },
|
|
83
|
-
[h]: { field: h },
|
|
84
|
-
color: h,
|
|
85
|
-
...i
|
|
86
|
-
}
|
|
87
|
-
}), m.push({
|
|
88
|
-
field: a(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[a(u.dataItem)] = { field: a(u.dataItem) });
|
|
99
|
-
}), m;
|
|
100
|
-
}, B = (e, t, r, i) => {
|
|
101
|
-
let o = F(e), s = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE), c = s.reduce((e, t) => {
|
|
102
|
-
let n = a(t.dataItem);
|
|
103
|
-
return e[n] = { field: n }, e;
|
|
104
|
-
}, {});
|
|
105
|
-
return s.map((n, s) => {
|
|
106
|
-
let l = a(n.dataItem);
|
|
107
|
-
return {
|
|
108
|
-
field: a(t),
|
|
109
|
-
props: {
|
|
110
|
-
measure: { field: l },
|
|
111
|
-
color: l,
|
|
112
|
-
start: o ? P.minScaleValue : void 0,
|
|
113
|
-
end: o ? { getValue: H(e, r, s) } : void 0,
|
|
114
|
-
...c,
|
|
115
|
-
...i
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
});
|
|
119
|
-
}, V = (e, t, r) => {
|
|
120
|
-
let i = F(e), o = [];
|
|
121
|
-
return e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE).forEach((n) => {
|
|
122
|
-
let s = a(n.dataItem), c = t[0].items[0][s], l = W(e, t, n), 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
|
-
}), o.push(...u);
|
|
151
|
-
}), o;
|
|
152
|
-
}, H = (e, t, r) => {
|
|
153
|
-
let i = e.measures.filter(d), o = i.filter((e) => e.role === n.GAUGE_VALUE), s = i.filter((e) => e.role === n.GAUGE_TARGET), c = o[0], l = s[0];
|
|
154
|
-
return (n, i, s) => {
|
|
155
|
-
if (!s) return P.minScaleValue;
|
|
156
|
-
let u = o.find((e, t) => t === r), d = u && s[a(u.dataItem)];
|
|
157
|
-
if (typeof d == "number" && d < 0) return P.minScaleValue;
|
|
158
|
-
let f = s[a(c.dataItem)], p;
|
|
159
|
-
if (p = e.gaugeSettings?.targetType === y.Data ? s[a(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 o.forEach((e, t) => {
|
|
163
|
-
let n = Math.max(0, s[a(e.dataItem)]);
|
|
164
|
-
m += n, t <= r && (h += n);
|
|
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: o } = e.gaugeSettings, s = e.measures.filter(d), c = s.filter((e) => e.role === n.GAUGE_TARGET)[0];
|
|
172
|
-
return i === y.Auto ? t[0].items.map((e) => s.map((t) => e[a(t.dataItem)])).reduce((e, t) => Math.max(...t, e), 0) * (1 + k.scale.padding) : c && i === y.Data ? { field: a(c.dataItem) } : r && i === y.PerMeasure ? r.targetValue ?? 0 : i === y.Manual ? o ?? 0 : 0;
|
|
173
|
-
}, G = /* @__PURE__ */ function(e) {
|
|
174
|
-
return e.Foreground = "foreground", e.Background = "background", e;
|
|
175
|
-
}({}), K = (e, t, n = 0) => `${e}-${t}-${n}`, q = (e) => Math.min(P.maxBarWidthOfRadius, P.outerRadius / e), oe = (e, t, r) => {
|
|
176
|
-
let i = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
|
|
177
|
-
return (e) => r !== void 0 && e.measure?.source?.field !== a(i[r]?.dataItem) ? !1 : e.background?.value ? t === G.Background : t === G.Foreground;
|
|
178
|
-
}, J = (e, t) => !t || e.coloring?.type === r.Single ? !1 : !I(e) || e.coloring?.type === r.Categorical, Y = (e, t, r, i, o, s, c, l) => {
|
|
179
|
-
let u = r.dimensions.filter(d)[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 || s && 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;
|
|
180
|
-
return {
|
|
181
|
-
key: K(E.Pie, s ? G.Background : G.Foreground, o),
|
|
182
|
-
type: E.Pie,
|
|
183
|
-
animations: {
|
|
184
|
-
enabled: !0,
|
|
185
|
-
presetId: "pie-chart"
|
|
186
|
-
},
|
|
187
|
-
data: {
|
|
188
|
-
collection: P.gaugeCollectionKey,
|
|
189
|
-
filter: (t) => {
|
|
190
|
-
if (!u) {
|
|
191
|
-
let e = r.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
|
|
192
|
-
return I(r) || e[o] && t.measure?.source?.field === a(e[o].dataItem);
|
|
193
|
-
}
|
|
194
|
-
return `${t.value}` == `${e[a(u.dataItem)]}`;
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
settings: {
|
|
198
|
-
startAngle: S,
|
|
199
|
-
endAngle: C,
|
|
200
|
-
slice: {
|
|
201
|
-
cornerRadius: r.gaugeSettings?.cornerRadius ?? 10,
|
|
202
|
-
outerRadius: P.outerRadius - o * h,
|
|
203
|
-
innerRadius: P.outerRadius - (o + (1 - P.barWidthRadiusPadding)) * h,
|
|
204
|
-
fill: m,
|
|
205
|
-
strokeWidth: .1,
|
|
206
|
-
opacity: s ? P.backgroundBarOpacity : 1,
|
|
207
|
-
arc: (e, t = 0) => {
|
|
208
|
-
if (s) return +(t === 0);
|
|
209
|
-
if (I(r)) return e.datum.measure.value;
|
|
210
|
-
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);
|
|
211
|
-
{
|
|
212
|
-
let n = e.resources.scale("onlyMeasures"), r = Number(n(e.datum.actual.value)) || 0;
|
|
213
|
-
return t === 0 ? r : 1 - r;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
brush: T([""], l, { overwriteOpacity: s ? P.backgroundBarOpacity : void 0 })
|
|
219
|
-
};
|
|
220
|
-
}, X = (e, t, n, r, s, c) => {
|
|
221
|
-
let l = e.dimensions.filter(d)[0], u = new j(e, t, n?.[0]?.itemsNotAffectedByFiltering), f;
|
|
222
|
-
f = r === G.Background && e.gaugeSettings?.backgroundBarColor ? e.gaugeSettings?.backgroundBarColor : u.getColorDefinition(J(e, l) ? { ref: u.MAIN_FIELD } : {}, !e.gaugeSettings?.backgroundBarColor && r === G.Background ? P.backgroundBarOpacity : void 0);
|
|
223
|
-
let p = l ? a(l.dataItem) : "onlyMeasures", m = !l && !I(e) ? "measureValue" : void 0, h = {
|
|
224
|
-
key: K(E.Box, r, s),
|
|
225
|
-
type: E.Box,
|
|
226
|
-
animations: { enabled: !0 },
|
|
227
|
-
data: {
|
|
228
|
-
collection: P.gaugeCollectionKey,
|
|
229
|
-
filter: oe(e, r, s)
|
|
230
|
-
},
|
|
231
|
-
settings: {
|
|
232
|
-
orientation: e.gaugeSettings.orientation ?? o.Horizontal,
|
|
233
|
-
major: {
|
|
234
|
-
scale: p,
|
|
235
|
-
ref: m
|
|
236
|
-
},
|
|
237
|
-
minor: { scale: "barScale" },
|
|
238
|
-
box: {
|
|
239
|
-
minWidthPx: 2,
|
|
240
|
-
fill: f,
|
|
241
|
-
rx: e.gaugeSettings?.barRadius ?? 0
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
brush: T([""], c, { disable: { triggers: r === G.Foreground } })
|
|
245
|
-
};
|
|
246
|
-
if (e.gaugeSettings?.strokeEnabled) {
|
|
247
|
-
let n = h.settings;
|
|
248
|
-
n && (n.box.stroke = e.gaugeSettings?.strokeColor || t.colors.brandColors[0], n.box.strokeWidth = e.gaugeSettings?.strokeWidth);
|
|
249
|
-
} else {
|
|
250
|
-
let e = h.settings;
|
|
251
|
-
e && (e.box.stroke = i.transparent);
|
|
252
|
-
}
|
|
253
|
-
return h;
|
|
254
|
-
}, se = (e, t, n, r, i, a) => {
|
|
255
|
-
if (!i) return n;
|
|
256
|
-
let o = [];
|
|
257
|
-
return o = F(e) ? Z(e, t, r, i, a) : ce(e, t, r, i, a), {
|
|
258
|
-
...n,
|
|
259
|
-
components: [...n.components, ...o]
|
|
260
|
-
};
|
|
261
|
-
}, ce = (e, t, r, i, a) => {
|
|
262
|
-
let o = e.dimensions.filter(d), s = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
|
|
263
|
-
return !o[0] && !I(e) ? s.map((n, r) => [Y(i[0].items[0], i, e, t, r, !0, s.length), Y(i[0].items[0], i, e, t, r, !1, s.length)]).reduce((e, t) => e.concat(t), []) : i[0].items.map((n, r) => [Y(n, i, e, t, r, !0, i[0].items.length, a), Y(n, i, e, t, r, !1, i[0].items.length, a)]).reduce((e, t) => e.concat(t), []);
|
|
264
|
-
}, Z = (e, t, r, i, a) => {
|
|
265
|
-
let o = e.dimensions.filter(d), s = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE), c = o[0], l = [];
|
|
266
|
-
if (I(e)) for (let n = s.length - 1; n >= 0; n--) l.push(X(e, t, i, G.Foreground, n, a));
|
|
267
|
-
else if (c) l = [X(e, t, i, G.Background, void 0, a), X(e, t, i, G.Foreground, void 0, a)];
|
|
268
|
-
else for (let n = s.length - 1; n >= 0; n--) l.push(X(e, t, i, G.Background, n)), l.push(X(e, t, i, G.Foreground, n));
|
|
269
|
-
return l;
|
|
270
|
-
}, le = (e, t, r) => {
|
|
271
|
-
let i = e.dimensions.filter(d), a = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
|
|
272
|
-
if (!e.gaugeSettings?.barMode || !i.length && e.gaugeSettings?.comparisonMode) return r;
|
|
273
|
-
let o = [];
|
|
274
|
-
return i.length ? (e.gaugeSettings?.showDimensionLabels !== !1 && i[0] && o.push(Q(!1, t, i[0].formatter, "dimension", void 0, e.gaugeSettings)), !e.gaugeSettings?.comparisonMode && e.gaugeSettings?.showValueLabels !== !1 && a[0] && o.push(Q(!0, t, a[0].formatter, "value", void 0, e.gaugeSettings))) : e.gaugeSettings?.showValueLabels !== !1 && a.forEach((n, r) => {
|
|
275
|
-
o.push(Q(!0, t, n.formatter, String(r), r, e.gaugeSettings));
|
|
276
|
-
}), {
|
|
277
|
-
...r,
|
|
278
|
-
components: [...r.components, ...o]
|
|
279
|
-
};
|
|
280
|
-
}, Q = (e, t, n, r, i, a) => {
|
|
281
|
-
let s = +!!e, c = {
|
|
282
|
-
type: "bar",
|
|
283
|
-
settings: {
|
|
284
|
-
direction: a?.orientation === o.Vertical ? "up" : "right",
|
|
285
|
-
fontSize: A(a?.labelFontSize),
|
|
286
|
-
fontFamily: t.fonts.general.fontFamily,
|
|
287
|
-
labels: [{
|
|
288
|
-
label: (t) => t.data ? e ? ue(t.data.actual.value, n, t) : `${f(n, t.data?.label)}` : "",
|
|
289
|
-
placements: e ? [{
|
|
290
|
-
position: v.Outside,
|
|
291
|
-
fill: "#000",
|
|
292
|
-
justify: 0
|
|
293
|
-
}, {
|
|
294
|
-
position: v.Inside,
|
|
295
|
-
fill: "#fff",
|
|
296
|
-
justify: s
|
|
297
|
-
}] : [{
|
|
298
|
-
position: v.Inside,
|
|
299
|
-
fill: "#fff",
|
|
300
|
-
justify: s
|
|
301
|
-
}]
|
|
302
|
-
}]
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
return {
|
|
306
|
-
type: E.Labels,
|
|
307
|
-
key: `gauge-bar-labels-${r}`,
|
|
308
|
-
layout: { displayOrder: b.Labels },
|
|
309
|
-
settings: { sources: [{
|
|
310
|
-
component: K(E.Box, G.Foreground, i),
|
|
311
|
-
selector: O.Rect,
|
|
312
|
-
strategy: c
|
|
313
|
-
}] },
|
|
314
|
-
animations: {
|
|
315
|
-
enabled: !0,
|
|
316
|
-
presetId: "chart-labels"
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
}, ue = (e, t, n) => e === null ? "-" : typeof t != "string" && c(t) ? _(t.format, t)(e, void 0, n.data) : `${f(t, e)}`, de = (e, t, n, r) => D(e, t, n, r), fe = (e, t, r, i, a) => {
|
|
320
|
-
if (!a) return r;
|
|
321
|
-
let o = e.dimensions.filter(d), s = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE), c = o[0], l = F(e), u = I(e), f = l ? E.Box : E.Pie, p = l && !u ? G.Background : G.Foreground, m = ((l || !c ? s : a[0]?.items) || []).map((e, t) => K(f, p, t));
|
|
322
|
-
return ne(e, t, r, {
|
|
323
|
-
filter: (e) => e.filter((e) => m.findIndex((t) => t === e.key) !== -1),
|
|
324
|
-
placement: {
|
|
325
|
-
type: l ? "bounds" : "slice",
|
|
326
|
-
area: "target"
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
}, pe = class extends C {
|
|
330
|
-
constructor() {
|
|
331
|
-
super([
|
|
332
|
-
R,
|
|
333
|
-
L,
|
|
334
|
-
se,
|
|
335
|
-
le,
|
|
336
|
-
de,
|
|
337
|
-
fe
|
|
338
|
-
]);
|
|
339
|
-
}
|
|
340
|
-
preCompile(e) {
|
|
341
|
-
if (!(e.measures ?? []).filter(d).filter((e) => e.role === n.GAUGE_VALUE).length) throw Error("Charts w/o measures are not supported ATM.");
|
|
342
|
-
}
|
|
343
|
-
}, me = g(), $ = m(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
|
|
344
|
-
let a = p(), [o] = (0, N.useState)(() => new pe());
|
|
345
|
-
if (!e || !(l(e) || s(e)) || !r) return null;
|
|
346
|
-
let c = t || u, d = o.compile(e, c, n, r, i, e.type, a);
|
|
347
|
-
return d ? /* @__PURE__ */ (0, me.jsx)(re, {
|
|
348
|
-
config: i,
|
|
349
|
-
definition: d,
|
|
350
|
-
size: r,
|
|
351
|
-
vSpec: e
|
|
352
|
-
}) : null;
|
|
353
|
-
}), he = /* @__PURE__ */ t({ GaugeChart: () => $ });
|
|
354
|
-
export { $ as n, he as t };
|