@astrato-io/visualizations 0.6.5 → 0.7.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/README.md +32 -2
- package/THIRD_PARTY_NOTICES.md +2 -229
- package/VISUALIZATION_DEFINITIONS.md +68 -114
- package/chunks/Button-BrGKp9Nm.js +110 -0
- package/chunks/DefaultPropsProvider-BsfB7QTn.js +257 -0
- package/chunks/FieldTypeIcon-Drs6hSJF.js +22 -0
- package/chunks/{LinearProgress-B1FeWaen.js → LinearProgress-VtfFx2vJ.js} +55 -55
- package/chunks/MenuOption-ByRqhRdX.js +3934 -0
- package/chunks/Title-CO5dP1ma.js +1691 -0
- package/chunks/ToggleButton-KOBAimC1.js +112 -0
- package/chunks/{app-filter-bar.compiler-BGJ7HAbr.js → app-filter-bar.compiler-TwVTeoj5.js} +10 -10
- package/chunks/{bar.compiler-CT0ZbQKc.js → bar.compiler-DuQg8EUb.js} +84 -84
- package/chunks/builder-DEDvNq1k.js +201 -0
- package/chunks/{color-settings-ZIvgNTq1.js → color-rules-CN7TcGrC.js} +2 -6
- package/chunks/color-settings-3VRlf_Vw.js +6 -0
- package/chunks/colorManipulator-D8Pjy1pf.js +45 -0
- package/chunks/coloring-CncX_JRX.js +278 -0
- package/chunks/{definitions-D3OVqmXl.js → definitions-BPJQTx16.js} +490 -382
- package/chunks/{escobar-eDjtGpkC.js → escobar-DRhRMYRE.js} +6067 -4742
- package/chunks/event-bus-CrLB-Y8z.js +3 -0
- package/chunks/extend-preset-CUFNpmPe.js +4398 -0
- package/chunks/{filter.compiler-DBsyRBJt.js → filter.compiler-w27dlv0C.js} +12 -12
- package/chunks/{filtering-tqjAyJH5.js → filtering-cc7WqWpg.js} +391 -310
- package/chunks/{handlers-VTBfIZYZ.js → handlers-TOT-7INo.js} +3241 -3442
- package/chunks/icon-picker-styles-CoJmwTRi.js +2246 -0
- package/chunks/isEqual-B8loyPsC.js +12 -0
- package/chunks/label-format-type-weq1XfcX.js +8 -0
- package/chunks/{line.compiler-CzdM5Ld0.js → line.compiler-Ct1WhN2p.js} +27 -27
- package/chunks/logger-DpQtYQnX.js +1163 -0
- package/chunks/lookup-BWllin0q.js +36 -0
- package/chunks/{metadata-BGElBy5Z.js → metadata-WABZrt7Y.js} +1 -1
- package/chunks/{number.compiler-G-R7y16P.js → number.compiler-D8TPly-4.js} +13 -13
- package/chunks/{operations-CTNUX6Sy.js → operations-Dh4v1Ovt.js} +9314 -9283
- package/chunks/{range-CiwTbMig.js → range-Bi-7zT0k.js} +2 -2
- package/chunks/registry-KervaxqJ.js +31 -0
- package/chunks/render-wrappers-OEmtaM8g.js +2 -0
- package/chunks/{registry-CsQQzukD.js → requirements-PAoRaJyb.js} +304 -336
- package/chunks/responsive.styles-DSiOGD7u.js +82 -0
- package/chunks/{shared-CBvcC5YV.js → shared-Bn4N5QcZ.js} +424 -424
- package/chunks/src-77e3mC7i.js +391 -0
- package/chunks/standalone-B55oyW6c.js +689 -0
- package/chunks/{standalone-C3gg736V.js → standalone-BDhPQtzQ.js} +375 -341
- package/chunks/{standalone-BMIbT1b2.js → standalone-BGkmozIb.js} +992 -837
- package/chunks/standalone-BMTCb10X.js +179 -0
- package/chunks/standalone-BXKRE_Se.js +468 -0
- package/chunks/standalone-Bes8srx1.js +354 -0
- package/chunks/standalone-BjZp0QMe.js +2 -0
- package/chunks/{standalone-JuLF-OoH.js → standalone-BlMIwpEe.js} +634 -519
- package/chunks/{standalone-C_rYnZ0N.js → standalone-C8ZAEutO.js} +43 -42
- package/chunks/standalone-C8qAelL4.js +2 -0
- package/chunks/standalone-CJvIXsQE.js +743 -0
- package/chunks/standalone-CLmGb7nn2.js +355 -0
- package/chunks/standalone-CM5XcAN5.js +52327 -0
- package/chunks/standalone-CXNP6-xD.js +420 -0
- package/chunks/{standalone-vzBY6q0I2.js → standalone-D5Q5ngsD.js} +57 -55
- package/chunks/standalone-DLlyRIE6.js +287 -0
- package/chunks/standalone-DMcI1afI.js +396 -0
- package/chunks/{standalone-DC-aUgXC.js → standalone-DN4S1MjT.js} +1111 -1092
- package/chunks/standalone-DT0wKji7.js +6 -0
- package/chunks/{standalone-0M4HlmDW2.js → standalone-DVTJwsTY.js} +1109 -1035
- package/chunks/standalone-DW6NT205.js +518 -0
- package/chunks/standalone-DYQIQH4c.js +2095 -0
- package/chunks/standalone-D__XCp-h.js +1003 -0
- package/chunks/standalone-XTgSsTAa.js +354 -0
- package/chunks/{standalone-v1oxfU20.js → standalone-XuGksArp.js} +20 -20
- package/chunks/{standalone-BtSHCp2U2.js → standalone-we5D5MIn.js} +173 -168
- package/chunks/{table.compiler-tb914oj3.js → table.compiler-DMeeHxb6.js} +29 -29
- package/chunks/useFieldName-Cjn9KCVp.js +7 -0
- package/chunks/useSlotProps-DLbQp4lc.js +166 -0
- package/chunks/{utils-Bg7K-t6K.js → utils-vdmi_2PK.js} +6271 -7804
- package/chunks/{view-Bn83C8d9.js → view-BuwQugKb.js} +2717 -3504
- package/chunks/{isEqual-BDxAhUo8.js → visualization-filters-Cc4KU-l-.js} +1887 -1946
- package/chunks/web-components-DqClFkgO.js +1185 -0
- package/chunks/with-html-element-D0uY2zjI.js +7328 -0
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +31 -14
- package/docs/operations/combo.md +1 -1
- package/docs/operations/date-picker.md +3 -3
- package/docs/operations/distribution-gauge.md +13 -13
- package/docs/operations/dot.md +13 -13
- package/docs/operations/filter.md +1 -1
- package/docs/operations/gauge.md +13 -13
- package/docs/operations/heatMap.md +13 -13
- 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 +3 -3
- package/docs/operations/line.md +7 -7
- package/docs/operations/number.md +1 -1
- package/docs/operations/pie.md +13 -13
- package/docs/operations/radar.md +7 -7
- package/docs/operations/sankey.md +13 -13
- package/docs/operations/scatter.md +13 -13
- 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 +18 -1
- package/docs/operations/tree.md +51 -37
- package/docs/operations/treemap.md +63 -49
- package/docs/operations/waterfall.md +1 -1
- package/docs/operations/word-cloud.md +13 -13
- package/getters.js +7 -7
- package/index.js +3 -1183
- package/metadata.js +18 -18
- package/operations.js +13 -13
- package/package.json +106 -55
- package/render.js +10 -0
- package/src/charts/bar.d.ts +1 -0
- package/src/charts/combo.d.ts +1 -0
- package/src/charts/dot.d.ts +1 -0
- package/src/charts/gauge-distribution.d.ts +1 -0
- package/src/charts/gauge.d.ts +1 -0
- package/src/charts/heat-map.d.ts +1 -0
- package/src/charts/histogram.d.ts +1 -0
- package/src/charts/line.d.ts +1 -0
- package/src/charts/pie.d.ts +1 -0
- package/src/charts/radar.d.ts +1 -0
- package/src/charts/sankey.d.ts +1 -0
- package/src/charts/scatter.d.ts +1 -0
- package/src/charts/table.d.ts +1 -0
- package/src/charts/tree.d.ts +1 -0
- package/src/charts/treemap.d.ts +1 -0
- package/src/charts/waterfall.d.ts +1 -0
- package/src/charts/word-cloud.d.ts +1 -0
- package/src/definitions/index.d.ts +1 -1
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +53 -30
- package/src/definitions/model/definitions/index.d.ts +1 -1
- package/src/definitions/model/definitions/schema-registry.d.ts +2 -2
- package/src/definitions/model/definitions/schemas/object.schema.d.ts +2 -2
- package/src/definitions/model/definitions/types/compilation.types.d.ts +10 -0
- package/src/definitions/model/definitions/types/index.d.ts +1 -1
- package/src/getters/index.d.ts +3 -3
- package/src/index.d.ts +1 -1
- package/src/objects/app-filter-bar.d.ts +1 -0
- package/src/objects/date-picker.d.ts +1 -0
- package/src/objects/filter.d.ts +1 -0
- package/src/objects/iframe.d.ts +1 -0
- package/src/objects/image.d.ts +1 -0
- package/src/objects/number.d.ts +1 -0
- package/src/objects/shape.d.ts +1 -0
- package/src/objects/slider.d.ts +1 -0
- package/src/objects/text.d.ts +1 -0
- package/src/operations/index.d.ts +3 -3
- package/src/registry/create-visualization-registry.d.ts +5 -0
- package/src/render/index.d.ts +34 -0
- package/src/runtime/index.d.ts +2 -2
- package/src/types.d.ts +9 -4
- package/src/web-components/index.d.ts +3 -3
- package/chunks/ClickAwayListener-BbeNMAvj.js +0 -52
- package/chunks/builder-B6dWSIdD.js +0 -12289
- package/chunks/coloring-B1XAfg6b.js +0 -664
- package/chunks/events-WZut5Ow6.js +0 -4
- package/chunks/grouping-type-On4s9Thj.js +0 -3
- package/chunks/requirements-DYjZCFyf.js +0 -6
- package/chunks/standalone-0ashe9w1.js +0 -411
- package/chunks/standalone-B7jax8wa.js +0 -339
- package/chunks/standalone-BK0VYU-l.js +0 -463
- package/chunks/standalone-BZV5vOwA.js +0 -6
- package/chunks/standalone-BhDrWj4p.js +0 -1980
- package/chunks/standalone-BvaKdky9.js +0 -344
- package/chunks/standalone-BwtM31-f.js +0 -2
- package/chunks/standalone-CC1VUjO32.js +0 -299
- package/chunks/standalone-CoLrAxRV.js +0 -13198
- package/chunks/standalone-DCtRoTWg.js +0 -675
- package/chunks/standalone-DUDFTBqL.js +0 -833
- package/chunks/standalone-DhZkX9Td.js +0 -2
- package/chunks/standalone-DtLElfuM.js +0 -512
- package/chunks/standalone-G9Q4Uczu.js +0 -726
- package/chunks/standalone-_DeX21JJ.js +0 -383
- package/chunks/standalone-gFhKZh8m.js +0 -179
- package/chunks/standalone-tDNy-SFH.js +0 -281
- package/chunks/ui-DQWtv2iM.js +0 -63551
- package/chunks/useFieldName-BvdcoJRl.js +0 -7
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
+
import { $i as t, Ds as n, Us as r, Xa as i, _c as a, fs as o, hn as s, mr as c, ws as l, zi as u, zr as d } from "./visualization-filters-Cc4KU-l-.js";
|
|
3
|
+
import { Ei as f, N as p, Xt as m, o as h, ri as g } from "./utils-vdmi_2PK.js";
|
|
4
|
+
import { Mm as _, hm as v } from "./handlers-TOT-7INo.js";
|
|
5
|
+
import { t as y } from "./label-format-type-weq1XfcX.js";
|
|
6
|
+
import "./logger-DpQtYQnX.js";
|
|
7
|
+
import { Bt as b, Et as x, F as S, I as C, Kt as w, R as T, Yt as E, at as D, cn as O, ct as ee, et as k, i as A, in as j, it as te, ln as ne, n as re, nt as ie, st as ae, tt as oe, un as se, vn as M, xt as N, yt as P, z as F } from "./escobar-DRhRMYRE.js";
|
|
8
|
+
import { _ as I } from "./MenuOption-ByRqhRdX.js";
|
|
9
|
+
import { t as L } from "./coloring-CncX_JRX.js";
|
|
10
|
+
import { t as R } from "./set-coloring-datafield-B3uIS1Pe.js";
|
|
11
|
+
var z = /* @__PURE__ */ e(f()), B = (e, i, a) => {
|
|
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 = r(u[0]?.dataItem) : e.coloring?.type === n.Categorical && (s = r(c[0]?.dataItem))), P(a, 0, { color: { field: s } });
|
|
14
|
+
let p = x(R(e, s ?? null), i, {});
|
|
15
|
+
if (f.length > 0) {
|
|
16
|
+
let e = r(f[0]?.dataItem);
|
|
17
|
+
p[e] = { data: { field: e } };
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
...a,
|
|
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, i) => {
|
|
26
|
+
if (!e.dimensions[0]) return i;
|
|
27
|
+
let a = e.measures.filter((e) => d(e)), o = C((e.supportingMeasures ?? []).filter((e) => d(e))), s = e.dimensions.filter((e) => d(e))?.[0], c = a.filter((e) => e.role === t.PIE_CHART_SLICE)?.[0], l = a.filter((e) => e.role === t.PIE_CHART_LENGTH)?.[0], u = r(c?.dataItem), f = r(l?.dataItem), p = r(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: O.Collection,
|
|
35
|
+
data: { extract: [{
|
|
36
|
+
field: p,
|
|
37
|
+
props: m
|
|
38
|
+
}] }
|
|
39
|
+
}];
|
|
40
|
+
return {
|
|
41
|
+
...i,
|
|
42
|
+
collections: h
|
|
43
|
+
};
|
|
44
|
+
}, U = "pie-alternates-switcher", W = "pie-alternates-switcher", G = (e) => s(e) || e.label || e.dataItem?.name || "Field", K = (e, t, n, i) => {
|
|
45
|
+
let o = n ? r(n.dataItem) : void 0;
|
|
46
|
+
return {
|
|
47
|
+
type: "native",
|
|
48
|
+
key: `${W}-interaction`,
|
|
49
|
+
events: { click(r) {
|
|
50
|
+
let s = this.element.getBoundingClientRect(), c = {
|
|
51
|
+
x: r.clientX - s.left,
|
|
52
|
+
y: r.clientY - s.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 && o) {
|
|
61
|
+
i(M.Text, "click", `text-${o}`, r, l, {
|
|
62
|
+
dataItemType: a.Measure,
|
|
63
|
+
dataItemRole: n.role
|
|
64
|
+
});
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
l?.data?.target === "dimension" && e && i(M.Text, "click", `text-${e}`, r, l, {
|
|
68
|
+
dataItemType: a.Dimension,
|
|
69
|
+
dataItemRole: t
|
|
70
|
+
});
|
|
71
|
+
} }
|
|
72
|
+
};
|
|
73
|
+
}, ce = (e, n, o, s, l, u, f, p) => {
|
|
74
|
+
let m = c(e.dimensions, e.enableAlternate, u?.isPrintMode), h = e.dimensions.filter((e) => d(e)), g = h[0], _ = g ? r(g.dataItem) : void 0, v = e.measures.filter((e) => e.role === t.PIE_CHART_SLICE), y = c(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 o;
|
|
76
|
+
let C = {
|
|
77
|
+
type: U,
|
|
78
|
+
key: W,
|
|
79
|
+
dimensionDataItemType: _ ? a.Dimension : void 0,
|
|
80
|
+
dimensionDataItemRole: g?.role,
|
|
81
|
+
measureDataItemType: b ? a.Measure : void 0,
|
|
82
|
+
measureDataItemRole: b?.role,
|
|
83
|
+
layout: {
|
|
84
|
+
dock: i.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: `${ne.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
|
+
...o,
|
|
101
|
+
components: [...o.components, C],
|
|
102
|
+
interactions: o.interactions ? [...o.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, i, a, 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(r(p.dataItem))(e.datum.rad.value) * (t - n) + n;
|
|
126
|
+
}
|
|
127
|
+
let x = {
|
|
128
|
+
type: M.Pie,
|
|
129
|
+
key: `${M.Pie}`,
|
|
130
|
+
data: { collection: O.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
|
+
...i,
|
|
148
|
+
components: [...i.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(ee)(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: M.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: `${M.Pie}`,
|
|
173
|
+
selector: se.Path,
|
|
174
|
+
strategy: {
|
|
175
|
+
type: "slice",
|
|
176
|
+
settings: {
|
|
177
|
+
fontSize: j(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, i) => {
|
|
199
|
+
let a = n.data[t]?.value, o = s(e) || e.label || e.dataItem.name || "", c = a;
|
|
200
|
+
return !i && e.formatter ? c = r.formatter(e.formatter)(a, void 0, n.data) : i && (c = r.formatter(ae(e.formatter))(a, void 0, n.data)), {
|
|
201
|
+
label: o,
|
|
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 === M.Pie),
|
|
207
|
+
placement: {
|
|
208
|
+
type: "slice",
|
|
209
|
+
area: "target"
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
if (o) return k(e, n, r, s, "tooltip", a);
|
|
213
|
+
let c = D(e, a), l = oe(e, n, pe, ie, a?.[0]?.sum, c);
|
|
214
|
+
return k(e, n, r, {
|
|
215
|
+
...s,
|
|
216
|
+
extract: l
|
|
217
|
+
}, "tooltip", a);
|
|
218
|
+
}, pe = (e, t, n, i, a, o, s, c) => {
|
|
219
|
+
let l = [], u = e.filter(d), f = te(n), p = u.filter((e) => !f.has(r(e.dataItem)))?.[0] ?? u?.[0], m = Object.keys(t.data).find((e) => t.data[e]?.source?.field === r(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(r(e.dataItem))).forEach((e) => {
|
|
224
|
+
let i = r(e.dataItem), a = Object.keys(t.data).find((e) => t.data[e]?.source?.field === i);
|
|
225
|
+
a && l.push(Y(e, a, 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 i = e.find((e) => e.role === t.PIE_CHART_SLICE && d(e));
|
|
335
|
+
if (!i) return;
|
|
336
|
+
let a = r(i.dataItem);
|
|
337
|
+
return n.reduce((e, t) => e + t[a], 0);
|
|
338
|
+
}, ve = g(), ye = m(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
|
|
339
|
+
let a = p(), [s] = (0, z.useState)(() => new me()), { activeKey: c } = h(), d = re();
|
|
340
|
+
if (!e || !o(e) || !n || !r) return null;
|
|
341
|
+
let f = {
|
|
342
|
+
...i,
|
|
343
|
+
valuePickerMode: !!c
|
|
344
|
+
}, m = t || u;
|
|
345
|
+
n[0] && (n[0].sum = _e(e.measures, n[0].items));
|
|
346
|
+
let g = s.compile(e, m, n, r, f, l.Pie, a, void 0, d);
|
|
347
|
+
return g ? /* @__PURE__ */ (0, ve.jsx)(A, {
|
|
348
|
+
config: f,
|
|
349
|
+
definition: g,
|
|
350
|
+
size: r,
|
|
351
|
+
vSpec: e,
|
|
352
|
+
escobarPlugins: [$]
|
|
353
|
+
}) : null;
|
|
354
|
+
});
|
|
355
|
+
export { ye as PieChart };
|