@astrato-io/visualizations 0.10.0 → 0.11.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 +21 -1
- package/README.md +22 -4
- package/THIRD_PARTY_NOTICES.md +494 -0
- package/VISUALIZATION_DEFINITIONS.md +59 -145
- package/chunks/{Button-CCF851ea.js → Button-CPG4WX8X.js} +3 -3
- package/chunks/{CircularProgress-yupH6YWs.js → CircularProgress-PSLW8HmD.js} +12 -12
- package/chunks/FieldTypeIcon-5k2bkqd0.js +22 -0
- package/chunks/{LinearProgress-CyFjN4px.js → LinearProgress-KQ2EQlGL.js} +16 -16
- package/chunks/{MenuOption-CQpT79AP.js → MenuOption-B-6K7kks.js} +151 -151
- package/chunks/{Title-C-p4ZarD.js → Title-BmvwZYkh.js} +32 -32
- package/chunks/{_createAggregator-BF4qG9XK.js → _createAggregator-CFmH6gUN.js} +11 -11
- package/chunks/{app-filter-bar.compiler-8fxCo2q7.js → app-filter-bar.compiler-BY5-T16I.js} +8 -8
- package/chunks/{bar-layout-DStC-GNV.js → bar-layout-BNou0dZF.js} +2 -2
- package/chunks/{bar.compiler-CQAu8KL8.js → bar.compiler-BkhO7sDd.js} +55 -53
- package/chunks/{builder-CScg1TOS.js → builder-CNjuqD2z.js} +107 -56
- package/chunks/category-axis-D1OVyMrr.js +20 -0
- package/chunks/{coloring-9jU3s_-p.js → coloring-BOiP0rmn.js} +54 -54
- package/chunks/{createSimplePaletteValueFilter-C4hZpCdn.js → createSimplePaletteValueFilter-BkgQ7MFE.js} +166 -166
- package/chunks/defaults-B5_8S-J-.js +3 -0
- package/chunks/{definitions-C4grxhye.js → definitions-AS9GcavE.js} +263 -242
- package/chunks/{escobar-CjirINHP.js → escobar-cQ1eQ64G.js} +8528 -8461
- package/chunks/{extend-preset-D-l9u_we.js → extend-preset-BlCbcXKR.js} +421 -421
- package/chunks/{filter.compiler-lji2Acgn.js → filter.compiler-CI7dDNM1.js} +12 -12
- package/chunks/{filtering-C1zakrrX.js → filtering-Dwi7hDPZ.js} +263 -263
- package/chunks/handlers-C63NVo7i.js +15433 -0
- package/chunks/{icon-picker-styles-Bj80ZUBK.js → icon-picker-styles-CBlxEu3s.js} +8 -8
- package/chunks/{isEqual-Ch9OEye3.js → isEqual-BdHo6wqq.js} +1 -1
- package/chunks/{isFocusVisible-CgMP0qkR.js → isFocusVisible-C1nlVUwL.js} +9 -9
- package/chunks/line.compiler-DCv3h42f.js +198 -0
- package/chunks/linear-Bq_r9l5S.js +264 -0
- package/chunks/{logger-CKRjhSHQ.js → logger-Bc-DqDM_.js} +72 -72
- package/chunks/{lookup-BWllin0q.js → lookup-B3tWH2hX.js} +1 -0
- package/chunks/{map.compiler-CKzorLgK.js → map.compiler-CRO6XpdI.js} +43 -45
- package/chunks/measure-format-default-B6ghxih7.js +22 -0
- package/chunks/{metadata-Bb9pTXrq.js → metadata-CtkvZEhS.js} +1 -1
- package/chunks/number.compiler-kV4lobCZ.js +57 -0
- package/chunks/{operations-DZoY50VX.js → operations-COl9wgqi.js} +9893 -9831
- package/chunks/{range-D1BTmFMp.js → range-CMJ5yc5Z.js} +2 -2
- package/chunks/{react-dom-Dgv2azN2.js → react-dom-BjsCbYHq.js} +76 -76
- package/chunks/{render-wrappers-_P3xwu5A.js → render-wrappers-DFHi3Wkr.js} +1 -1
- package/chunks/{requirements-NHNrR8Ie.js → requirements-C5YLmHKe.js} +251 -227
- package/chunks/{shared-UitWpq1J.js → shared-DyqxOie0.js} +290 -278
- package/chunks/standalone-06i1wmIX.js +6 -0
- package/chunks/{standalone-DtBk_iUz.js → standalone-9jrQ3zJT.js} +10 -10
- package/chunks/standalone-B6zUvxNQ.js +357 -0
- package/chunks/{standalone-Bnnr87pc.js → standalone-BYK2U0Vd.js} +418 -679
- package/chunks/standalone-Be5APcVv.js +762 -0
- package/chunks/standalone-Bp4G3MDx.js +396 -0
- package/chunks/{standalone-CbPk8bKn.js → standalone-BrjtMIdd.js} +132 -132
- package/chunks/{standalone-BOzHA_d4.js → standalone-Bsfz5vnJ.js} +57 -57
- package/chunks/standalone-BuXpKMnc.js +2 -0
- package/chunks/standalone-CIjNYyya.js +8378 -0
- package/chunks/{standalone-B0U6c3su.js → standalone-CS5VGoja.js} +358 -358
- package/chunks/standalone-CUGt2FUF.js +2 -0
- package/chunks/{standalone-BapqaniK.js → standalone-ChfEHb28.js} +2299 -1072
- package/chunks/standalone-CnF2OYLQ.js +355 -0
- package/chunks/standalone-CznEEiq3.js +422 -0
- package/chunks/{standalone-Ck63MZzj.js → standalone-D9k5SCd8.js} +165 -165
- package/chunks/{standalone-CRdDZYeM.js → standalone-DYVYccmY.js} +855 -855
- package/chunks/{standalone-CVknVdUC.js → standalone-DaNxWIKn.js} +27 -27
- package/chunks/{standalone-swGs70tD.js → standalone-Db_HNuWx.js} +50 -50
- package/chunks/standalone-DcuE8KBa.js +287 -0
- package/chunks/{standalone-U0WJwFlG.js → standalone-I5kRIsp8.js} +97 -97
- package/chunks/{standalone-BBu90BhK.js → standalone-K2OvRAQM.js} +125 -125
- package/chunks/{standalone-DCFY1MAV.js → standalone-c4CPN6ug.js} +4634 -4633
- package/chunks/{standalone-ByKKqT5L.js → standalone-iOnJhCvA.js} +302 -302
- package/chunks/standalone-pCrzBiTy.js +773 -0
- package/chunks/standalone-qrZaimgC.js +689 -0
- package/chunks/standalone-yqDJ8h3K.js +1012 -0
- package/chunks/{table.compiler-OWSx5MOq.js → table.compiler-CMH_dtYs.js} +29 -29
- package/chunks/{useFieldName-B8iCYyw1.js → useFieldName-BfxBzhhH.js} +1 -1
- package/chunks/{utils-3Igg6xmO.js → utils-BdJrEeIQ.js} +4037 -4015
- package/chunks/{view-DdMLZySj.js → view-Q-_XIrWE.js} +1615 -1615
- package/chunks/{visualization-filters-CzvFHE6M.js → visualization-filters-BwS0xUqs.js} +1723 -1693
- package/chunks/{with-html-element-DOfkR3C1.js → with-html-element-D_ooGNWI.js} +4006 -3994
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +30 -1
- package/docs/operations/combo.md +30 -1
- package/docs/operations/date-picker.md +1 -1
- package/docs/operations/distribution-gauge.md +1 -1
- package/docs/operations/dot.md +1 -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 +1 -1
- package/docs/operations/iframe.md +1 -1
- package/docs/operations/image.md +1 -1
- package/docs/operations/index.md +5 -4
- package/docs/operations/line.md +48 -1
- package/docs/operations/map.md +5274 -0
- 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 +1 -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 +1 -1
- 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 +3 -3
- package/index.js +528 -504
- package/metadata.js +2 -2
- package/operations.js +6 -6
- package/package.json +73 -68
- package/src/definitions/index.d.ts +1 -1
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +34 -53
- package/src/definitions/model/definitions/schema-registry.d.ts +2 -2
- package/src/definitions/model/definitions/schemas/bar.schema.d.ts +1 -1
- package/src/definitions/model/definitions/schemas/broad-chart.schema.d.ts +2 -2
- package/src/definitions/model/definitions/schemas/common.schema.d.ts +14 -2
- package/src/definitions/model/definitions/schemas/index.d.ts +1 -1
- package/src/definitions/model/definitions/schemas/line.schema.d.ts +1 -1
- package/src/definitions/model/definitions/types/compilation.types.d.ts +4 -1
- package/src/types.d.ts +28 -28
- package/src/visualization-catalog.d.ts +3 -0
- package/styles.css +1 -1
- package/chunks/FieldTypeIcon-D_MzsdfY.js +0 -22
- package/chunks/defaults-cyNhn37t.js +0 -3
- package/chunks/handlers-ZviIUC-j.js +0 -15387
- package/chunks/line.compiler-De5fiKuR.js +0 -198
- package/chunks/number.compiler-CaTmJkmi.js +0 -53
- package/chunks/standalone-BEekPuA12.js +0 -357
- package/chunks/standalone-BR2JuRIC.js +0 -422
- package/chunks/standalone-BwJqDj2Z.js +0 -396
- package/chunks/standalone-CRfDOO1x.js +0 -287
- package/chunks/standalone-DZDGX3aa.js +0 -518
- package/chunks/standalone-DhfgeJIk.js +0 -1012
- package/chunks/standalone-DibjA73M.js +0 -6
- package/chunks/standalone-DxBAyqAu.js +0 -772
- package/chunks/standalone-KMQPsNsq.js +0 -2
- package/chunks/standalone-MBLSvsrY.js +0 -2
- package/chunks/standalone-wgFAVnnm.js +0 -355
- package/chunks/standalone-xGV0dqPV.js +0 -689
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import { o as e, r as t } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import { Da as n, Gs as r, Io as i, Js as a, Pc as o, Qr as s, Ra as c, Za as l, oa as u, vc as d } from "./visualization-filters-CzvFHE6M.js";
|
|
3
|
-
import { Ht as f, N as p, Ut as m, ci as h, jt as g, zr as _ } from "./utils-3Igg6xmO.js";
|
|
4
|
-
import { h_ as v } from "./handlers-ZviIUC-j.js";
|
|
5
|
-
import { n as y } from "./label-format-type-C46pzgx7.js";
|
|
6
|
-
import "./logger-CKRjhSHQ.js";
|
|
7
|
-
import { At as b, Dt as x, I as S, L as C, Ot as ee, Vt as te, Xt as w, Z as T, fn as E, i as ne, in as re, mn as D, tt as ie, un as O, vn as k, xt as A } from "./escobar-CjirINHP.js";
|
|
8
|
-
import { t as j } from "./coloring-9jU3s_-p.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 === d.Categorical || t?.type === d.Single ? ee(e, []) ?? "" : b(e) ?? "";
|
|
26
|
-
}, L = (e, t, n) => {
|
|
27
|
-
let r = { ...x(M(e, ae(e) ?? ""), t, {}) }, a = e.gaugeSettings?.barPadding ?? D.scale.padding;
|
|
28
|
-
r = T(e, r, a);
|
|
29
|
-
let l = e.dimensions.filter(s), u = e.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE);
|
|
30
|
-
return !l.length && F(e) ? r.onlyMeasures = {
|
|
31
|
-
data: I(e) ? { extract: { field: u[0] ? o(u[0].dataItem) : "" } } : u.map((e) => o(e.dataItem)),
|
|
32
|
-
type: E.Band,
|
|
33
|
-
padding: a
|
|
34
|
-
} : I(e) || (r.onlyMeasures = {
|
|
35
|
-
data: { fields: u.map((e) => o(e.dataItem)) },
|
|
36
|
-
include: [0],
|
|
37
|
-
expand: .05
|
|
38
|
-
}), F(e) && (r.barScale = {
|
|
39
|
-
min: P.minScaleValue - P.scalePadding,
|
|
40
|
-
max: P.maxScaleValue + P.scalePadding,
|
|
41
|
-
invert: e.gaugeSettings?.orientation === i.Vertical
|
|
42
|
-
}), {
|
|
43
|
-
...n,
|
|
44
|
-
scales: r
|
|
45
|
-
};
|
|
46
|
-
}, R = (e, t, n, r, i) => {
|
|
47
|
-
if (!i) return n;
|
|
48
|
-
let a = e.dimensions.filter(s), l = e.measures.filter(s), u = C((e.supportingMeasures ?? []).filter(s)), d = l.filter((e) => e.role === c.GAUGE_VALUE), f = a[0], p = d[0], { targetType: m } = e.gaugeSettings ?? {}, h = F(e), g = f?.dataItem ?? p?.dataItem;
|
|
49
|
-
if (!g) return n;
|
|
50
|
-
let _ = [], v = P.minScaleValue;
|
|
51
|
-
if (I(e) ? _.push(...B(e, g, i, u)) : f ? _.push(...z(e, g, i, u)) : _.push(...V(e, i, u)), h) {
|
|
52
|
-
let t = o(p.dataItem), n = {
|
|
53
|
-
field: o(g),
|
|
54
|
-
props: {
|
|
55
|
-
actual: { field: t },
|
|
56
|
-
color: t,
|
|
57
|
-
start: v,
|
|
58
|
-
end: P.maxScaleValue,
|
|
59
|
-
background: !0,
|
|
60
|
-
...u
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
(m === y.Data || m === y.Manual) && (n.props ??= {}, n.props.target = W(e, i)), l.forEach((e) => {
|
|
64
|
-
n.props ??= {};
|
|
65
|
-
let t = `measure-${o(e.dataItem)}`;
|
|
66
|
-
n.props[t] = { field: o(e.dataItem) };
|
|
67
|
-
}), _.push(n);
|
|
68
|
-
}
|
|
69
|
-
let b = [{
|
|
70
|
-
key: P.gaugeCollectionKey,
|
|
71
|
-
data: { extract: _ }
|
|
72
|
-
}];
|
|
73
|
-
return {
|
|
74
|
-
...n,
|
|
75
|
-
collections: b
|
|
76
|
-
};
|
|
77
|
-
}, z = (e, t, n, r) => {
|
|
78
|
-
let i = e.measures.filter(s), a = i.filter((e) => e.role === c.GAUGE_VALUE), l = i.filter((e) => e.role === c.GAUGE_TARGET), u = a[0], d = l[0], { targetType: f } = e.gaugeSettings, p = F(e), m = [], h = o(u.dataItem);
|
|
79
|
-
return p || m.push({
|
|
80
|
-
field: o(t),
|
|
81
|
-
props: {
|
|
82
|
-
actual: { field: h },
|
|
83
|
-
[h]: { field: h },
|
|
84
|
-
color: h,
|
|
85
|
-
...r
|
|
86
|
-
}
|
|
87
|
-
}), m.push({
|
|
88
|
-
field: o(t),
|
|
89
|
-
props: {
|
|
90
|
-
actual: { field: h },
|
|
91
|
-
start: p ? P.minScaleValue : void 0,
|
|
92
|
-
end: p ? { getValue: H(e, n) } : void 0,
|
|
93
|
-
[h]: { field: h },
|
|
94
|
-
color: h,
|
|
95
|
-
...r
|
|
96
|
-
}
|
|
97
|
-
}), (f === y.Data || f === y.Manual) && m.forEach((t) => {
|
|
98
|
-
t.props ??= {}, t.props.target = W(e, n), d && f === y.Data && (t.props[o(d.dataItem)] = { field: o(d.dataItem) });
|
|
99
|
-
}), m;
|
|
100
|
-
}, B = (e, t, n, r) => {
|
|
101
|
-
let i = F(e), a = e.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE), l = a.reduce((e, t) => {
|
|
102
|
-
let n = o(t.dataItem);
|
|
103
|
-
return e[n] = { field: n }, e;
|
|
104
|
-
}, {});
|
|
105
|
-
return a.map((a, s) => {
|
|
106
|
-
let c = o(a.dataItem);
|
|
107
|
-
return {
|
|
108
|
-
field: o(t),
|
|
109
|
-
props: {
|
|
110
|
-
measure: { field: c },
|
|
111
|
-
color: c,
|
|
112
|
-
start: i ? P.minScaleValue : void 0,
|
|
113
|
-
end: i ? { getValue: H(e, n, s) } : void 0,
|
|
114
|
-
...l,
|
|
115
|
-
...r
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
});
|
|
119
|
-
}, V = (e, t, n) => {
|
|
120
|
-
let r = F(e), i = [];
|
|
121
|
-
return e.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE).forEach((a) => {
|
|
122
|
-
let s = o(a.dataItem), c = t[0].items[0][s], l = W(e, t, a), 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: r ? P.minScaleValue : void 0,
|
|
131
|
-
end: r && typeof c == "number" && typeof l == "number" ? U(c, l) : void 0,
|
|
132
|
-
[s]: { field: s },
|
|
133
|
-
...n
|
|
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: r ? P.minScaleValue : void 0,
|
|
143
|
-
end: r ? P.maxScaleValue : void 0,
|
|
144
|
-
background: !0,
|
|
145
|
-
[s]: { field: s },
|
|
146
|
-
...n
|
|
147
|
-
}
|
|
148
|
-
}), (e.gaugeSettings?.targetType ?? y.Auto) !== y.Auto && u.forEach((e) => {
|
|
149
|
-
e.props ??= {}, e.props.target = l;
|
|
150
|
-
}), i.push(...u);
|
|
151
|
-
}), i;
|
|
152
|
-
}, H = (e, t, n) => {
|
|
153
|
-
let r = e.measures.filter(s), i = r.filter((e) => e.role === c.GAUGE_VALUE), a = r.filter((e) => e.role === c.GAUGE_TARGET), l = i[0], u = a[0];
|
|
154
|
-
return (r, a, s) => {
|
|
155
|
-
if (!s) return P.minScaleValue;
|
|
156
|
-
let c = i.find((e, t) => t === n), d = c && s[o(c.dataItem)];
|
|
157
|
-
if (typeof d == "number" && d < 0) return P.minScaleValue;
|
|
158
|
-
let f = s[o(l.dataItem)], p;
|
|
159
|
-
if (p = e.gaugeSettings?.targetType === y.Data ? s[o(u?.dataItem)] : W(e, t), typeof f != "number" || typeof p != "number") return P.minScaleValue;
|
|
160
|
-
if (!I(e) || n === void 0) return U(f, p);
|
|
161
|
-
let m = 0, h = 0;
|
|
162
|
-
return i.forEach((e, t) => {
|
|
163
|
-
let r = Math.max(0, s[o(e.dataItem)]);
|
|
164
|
-
m += r, t <= n && (h += r);
|
|
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, n) => {
|
|
171
|
-
let { targetType: r, targetValue: i } = e.gaugeSettings, a = e.measures.filter(s), l = a.filter((e) => e.role === c.GAUGE_TARGET)[0];
|
|
172
|
-
return r === y.Auto ? t[0].items.map((e) => a.map((t) => e[o(t.dataItem)])).reduce((e, t) => Math.max(...t, e), 0) * (1 + D.scale.padding) : l && r === y.Data ? { field: o(l.dataItem) } : n && r === y.PerMeasure ? n.targetValue ?? 0 : r === y.Manual ? i ?? 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, n) => {
|
|
177
|
-
let r = e.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE);
|
|
178
|
-
return (e) => n !== void 0 && e.measure?.source?.field !== o(r[n]?.dataItem) ? !1 : e.background?.value ? t === G.Background : t === G.Foreground;
|
|
179
|
-
}, J = (e, t) => !t || e.coloring?.type === d.Single ? !1 : !I(e) || e.coloring?.type === d.Categorical, Y = (e, t, n, r, i, a, l, u) => {
|
|
180
|
-
let d = n.dimensions.filter(s)[0], f = new j(n, r, t?.[0]?.itemsNotAffectedByFiltering), p = f.getColorDefinition(J(n, d) ? { ref: f.MAIN_FIELD } : {}), m = (e, t = 0) => !I(n) && t === 1 || a && I(n) ? "transparent" : typeof p == "function" ? p(e) : p, h = q(l), g = Number(n.gaugeSettings?.size), _ = Number(n.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(k.Pie, a ? G.Background : G.Foreground, i),
|
|
183
|
-
type: k.Pie,
|
|
184
|
-
animations: {
|
|
185
|
-
enabled: !0,
|
|
186
|
-
presetId: "pie-chart"
|
|
187
|
-
},
|
|
188
|
-
data: {
|
|
189
|
-
collection: P.gaugeCollectionKey,
|
|
190
|
-
filter: (t) => {
|
|
191
|
-
if (!d) {
|
|
192
|
-
let e = n.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE);
|
|
193
|
-
return I(n) || e[i] && t.measure?.source?.field === o(e[i].dataItem);
|
|
194
|
-
}
|
|
195
|
-
return `${t.value}` == `${e[o(d.dataItem)]}`;
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
settings: {
|
|
199
|
-
startAngle: S,
|
|
200
|
-
endAngle: C,
|
|
201
|
-
slice: {
|
|
202
|
-
cornerRadius: n.gaugeSettings?.cornerRadius ?? 10,
|
|
203
|
-
outerRadius: P.outerRadius - i * h,
|
|
204
|
-
innerRadius: P.outerRadius - (i + (1 - P.barWidthRadiusPadding)) * h,
|
|
205
|
-
fill: m,
|
|
206
|
-
strokeWidth: .1,
|
|
207
|
-
opacity: a ? P.backgroundBarOpacity : 1,
|
|
208
|
-
arc: (e, t = 0) => {
|
|
209
|
-
if (a) return +(t === 0);
|
|
210
|
-
if (I(n)) return e.datum.measure.value;
|
|
211
|
-
if ((n.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([""], u, { overwriteOpacity: a ? P.backgroundBarOpacity : void 0 })
|
|
220
|
-
};
|
|
221
|
-
}, X = (e, t, r, a, c, l) => {
|
|
222
|
-
let u = e.dimensions.filter(s)[0], d = new j(e, t, r?.[0]?.itemsNotAffectedByFiltering), f;
|
|
223
|
-
f = a === G.Background && e.gaugeSettings?.backgroundBarColor ? e.gaugeSettings?.backgroundBarColor : d.getColorDefinition(J(e, u) ? { ref: d.MAIN_FIELD } : {}, !e.gaugeSettings?.backgroundBarColor && a === G.Background ? P.backgroundBarOpacity : void 0);
|
|
224
|
-
let p = u ? o(u.dataItem) : "onlyMeasures", m = !u && !I(e) ? "measureValue" : void 0, h = {
|
|
225
|
-
key: K(k.Box, a, c),
|
|
226
|
-
type: k.Box,
|
|
227
|
-
animations: { enabled: !0 },
|
|
228
|
-
data: {
|
|
229
|
-
collection: P.gaugeCollectionKey,
|
|
230
|
-
filter: oe(e, a, 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: a === 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 = n.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 === c.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 === c.GAUGE_VALUE), l = a[0], u = [];
|
|
267
|
-
if (I(e)) for (let n = o.length - 1; n >= 0; n--) u.push(X(e, t, r, G.Foreground, n, i));
|
|
268
|
-
else if (l) u = [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--) u.push(X(e, t, r, G.Background, n)), u.push(X(e, t, r, G.Foreground, n));
|
|
270
|
-
return u;
|
|
271
|
-
}, le = (e, t, n) => {
|
|
272
|
-
let r = e.dimensions.filter(s), i = e.measures.filter(s).filter((e) => e.role === c.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: re(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: k.Labels,
|
|
308
|
-
key: `gauge-bar-labels-${r}`,
|
|
309
|
-
layout: { displayOrder: te.Labels },
|
|
310
|
-
settings: { sources: [{
|
|
311
|
-
component: K(k.Box, G.Foreground, a),
|
|
312
|
-
selector: O.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" && l(t) ? f(t.format, t)(e, void 0, n.data) : `${m(t, e)}`, de = (e, t, n, r) => A(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 === c.GAUGE_VALUE), l = a[0], u = F(e), d = I(e), f = u ? k.Box : k.Pie, p = u && !d ? G.Background : G.Foreground, m = ((u || !l ? o : i[0]?.items) || []).map((e, t) => K(f, p, t));
|
|
323
|
-
return ie(e, t, n, {
|
|
324
|
-
filter: (e) => e.filter((e) => m.findIndex((t) => t === e.key) !== -1),
|
|
325
|
-
placement: {
|
|
326
|
-
type: u ? "bounds" : "slice",
|
|
327
|
-
area: "target"
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
}, pe = class extends S {
|
|
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 === c.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: o }) => {
|
|
345
|
-
let s = p(), [c] = (0, N.useState)(() => new pe());
|
|
346
|
-
if (!e || !(a(e) || r(e)) || !i) return null;
|
|
347
|
-
let l = t || u, d = c.compile(e, l, n, i, o, e.type, s);
|
|
348
|
-
return d ? /* @__PURE__ */ (0, me.jsx)(ne, {
|
|
349
|
-
config: o,
|
|
350
|
-
definition: d,
|
|
351
|
-
size: i,
|
|
352
|
-
vSpec: e
|
|
353
|
-
}) : null;
|
|
354
|
-
}), he = /* @__PURE__ */ t({ GaugeChart: () => $ });
|
|
355
|
-
export { $ as n, he as t };
|