@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,773 @@
|
|
|
1
|
+
import "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
+
import { Gs as e, Ns as t, Sa as n, Ua as r, Xc as i, Yc as a, _i as o, _n as s, di as c, gr as l, hl as u, hs as d, ms as f, tn as p, u as m } from "./visualization-filters-B9qik5_K.js";
|
|
3
|
+
import { I as h, Mt as g, P as ee, Ur as _, fi as v, s as te, tn as y } from "./utils-CUKgR7it.js";
|
|
4
|
+
import { x_ as b } from "./handlers-CyYFSfhM.js";
|
|
5
|
+
import { t as x } from "./stroke-dash-UgMEcCS4.js";
|
|
6
|
+
import "./logger-Cioob-QV.js";
|
|
7
|
+
import { r as ne } from "./extend-preset-BpXttHFk.js";
|
|
8
|
+
import { En as re, F as ie, Mn as S, Mt as C, Ot as w, P as ae, R as T, Xt as E, Yt as oe, _ as D, _n as O, _t as k, an as se, en as A, gn as j, hn as ce, i as le, in as ue, k as de, mn as fe, n as pe, on as me, un as he, v as ge, vn as M, wn as _e, y as ve } from "./escobar-CMvphKSK.js";
|
|
9
|
+
import { p as ye } from "./with-html-element-1GSeLT59.js";
|
|
10
|
+
import "./builder-7w_bgV_h.js";
|
|
11
|
+
v();
|
|
12
|
+
function N(e) {
|
|
13
|
+
let { measureProps: t, index: n, items: r, vSpec: i, vTheme: a } = e, { positive: o, negative: s } = be(t, i, a), c;
|
|
14
|
+
return c = n === 0 ? r[0] > 0 ? o : s : r[n] > r[n - 1] ? o : s, c;
|
|
15
|
+
}
|
|
16
|
+
var P = (e, t) => {
|
|
17
|
+
let n = m(t).status;
|
|
18
|
+
return {
|
|
19
|
+
positive: e.colors.positive ?? n.positive,
|
|
20
|
+
negative: e.colors.negative ?? n.negative,
|
|
21
|
+
subTotal: e.colors.subTotal ?? n.total
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
function be(e, t, n) {
|
|
25
|
+
let r = P(t, n);
|
|
26
|
+
if (!e?.customColorEnabled) return F({ ...r }, t);
|
|
27
|
+
let { customColor: i } = e;
|
|
28
|
+
return F({
|
|
29
|
+
positive: i.positive ?? r.positive,
|
|
30
|
+
negative: i.negative ?? r.negative,
|
|
31
|
+
subTotal: i.subTotal ?? r.subTotal
|
|
32
|
+
}, t);
|
|
33
|
+
}
|
|
34
|
+
function xe(e, t, n) {
|
|
35
|
+
let r = e.measureProps[t];
|
|
36
|
+
return r?.customColorEnabled && r?.customColor.subTotal ? r?.customColor.subTotal : P(e, n).subTotal;
|
|
37
|
+
}
|
|
38
|
+
function F(e, t) {
|
|
39
|
+
return t.barSettings.translucentBars ? {
|
|
40
|
+
positive: I(e.positive, t),
|
|
41
|
+
negative: I(e.negative, t),
|
|
42
|
+
subTotal: I(e.subTotal, t)
|
|
43
|
+
} : e;
|
|
44
|
+
}
|
|
45
|
+
var Se = .65, Ce = 1;
|
|
46
|
+
function I(e, t) {
|
|
47
|
+
return (n) => {
|
|
48
|
+
if (typeof n.datum.end.value != "number" || typeof n.datum.start.value != "number") return null;
|
|
49
|
+
let r = n.datum.end.value - n.datum.start.value;
|
|
50
|
+
n.datum.reverted.value && (r *= -1);
|
|
51
|
+
let i = [{
|
|
52
|
+
color: e,
|
|
53
|
+
opacity: Ce,
|
|
54
|
+
offset: +(r < 0)
|
|
55
|
+
}, {
|
|
56
|
+
color: e,
|
|
57
|
+
opacity: Se,
|
|
58
|
+
offset: r < 0 ? 0 : 1
|
|
59
|
+
}];
|
|
60
|
+
return r < 0 && i.reverse(), {
|
|
61
|
+
type: "gradient",
|
|
62
|
+
degree: O(t) ? 0 : 90,
|
|
63
|
+
stops: i
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
var we = (e, t) => t || e.colors.brandColors[0], Te = "subTotal-measure", L = (e) => `${Te}-${e}`, R = "total-measure", Ee = (e) => `${i.Waterfall}.subTotal.${e}`, z = `${i.Waterfall}.total`;
|
|
68
|
+
function B(e) {
|
|
69
|
+
return ({ data: t, formatter: n }) => {
|
|
70
|
+
let r = t?.end.value - t?.start.value;
|
|
71
|
+
return t?.reverted?.value && (r *= -1), e.formatter && r && n ? n(e.formatter)(`${r}`) : `${r}`;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
var V = "waterfall-chart", H = {
|
|
75
|
+
scale: "onlyMeasures",
|
|
76
|
+
ref: "series"
|
|
77
|
+
};
|
|
78
|
+
function U(e) {
|
|
79
|
+
return {
|
|
80
|
+
collection: "collection-no-dimension",
|
|
81
|
+
filter: (t) => t?.source?.field === e
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function De(e, t, n) {
|
|
85
|
+
let r = U(L(n)), i = {
|
|
86
|
+
scale: e.orientation === d.Horizontal ? M.XAxisScale : M.YAxisScale,
|
|
87
|
+
ref: "end"
|
|
88
|
+
}, a = xe(e, n, t);
|
|
89
|
+
return {
|
|
90
|
+
type: S.Box,
|
|
91
|
+
layout: { displayOrder: A.VisualizationElement },
|
|
92
|
+
key: Ee(n),
|
|
93
|
+
data: r,
|
|
94
|
+
settings: W(e, t, H, i, a),
|
|
95
|
+
animations: {
|
|
96
|
+
enabled: !0,
|
|
97
|
+
presetId: V
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function Oe(e, t) {
|
|
102
|
+
let n = U(R), r = {
|
|
103
|
+
scale: e.orientation === d.Horizontal ? M.XAxisScale : M.YAxisScale,
|
|
104
|
+
ref: "end"
|
|
105
|
+
}, i = e.total.color;
|
|
106
|
+
return {
|
|
107
|
+
type: S.Box,
|
|
108
|
+
layout: { displayOrder: A.VisualizationElement },
|
|
109
|
+
key: z,
|
|
110
|
+
data: n,
|
|
111
|
+
settings: W(e, t, H, r, i),
|
|
112
|
+
animations: {
|
|
113
|
+
enabled: !0,
|
|
114
|
+
presetId: V
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
var ke = (e, t, n, r) => ({
|
|
119
|
+
type: S.Box,
|
|
120
|
+
layout: { displayOrder: A.VisualizationElement },
|
|
121
|
+
key: w(e, t, i.Waterfall),
|
|
122
|
+
data: r,
|
|
123
|
+
settings: n,
|
|
124
|
+
animations: {
|
|
125
|
+
enabled: !0,
|
|
126
|
+
presetId: V
|
|
127
|
+
}
|
|
128
|
+
}), W = (e, t, n, i, a) => {
|
|
129
|
+
let o = {
|
|
130
|
+
orientation: e.orientation ?? d.Vertical,
|
|
131
|
+
major: n,
|
|
132
|
+
minor: i,
|
|
133
|
+
box: {
|
|
134
|
+
minWidthPx: 2,
|
|
135
|
+
ref: "",
|
|
136
|
+
rx: p(e.barSettings.barRadius, 0),
|
|
137
|
+
fill: a,
|
|
138
|
+
stacked: !1,
|
|
139
|
+
grouped: !1,
|
|
140
|
+
boxPadding: e.barSettings.barPadding ?? 0,
|
|
141
|
+
groupPadding: 0,
|
|
142
|
+
itemsInStackCount: 0,
|
|
143
|
+
roundAllEdges: e.barSettings.roundAllEdges ?? !1,
|
|
144
|
+
useCustomBoxRounding: e.barSettings.useCustomBoxRounding ?? !1,
|
|
145
|
+
ignoreOutOfBounds: e.barSettings.ignoreOutOfBounds ?? !1
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
return e.barSettings?.strokeEnabled ? (o.box.stroke = we(t, e.barSettings?.strokeColor ?? ""), o.box.strokeWidth = e.barSettings?.strokeWidth) : o.box.stroke = r.transparent, o;
|
|
149
|
+
}, Ae = "collection-no-dimension", je = "onlyMeasures";
|
|
150
|
+
b.Inside, b.Outside, b.Opposite;
|
|
151
|
+
function G(e, t) {
|
|
152
|
+
let n = e.measures.filter((e) => c(e));
|
|
153
|
+
return n.filter((r, i) => {
|
|
154
|
+
let a = u(r.dataItem), o = t[0].items[0][a], s = e.measureProps[a];
|
|
155
|
+
if (i === 0) return !!o || !s?.hideIfEmpty;
|
|
156
|
+
let c = u(n[i - 1].dataItem);
|
|
157
|
+
return o !== t[0].items[0][c] || !s?.hideIfEmpty;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
var Me = (e, t, n, r, i, a, o, s) => {
|
|
161
|
+
n = ue(e, t, n, r, i, a, o, s);
|
|
162
|
+
let u = [], d = [];
|
|
163
|
+
if ("axes" in e) {
|
|
164
|
+
let n = e.axes?.dimension || {};
|
|
165
|
+
if (!n.disabled) {
|
|
166
|
+
let r = O(e) ? f.Left : f.Bottom;
|
|
167
|
+
if (u.push(se(je, n, {
|
|
168
|
+
...t.axis.measure,
|
|
169
|
+
...t.fonts,
|
|
170
|
+
chart: m(t)
|
|
171
|
+
}, r)), n.showAxisName) {
|
|
172
|
+
let i = e.measures.filter((e) => c(e)), o = i.length ? i : e.measures;
|
|
173
|
+
if (o.length) {
|
|
174
|
+
let i = l(e.measures, !!e.enableAlternate, a?.isPrintMode);
|
|
175
|
+
d.push(me(o, i, r, {
|
|
176
|
+
...t.axis.measure,
|
|
177
|
+
...t.fonts,
|
|
178
|
+
chart: m(t)
|
|
179
|
+
}, void 0, n.axisTitle ?? "Measures", n.titleFontSize, "waterfall-measures-axis-label"));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
...n,
|
|
186
|
+
components: [
|
|
187
|
+
...n.components,
|
|
188
|
+
...u,
|
|
189
|
+
...d
|
|
190
|
+
]
|
|
191
|
+
};
|
|
192
|
+
}, Ne = (t, n, r, i, a) => {
|
|
193
|
+
if (!a) return r;
|
|
194
|
+
let o = de(t, {});
|
|
195
|
+
(t.axes?.primaryMeasure?.axisRange?.axisRangeOption ?? e.Auto) === e.Auto && (O(t) ? o[M.XAxisScale].expand = .3 : o[M.YAxisScale].expand = .3);
|
|
196
|
+
let c = [];
|
|
197
|
+
return G(t, a).forEach((e, n) => {
|
|
198
|
+
let r = u(e.dataItem), i = s(e);
|
|
199
|
+
c.push({
|
|
200
|
+
value: r,
|
|
201
|
+
label: i || e.label || e.dataItem.name
|
|
202
|
+
});
|
|
203
|
+
let a = t.measureProps[r];
|
|
204
|
+
a?.subTotalEnabled && c.push({
|
|
205
|
+
value: L(n),
|
|
206
|
+
label: a?.subTotalLabel || "Sub-Total"
|
|
207
|
+
});
|
|
208
|
+
}), t.total.enabled && c.push({
|
|
209
|
+
value: R,
|
|
210
|
+
label: t.total.label || "Total"
|
|
211
|
+
}), o.onlyMeasures = {
|
|
212
|
+
data: { items: c },
|
|
213
|
+
padding: t.barSettings.barPadding ?? 0,
|
|
214
|
+
type: re.Band,
|
|
215
|
+
value: (e) => `${e.datum.value.value}`,
|
|
216
|
+
label: (e) => `${e.datum.value.label}`
|
|
217
|
+
}, {
|
|
218
|
+
...r,
|
|
219
|
+
scales: o
|
|
220
|
+
};
|
|
221
|
+
}, K = "measures", Pe = (e, t, n, r, i) => {
|
|
222
|
+
if (!i) return n;
|
|
223
|
+
let a = [], o, s = G(e, i), l = ge((e.supportingMeasures ?? []).filter((e) => c(e)));
|
|
224
|
+
if (s.forEach((t, n) => {
|
|
225
|
+
let r = u(t.dataItem), i, c;
|
|
226
|
+
if (n === 0) i = 0, c = { field: r }, o = "end";
|
|
227
|
+
else if (o === "start") i = { field: u(s[n - 1].dataItem) }, c = { field: r }, o = "end";
|
|
228
|
+
else {
|
|
229
|
+
let e = u(s[n - 1].dataItem);
|
|
230
|
+
i = { field: r }, c = { field: e }, o = "start";
|
|
231
|
+
}
|
|
232
|
+
a.push({
|
|
233
|
+
field: r,
|
|
234
|
+
props: {
|
|
235
|
+
stackKey: K,
|
|
236
|
+
[r]: { field: r },
|
|
237
|
+
...l,
|
|
238
|
+
series: r,
|
|
239
|
+
start: i,
|
|
240
|
+
color: r,
|
|
241
|
+
end: c,
|
|
242
|
+
secondaryAxis: t.secondaryAxis,
|
|
243
|
+
isMultipleMeasures: !0,
|
|
244
|
+
subTotal: !1,
|
|
245
|
+
reverted: o === "start"
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
let d = e.measureProps[r];
|
|
249
|
+
if (d?.subTotalEnabled) {
|
|
250
|
+
let e = L(n), t, i;
|
|
251
|
+
o === "end" ? (t = 0, i = { field: r }) : (t = { field: r }, i = 0), a.push({
|
|
252
|
+
field: e,
|
|
253
|
+
props: {
|
|
254
|
+
stackKey: K,
|
|
255
|
+
...l,
|
|
256
|
+
series: e,
|
|
257
|
+
start: t,
|
|
258
|
+
color: e,
|
|
259
|
+
end: i,
|
|
260
|
+
secondaryAxis: !1,
|
|
261
|
+
isMultipleMeasures: !0,
|
|
262
|
+
label: d?.subTotalLabel || "Sub-Total",
|
|
263
|
+
subTotal: !0,
|
|
264
|
+
reverted: o === "start"
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}), e.total.enabled) {
|
|
269
|
+
let t = u(s[s.length - 1].dataItem), n, r;
|
|
270
|
+
o === "end" ? (n = 0, r = { field: t }) : (n = { field: t }, r = 0), a.push({
|
|
271
|
+
field: R,
|
|
272
|
+
props: {
|
|
273
|
+
stackKey: K,
|
|
274
|
+
...l,
|
|
275
|
+
series: R,
|
|
276
|
+
start: n,
|
|
277
|
+
color: R,
|
|
278
|
+
end: r,
|
|
279
|
+
secondaryAxis: !1,
|
|
280
|
+
isMultipleMeasures: !0,
|
|
281
|
+
label: e.total.label || "Total",
|
|
282
|
+
subTotal: !0,
|
|
283
|
+
reverted: o === "start"
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
let d = {
|
|
288
|
+
key: Ae,
|
|
289
|
+
data: { extract: a }
|
|
290
|
+
};
|
|
291
|
+
return {
|
|
292
|
+
...n,
|
|
293
|
+
collections: [d]
|
|
294
|
+
};
|
|
295
|
+
}, Fe = (e, t, n, r, i) => {
|
|
296
|
+
if (!i) return n;
|
|
297
|
+
let a = Object.values(i[0].items[0]), o = G(e, i).reduce((n, r, i) => {
|
|
298
|
+
let o = u(r.dataItem), s = U(o), c = {
|
|
299
|
+
scale: j(e, r),
|
|
300
|
+
ref: "end"
|
|
301
|
+
}, l = N({
|
|
302
|
+
measureProps: e.measureProps[o],
|
|
303
|
+
index: i,
|
|
304
|
+
items: a,
|
|
305
|
+
vSpec: e,
|
|
306
|
+
vTheme: t
|
|
307
|
+
}), d = [...n], f = W(e, t, H, c, l);
|
|
308
|
+
return d.push(ke(e, r, f, s)), e.measureProps[o]?.subTotalEnabled && d.push(De(e, t, i)), d;
|
|
309
|
+
}, []);
|
|
310
|
+
return e.total.enabled && o.push(Oe(e, t)), {
|
|
311
|
+
...n,
|
|
312
|
+
components: [...n.components, ...o]
|
|
313
|
+
};
|
|
314
|
+
}, Ie = [{ position: b.Outside }, {
|
|
315
|
+
position: b.Inside,
|
|
316
|
+
justify: 1
|
|
317
|
+
}], Le = (e, t, n, r, i) => {
|
|
318
|
+
if (!i) return n;
|
|
319
|
+
let a = [], o = G(e, i);
|
|
320
|
+
return o.forEach((n, r) => {
|
|
321
|
+
if (!n.dataLabels?.show) return;
|
|
322
|
+
a.push(Be(e, t, n, r));
|
|
323
|
+
let i = u(n.dataItem);
|
|
324
|
+
e.measureProps[i]?.subTotalEnabled && a.push(ze(e, t, n, r));
|
|
325
|
+
}), e.total.enabled && e.total.showDataLabel && a.push(Re(e, t, o)), {
|
|
326
|
+
...n,
|
|
327
|
+
components: [...n.components, ...a]
|
|
328
|
+
};
|
|
329
|
+
}, q = {
|
|
330
|
+
layout: { displayOrder: A.Labels },
|
|
331
|
+
animations: {
|
|
332
|
+
enabled: !0,
|
|
333
|
+
presetId: "chart-labels"
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
function Re(e, t, n) {
|
|
337
|
+
let r = n[n.length - 1], i = B(r);
|
|
338
|
+
return {
|
|
339
|
+
...q,
|
|
340
|
+
type: S.Labels,
|
|
341
|
+
key: "bar-labels-normal-total",
|
|
342
|
+
settings: J(e, t, z, i, e.total?.showLabelBackdrop, e.total?.labelFontSize)
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function ze(e, t, n, r) {
|
|
346
|
+
return {
|
|
347
|
+
...q,
|
|
348
|
+
type: S.Labels,
|
|
349
|
+
key: `bar-labels-normal-${r}-sub`,
|
|
350
|
+
settings: J(e, t, Ee(r), B(n), n.dataLabels?.showBackdrop, n.dataLabels?.size)
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function Be(e, t, n, r) {
|
|
354
|
+
let a = w(e, n, i.Waterfall);
|
|
355
|
+
return {
|
|
356
|
+
...q,
|
|
357
|
+
type: S.Labels,
|
|
358
|
+
key: `bar-labels-normal-${r}`,
|
|
359
|
+
settings: J(e, t, a, B(n), n.dataLabels?.showBackdrop, n.dataLabels?.size)
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function J(e, t, n, r, i = !1, a) {
|
|
363
|
+
return { sources: [{
|
|
364
|
+
component: n,
|
|
365
|
+
selector: _e.Rect,
|
|
366
|
+
strategy: {
|
|
367
|
+
type: "bar",
|
|
368
|
+
settings: {
|
|
369
|
+
direction: Ve(e),
|
|
370
|
+
fontSize: fe(a, m(t).fontSizes.dataLabel),
|
|
371
|
+
fontFamily: t.fonts.general.fontFamily,
|
|
372
|
+
labels: [{
|
|
373
|
+
label: r,
|
|
374
|
+
placements: i ? Ie.map((n) => E(n, t, O(e))) : Ie
|
|
375
|
+
}]
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}] };
|
|
379
|
+
}
|
|
380
|
+
function Ve(e) {
|
|
381
|
+
return ({ data: t }) => {
|
|
382
|
+
if (!t) return null;
|
|
383
|
+
let n = t.end.value > t.start.value;
|
|
384
|
+
return (t.reverted?.value ? !n : n) ? O(e) ? "right" : "up" : O(e) ? "left" : "down";
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
var He = {
|
|
388
|
+
curve: t.Linear,
|
|
389
|
+
line: {
|
|
390
|
+
stroke: r.grey1,
|
|
391
|
+
strokeWidth: 2,
|
|
392
|
+
strokeDasharray: x({
|
|
393
|
+
space: 1,
|
|
394
|
+
width: 4
|
|
395
|
+
}),
|
|
396
|
+
show: !0
|
|
397
|
+
}
|
|
398
|
+
}, Ue = {
|
|
399
|
+
scale: je,
|
|
400
|
+
ref: "series"
|
|
401
|
+
}, We = {
|
|
402
|
+
enabled: !0,
|
|
403
|
+
presetId: "simple-opacity"
|
|
404
|
+
}, Ge = (e, t, n) => {
|
|
405
|
+
if (!e.showLines || !n.collections) return n;
|
|
406
|
+
let r = n.collections[0].data.extract, a = "end", o = r.slice(0, -1).map((t, n) => {
|
|
407
|
+
let o = a;
|
|
408
|
+
return r[n + 1].props?.subTotal || (a = a === "start" ? "end" : "start"), {
|
|
409
|
+
type: S.Line,
|
|
410
|
+
layout: { displayOrder: A.VisualizationElement },
|
|
411
|
+
key: `${i.Line}.${n}`,
|
|
412
|
+
data: {
|
|
413
|
+
collection: Ae,
|
|
414
|
+
filter: (e, t) => [n, n + 1].includes(t)
|
|
415
|
+
},
|
|
416
|
+
settings: Ke(e, o),
|
|
417
|
+
animations: We
|
|
418
|
+
};
|
|
419
|
+
});
|
|
420
|
+
return {
|
|
421
|
+
...n,
|
|
422
|
+
components: [...n.components, ...o]
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
function Ke(e, t) {
|
|
426
|
+
let n = O(e);
|
|
427
|
+
return {
|
|
428
|
+
layers: He,
|
|
429
|
+
coordinates: {
|
|
430
|
+
major: Ue,
|
|
431
|
+
minor: {
|
|
432
|
+
scale: n ? M.XAxisScale : M.YAxisScale,
|
|
433
|
+
ref: t
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
orientation: n ? d.Vertical : d.Horizontal
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
var qe = (e, t, n) => {
|
|
440
|
+
let r = e.measures.filter(c), a = r.map((t) => w(e, t, i.Waterfall));
|
|
441
|
+
return ae(e, t, n, {
|
|
442
|
+
filter: (e) => e.filter((e) => e.data?.subTotal?.value || a.findIndex((t) => t === e.key) !== -1),
|
|
443
|
+
placement: {
|
|
444
|
+
type: "bounds",
|
|
445
|
+
area: "target"
|
|
446
|
+
},
|
|
447
|
+
extract: ie({
|
|
448
|
+
...e,
|
|
449
|
+
measures: r
|
|
450
|
+
}, t, Je, () => "")
|
|
451
|
+
}, `tooltip-${S.Box}`);
|
|
452
|
+
}, Je = (e, t, n, r, i, a, o, c) => {
|
|
453
|
+
let { formatter: l } = n, d = t.data, f = T(n), p = e.filter((e) => !f.has(u(e.dataItem))), m = e.filter((e) => f.has(u(e.dataItem))).flatMap((e) => {
|
|
454
|
+
let n = u(e.dataItem), r = Object.keys(t.data).find((e) => t.data[e]?.source?.field === n);
|
|
455
|
+
if (!r) return [];
|
|
456
|
+
let i = t.data[r]?.value, a = i;
|
|
457
|
+
return !c && e?.formatter && l ? a = l(e.formatter)(i) : c && l && (a = l(k(e?.formatter))(i)), [{
|
|
458
|
+
label: s(e) || e.label || e.dataItem.name || "",
|
|
459
|
+
value: a
|
|
460
|
+
}];
|
|
461
|
+
});
|
|
462
|
+
if (d.subTotal.value) {
|
|
463
|
+
let e = d.label, n = d.reverted.value ? d.start.value : d.end.value, r;
|
|
464
|
+
if (t.key === z) {
|
|
465
|
+
let e = p[p.length - 1];
|
|
466
|
+
r = !c && e?.formatter && l ? l(e.formatter)(n) : n;
|
|
467
|
+
} else {
|
|
468
|
+
let e = parseInt(t.data._configOrder, 10), i = e > 0 ? p[e - 1] : void 0;
|
|
469
|
+
r = !c && i?.formatter && l ? l(i.formatter)(n) : n;
|
|
470
|
+
}
|
|
471
|
+
return [{
|
|
472
|
+
label: e.value.toString(),
|
|
473
|
+
value: r
|
|
474
|
+
}, ...m];
|
|
475
|
+
} else {
|
|
476
|
+
let t = d.series.value.toString(), n = e.find((e) => u(e.dataItem) === t), r = (d.reverted.value ? -1 : 1) * (d.end.value - d.start.value), i = r;
|
|
477
|
+
return !c && n?.formatter && l ? i = l(n.formatter)(r) : c && l && (i = l(k(n?.formatter))(r)), [{
|
|
478
|
+
label: (n ? s(n) : "") || n?.label || n?.dataItem.name || "",
|
|
479
|
+
value: i
|
|
480
|
+
}, ...m];
|
|
481
|
+
}
|
|
482
|
+
}, Y = {
|
|
483
|
+
id: "__waterfall_comparison_id",
|
|
484
|
+
kind: "__waterfall_comparison_kind",
|
|
485
|
+
start: "__waterfall_comparison_start",
|
|
486
|
+
end: "__waterfall_comparison_end",
|
|
487
|
+
change: "__waterfall_comparison_change",
|
|
488
|
+
label: "__waterfall_comparison_label"
|
|
489
|
+
};
|
|
490
|
+
function Ye(e) {
|
|
491
|
+
return e.dimensions?.filter(c).length === 1 && e.measures.filter(c).length === 2;
|
|
492
|
+
}
|
|
493
|
+
function Xe(e) {
|
|
494
|
+
return s(e) || e.label || e.dataItem.name || "";
|
|
495
|
+
}
|
|
496
|
+
function X(e) {
|
|
497
|
+
return typeof e == "number" && Number.isFinite(e) ? e : 0;
|
|
498
|
+
}
|
|
499
|
+
function Ze(e, t) {
|
|
500
|
+
if (!t.items.length) return t;
|
|
501
|
+
let [n, r] = e.measures.filter(c), i = u(n.dataItem), a = u(r.dataItem), o = t.items.reduce((e, t) => e + X(t[i]), 0), s = t.items.reduce((e, t) => e + X(t[a]), 0), l = e.measureProps?.[a]?.hideIfEmpty ?? !1, d = /* @__PURE__ */ new Set([...t.fields.map((e) => e.dataItemId), ...t.items.flatMap((e) => Object.keys(e))]), f = Object.fromEntries([...d].map((e) => [e, null])), p = (e, t, n) => ({
|
|
502
|
+
...f,
|
|
503
|
+
[u(e.dataItem)]: n,
|
|
504
|
+
[Y.id]: t,
|
|
505
|
+
[Y.kind]: t,
|
|
506
|
+
[Y.start]: 0,
|
|
507
|
+
[Y.end]: n,
|
|
508
|
+
[Y.change]: n,
|
|
509
|
+
[Y.label]: Xe(e)
|
|
510
|
+
}), m = o, h = t.items.flatMap((e, t) => {
|
|
511
|
+
let n = X(e[a]) - X(e[i]), r = m;
|
|
512
|
+
return m += n, l && n === 0 ? [] : [{
|
|
513
|
+
...e,
|
|
514
|
+
[Y.id]: `category-${t}`,
|
|
515
|
+
[Y.kind]: "change",
|
|
516
|
+
[Y.start]: r,
|
|
517
|
+
[Y.end]: m,
|
|
518
|
+
[Y.change]: n,
|
|
519
|
+
[Y.label]: ""
|
|
520
|
+
}];
|
|
521
|
+
});
|
|
522
|
+
return {
|
|
523
|
+
...t,
|
|
524
|
+
items: [
|
|
525
|
+
p(n, "opening", o),
|
|
526
|
+
...h,
|
|
527
|
+
p(r, "closing", s)
|
|
528
|
+
]
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
var Z = "waterfall-comparison", Q = {
|
|
532
|
+
opening: "waterfall.comparison.opening",
|
|
533
|
+
positive: "waterfall.comparison.positive",
|
|
534
|
+
negative: "waterfall.comparison.negative",
|
|
535
|
+
closing: "waterfall.comparison.closing"
|
|
536
|
+
}, Qe = (t, n, r, i, a, s, l, d) => {
|
|
537
|
+
let f = {
|
|
538
|
+
...t,
|
|
539
|
+
barSettings: {
|
|
540
|
+
...o.barSettings,
|
|
541
|
+
...t.barSettings
|
|
542
|
+
},
|
|
543
|
+
colors: {
|
|
544
|
+
...o.colors,
|
|
545
|
+
...t.colors
|
|
546
|
+
},
|
|
547
|
+
measures: t.measures.map((e) => ({
|
|
548
|
+
...e,
|
|
549
|
+
secondaryAxis: !1
|
|
550
|
+
}))
|
|
551
|
+
}, [p, m] = f.measures.filter(c), [h] = f.dimensions.filter(c), g = u(h.dataItem), ee = (f.supportingMeasures ?? []).filter(c), _ = ce(f), v = j(f, p);
|
|
552
|
+
r = {
|
|
553
|
+
...r,
|
|
554
|
+
collections: [{
|
|
555
|
+
key: Z,
|
|
556
|
+
data: { extract: [{
|
|
557
|
+
field: Y.id,
|
|
558
|
+
props: {
|
|
559
|
+
kind: { field: Y.kind },
|
|
560
|
+
category: { field: g },
|
|
561
|
+
start: { field: Y.start },
|
|
562
|
+
end: { field: Y.end },
|
|
563
|
+
change: { field: Y.change },
|
|
564
|
+
endpointLabel: { field: Y.label },
|
|
565
|
+
reverted: !1,
|
|
566
|
+
...Object.fromEntries([p, m].map((e) => {
|
|
567
|
+
let t = u(e.dataItem);
|
|
568
|
+
return [t, { field: t }];
|
|
569
|
+
})),
|
|
570
|
+
...ge(ee)
|
|
571
|
+
}
|
|
572
|
+
}] }
|
|
573
|
+
}],
|
|
574
|
+
scales: de(f, {})
|
|
575
|
+
};
|
|
576
|
+
let te = {
|
|
577
|
+
type: re.Band,
|
|
578
|
+
data: { items: (a?.[0]?.items ?? []).map((e) => ({
|
|
579
|
+
value: String(e[Y.id]),
|
|
580
|
+
label: e[Y.label],
|
|
581
|
+
kind: e[Y.kind],
|
|
582
|
+
category: e[g]
|
|
583
|
+
})) },
|
|
584
|
+
padding: f.barSettings.barPadding,
|
|
585
|
+
invert: f.axes?.dimension?.invertAxis,
|
|
586
|
+
value: ({ datum: e }) => e.value.value,
|
|
587
|
+
label: ({ datum: e, resources: t }) => e.value.kind === "change" ? t.chart.dataset("0").field(g).formatter()(e.value.category) : e.value.label
|
|
588
|
+
};
|
|
589
|
+
r.scales[_] = te, r.scales[v].data = { fields: [Y.start, Y.end] }, (f.axes?.primaryMeasure?.axisRange?.axisRangeOption ?? e.Auto) === e.Auto && (r.scales[v].expand = .3), r = ue({
|
|
590
|
+
...f,
|
|
591
|
+
dimensions: f.dimensions.map((e) => ({
|
|
592
|
+
...e,
|
|
593
|
+
formatter: void 0
|
|
594
|
+
}))
|
|
595
|
+
}, n, r, i, a, s, l, d), r.components = r.components.map((e) => e.type === S.Axis && e.scale === _ ? {
|
|
596
|
+
...e,
|
|
597
|
+
key: "axis.waterfall.comparison.dimension",
|
|
598
|
+
brush: void 0
|
|
599
|
+
} : e), r = C(f, n, r, i, a);
|
|
600
|
+
let y = [], b = [], x = { scale: _ }, ne = {
|
|
601
|
+
scale: v,
|
|
602
|
+
ref: "end"
|
|
603
|
+
}, w = f.measureProps?.[u(m.dataItem)], T = w && {
|
|
604
|
+
...w,
|
|
605
|
+
customColor: {
|
|
606
|
+
...f.colors,
|
|
607
|
+
...w.customColor
|
|
608
|
+
}
|
|
609
|
+
}, E = (e, t, r, i, a) => {
|
|
610
|
+
y.push({
|
|
611
|
+
key: e,
|
|
612
|
+
type: S.Box,
|
|
613
|
+
layout: { displayOrder: A.VisualizationElement },
|
|
614
|
+
data: {
|
|
615
|
+
collection: Z,
|
|
616
|
+
filter: r
|
|
617
|
+
},
|
|
618
|
+
settings: W(f, n, x, ne, i),
|
|
619
|
+
brush: a ? he(["category"], s, { valuePickerMode: s?.valuePickerMode }) : void 0,
|
|
620
|
+
animations: {
|
|
621
|
+
enabled: !0,
|
|
622
|
+
presetId: "simple-opacity"
|
|
623
|
+
}
|
|
624
|
+
}), t.dataLabels?.show && b.push({
|
|
625
|
+
key: `${e}.labels`,
|
|
626
|
+
type: S.Labels,
|
|
627
|
+
layout: { displayOrder: A.Labels },
|
|
628
|
+
settings: J(f, n, e, ({ data: e, formatter: n }) => t.formatter && n ? n(t.formatter)(e.change.value) : String(e.change.value), t.dataLabels.showBackdrop, t.dataLabels.size),
|
|
629
|
+
animations: {
|
|
630
|
+
enabled: !0,
|
|
631
|
+
presetId: "chart-labels"
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
}, D = (e) => {
|
|
635
|
+
let t = f.measureProps?.[u(e.dataItem)];
|
|
636
|
+
return t?.customColorEnabled && t.customColor?.subTotal || f.colors.subTotal;
|
|
637
|
+
};
|
|
638
|
+
return E(Q.opening, p, (e) => e.kind.value === "opening", D(p), !1), E(Q.positive, m, (e) => e.kind.value === "change" && Number(e.change.value) >= 0, N({
|
|
639
|
+
measureProps: T,
|
|
640
|
+
index: 0,
|
|
641
|
+
items: [1],
|
|
642
|
+
vSpec: f
|
|
643
|
+
}), !0), E(Q.negative, m, (e) => e.kind.value === "change" && Number(e.change.value) < 0, N({
|
|
644
|
+
measureProps: T,
|
|
645
|
+
index: 0,
|
|
646
|
+
items: [-1],
|
|
647
|
+
vSpec: f
|
|
648
|
+
}), !0), E(Q.closing, m, (e) => e.kind.value === "closing", D(m), !1), r = {
|
|
649
|
+
...r,
|
|
650
|
+
components: [
|
|
651
|
+
...r.components,
|
|
652
|
+
...y,
|
|
653
|
+
...b
|
|
654
|
+
]
|
|
655
|
+
}, f.showLines && r.components.push($e(f, n.axis.dimension.lineColor)), r = ae(f, n, r, {
|
|
656
|
+
filter: (e) => e.filter((e) => Object.values(Q).includes(e.key)),
|
|
657
|
+
placement: {
|
|
658
|
+
type: "bounds",
|
|
659
|
+
area: "target"
|
|
660
|
+
},
|
|
661
|
+
extract: ie(f, n, et, (e, t) => String(t.data.kind.value === "change" ? t.data.category.label : t.data.endpointLabel.value))
|
|
662
|
+
}), oe(f, n, r, i, a);
|
|
663
|
+
};
|
|
664
|
+
function $e(e, t) {
|
|
665
|
+
let n = ce(e), r = j(e, void 0), i = !!e.axes?.dimension?.invertAxis, a = {
|
|
666
|
+
scale: n,
|
|
667
|
+
fn: (e) => Number(e.scale(e.datum.value)) + (i ? 0 : e.scale.bandwidth())
|
|
668
|
+
}, o = {
|
|
669
|
+
scale: n,
|
|
670
|
+
fn: (e, t) => e.data.items[t + 1] ? Number(e.scale(e.data.items[t + 1].value)) + (i ? e.scale.bandwidth() : 0) : 1
|
|
671
|
+
}, s = {
|
|
672
|
+
scale: r,
|
|
673
|
+
ref: "end"
|
|
674
|
+
};
|
|
675
|
+
return {
|
|
676
|
+
key: "waterfall.comparison.connectors",
|
|
677
|
+
type: S.LineCoord,
|
|
678
|
+
layout: { displayOrder: A.VisualizationElement },
|
|
679
|
+
data: { collection: Z },
|
|
680
|
+
settings: {
|
|
681
|
+
...O(e) ? {
|
|
682
|
+
x0: s,
|
|
683
|
+
x1: s,
|
|
684
|
+
y0: a,
|
|
685
|
+
y1: o
|
|
686
|
+
} : {
|
|
687
|
+
x0: a,
|
|
688
|
+
x1: o,
|
|
689
|
+
y0: s,
|
|
690
|
+
y1: s
|
|
691
|
+
},
|
|
692
|
+
show: (e, t) => !!e.data.items[t + 1],
|
|
693
|
+
stroke: t,
|
|
694
|
+
strokeWidth: 1,
|
|
695
|
+
strokeDasharray: "2 2"
|
|
696
|
+
},
|
|
697
|
+
animations: {
|
|
698
|
+
enabled: !0,
|
|
699
|
+
presetId: "simple-opacity"
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
var et = (e, t, n, r, i, a, o, s) => {
|
|
704
|
+
let c = t.data.kind.value, l = c === "opening" ? e[0] : e[1], d = c === "change" ? e : [l], f = (e, t) => {
|
|
705
|
+
let r = s ? k(e?.formatter) : e?.formatter;
|
|
706
|
+
return r && n.formatter ? n.formatter(r)(t) : t ?? "";
|
|
707
|
+
}, p = d.map((e) => ({
|
|
708
|
+
label: Xe(e),
|
|
709
|
+
value: f(e, t.data[u(e.dataItem)]?.value)
|
|
710
|
+
}));
|
|
711
|
+
return c === "change" && p.push({
|
|
712
|
+
label: "Change",
|
|
713
|
+
value: f(e[1], t.data.change.value)
|
|
714
|
+
}), p;
|
|
715
|
+
}, tt = class extends D {
|
|
716
|
+
constructor() {
|
|
717
|
+
let e = [
|
|
718
|
+
Pe,
|
|
719
|
+
Ne,
|
|
720
|
+
Me,
|
|
721
|
+
C,
|
|
722
|
+
Fe,
|
|
723
|
+
Le,
|
|
724
|
+
Ge,
|
|
725
|
+
qe,
|
|
726
|
+
oe
|
|
727
|
+
];
|
|
728
|
+
super([(t, ...n) => {
|
|
729
|
+
if (Ye(t)) return Qe(t, ...n);
|
|
730
|
+
let [r, i, ...a] = n;
|
|
731
|
+
return e.reduce((e, n) => n(t, r, e, ...a), i);
|
|
732
|
+
}]);
|
|
733
|
+
}
|
|
734
|
+
preCompile(e, t) {
|
|
735
|
+
if (Ye(e)) {
|
|
736
|
+
t[0] = Ze(e, ve(e, t)[0]);
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
let n = [];
|
|
740
|
+
Object.entries(t[0].items[0]).forEach(([e, t]) => {
|
|
741
|
+
if (n.length === 0) n.push([e, t]);
|
|
742
|
+
else {
|
|
743
|
+
let r = t + n[n.length - 1][1];
|
|
744
|
+
n.push([e, r]);
|
|
745
|
+
}
|
|
746
|
+
}), t[0].items[0] = Object.fromEntries(n), nt(e) && (e.measureProps = ne);
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
function nt(e) {
|
|
750
|
+
return e.measures.filter((e) => c(e)).every((e) => e.dataItem.internalKey.startsWith("internalKeyMeasure"));
|
|
751
|
+
}
|
|
752
|
+
var $ = _(), rt = new tt(), it = g(({ vSpec: e, vTheme: t, data: r, elementSize: o, vizProperties: s }) => {
|
|
753
|
+
let l = ee(), { activeKey: u } = te(), d = h(), f = y(), p = pe();
|
|
754
|
+
if (!r || !e || !a(e)) return null;
|
|
755
|
+
let m = e.dimensions.some(c), g = m ? !r[0]?.items.length : at(r);
|
|
756
|
+
if (!s.isFetchingData && g) return /* @__PURE__ */ (0, $.jsx)(ye, { vBackendAPI: f });
|
|
757
|
+
if (g || !o) return null;
|
|
758
|
+
let _ = {
|
|
759
|
+
...s,
|
|
760
|
+
valuePickerMode: !!u
|
|
761
|
+
}, v = t || n, b = rt.compile(e, v, structuredClone(r), o, _, i.Waterfall, l, d, p);
|
|
762
|
+
return b ? /* @__PURE__ */ (0, $.jsx)(le, {
|
|
763
|
+
config: _,
|
|
764
|
+
definition: b,
|
|
765
|
+
size: o,
|
|
766
|
+
vSpec: e,
|
|
767
|
+
selectionData: m ? r[0].items : void 0
|
|
768
|
+
}) : null;
|
|
769
|
+
});
|
|
770
|
+
function at(e) {
|
|
771
|
+
return e?.[0].items.length === 0 || !Object.values(e[0].items[0]).some(Boolean);
|
|
772
|
+
}
|
|
773
|
+
export { it as WaterfallChart };
|