@astrato-io/visualizations 0.9.0 → 0.10.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 +8 -4
- package/THIRD_PARTY_NOTICES.md +163 -14
- package/VISUALIZATION_DEFINITIONS.md +319 -32
- package/chunks/{Button-5CxPEACP.js → Button-CCF851ea.js} +4 -4
- package/chunks/{CircularProgress-DFS-LQb7.js → CircularProgress-yupH6YWs.js} +39 -39
- package/chunks/FieldTypeIcon-D_MzsdfY.js +22 -0
- package/chunks/{LinearProgress-CjIQfkNA.js → LinearProgress-CyFjN4px.js} +9 -9
- package/chunks/{MenuOption-Cb7B7x6z.js → MenuOption-CQpT79AP.js} +143 -142
- package/chunks/{Title-CtFw1bVg.js → Title-C-p4ZarD.js} +22 -22
- package/chunks/_createAggregator-BF4qG9XK.js +50 -0
- package/chunks/{app-filter-bar.compiler-B9775gLJ.js → app-filter-bar.compiler-8fxCo2q7.js} +10 -10
- package/chunks/bar-layout-DStC-GNV.js +9 -0
- package/chunks/{bar.compiler-B7wlH_Ro.js → bar.compiler-CQAu8KL8.js} +102 -84
- package/chunks/{builder-Dxo7D7c6.js → builder-CScg1TOS.js} +71 -38
- package/chunks/color-rules-DYJL4fIW.js +15 -0
- package/chunks/color-settings-DJFoFTip.js +5 -0
- package/chunks/{coloring-B-Wa8D5P.js → coloring-9jU3s_-p.js} +41 -41
- package/chunks/createSimplePaletteValueFilter-C4hZpCdn.js +2005 -0
- package/chunks/defaults-cyNhn37t.js +3 -0
- package/chunks/{definitions-DNpzD9tY.js → definitions-C4grxhye.js} +613 -401
- package/chunks/{escobar-C4Nm3eJ7.js → escobar-CjirINHP.js} +5326 -5079
- package/chunks/{extend-preset-BVKFtoe-.js → extend-preset-D-l9u_we.js} +974 -909
- package/chunks/{filter.compiler-BlS3zoy_.js → filter.compiler-lji2Acgn.js} +10 -10
- package/chunks/{filtering-CGuLpg7u.js → filtering-C1zakrrX.js} +385 -429
- package/chunks/handlers-ZviIUC-j.js +15387 -0
- package/chunks/{icon-picker-styles-DYQgVEKG.js → icon-picker-styles-Bj80ZUBK.js} +11 -11
- package/chunks/isEqual-Ch9OEye3.js +16 -0
- package/chunks/{isFocusVisible-B1_z03UT.js → isFocusVisible-CgMP0qkR.js} +1 -1
- package/chunks/label-format-type-C46pzgx7.js +17 -0
- package/chunks/{line.compiler-Bo9i9qag.js → line.compiler-De5fiKuR.js} +9 -9
- package/chunks/{logger-3lng-wOw.js → logger-CKRjhSHQ.js} +71 -64
- package/chunks/map.compiler-CKzorLgK.js +345 -0
- package/chunks/{metadata-Fmx1swpK.js → metadata-Bb9pTXrq.js} +1 -1
- package/chunks/{number.compiler-CdLd5aGW.js → number.compiler-CaTmJkmi.js} +7 -7
- package/chunks/operations-DZoY50VX.js +31297 -0
- package/chunks/{range-CzO4isKK.js → range-D1BTmFMp.js} +2 -2
- package/chunks/{react-dom-BwZT0N3F.js → react-dom-Dgv2azN2.js} +70 -70
- package/chunks/{render-wrappers-CAuvgMxi.js → render-wrappers-_P3xwu5A.js} +1 -1
- package/chunks/{requirements-CYpVh65U.js → requirements-NHNrR8Ie.js} +59 -57
- package/chunks/shared-UitWpq1J.js +1331 -0
- package/chunks/{standalone-CoQxJ6ov.js → standalone-B0U6c3su.js} +804 -804
- package/chunks/{standalone-C6XDHYAM.js → standalone-BBu90BhK.js} +109 -109
- package/chunks/standalone-BEekPuA12.js +357 -0
- package/chunks/{standalone-CPUiiWNP.js → standalone-BOzHA_d4.js} +41 -41
- package/chunks/standalone-BR2JuRIC.js +422 -0
- package/chunks/{standalone-DuwTOBXH.js → standalone-BapqaniK.js} +592 -592
- package/chunks/{standalone-DWPfdP0A.js → standalone-Bnnr87pc.js} +523 -523
- package/chunks/standalone-BwJqDj2Z.js +396 -0
- package/chunks/{standalone-LFVgLhia.js → standalone-ByKKqT5L.js} +266 -258
- package/chunks/{standalone-BDrQMxLi.js → standalone-CRdDZYeM.js} +1788 -1004
- package/chunks/standalone-CRfDOO1x.js +287 -0
- package/chunks/{standalone-BvWdpUL3.js → standalone-CVknVdUC.js} +21 -18
- package/chunks/standalone-CbPk8bKn.js +580 -0
- package/chunks/{standalone-r4ObFvys.js → standalone-Ck63MZzj.js} +218 -216
- package/chunks/{standalone-Cu73fzSr.js → standalone-DCFY1MAV.js} +6040 -5820
- package/chunks/{standalone-CiaaibTa.js → standalone-DZDGX3aa.js} +174 -174
- package/chunks/standalone-DhfgeJIk.js +1012 -0
- package/chunks/standalone-DibjA73M.js +6 -0
- package/chunks/{standalone-CXniic5x.js → standalone-DtBk_iUz.js} +6 -5
- package/chunks/standalone-DxBAyqAu.js +772 -0
- package/chunks/standalone-KMQPsNsq.js +2 -0
- package/chunks/standalone-MBLSvsrY.js +2 -0
- package/chunks/standalone-U0WJwFlG.js +354 -0
- package/chunks/{standalone-CNkHsynO.js → standalone-swGs70tD.js} +54 -56
- package/chunks/standalone-wgFAVnnm.js +355 -0
- package/chunks/standalone-xGV0dqPV.js +689 -0
- package/chunks/{table.compiler-C1qjqXaT.js → table.compiler-OWSx5MOq.js} +4 -4
- package/chunks/{useFieldName-mWrD_uk_.js → useFieldName-B8iCYyw1.js} +1 -1
- package/chunks/{utils-DYYD4Zzf.js → utils-3Igg6xmO.js} +4740 -4737
- package/chunks/{view-7fH6mGmY.js → view-DdMLZySj.js} +1988 -1632
- package/chunks/{visualization-filters-mVnsnvLP.js → visualization-filters-CzvFHE6M.js} +3158 -2417
- package/chunks/{with-html-element-B0Clt4jY.js → with-html-element-DOfkR3C1.js} +3353 -3160
- 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 +262 -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 +507 -459
- package/metadata.js +2 -2
- package/operations.js +5 -5
- package/package.json +72 -67
- package/src/definitions/index.d.ts +1 -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 +188 -2
- 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 +7 -2
- 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 +45 -41
- 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-5DnapeHH.js +0 -420
- package/chunks/standalone-B4jrf4KE.js +0 -354
- package/chunks/standalone-B6s_xG2u.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-DBeXQrwH.js +0 -468
- package/chunks/standalone-DMCwtebn.js +0 -396
- 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
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
+
import { Fo as t, Pc as n, Qr as r, Ra as i, cl as a, hc as o, in as s, oa as c, rc as l, rr as u, vc as d } from "./visualization-filters-CzvFHE6M.js";
|
|
3
|
+
import { N as f, ci as p, jt as m, s as h, zr as g } from "./utils-3Igg6xmO.js";
|
|
4
|
+
import { t_ as _, v_ as v } from "./handlers-ZviIUC-j.js";
|
|
5
|
+
import { t as y } from "./label-format-type-C46pzgx7.js";
|
|
6
|
+
import "./logger-CKRjhSHQ.js";
|
|
7
|
+
import { B as b, Dt as x, I as S, L as C, St as w, Vt as T, Xt as E, at as ee, bt as te, cn as D, ct as O, i as k, in as A, ln as j, lt as ne, n as re, nt as ie, ot as ae, qt as M, rt as oe, tt as N, un as se, vn as P, z as F } from "./escobar-CjirINHP.js";
|
|
8
|
+
import { _ as I } from "./MenuOption-CQpT79AP.js";
|
|
9
|
+
import { t as L } from "./coloring-9jU3s_-p.js";
|
|
10
|
+
import { t as R } from "./set-coloring-datafield-B3uIS1Pe.js";
|
|
11
|
+
var z = /* @__PURE__ */ e(p()), B = (e, t, a) => {
|
|
12
|
+
let { coloring: o } = e || {}, s = o?.fieldId, c = e.dimensions.filter((e) => r(e)), l = e.measures.filter((e) => r(e)), u = l.filter((e) => e.role === i.PIE_CHART_SLICE), f = l.filter((e) => e.role === i.PIE_CHART_LENGTH);
|
|
13
|
+
s || (e.coloring?.type === d.Gradient ? s = n(u[0]?.dataItem) : e.coloring?.type === d.Categorical && (s = n(c[0]?.dataItem))), te(a, 0, { color: { field: s } });
|
|
14
|
+
let p = x(R(e, s ?? null), t, {});
|
|
15
|
+
if (f.length > 0) {
|
|
16
|
+
let e = n(f[0]?.dataItem);
|
|
17
|
+
p[e] = { data: { field: e } };
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
...a,
|
|
21
|
+
scales: p
|
|
22
|
+
};
|
|
23
|
+
}, V = {
|
|
24
|
+
num: "num",
|
|
25
|
+
rad: "rad",
|
|
26
|
+
group: "group"
|
|
27
|
+
}, H = (e, t, a) => {
|
|
28
|
+
if (!e.dimensions[0]) return a;
|
|
29
|
+
let o = e.measures.filter((e) => r(e)), s = C((e.supportingMeasures ?? []).filter((e) => r(e))), c = e.dimensions.filter((e) => r(e))?.[0], l = o.filter((e) => e.role === i.PIE_CHART_SLICE)?.[0], u = o.filter((e) => e.role === i.PIE_CHART_LENGTH)?.[0], d = n(l?.dataItem), f = n(u?.dataItem), p = n(c?.dataItem), m = {
|
|
30
|
+
[V.num]: l?.dataItem?.name ? { field: d } : void 0,
|
|
31
|
+
[V.rad]: u?.dataItem?.name ? { field: f } : void 0,
|
|
32
|
+
...s
|
|
33
|
+
};
|
|
34
|
+
d && (m[d] = { field: d }), f && (m[f] = { field: f });
|
|
35
|
+
let h = [{
|
|
36
|
+
key: D.Collection,
|
|
37
|
+
data: { extract: [{
|
|
38
|
+
field: p,
|
|
39
|
+
props: m
|
|
40
|
+
}] }
|
|
41
|
+
}];
|
|
42
|
+
return {
|
|
43
|
+
...a,
|
|
44
|
+
collections: h
|
|
45
|
+
};
|
|
46
|
+
}, U = "pie-alternates-switcher", W = "pie-alternates-switcher", G = (e) => s(e) || e.label || e.dataItem?.name || "Field", K = (e, t, r, i) => {
|
|
47
|
+
let o = r ? n(r.dataItem) : void 0;
|
|
48
|
+
return {
|
|
49
|
+
type: "native",
|
|
50
|
+
key: `${W}-interaction`,
|
|
51
|
+
events: { click(n) {
|
|
52
|
+
let s = this.element.getBoundingClientRect(), c = {
|
|
53
|
+
x: n.clientX - s.left,
|
|
54
|
+
y: n.clientY - s.top
|
|
55
|
+
}, l = this.chart.shapesAt(c, {
|
|
56
|
+
components: [{
|
|
57
|
+
key: W,
|
|
58
|
+
propagation: "stop"
|
|
59
|
+
}],
|
|
60
|
+
propagation: "stop"
|
|
61
|
+
}).find((e) => e.data?.target === "measure" || e.data?.target === "dimension");
|
|
62
|
+
if (l?.data?.target === "measure" && r && o) {
|
|
63
|
+
i(P.Text, "click", `text-${o}`, n, l, {
|
|
64
|
+
dataItemType: a.Measure,
|
|
65
|
+
dataItemRole: r.role
|
|
66
|
+
});
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
l?.data?.target === "dimension" && e && i(P.Text, "click", `text-${e}`, n, l, {
|
|
70
|
+
dataItemType: a.Dimension,
|
|
71
|
+
dataItemRole: t
|
|
72
|
+
});
|
|
73
|
+
} }
|
|
74
|
+
};
|
|
75
|
+
}, ce = (e, o, s, c, l, d, f, p) => {
|
|
76
|
+
let m = u(e.dimensions, e.enableAlternate, d?.isPrintMode), h = e.dimensions.filter((e) => r(e)), g = h[0], _ = g ? n(g.dataItem) : void 0, v = e.measures.filter((e) => e.role === i.PIE_CHART_SLICE), y = u(v, e.enableAlternate, d?.isPrintMode), b = v.filter((e) => r(e))[0], x = m && h.length ? h.map((e) => G(e)).join(", ") : void 0, S = y && b ? G(b) : void 0;
|
|
77
|
+
if (!x && !S) return s;
|
|
78
|
+
let C = {
|
|
79
|
+
type: U,
|
|
80
|
+
key: W,
|
|
81
|
+
dimensionDataItemType: _ ? a.Dimension : void 0,
|
|
82
|
+
dimensionDataItemRole: g?.role,
|
|
83
|
+
measureDataItemType: b ? a.Measure : void 0,
|
|
84
|
+
measureDataItemRole: b?.role,
|
|
85
|
+
layout: {
|
|
86
|
+
dock: t.Bottom,
|
|
87
|
+
displayOrder: 0
|
|
88
|
+
},
|
|
89
|
+
settings: {
|
|
90
|
+
dimensionLabel: x ? M(x) : void 0,
|
|
91
|
+
measureLabel: S ? M(S) : void 0,
|
|
92
|
+
fontFamily: o.fonts.general.fontFamily ?? void 0,
|
|
93
|
+
fontSize: `${j.fieldTitle.fontSize}px`,
|
|
94
|
+
color: o.fonts.general.color,
|
|
95
|
+
paddingLeft: 5,
|
|
96
|
+
paddingRight: 5,
|
|
97
|
+
paddingVertical: 5,
|
|
98
|
+
labelGap: 12
|
|
99
|
+
}
|
|
100
|
+
}, w = p ? [K(_, g?.role, b, p)] : [];
|
|
101
|
+
return {
|
|
102
|
+
...s,
|
|
103
|
+
components: [...s.components, C],
|
|
104
|
+
interactions: s.interactions ? [...s.interactions, ...w] : w
|
|
105
|
+
};
|
|
106
|
+
}, q = {
|
|
107
|
+
outerRadius: .8,
|
|
108
|
+
outerRadiusWithoutLabels: .95,
|
|
109
|
+
cornerRadius: _.pie,
|
|
110
|
+
strokeWidth: 0,
|
|
111
|
+
strokeEnabled: !1,
|
|
112
|
+
strokeColor: "#C6C6C6",
|
|
113
|
+
multiMeasureMinRadius: .3,
|
|
114
|
+
donut: {
|
|
115
|
+
innerRadius: .55,
|
|
116
|
+
cornerRadius: _.donut,
|
|
117
|
+
multiMeasureMinRadius: .6
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
function J(e) {
|
|
121
|
+
return e.pieSettings?.donut ?? !1;
|
|
122
|
+
}
|
|
123
|
+
var le = (e, t, a, o, s, c) => {
|
|
124
|
+
let l = e.measures.filter((e) => r(e)), u = l.filter((e) => e.role === i.PIE_CHART_SLICE), d = l.filter((e) => e.role === i.PIE_CHART_LENGTH), f = u[0], p = d[0], m = new L(e, t, s?.[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;
|
|
125
|
+
if (p) {
|
|
126
|
+
let t = g, r = J(e) ? q.donut.multiMeasureMinRadius : q.multiMeasureMinRadius;
|
|
127
|
+
g = (e) => e.resources.scale(n(p.dataItem))(e.datum.rad.value) * (t - r) + r;
|
|
128
|
+
}
|
|
129
|
+
let x = {
|
|
130
|
+
type: P.Pie,
|
|
131
|
+
key: `${P.Pie}`,
|
|
132
|
+
data: { collection: D.Collection },
|
|
133
|
+
animations: {
|
|
134
|
+
enabled: !0,
|
|
135
|
+
presetId: "pie-chart"
|
|
136
|
+
},
|
|
137
|
+
settings: { slice: {
|
|
138
|
+
arc: { ref: "num" },
|
|
139
|
+
stroke: b,
|
|
140
|
+
strokeWidth: v ? y : 0,
|
|
141
|
+
cornerRadius: _,
|
|
142
|
+
innerRadius: h,
|
|
143
|
+
outerRadius: g,
|
|
144
|
+
fill: m.getColorDefinition({ ref: "color" })
|
|
145
|
+
} },
|
|
146
|
+
brush: E([""], c, { valuePickerMode: c?.valuePickerMode })
|
|
147
|
+
};
|
|
148
|
+
return {
|
|
149
|
+
...a,
|
|
150
|
+
components: [...a.components, x]
|
|
151
|
+
};
|
|
152
|
+
}, ue = (e, t, n) => ({ data: i, formatter: a }) => {
|
|
153
|
+
let o = e.dimensions.filter((e) => r(e))[0], s = i.value, c = i[V.num].value, l = o.formatter && s && a ? a(o.formatter)(s) : `${s}`, u = t.formatter && c && a ? a(t.formatter)(c, void 0, i) : `${c}`, d = c != null && n && a ? a(ne)(c / n) : null, f = () => t.dataLabels?.measureLabelFormat === v.Percentage ? d === null ? [] : [d] : t.dataLabels?.measureLabelFormat === v.ValueAndPercentage ? d === null ? [u] : [u, d] : [u];
|
|
154
|
+
switch (t.dataLabels?.labelFormat) {
|
|
155
|
+
case y.Measure: {
|
|
156
|
+
let e = f();
|
|
157
|
+
return e.length <= 1 ? e[0] ?? null : e;
|
|
158
|
+
}
|
|
159
|
+
case y.DimensionAndMeasure: return [l, ...f()];
|
|
160
|
+
default: return l;
|
|
161
|
+
}
|
|
162
|
+
}, de = (e, t, n, a, o, s) => {
|
|
163
|
+
let c = e.dimensions.filter((e) => r(e)), l = e.measures.filter((e) => r(e)), u = c[0], d = l.find((e) => e.role === i.PIE_CHART_SLICE) ?? l[0];
|
|
164
|
+
if (!u || !d || !d.dataLabels?.show) return n;
|
|
165
|
+
let f = new I(t.fonts.general.color), p = d.dataLabels.showBackdrop ? F(d.dataLabels.backdropColor ? { fill: d.dataLabels.backdropColor } : void 0) : void 0, m = p ? b(f) : d.dataLabels.textColor || "#000", { strokeEnabled: h, strokeWidth: g = q.strokeWidth } = e.pieSettings, _ = h ? g / 2 : 0, v = {
|
|
166
|
+
type: P.Labels,
|
|
167
|
+
key: "pie-labels",
|
|
168
|
+
animations: {
|
|
169
|
+
enabled: !0,
|
|
170
|
+
presetId: "chart-labels"
|
|
171
|
+
},
|
|
172
|
+
layout: { displayOrder: T.Labels },
|
|
173
|
+
settings: { sources: [{
|
|
174
|
+
component: `${P.Pie}`,
|
|
175
|
+
selector: se.Path,
|
|
176
|
+
strategy: {
|
|
177
|
+
type: "slice",
|
|
178
|
+
settings: {
|
|
179
|
+
fontSize: A(d.dataLabels.size),
|
|
180
|
+
fontFamily: t.fonts.general.fontFamily,
|
|
181
|
+
labels: [{
|
|
182
|
+
label: ue(e, d, o?.[0]?.sum),
|
|
183
|
+
placements: [{
|
|
184
|
+
position: "outside",
|
|
185
|
+
fill: m,
|
|
186
|
+
backdrop: p
|
|
187
|
+
}],
|
|
188
|
+
strokeDelta: _,
|
|
189
|
+
linkData: ({ data: e }) => e
|
|
190
|
+
}]
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}] },
|
|
194
|
+
brush: E([""], s, { valuePickerMode: s?.valuePickerMode })
|
|
195
|
+
};
|
|
196
|
+
return {
|
|
197
|
+
...n,
|
|
198
|
+
components: [...n.components, v]
|
|
199
|
+
};
|
|
200
|
+
}, Y = (e, t, n, r, i) => {
|
|
201
|
+
let a = n.data[t]?.value, o = s(e) || e.label || e.dataItem.name || "", c = a;
|
|
202
|
+
return !i && e.formatter ? c = r.formatter(e.formatter)(a, void 0, n.data) : i && (c = r.formatter(O(e.formatter))(a, void 0, n.data)), {
|
|
203
|
+
label: o,
|
|
204
|
+
value: c
|
|
205
|
+
};
|
|
206
|
+
}, fe = (e, t, n, a, o) => {
|
|
207
|
+
let s = !!e.measures.filter(r).filter((e) => e.role === i.PIE_CHART_LENGTH)?.[0], c = {
|
|
208
|
+
filter: (e) => e.filter((e) => e.key === P.Pie),
|
|
209
|
+
placement: {
|
|
210
|
+
type: "slice",
|
|
211
|
+
area: "target"
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
if (s) return N(e, t, n, c, "tooltip", o);
|
|
215
|
+
let l = ae(e, o), u = ie(e, t, pe, oe, o?.[0]?.sum, l);
|
|
216
|
+
return N(e, t, n, {
|
|
217
|
+
...c,
|
|
218
|
+
extract: u
|
|
219
|
+
}, "tooltip", o);
|
|
220
|
+
}, pe = (e, t, i, a, o, s, c, l) => {
|
|
221
|
+
let u = [], d = e.filter(r), f = ee(i), p = d.filter((e) => !f.has(n(e.dataItem)))?.[0] ?? d?.[0], m = Object.keys(t.data).find((e) => t.data[e]?.source?.field === n(p?.dataItem));
|
|
222
|
+
if (!m || !p ? u.push({
|
|
223
|
+
label: "",
|
|
224
|
+
value: ""
|
|
225
|
+
}) : u.push(Y(p, m, t, i, l)), d.filter((e) => f.has(n(e.dataItem))).forEach((e) => {
|
|
226
|
+
let r = n(e.dataItem), a = Object.keys(t.data).find((e) => t.data[e]?.source?.field === r);
|
|
227
|
+
a && u.push(Y(e, a, t, i, l));
|
|
228
|
+
}), c) return u;
|
|
229
|
+
let h = Object.values(s ?? {}).reduce((e, t) => e + Number(t), 0);
|
|
230
|
+
return u.push({
|
|
231
|
+
label: "Total",
|
|
232
|
+
value: p?.formatter ? i.formatter(p.formatter)(h) : h
|
|
233
|
+
}), u;
|
|
234
|
+
}, me = class extends S {
|
|
235
|
+
constructor() {
|
|
236
|
+
super([
|
|
237
|
+
H,
|
|
238
|
+
B,
|
|
239
|
+
le,
|
|
240
|
+
ce,
|
|
241
|
+
de,
|
|
242
|
+
w,
|
|
243
|
+
fe
|
|
244
|
+
]);
|
|
245
|
+
}
|
|
246
|
+
preCompile(e) {
|
|
247
|
+
let t = e.dimensions.filter((e) => r(e))?.[0], n = e.measures.filter((e) => r(e))?.[0];
|
|
248
|
+
if (!t || !n) throw Error("Charts w/o dimensions or measures are not supported ATM.");
|
|
249
|
+
}
|
|
250
|
+
}, X = " ▼", Z = "...", Q = (e, t, n, r) => e.measureText({
|
|
251
|
+
text: t,
|
|
252
|
+
fontFamily: n,
|
|
253
|
+
fontSize: r
|
|
254
|
+
}).width, he = (e, t, n, r, i) => {
|
|
255
|
+
if (t <= 0 || Q(n, e, r, i) <= t) return e;
|
|
256
|
+
let a = e.endsWith(X), o = a ? X : "", s = a ? e.slice(0, -2) : e;
|
|
257
|
+
if (Q(n, `${Z}${o}`, r, i) > t) return Z;
|
|
258
|
+
let c = 0, l = s.length;
|
|
259
|
+
for (; c < l;) {
|
|
260
|
+
let e = Math.ceil((c + l) / 2);
|
|
261
|
+
Q(n, `${s.slice(0, e)}${Z}${o}`, r, i) <= t ? c = e : l = e - 1;
|
|
262
|
+
}
|
|
263
|
+
return `${s.slice(0, c)}${Z}${o}`;
|
|
264
|
+
}, ge = {
|
|
265
|
+
require: ["renderer"],
|
|
266
|
+
defaultSettings: { settings: {
|
|
267
|
+
dimensionLabel: "",
|
|
268
|
+
measureLabel: "",
|
|
269
|
+
fontSize: "12px",
|
|
270
|
+
color: "#000",
|
|
271
|
+
paddingLeft: 5,
|
|
272
|
+
paddingRight: 5,
|
|
273
|
+
paddingVertical: 5,
|
|
274
|
+
labelGap: 12
|
|
275
|
+
} },
|
|
276
|
+
preferredSize() {
|
|
277
|
+
if (!this.renderer) return 0;
|
|
278
|
+
let { fontFamily: e = "Arial", fontSize: t, paddingVertical: n } = this.settings.settings;
|
|
279
|
+
return this.renderer.measureText({
|
|
280
|
+
fontFamily: e,
|
|
281
|
+
fontSize: t
|
|
282
|
+
}).height + n * 2;
|
|
283
|
+
},
|
|
284
|
+
render() {
|
|
285
|
+
let { renderer: e } = this;
|
|
286
|
+
if (!e) return [];
|
|
287
|
+
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 = [];
|
|
288
|
+
return n && h.push({
|
|
289
|
+
type: "rect",
|
|
290
|
+
x: Math.max(d, 0),
|
|
291
|
+
y: 0,
|
|
292
|
+
width: Math.min(l, this.rect.width),
|
|
293
|
+
height: this.rect.height,
|
|
294
|
+
fill: "rgba(0, 0, 0, 0)",
|
|
295
|
+
strokeWidth: 0,
|
|
296
|
+
data: { target: "measure" }
|
|
297
|
+
}), t && (h.push({
|
|
298
|
+
type: "rect",
|
|
299
|
+
x: o,
|
|
300
|
+
y: 0,
|
|
301
|
+
width: m,
|
|
302
|
+
height: this.rect.height,
|
|
303
|
+
fill: "rgba(0, 0, 0, 0)",
|
|
304
|
+
strokeWidth: 0,
|
|
305
|
+
data: { target: "dimension" }
|
|
306
|
+
}), h.push({
|
|
307
|
+
type: "text",
|
|
308
|
+
text: p,
|
|
309
|
+
x: o,
|
|
310
|
+
y: this.rect.height / 2,
|
|
311
|
+
anchor: "start",
|
|
312
|
+
baseline: "central",
|
|
313
|
+
fontFamily: r,
|
|
314
|
+
fontSize: i,
|
|
315
|
+
fill: a,
|
|
316
|
+
maxWidth: f,
|
|
317
|
+
data: { target: "dimension" }
|
|
318
|
+
})), n && h.push({
|
|
319
|
+
type: "text",
|
|
320
|
+
text: n,
|
|
321
|
+
x: u,
|
|
322
|
+
y: this.rect.height / 2,
|
|
323
|
+
anchor: "end",
|
|
324
|
+
baseline: "central",
|
|
325
|
+
fontFamily: r,
|
|
326
|
+
fontSize: i,
|
|
327
|
+
fill: a,
|
|
328
|
+
data: { target: "measure" }
|
|
329
|
+
}), h;
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
function $(e) {
|
|
333
|
+
e.component(U, ge);
|
|
334
|
+
}
|
|
335
|
+
var _e = (e, t) => {
|
|
336
|
+
let a = e.find((e) => e.role === i.PIE_CHART_SLICE && r(e));
|
|
337
|
+
if (!a) return;
|
|
338
|
+
let o = n(a.dataItem);
|
|
339
|
+
return t.reduce((e, t) => e + t[o], 0);
|
|
340
|
+
}, ve = g(), ye = m(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
|
|
341
|
+
let a = f(), [s] = (0, z.useState)(() => new me()), { activeKey: u } = h(), d = re();
|
|
342
|
+
if (!e || !l(e) || !n || !r) return null;
|
|
343
|
+
let p = {
|
|
344
|
+
...i,
|
|
345
|
+
valuePickerMode: !!u
|
|
346
|
+
}, m = t || c;
|
|
347
|
+
n[0] && (n[0].sum = _e(e.measures, n[0].items));
|
|
348
|
+
let g = s.compile(e, m, n, r, p, o.Pie, a, void 0, d);
|
|
349
|
+
return g ? /* @__PURE__ */ (0, ve.jsx)(k, {
|
|
350
|
+
config: p,
|
|
351
|
+
definition: g,
|
|
352
|
+
size: r,
|
|
353
|
+
vSpec: e,
|
|
354
|
+
escobarPlugins: [$]
|
|
355
|
+
}) : null;
|
|
356
|
+
});
|
|
357
|
+
export { ye as PieChart };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { $o as t, cc as n, io as r, oa as i, ro as a } from "./visualization-filters-CzvFHE6M.js";
|
|
3
|
+
import { U as o, W as s, ci as c, f as l, jt as u, zr as d } from "./utils-3Igg6xmO.js";
|
|
4
4
|
import { t as f } from "./stroke-dash-UgMEcCS4.js";
|
|
5
|
-
import { s as p } from "./coloring-
|
|
6
|
-
var m = /* @__PURE__ */ e(
|
|
7
|
-
shape:
|
|
5
|
+
import { s as p } from "./coloring-9jU3s_-p.js";
|
|
6
|
+
var m = /* @__PURE__ */ e(c()), h = (e) => e === r.Line || e === r.Elbow, g = {
|
|
7
|
+
shape: r.Square,
|
|
8
8
|
backgroundColor: { code: "#c4c4c4" },
|
|
9
9
|
backgroundType: "color",
|
|
10
10
|
lineThickness: 2,
|
|
@@ -13,32 +13,32 @@ var m = /* @__PURE__ */ e(l()), h = (e) => e === i.Line || e === i.Elbow, g = {
|
|
|
13
13
|
borderRadiusY: 0,
|
|
14
14
|
preserveAspectRatio: !0,
|
|
15
15
|
strokeColor: { code: "#8d8d8d" },
|
|
16
|
-
imageFit:
|
|
16
|
+
imageFit: a.Fill,
|
|
17
17
|
strokeDash: void 0,
|
|
18
18
|
imageURL: void 0,
|
|
19
19
|
scale: 1,
|
|
20
20
|
rotate: 0,
|
|
21
21
|
heightBasedSize: !1
|
|
22
|
-
}, _ = (e,
|
|
23
|
-
let
|
|
24
|
-
(
|
|
25
|
-
let c =
|
|
26
|
-
|
|
27
|
-
let l =
|
|
22
|
+
}, _ = (e, n) => {
|
|
23
|
+
let i = { ...e?.shapeSettings }, a = 0, o = 0, s = i?.borderEnabled ?? g.borderEnabled;
|
|
24
|
+
(i?.shape === r.Square || i?.shape === r.Rectangle) && i?.borderRadius && (a = i?.borderRadius, o = a, !i?.preserveAspectRatio && n && (n.width > n.height ? o = (n.width || 1) / (n.height || 1) * o : a = (n.height || 1) / (n.width || 1) * a)), h(i?.shape) && (i.backgroundColor = { code: "none" }, s = !0);
|
|
25
|
+
let c = i?.rotate ?? g.rotate;
|
|
26
|
+
i?.shape === r.Line && i?.heightBasedSize && (c += 90);
|
|
27
|
+
let l = i?.borderStyle === t.Line ? void 0 : i?.strokeDash ?? g.strokeDash;
|
|
28
28
|
return {
|
|
29
|
-
backgroundType:
|
|
30
|
-
shape:
|
|
31
|
-
backgroundColor:
|
|
32
|
-
imageURL:
|
|
33
|
-
imageFit:
|
|
29
|
+
backgroundType: i?.backgroundType ?? "color",
|
|
30
|
+
shape: i?.shape ?? g.shape,
|
|
31
|
+
backgroundColor: i?.backgroundColor?.code ? i?.backgroundColor : g.backgroundColor,
|
|
32
|
+
imageURL: i?.imageURL ?? g.imageURL,
|
|
33
|
+
imageFit: i?.imageFit ?? g.imageFit,
|
|
34
34
|
strokeDash: l,
|
|
35
|
-
lineThickness:
|
|
35
|
+
lineThickness: i?.lineThickness ?? g.lineThickness,
|
|
36
36
|
borderEnabled: s,
|
|
37
|
-
strokeColor:
|
|
38
|
-
preserveAspectRatio:
|
|
39
|
-
scale:
|
|
37
|
+
strokeColor: i?.strokeColor?.code ? i?.strokeColor : g.strokeColor,
|
|
38
|
+
preserveAspectRatio: i?.preserveAspectRatio ?? g.preserveAspectRatio,
|
|
39
|
+
scale: i?.scale ?? g.scale,
|
|
40
40
|
rotate: c,
|
|
41
|
-
heightBasedSize:
|
|
41
|
+
heightBasedSize: i?.heightBasedSize ?? g.heightBasedSize,
|
|
42
42
|
borderRadiusX: a,
|
|
43
43
|
borderRadiusY: o
|
|
44
44
|
};
|
|
@@ -83,17 +83,17 @@ var m = /* @__PURE__ */ e(l()), h = (e) => e === i.Line || e === i.Elbow, g = {
|
|
|
83
83
|
...e
|
|
84
84
|
}), E = (e) => {
|
|
85
85
|
switch (e) {
|
|
86
|
-
case
|
|
87
|
-
case
|
|
88
|
-
case
|
|
89
|
-
case
|
|
90
|
-
case
|
|
91
|
-
case
|
|
92
|
-
case
|
|
93
|
-
case
|
|
86
|
+
case r.Circle: return b;
|
|
87
|
+
case r.Rectangle:
|
|
88
|
+
case r.Square: return w;
|
|
89
|
+
case r.Triangle: return T;
|
|
90
|
+
case r.Hexagon: return S;
|
|
91
|
+
case r.Line: return C;
|
|
92
|
+
case r.Arrow: return y;
|
|
93
|
+
case r.Elbow: return x;
|
|
94
94
|
default: return w;
|
|
95
95
|
}
|
|
96
|
-
}, D =
|
|
96
|
+
}, D = s({
|
|
97
97
|
mainContainer: {
|
|
98
98
|
width: "100%",
|
|
99
99
|
height: "100%",
|
|
@@ -111,33 +111,33 @@ var m = /* @__PURE__ */ e(l()), h = (e) => e === i.Line || e === i.Elbow, g = {
|
|
|
111
111
|
height: "100%",
|
|
112
112
|
transition: "ease-in-out 300ms"
|
|
113
113
|
}
|
|
114
|
-
}), O = ({ patternId: e, imgUrl: t, onLoadCallback: n, imageFit:
|
|
114
|
+
}), O = ({ patternId: e, imgUrl: t, onLoadCallback: n, imageFit: r = a.Fill }) => /* @__PURE__ */ (0, v.jsx)("defs", { children: /* @__PURE__ */ (0, v.jsx)("pattern", {
|
|
115
115
|
id: e,
|
|
116
116
|
viewBox: "0 0 1 1",
|
|
117
117
|
patternUnits: "objectBoundingBox",
|
|
118
118
|
width: "100%",
|
|
119
119
|
height: "100%",
|
|
120
|
-
preserveAspectRatio:
|
|
120
|
+
preserveAspectRatio: r,
|
|
121
121
|
children: /* @__PURE__ */ (0, v.jsx)("image", {
|
|
122
122
|
xlinkHref: t,
|
|
123
123
|
x: "0",
|
|
124
124
|
y: "0",
|
|
125
125
|
width: "1",
|
|
126
126
|
height: "1",
|
|
127
|
-
preserveAspectRatio:
|
|
127
|
+
preserveAspectRatio: r,
|
|
128
128
|
onLoad: n,
|
|
129
129
|
onError: n
|
|
130
130
|
})
|
|
131
|
-
}) }), k =
|
|
132
|
-
let
|
|
131
|
+
}) }), k = u(({ vSpec: e, vTheme: t, elementSize: a }) => {
|
|
132
|
+
let s = t || i, c = _(e && n(e) ? e : void 0, a), u = D(), d = l(), y = E(c.shape), b = `${o()}-background-image-fill`, x = `${o()}-insideStroke`, S = p(s, c.backgroundColor?.code), C = p(s, c.strokeColor?.code), w = f(c.strokeDash), T = c.lineThickness ?? g.lineThickness, k = c.shape === r.Line ? T / 2 : T;
|
|
133
133
|
return (0, m.useEffect)(() => {
|
|
134
134
|
(!c.imageURL || c.backgroundType === "color") && d();
|
|
135
135
|
}, []), /* @__PURE__ */ (0, v.jsx)("div", {
|
|
136
|
-
className:
|
|
136
|
+
className: u.mainContainer,
|
|
137
137
|
"data-testid": "shape-container",
|
|
138
138
|
children: /* @__PURE__ */ (0, v.jsxs)("svg", {
|
|
139
139
|
viewBox: "0 0 100 100",
|
|
140
|
-
className:
|
|
140
|
+
className: u.svg,
|
|
141
141
|
style: { transform: `rotate(${c.rotate ?? 0}deg) scale(${c.scale ?? 1})` },
|
|
142
142
|
preserveAspectRatio: c.preserveAspectRatio ? "" : "none",
|
|
143
143
|
children: [
|
|
@@ -149,7 +149,7 @@ var m = /* @__PURE__ */ e(l()), h = (e) => e === i.Line || e === i.Elbow, g = {
|
|
|
149
149
|
}) : null,
|
|
150
150
|
/* @__PURE__ */ (0, v.jsx)("defs", { children: /* @__PURE__ */ (0, v.jsx)("clipPath", {
|
|
151
151
|
id: x,
|
|
152
|
-
className:
|
|
152
|
+
className: u.shapeGroup,
|
|
153
153
|
style: { opacity: c.opacity === void 0 ? 1 : c.opacity },
|
|
154
154
|
children: /* @__PURE__ */ (0, v.jsx)(y, {
|
|
155
155
|
rx: `${c.borderRadiusX ?? 0}px`,
|
|
@@ -157,7 +157,7 @@ var m = /* @__PURE__ */ e(l()), h = (e) => e === i.Line || e === i.Elbow, g = {
|
|
|
157
157
|
})
|
|
158
158
|
}) }),
|
|
159
159
|
/* @__PURE__ */ (0, v.jsx)("g", {
|
|
160
|
-
className:
|
|
160
|
+
className: u.shapeGroup,
|
|
161
161
|
style: { opacity: c.opacity === void 0 ? 1 : c.opacity },
|
|
162
162
|
fill: c.imageURL && c.backgroundType === "image" ? `url(#${b})` : S,
|
|
163
163
|
stroke: C,
|
|
@@ -168,7 +168,7 @@ var m = /* @__PURE__ */ e(l()), h = (e) => e === i.Line || e === i.Elbow, g = {
|
|
|
168
168
|
children: /* @__PURE__ */ (0, v.jsx)(y, {
|
|
169
169
|
rx: `${c.borderRadiusX ?? 0}px`,
|
|
170
170
|
ry: `${c.borderRadiusY ?? 0}px`,
|
|
171
|
-
...c.shape ===
|
|
171
|
+
...c.shape === r.Line ? { heightBasedSize: c.heightBasedSize } : {}
|
|
172
172
|
})
|
|
173
173
|
})
|
|
174
174
|
})
|