@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,355 +0,0 @@
|
|
|
1
|
-
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import { $i as t, Ds as n, Gn as r, Kt as i, Us as a, Xa as o, _c as s, fs as c, ws as l, zi as u, zr as d } from "./visualization-filters-mVnsnvLP.js";
|
|
3
|
-
import { N as f, Ot as p, ei as m, jr as h, s as g } from "./utils-DYYD4Zzf.js";
|
|
4
|
-
import { Pm as _, _m as v } from "./handlers-CMbyj5y1.js";
|
|
5
|
-
import { t as y } from "./label-format-type-weq1XfcX.js";
|
|
6
|
-
import "./logger-3lng-wOw.js";
|
|
7
|
-
import { Bt as b, Et as x, F as S, I as C, Kt as w, R as T, Yt as E, _n as D, at as O, cn as ee, ct as k, et as A, i as j, it as te, ln as ne, n as re, nt as ie, rn as ae, sn as M, st as oe, tt as se, xt as N, yt as P, z as F } from "./escobar-C4Nm3eJ7.js";
|
|
8
|
-
import { _ as I } from "./MenuOption-Cb7B7x6z.js";
|
|
9
|
-
import { t as L } from "./coloring-B-Wa8D5P.js";
|
|
10
|
-
import { t as R } from "./set-coloring-datafield-B3uIS1Pe.js";
|
|
11
|
-
var z = /* @__PURE__ */ e(m()), B = (e, r, i) => {
|
|
12
|
-
let { coloring: o } = e || {}, s = o?.fieldId, c = e.dimensions.filter((e) => d(e)), l = e.measures.filter((e) => d(e)), u = l.filter((e) => e.role === t.PIE_CHART_SLICE), f = l.filter((e) => e.role === t.PIE_CHART_LENGTH);
|
|
13
|
-
s || (e.coloring?.type === n.Gradient ? s = a(u[0]?.dataItem) : e.coloring?.type === n.Categorical && (s = a(c[0]?.dataItem))), P(i, 0, { color: { field: s } });
|
|
14
|
-
let p = x(R(e, s ?? null), r, {});
|
|
15
|
-
if (f.length > 0) {
|
|
16
|
-
let e = a(f[0]?.dataItem);
|
|
17
|
-
p[e] = { data: { field: e } };
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
...i,
|
|
21
|
-
scales: p
|
|
22
|
-
};
|
|
23
|
-
}, V = /* @__PURE__ */ function(e) {
|
|
24
|
-
return e.num = "num", e.rad = "rad", e.group = "group", e;
|
|
25
|
-
}({}), H = (e, n, r) => {
|
|
26
|
-
if (!e.dimensions[0]) return r;
|
|
27
|
-
let i = e.measures.filter((e) => d(e)), o = C((e.supportingMeasures ?? []).filter((e) => d(e))), s = e.dimensions.filter((e) => d(e))?.[0], c = i.filter((e) => e.role === t.PIE_CHART_SLICE)?.[0], l = i.filter((e) => e.role === t.PIE_CHART_LENGTH)?.[0], u = a(c?.dataItem), f = a(l?.dataItem), p = a(s?.dataItem), m = {
|
|
28
|
-
num: c?.dataItem?.name ? { field: u } : void 0,
|
|
29
|
-
rad: l?.dataItem?.name ? { field: f } : void 0,
|
|
30
|
-
...o
|
|
31
|
-
};
|
|
32
|
-
u && (m[u] = { field: u }), f && (m[f] = { field: f });
|
|
33
|
-
let h = [{
|
|
34
|
-
key: M.Collection,
|
|
35
|
-
data: { extract: [{
|
|
36
|
-
field: p,
|
|
37
|
-
props: m
|
|
38
|
-
}] }
|
|
39
|
-
}];
|
|
40
|
-
return {
|
|
41
|
-
...r,
|
|
42
|
-
collections: h
|
|
43
|
-
};
|
|
44
|
-
}, U = "pie-alternates-switcher", W = "pie-alternates-switcher", G = (e) => i(e) || e.label || e.dataItem?.name || "Field", K = (e, t, n, r) => {
|
|
45
|
-
let i = n ? a(n.dataItem) : void 0;
|
|
46
|
-
return {
|
|
47
|
-
type: "native",
|
|
48
|
-
key: `${W}-interaction`,
|
|
49
|
-
events: { click(a) {
|
|
50
|
-
let o = this.element.getBoundingClientRect(), c = {
|
|
51
|
-
x: a.clientX - o.left,
|
|
52
|
-
y: a.clientY - o.top
|
|
53
|
-
}, l = this.chart.shapesAt(c, {
|
|
54
|
-
components: [{
|
|
55
|
-
key: W,
|
|
56
|
-
propagation: "stop"
|
|
57
|
-
}],
|
|
58
|
-
propagation: "stop"
|
|
59
|
-
}).find((e) => e.data?.target === "measure" || e.data?.target === "dimension");
|
|
60
|
-
if (l?.data?.target === "measure" && n && i) {
|
|
61
|
-
r(D.Text, "click", `text-${i}`, a, l, {
|
|
62
|
-
dataItemType: s.Measure,
|
|
63
|
-
dataItemRole: n.role
|
|
64
|
-
});
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
l?.data?.target === "dimension" && e && r(D.Text, "click", `text-${e}`, a, l, {
|
|
68
|
-
dataItemType: s.Dimension,
|
|
69
|
-
dataItemRole: t
|
|
70
|
-
});
|
|
71
|
-
} }
|
|
72
|
-
};
|
|
73
|
-
}, ce = (e, n, i, c, l, u, f, p) => {
|
|
74
|
-
let m = r(e.dimensions, e.enableAlternate, u?.isPrintMode), h = e.dimensions.filter((e) => d(e)), g = h[0], _ = g ? a(g.dataItem) : void 0, v = e.measures.filter((e) => e.role === t.PIE_CHART_SLICE), y = r(v, e.enableAlternate, u?.isPrintMode), b = v.filter((e) => d(e))[0], x = m && h.length ? h.map((e) => G(e)).join(", ") : void 0, S = y && b ? G(b) : void 0;
|
|
75
|
-
if (!x && !S) return i;
|
|
76
|
-
let C = {
|
|
77
|
-
type: U,
|
|
78
|
-
key: W,
|
|
79
|
-
dimensionDataItemType: _ ? s.Dimension : void 0,
|
|
80
|
-
dimensionDataItemRole: g?.role,
|
|
81
|
-
measureDataItemType: b ? s.Measure : void 0,
|
|
82
|
-
measureDataItemRole: b?.role,
|
|
83
|
-
layout: {
|
|
84
|
-
dock: o.Bottom,
|
|
85
|
-
displayOrder: 0
|
|
86
|
-
},
|
|
87
|
-
settings: {
|
|
88
|
-
dimensionLabel: x ? w(x) : void 0,
|
|
89
|
-
measureLabel: S ? w(S) : void 0,
|
|
90
|
-
fontFamily: n.fonts.general.fontFamily ?? void 0,
|
|
91
|
-
fontSize: `${ee.fieldTitle.fontSize}px`,
|
|
92
|
-
color: n.fonts.general.color,
|
|
93
|
-
paddingLeft: 5,
|
|
94
|
-
paddingRight: 5,
|
|
95
|
-
paddingVertical: 5,
|
|
96
|
-
labelGap: 12
|
|
97
|
-
}
|
|
98
|
-
}, T = p ? [K(_, g?.role, b, p)] : [];
|
|
99
|
-
return {
|
|
100
|
-
...i,
|
|
101
|
-
components: [...i.components, C],
|
|
102
|
-
interactions: i.interactions ? [...i.interactions, ...T] : T
|
|
103
|
-
};
|
|
104
|
-
}, q = {
|
|
105
|
-
outerRadius: .8,
|
|
106
|
-
outerRadiusWithoutLabels: .95,
|
|
107
|
-
cornerRadius: v.pie,
|
|
108
|
-
strokeWidth: 0,
|
|
109
|
-
strokeEnabled: !1,
|
|
110
|
-
strokeColor: "#C6C6C6",
|
|
111
|
-
multiMeasureMinRadius: .3,
|
|
112
|
-
donut: {
|
|
113
|
-
innerRadius: .55,
|
|
114
|
-
cornerRadius: v.donut,
|
|
115
|
-
multiMeasureMinRadius: .6
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
function J(e) {
|
|
119
|
-
return e.pieSettings?.donut ?? !1;
|
|
120
|
-
}
|
|
121
|
-
var le = (e, n, r, i, o, s) => {
|
|
122
|
-
let c = e.measures.filter((e) => d(e)), l = c.filter((e) => e.role === t.PIE_CHART_SLICE), u = c.filter((e) => e.role === t.PIE_CHART_LENGTH), f = l[0], p = u[0], m = new L(e, n, o?.[0]?.itemsNotAffectedByFiltering), h = J(e) ? q.donut.innerRadius : 0, g = f?.dataLabels?.show === !1 ? q.outerRadiusWithoutLabels : q.outerRadius, _ = e.pieSettings?.cornerRadius ?? (J(e) ? q.donut.cornerRadius : q.cornerRadius), v = e.pieSettings?.strokeEnabled ?? q.strokeEnabled, y = e.pieSettings?.strokeWidth ?? q.strokeWidth, b = e.pieSettings?.strokeColor ?? q.strokeColor;
|
|
123
|
-
if (p) {
|
|
124
|
-
let t = g, n = J(e) ? q.donut.multiMeasureMinRadius : q.multiMeasureMinRadius;
|
|
125
|
-
g = (e) => e.resources.scale(a(p.dataItem))(e.datum.rad.value) * (t - n) + n;
|
|
126
|
-
}
|
|
127
|
-
let x = {
|
|
128
|
-
type: D.Pie,
|
|
129
|
-
key: `${D.Pie}`,
|
|
130
|
-
data: { collection: M.Collection },
|
|
131
|
-
animations: {
|
|
132
|
-
enabled: !0,
|
|
133
|
-
presetId: "pie-chart"
|
|
134
|
-
},
|
|
135
|
-
settings: { slice: {
|
|
136
|
-
arc: { ref: "num" },
|
|
137
|
-
stroke: b,
|
|
138
|
-
strokeWidth: v ? y : 0,
|
|
139
|
-
cornerRadius: _,
|
|
140
|
-
innerRadius: h,
|
|
141
|
-
outerRadius: g,
|
|
142
|
-
fill: m.getColorDefinition({ ref: "color" })
|
|
143
|
-
} },
|
|
144
|
-
brush: E([""], s, { valuePickerMode: s?.valuePickerMode })
|
|
145
|
-
};
|
|
146
|
-
return {
|
|
147
|
-
...r,
|
|
148
|
-
components: [...r.components, x]
|
|
149
|
-
};
|
|
150
|
-
}, ue = (e, t, n) => ({ data: r, formatter: i }) => {
|
|
151
|
-
let a = e.dimensions.filter((e) => d(e))[0], o = r.value, s = r[V.num].value, c = a.formatter && o && i ? i(a.formatter)(o) : `${o}`, l = t.formatter && s && i ? i(t.formatter)(s, void 0, r) : `${s}`, u = s != null && n && i ? i(k)(s / n) : null, f = () => t.dataLabels?.measureLabelFormat === _.Percentage ? u === null ? [] : [u] : t.dataLabels?.measureLabelFormat === _.ValueAndPercentage ? u === null ? [l] : [l, u] : [l];
|
|
152
|
-
switch (t.dataLabels?.labelFormat) {
|
|
153
|
-
case y.Measure: {
|
|
154
|
-
let e = f();
|
|
155
|
-
return e.length <= 1 ? e[0] ?? null : e;
|
|
156
|
-
}
|
|
157
|
-
case y.DimensionAndMeasure: return [c, ...f()];
|
|
158
|
-
default: return c;
|
|
159
|
-
}
|
|
160
|
-
}, de = (e, n, r, i, a, o) => {
|
|
161
|
-
let s = e.dimensions.filter((e) => d(e)), c = e.measures.filter((e) => d(e)), l = s[0], u = c.find((e) => e.role === t.PIE_CHART_SLICE) ?? c[0];
|
|
162
|
-
if (!l || !u || !u.dataLabels?.show) return r;
|
|
163
|
-
let f = new I(n.fonts.general.color), p = u.dataLabels.showBackdrop ? T(u.dataLabels.backdropColor ? { fill: u.dataLabels.backdropColor } : void 0) : void 0, m = p ? F(f) : u.dataLabels.textColor || "#000", { strokeEnabled: h, strokeWidth: g = q.strokeWidth } = e.pieSettings, _ = h ? g / 2 : 0, v = {
|
|
164
|
-
type: D.Labels,
|
|
165
|
-
key: "pie-labels",
|
|
166
|
-
animations: {
|
|
167
|
-
enabled: !0,
|
|
168
|
-
presetId: "chart-labels"
|
|
169
|
-
},
|
|
170
|
-
layout: { displayOrder: b.Labels },
|
|
171
|
-
settings: { sources: [{
|
|
172
|
-
component: `${D.Pie}`,
|
|
173
|
-
selector: ne.Path,
|
|
174
|
-
strategy: {
|
|
175
|
-
type: "slice",
|
|
176
|
-
settings: {
|
|
177
|
-
fontSize: ae(u.dataLabels.size),
|
|
178
|
-
fontFamily: n.fonts.general.fontFamily,
|
|
179
|
-
labels: [{
|
|
180
|
-
label: ue(e, u, a?.[0]?.sum),
|
|
181
|
-
placements: [{
|
|
182
|
-
position: "outside",
|
|
183
|
-
fill: m,
|
|
184
|
-
backdrop: p
|
|
185
|
-
}],
|
|
186
|
-
strokeDelta: _,
|
|
187
|
-
linkData: ({ data: e }) => e
|
|
188
|
-
}]
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}] },
|
|
192
|
-
brush: E([""], o, { valuePickerMode: o?.valuePickerMode })
|
|
193
|
-
};
|
|
194
|
-
return {
|
|
195
|
-
...r,
|
|
196
|
-
components: [...r.components, v]
|
|
197
|
-
};
|
|
198
|
-
}, Y = (e, t, n, r, a) => {
|
|
199
|
-
let o = n.data[t]?.value, s = i(e) || e.label || e.dataItem.name || "", c = o;
|
|
200
|
-
return !a && e.formatter ? c = r.formatter(e.formatter)(o, void 0, n.data) : a && (c = r.formatter(oe(e.formatter))(o, void 0, n.data)), {
|
|
201
|
-
label: s,
|
|
202
|
-
value: c
|
|
203
|
-
};
|
|
204
|
-
}, fe = (e, n, r, i, a) => {
|
|
205
|
-
let o = !!e.measures.filter(d).filter((e) => e.role === t.PIE_CHART_LENGTH)?.[0], s = {
|
|
206
|
-
filter: (e) => e.filter((e) => e.key === D.Pie),
|
|
207
|
-
placement: {
|
|
208
|
-
type: "slice",
|
|
209
|
-
area: "target"
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
if (o) return A(e, n, r, s, "tooltip", a);
|
|
213
|
-
let c = O(e, a), l = se(e, n, pe, ie, a?.[0]?.sum, c);
|
|
214
|
-
return A(e, n, r, {
|
|
215
|
-
...s,
|
|
216
|
-
extract: l
|
|
217
|
-
}, "tooltip", a);
|
|
218
|
-
}, pe = (e, t, n, r, i, o, s, c) => {
|
|
219
|
-
let l = [], u = e.filter(d), f = te(n), p = u.filter((e) => !f.has(a(e.dataItem)))?.[0] ?? u?.[0], m = Object.keys(t.data).find((e) => t.data[e]?.source?.field === a(p?.dataItem));
|
|
220
|
-
if (!m || !p ? l.push({
|
|
221
|
-
label: "",
|
|
222
|
-
value: ""
|
|
223
|
-
}) : l.push(Y(p, m, t, n, c)), u.filter((e) => f.has(a(e.dataItem))).forEach((e) => {
|
|
224
|
-
let r = a(e.dataItem), i = Object.keys(t.data).find((e) => t.data[e]?.source?.field === r);
|
|
225
|
-
i && l.push(Y(e, i, t, n, c));
|
|
226
|
-
}), s) return l;
|
|
227
|
-
let h = Object.values(o ?? {}).reduce((e, t) => e + Number(t), 0);
|
|
228
|
-
return l.push({
|
|
229
|
-
label: "Total",
|
|
230
|
-
value: p?.formatter ? n.formatter(p.formatter)(h) : h
|
|
231
|
-
}), l;
|
|
232
|
-
}, me = class extends S {
|
|
233
|
-
constructor() {
|
|
234
|
-
super([
|
|
235
|
-
H,
|
|
236
|
-
B,
|
|
237
|
-
le,
|
|
238
|
-
ce,
|
|
239
|
-
de,
|
|
240
|
-
N,
|
|
241
|
-
fe
|
|
242
|
-
]);
|
|
243
|
-
}
|
|
244
|
-
preCompile(e) {
|
|
245
|
-
let t = e.dimensions.filter((e) => d(e))?.[0], n = e.measures.filter((e) => d(e))?.[0];
|
|
246
|
-
if (!t || !n) throw Error("Charts w/o dimensions or measures are not supported ATM.");
|
|
247
|
-
}
|
|
248
|
-
}, X = " ▼", Z = "...", Q = (e, t, n, r) => e.measureText({
|
|
249
|
-
text: t,
|
|
250
|
-
fontFamily: n,
|
|
251
|
-
fontSize: r
|
|
252
|
-
}).width, he = (e, t, n, r, i) => {
|
|
253
|
-
if (t <= 0 || Q(n, e, r, i) <= t) return e;
|
|
254
|
-
let a = e.endsWith(X), o = a ? X : "", s = a ? e.slice(0, -2) : e;
|
|
255
|
-
if (Q(n, `${Z}${o}`, r, i) > t) return Z;
|
|
256
|
-
let c = 0, l = s.length;
|
|
257
|
-
for (; c < l;) {
|
|
258
|
-
let e = Math.ceil((c + l) / 2);
|
|
259
|
-
Q(n, `${s.slice(0, e)}${Z}${o}`, r, i) <= t ? c = e : l = e - 1;
|
|
260
|
-
}
|
|
261
|
-
return `${s.slice(0, c)}${Z}${o}`;
|
|
262
|
-
}, ge = {
|
|
263
|
-
require: ["renderer"],
|
|
264
|
-
defaultSettings: { settings: {
|
|
265
|
-
dimensionLabel: "",
|
|
266
|
-
measureLabel: "",
|
|
267
|
-
fontSize: "12px",
|
|
268
|
-
color: "#000",
|
|
269
|
-
paddingLeft: 5,
|
|
270
|
-
paddingRight: 5,
|
|
271
|
-
paddingVertical: 5,
|
|
272
|
-
labelGap: 12
|
|
273
|
-
} },
|
|
274
|
-
preferredSize() {
|
|
275
|
-
if (!this.renderer) return 0;
|
|
276
|
-
let { fontFamily: e = "Arial", fontSize: t, paddingVertical: n } = this.settings.settings;
|
|
277
|
-
return this.renderer.measureText({
|
|
278
|
-
fontFamily: e,
|
|
279
|
-
fontSize: t
|
|
280
|
-
}).height + n * 2;
|
|
281
|
-
},
|
|
282
|
-
render() {
|
|
283
|
-
let { renderer: e } = this;
|
|
284
|
-
if (!e) return [];
|
|
285
|
-
let { dimensionLabel: t, measureLabel: n, fontFamily: r = "Arial", fontSize: i, color: a, paddingLeft: o, paddingRight: s, labelGap: c } = this.settings.settings, l = n ? Q(e, n, r, i) : 0, u = this.rect.width - s, d = u - l, f = Math.max(Math.min(n ? d - c - o : this.rect.width - o - s, this.rect.width / 2), 0), p = t ? he(t, f, e, r, i) : "", m = p ? Q(e, p, r, i) : 0, h = [];
|
|
286
|
-
return n && h.push({
|
|
287
|
-
type: "rect",
|
|
288
|
-
x: Math.max(d, 0),
|
|
289
|
-
y: 0,
|
|
290
|
-
width: Math.min(l, this.rect.width),
|
|
291
|
-
height: this.rect.height,
|
|
292
|
-
fill: "rgba(0, 0, 0, 0)",
|
|
293
|
-
strokeWidth: 0,
|
|
294
|
-
data: { target: "measure" }
|
|
295
|
-
}), t && (h.push({
|
|
296
|
-
type: "rect",
|
|
297
|
-
x: o,
|
|
298
|
-
y: 0,
|
|
299
|
-
width: m,
|
|
300
|
-
height: this.rect.height,
|
|
301
|
-
fill: "rgba(0, 0, 0, 0)",
|
|
302
|
-
strokeWidth: 0,
|
|
303
|
-
data: { target: "dimension" }
|
|
304
|
-
}), h.push({
|
|
305
|
-
type: "text",
|
|
306
|
-
text: p,
|
|
307
|
-
x: o,
|
|
308
|
-
y: this.rect.height / 2,
|
|
309
|
-
anchor: "start",
|
|
310
|
-
baseline: "central",
|
|
311
|
-
fontFamily: r,
|
|
312
|
-
fontSize: i,
|
|
313
|
-
fill: a,
|
|
314
|
-
maxWidth: f,
|
|
315
|
-
data: { target: "dimension" }
|
|
316
|
-
})), n && h.push({
|
|
317
|
-
type: "text",
|
|
318
|
-
text: n,
|
|
319
|
-
x: u,
|
|
320
|
-
y: this.rect.height / 2,
|
|
321
|
-
anchor: "end",
|
|
322
|
-
baseline: "central",
|
|
323
|
-
fontFamily: r,
|
|
324
|
-
fontSize: i,
|
|
325
|
-
fill: a,
|
|
326
|
-
data: { target: "measure" }
|
|
327
|
-
}), h;
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
function $(e) {
|
|
331
|
-
e.component(U, ge);
|
|
332
|
-
}
|
|
333
|
-
var _e = (e, n) => {
|
|
334
|
-
let r = e.find((e) => e.role === t.PIE_CHART_SLICE && d(e));
|
|
335
|
-
if (!r) return;
|
|
336
|
-
let i = a(r.dataItem);
|
|
337
|
-
return n.reduce((e, t) => e + t[i], 0);
|
|
338
|
-
}, ve = h(), ye = p(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
|
|
339
|
-
let a = f(), [o] = (0, z.useState)(() => new me()), { activeKey: s } = g(), d = re();
|
|
340
|
-
if (!e || !c(e) || !n || !r) return null;
|
|
341
|
-
let p = {
|
|
342
|
-
...i,
|
|
343
|
-
valuePickerMode: !!s
|
|
344
|
-
}, m = t || u;
|
|
345
|
-
n[0] && (n[0].sum = _e(e.measures, n[0].items));
|
|
346
|
-
let h = o.compile(e, m, n, r, p, l.Pie, a, void 0, d);
|
|
347
|
-
return h ? /* @__PURE__ */ (0, ve.jsx)(j, {
|
|
348
|
-
config: p,
|
|
349
|
-
definition: h,
|
|
350
|
-
size: r,
|
|
351
|
-
vSpec: e,
|
|
352
|
-
escobarPlugins: [$]
|
|
353
|
-
}) : null;
|
|
354
|
-
});
|
|
355
|
-
export { ye as PieChart };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import { Ot as e, ei as t, jr as n } from "./utils-DYYD4Zzf.js";
|
|
3
|
-
import { n as r } from "./standalone-530a5lvf.js";
|
|
4
|
-
t();
|
|
5
|
-
var i = n(), a = e((e) => /* @__PURE__ */ (0, i.jsx)(r, { ...e }));
|
|
6
|
-
export { a as HistogramChart };
|