@astrato-io/visualizations 0.6.4 → 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/CHANGELOG.md +0 -0
- package/README.md +32 -2
- package/THIRD_PARTY_NOTICES.md +68 -205
- 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-CUZ0D8_t.js → LinearProgress-VtfFx2vJ.js} +51 -51
- 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-TwVTeoj5.js +64 -0
- package/chunks/bar.compiler-DuQg8EUb.js +374 -0
- 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/{src-BC7cGcJ-.js → definitions-BPJQTx16.js} +650 -464
- package/chunks/{escobar-BGqT1EsE.js → escobar-DRhRMYRE.js} +6282 -4931
- package/chunks/event-bus-CrLB-Y8z.js +3 -0
- package/chunks/extend-preset-CUFNpmPe.js +4398 -0
- package/chunks/filter.compiler-w27dlv0C.js +70 -0
- package/chunks/filtering-cc7WqWpg.js +1153 -0
- package/chunks/handlers-TOT-7INo.js +12871 -0
- 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-Ct1WhN2p.js +198 -0
- package/chunks/logger-DpQtYQnX.js +1163 -0
- package/chunks/lookup-BWllin0q.js +36 -0
- package/chunks/{metadata-CPXdYoln.js → metadata-WABZrt7Y.js} +1 -1
- package/chunks/number.compiler-D8TPly-4.js +53 -0
- package/chunks/{src-C0LgoUWY.js → operations-Dh4v1Ovt.js} +7716 -7541
- package/chunks/{range-DrzdfBX4.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-CExpGJ1N.js → requirements-PAoRaJyb.js} +294 -326
- package/chunks/responsive.styles-DSiOGD7u.js +82 -0
- package/chunks/shared-Bn4N5QcZ.js +1218 -0
- package/chunks/src-77e3mC7i.js +391 -0
- package/chunks/standalone-B55oyW6c.js +689 -0
- package/chunks/{standalone-CY57qwZ-.js → standalone-BDhPQtzQ.js} +386 -352
- package/chunks/{standalone-BDCwI6Hn.js → standalone-BGkmozIb.js} +1108 -953
- 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-BH5NqDwp.js → standalone-BlMIwpEe.js} +687 -573
- package/chunks/{standalone-CCNtaJ7s.js → standalone-C8ZAEutO.js} +44 -43
- package/chunks/standalone-C8qAelL4.js +2 -0
- package/chunks/standalone-CJvIXsQE.js +743 -0
- package/chunks/standalone-CLmGb7nn2.js +355 -0
- package/chunks/{ui-D1HQNIBy.js → standalone-CM5XcAN5.js} +15946 -17658
- package/chunks/standalone-CXNP6-xD.js +420 -0
- package/chunks/{standalone-BYm1UjLr.js → standalone-D5Q5ngsD.js} +59 -57
- package/chunks/standalone-DLlyRIE6.js +287 -0
- package/chunks/standalone-DMcI1afI.js +396 -0
- package/chunks/{standalone-jiz0L2Dg.js → standalone-DN4S1MjT.js} +1113 -1094
- package/chunks/{standalone-QJ1kKMnO.js → standalone-DT0wKji7.js} +2 -2
- package/chunks/{standalone-D5vnf-9y.js → standalone-DVTJwsTY.js} +1110 -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-XuGksArp.js +68 -0
- package/chunks/{standalone-CNyNHKVx.js → standalone-we5D5MIn.js} +176 -172
- package/chunks/table.compiler-DMeeHxb6.js +222 -0
- package/chunks/useFieldName-Cjn9KCVp.js +7 -0
- package/chunks/useSlotProps-DLbQp4lc.js +166 -0
- package/chunks/{utils-Ba9T0TqC.js → utils-vdmi_2PK.js} +6266 -6517
- package/chunks/{src-DvX5LU9T.js → view-BuwQugKb.js} +2893 -5956
- package/chunks/visualization-filters-Cc4KU-l-.js +7455 -0
- package/chunks/web-components-DqClFkgO.js +1185 -0
- package/chunks/with-html-element-D0uY2zjI.js +7328 -0
- package/definitions.js +3 -3
- package/docs/operations/astrato-app-filter-bar.md +17 -17
- package/docs/operations/bar.md +1006 -1071
- package/docs/operations/combo.md +717 -738
- package/docs/operations/date-picker.md +27 -27
- package/docs/operations/distribution-gauge.md +471 -607
- package/docs/operations/dot.md +787 -879
- package/docs/operations/filter.md +139 -163
- package/docs/operations/gauge.md +491 -627
- package/docs/operations/heatMap.md +834 -916
- package/docs/operations/histogram.md +166 -180
- package/docs/operations/iframe.md +5 -5
- package/docs/operations/image.md +16 -16
- package/docs/operations/index.md +12 -12
- package/docs/operations/line.md +811 -888
- package/docs/operations/number.md +470 -536
- package/docs/operations/pie.md +825 -958
- package/docs/operations/radar.md +599 -679
- package/docs/operations/sankey.md +462 -584
- package/docs/operations/scatter.md +823 -929
- package/docs/operations/shape.md +34 -34
- package/docs/operations/simpleTextObject.md +18 -25
- package/docs/operations/slider.md +33 -43
- package/docs/operations/table.md +1177 -1150
- package/docs/operations/tree.md +404 -397
- package/docs/operations/treemap.md +595 -673
- package/docs/operations/waterfall.md +369 -379
- package/docs/operations/word-cloud.md +512 -583
- package/getters.js +7 -7
- package/index.js +3 -1183
- package/metadata.js +18 -18
- package/operations.js +13 -13
- package/package.json +133 -88
- 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 +2 -2
- package/src/definitions/{shared/lib → model/definitions}/available-fields.d.ts +0 -1
- package/src/definitions/{shared/lib/compilers/index.d.ts → model/definitions/compilers/compile.d.ts} +1 -1
- package/src/definitions/model/definitions/data-item-resolution.d.ts +19 -0
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1364 -0
- package/src/definitions/model/definitions/descriptors/json-schema.d.ts +2 -0
- package/src/definitions/model/definitions/diagnostics.d.ts +5 -0
- package/src/definitions/model/definitions/field-suggestions.d.ts +2 -0
- package/src/definitions/model/definitions/index.d.ts +23 -0
- package/src/definitions/{shared/lib → model/definitions}/registry/compile.d.ts +1 -1
- package/src/definitions/model/definitions/registry/descriptor-registry.d.ts +3 -0
- package/src/definitions/model/definitions/schema-registry.d.ts +660 -0
- package/src/definitions/{shared/lib → model/definitions}/schemas/broad-chart.schema.d.ts +1 -1
- package/src/definitions/{shared/lib → model/definitions}/schemas/common.schema.d.ts +0 -1
- package/src/definitions/model/definitions/schemas/index.d.ts +9 -0
- package/src/definitions/{shared/lib → model/definitions}/schemas/object.schema.d.ts +8 -8
- package/src/definitions/{shared/lib → model/definitions}/types/compilation.types.d.ts +10 -0
- package/src/definitions/{shared/lib → model/definitions}/types/definition.types.d.ts +1 -1
- package/src/definitions/model/definitions/types/index.d.ts +3 -0
- package/src/definitions/{shared/lib/registry → model/definitions}/validation.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/Radio-Ciu-F4CU.js +0 -957
- package/chunks/ToggleButton-BCJc3Jlc.js +0 -153
- package/chunks/_baseFlatten-DPXPOrea.js +0 -7076
- package/chunks/app-filter-bar.compiler-j_CVoWTa.js +0 -55
- package/chunks/bar.compiler-oqaPzIut.js +0 -370
- package/chunks/coloring-C16AUZEi.js +0 -663
- package/chunks/data-item-resolution-1lvYB5ln.js +0 -53
- package/chunks/event-bus-KiSiCJrC.js +0 -2683
- package/chunks/events-WZut5Ow6.js +0 -4
- package/chunks/filter.compiler-CuLtc_02.js +0 -60
- package/chunks/filtering-Yq4DEa0t.js +0 -953
- package/chunks/gauge-target-type-BkKXAqkX.js +0 -4
- package/chunks/grouping-type-BX_9Ix5q.js +0 -3
- package/chunks/interfaces-VUY4_yVO.js +0 -8742
- package/chunks/line-settings-DfYTUyPz.js +0 -4
- package/chunks/line.compiler-BpA_6Tc7.js +0 -188
- package/chunks/number.compiler-DbkWcG4S.js +0 -44
- package/chunks/pie-uv42Eqal.js +0 -10
- package/chunks/requirements-DNhuShLS.js +0 -6
- package/chunks/shared-CKDL4hx9.js +0 -1171
- package/chunks/src-Cum_2NLV.js +0 -12145
- package/chunks/src-Dun_jXtz.js +0 -10295
- package/chunks/standalone-87YV_m9n.js +0 -687
- package/chunks/standalone-BLVAWLNJ.js +0 -385
- package/chunks/standalone-BPomtAVs.js +0 -2
- package/chunks/standalone-BXyBcUOQ.js +0 -2
- package/chunks/standalone-BllF4rDp.js +0 -383
- package/chunks/standalone-BmfMt74U.js +0 -726
- package/chunks/standalone-BqWyrnZI.js +0 -281
- package/chunks/standalone-C85u7U6I.js +0 -340
- package/chunks/standalone-CDQnr6qT.js +0 -345
- package/chunks/standalone-CZynjFG7.js +0 -12979
- package/chunks/standalone-DFPva_ku.js +0 -299
- package/chunks/standalone-DQxxNwF8.js +0 -675
- package/chunks/standalone-DS9T0FZ-.js +0 -830
- package/chunks/standalone-Dx3MLlrO.js +0 -512
- package/chunks/standalone-DzixzZAL.js +0 -411
- package/chunks/standalone-lBm9hQ-q.js +0 -179
- package/chunks/standalone-rJ45Zfl1.js +0 -68
- package/chunks/table.compiler-BrXkm4Fz.js +0 -213
- package/chunks/toInteger-DVZr-D1j.js +0 -11
- package/chunks/treemap-x_zmJoG7.js +0 -23
- package/chunks/types-dVVCsDWD.js +0 -4
- package/chunks/useFieldName-oqQ3bvnO.js +0 -7
- package/chunks/view-CLqWMV7Z.js +0 -156
- package/src/definitions/shared/index.d.ts +0 -5
- package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +0 -587
- package/src/definitions/shared/lib/registry/index.d.ts +0 -3
- package/src/definitions/shared/lib/schemas/index.d.ts +0 -9
- package/src/definitions/shared/lib/types/index.d.ts +0 -3
- package/src/definitions/{shared/lib → model/definitions}/schemas/app-filter-bar.schema.d.ts +0 -0
- package/src/definitions/{shared/lib → model/definitions}/schemas/bar.schema.d.ts +0 -0
- package/src/definitions/{shared/lib → model/definitions}/schemas/filter.schema.d.ts +0 -0
- package/src/definitions/{shared/lib → model/definitions}/schemas/line.schema.d.ts +0 -0
- package/src/definitions/{shared/lib → model/definitions}/schemas/number.schema.d.ts +0 -0
- package/src/definitions/{shared/lib → model/definitions}/schemas/table.schema.d.ts +4 -4
- /package/src/definitions/{shared/lib → model/definitions}/types/descriptor.types.d.ts +0 -0
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import { La as t, No as n, Ta as r, Ti as i, Wc as a, Xs as o, Yn as s, pc as c, qs as l, ti as u } from "./interfaces-VUY4_yVO.js";
|
|
3
|
-
import { Ki as d, P as f, Zt as p, o as m, wi as h } from "./utils-Ba9T0TqC.js";
|
|
4
|
-
import { Bn as g, Vn as _ } from "./event-bus-KiSiCJrC.js";
|
|
5
|
-
import { n as v } from "./pie-uv42Eqal.js";
|
|
6
|
-
import { F as y, Ft as b, Jt as x, M as S, P as C, Q as w, Qt as T, St as E, Vt as D, Wt as O, X as k, Z as A, _t as j, et as M, ht as ee, i as te, it as ne, j as re, n as ie, nn as ae, rt as oe, tt as N, un as P } from "./escobar-BGqT1EsE.js";
|
|
7
|
-
import { l as F, vt as I } from "./_baseFlatten-DPXPOrea.js";
|
|
8
|
-
import { t as L } from "./coloring-C16AUZEi.js";
|
|
9
|
-
import { t as R } from "./set-coloring-datafield-B3uIS1Pe.js";
|
|
10
|
-
var z = /* @__PURE__ */ e(d()), B = (e, n, r) => {
|
|
11
|
-
let { coloring: a } = e || {}, s = a?.fieldId, l = e.dimensions.filter((e) => i(e)), u = e.measures.filter((e) => i(e)), d = u.filter((e) => e.role === t.PIE_CHART_SLICE), f = u.filter((e) => e.role === t.PIE_CHART_LENGTH);
|
|
12
|
-
s || (e.coloring?.type === o.Gradient ? s = c(d[0]?.dataItem) : e.coloring?.type === o.Categorical && (s = c(l[0]?.dataItem))), ee(r, 0, { color: { field: s } });
|
|
13
|
-
let p = E(R(e, s), n, {});
|
|
14
|
-
if (f.length > 0) {
|
|
15
|
-
let e = c(f[0]?.dataItem);
|
|
16
|
-
p[e] = { data: { field: e } };
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
...r,
|
|
20
|
-
scales: p
|
|
21
|
-
};
|
|
22
|
-
}, V = /* @__PURE__ */ function(e) {
|
|
23
|
-
return e.num = "num", e.rad = "rad", e.group = "group", e;
|
|
24
|
-
}({}), H = (e, n, r) => {
|
|
25
|
-
if (!e.dimensions[0]) return r;
|
|
26
|
-
let a = e.measures.filter((e) => i(e)), o = S((e.supportingMeasures ?? []).filter((e) => i(e))), s = e.dimensions.filter((e) => i(e))?.[0], l = a.filter((e) => e.role === t.PIE_CHART_SLICE)?.[0], u = a.filter((e) => e.role === t.PIE_CHART_LENGTH)?.[0], d = c(l?.dataItem), f = c(u?.dataItem), p = c(s?.dataItem), m = [{
|
|
27
|
-
key: T.Collection,
|
|
28
|
-
data: { extract: [{
|
|
29
|
-
field: p,
|
|
30
|
-
props: {
|
|
31
|
-
num: l?.dataItem?.name ? { field: d } : void 0,
|
|
32
|
-
rad: u?.dataItem?.name ? { field: f } : void 0,
|
|
33
|
-
...o
|
|
34
|
-
}
|
|
35
|
-
}] }
|
|
36
|
-
}];
|
|
37
|
-
return d && (m[0].data.extract[0].props[d] = { field: d }), f && (m[0].data.extract[0].props[f] = { field: f }), {
|
|
38
|
-
...r,
|
|
39
|
-
collections: m
|
|
40
|
-
};
|
|
41
|
-
}, U = "pie-alternates-switcher", W = "pie-alternates-switcher", G = (e) => s(e) || e.label || e.dataItem?.name || "Field", K = (e, t, n, r) => {
|
|
42
|
-
let i = n ? c(n.dataItem) : void 0;
|
|
43
|
-
return {
|
|
44
|
-
type: "native",
|
|
45
|
-
key: `${W}-interaction`,
|
|
46
|
-
events: { click(o) {
|
|
47
|
-
let s = this.element.getBoundingClientRect(), c = {
|
|
48
|
-
x: o.clientX - s.left,
|
|
49
|
-
y: o.clientY - s.top
|
|
50
|
-
}, l = this.chart.shapesAt(c, {
|
|
51
|
-
components: [{
|
|
52
|
-
key: W,
|
|
53
|
-
propagation: "stop"
|
|
54
|
-
}],
|
|
55
|
-
propagation: "stop"
|
|
56
|
-
}).find((e) => e.data?.target === "measure" || e.data?.target === "dimension");
|
|
57
|
-
if (l?.data?.target === "measure" && n && i) {
|
|
58
|
-
r(P.Text, "click", `text-${i}`, o, l, {
|
|
59
|
-
dataItemType: a.Measure,
|
|
60
|
-
dataItemRole: n.role
|
|
61
|
-
});
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
l?.data?.target === "dimension" && e && r(P.Text, "click", `text-${e}`, o, l, {
|
|
65
|
-
dataItemType: a.Dimension,
|
|
66
|
-
dataItemRole: t
|
|
67
|
-
});
|
|
68
|
-
} }
|
|
69
|
-
};
|
|
70
|
-
}, se = (e, r, o, s, l, d, f, p) => {
|
|
71
|
-
let m = u(e.dimensions, e.enableAlternate, d?.isPrintMode), h = e.dimensions.filter((e) => i(e)), g = h[0], _ = g ? c(g.dataItem) : void 0, v = e.measures.filter((e) => e.role === t.PIE_CHART_SLICE), y = u(v, e.enableAlternate, d?.isPrintMode), b = v.filter((e) => i(e))[0], x = m && h.length ? h.map((e) => G(e)).join(", ") : void 0, S = y && b ? G(b) : void 0;
|
|
72
|
-
if (!x && !S) return o;
|
|
73
|
-
let C = {
|
|
74
|
-
type: U,
|
|
75
|
-
key: W,
|
|
76
|
-
dimensionDataItemType: _ ? a.Dimension : void 0,
|
|
77
|
-
dimensionDataItemRole: g?.role,
|
|
78
|
-
measureDataItemType: b ? a.Measure : void 0,
|
|
79
|
-
measureDataItemRole: b?.role,
|
|
80
|
-
layout: {
|
|
81
|
-
dock: n.Bottom,
|
|
82
|
-
displayOrder: 0
|
|
83
|
-
},
|
|
84
|
-
settings: {
|
|
85
|
-
dimensionLabel: x ? D(x) : void 0,
|
|
86
|
-
measureLabel: S ? D(S) : void 0,
|
|
87
|
-
fontFamily: r.fonts.general.fontFamily,
|
|
88
|
-
fontSize: `${I.fieldTitle.fontSize}px`,
|
|
89
|
-
color: r.fonts.general.color,
|
|
90
|
-
paddingLeft: 5,
|
|
91
|
-
paddingRight: 5,
|
|
92
|
-
paddingVertical: 5,
|
|
93
|
-
labelGap: 12
|
|
94
|
-
}
|
|
95
|
-
}, w = p ? [K(_, g?.role, b, p)] : [];
|
|
96
|
-
return {
|
|
97
|
-
...o,
|
|
98
|
-
components: [...o.components, C],
|
|
99
|
-
interactions: o.interactions ? [...o.interactions, ...w] : w
|
|
100
|
-
};
|
|
101
|
-
}, q = {
|
|
102
|
-
outerRadius: .8,
|
|
103
|
-
outerRadiusWithoutLabels: .95,
|
|
104
|
-
cornerRadius: v.pie,
|
|
105
|
-
strokeWidth: 0,
|
|
106
|
-
strokeEnabled: !1,
|
|
107
|
-
strokeColor: "#C6C6C6",
|
|
108
|
-
multiMeasureMinRadius: .3,
|
|
109
|
-
donut: {
|
|
110
|
-
innerRadius: .55,
|
|
111
|
-
cornerRadius: v.donut,
|
|
112
|
-
multiMeasureMinRadius: .6
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
function J(e) {
|
|
116
|
-
return e.pieSettings?.donut ?? !1;
|
|
117
|
-
}
|
|
118
|
-
var ce = (e, n, r, a, o, s) => {
|
|
119
|
-
let l = e.measures.filter((e) => i(e)), u = l.filter((e) => e.role === t.PIE_CHART_SLICE), d = l.filter((e) => e.role === t.PIE_CHART_LENGTH), f = u[0], p = d[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;
|
|
120
|
-
if (p) {
|
|
121
|
-
let t = g, n = J(e) ? q.donut.multiMeasureMinRadius : q.multiMeasureMinRadius;
|
|
122
|
-
g = (e) => e.resources.scale(c(p.dataItem))(e.datum.rad.value) * (t - n) + n;
|
|
123
|
-
}
|
|
124
|
-
let x = {
|
|
125
|
-
type: P.Pie,
|
|
126
|
-
key: `${P.Pie}`,
|
|
127
|
-
data: { collection: T.Collection },
|
|
128
|
-
animations: {
|
|
129
|
-
enabled: !0,
|
|
130
|
-
presetId: "pie-chart"
|
|
131
|
-
},
|
|
132
|
-
settings: { slice: {
|
|
133
|
-
arc: { ref: "num" },
|
|
134
|
-
stroke: b,
|
|
135
|
-
strokeWidth: v ? y : 0,
|
|
136
|
-
cornerRadius: _,
|
|
137
|
-
innerRadius: h,
|
|
138
|
-
outerRadius: g,
|
|
139
|
-
fill: m.getColorDefinition({ ref: "color" })
|
|
140
|
-
} },
|
|
141
|
-
brush: O([""], s, { valuePickerMode: s?.valuePickerMode })
|
|
142
|
-
};
|
|
143
|
-
return {
|
|
144
|
-
...r,
|
|
145
|
-
components: [...r.components, x]
|
|
146
|
-
};
|
|
147
|
-
}, le = (e, t, n) => ({ data: r, formatter: a }) => {
|
|
148
|
-
let o = e.dimensions.filter((e) => i(e))[0], s = r.value, c = r[V.num].value, l = o.formatter && s && a ? a(o.formatter)(s) : `${s}`, u = t.formatter && c && a ? a(t.formatter)(c, void 0, r) : `${c}`, d = c != null && n && a ? a(ne)(c / n) : null, f = () => t.dataLabels?.measureLabelFormat === g.Percentage ? [d] : t.dataLabels?.measureLabelFormat === g.ValueAndPercentage ? [u, d] : [u];
|
|
149
|
-
switch (t.dataLabels?.labelFormat) {
|
|
150
|
-
case _.Measure: {
|
|
151
|
-
let e = f();
|
|
152
|
-
return e.length === 1 ? e[0] : e;
|
|
153
|
-
}
|
|
154
|
-
case _.DimensionAndMeasure: return [l, ...f()];
|
|
155
|
-
default: return l;
|
|
156
|
-
}
|
|
157
|
-
}, ue = (e, n, r, a, o, s) => {
|
|
158
|
-
let c = e.dimensions.filter((e) => i(e)), l = e.measures.filter((e) => i(e)), u = c[0], d = l.find((e) => e.role === t.PIE_CHART_SLICE) ?? l[0];
|
|
159
|
-
if (!u || !d || !d.dataLabels?.show) return r;
|
|
160
|
-
let f = new F(n.fonts.general.color), p = d.dataLabels.showBackdrop ? C(d.dataLabels.backdropColor ? { fill: d.dataLabels.backdropColor } : void 0) : void 0, m = p ? y(f) : d.dataLabels.textColor || "#000", { strokeEnabled: h, strokeWidth: g = q.strokeWidth } = e.pieSettings, _ = h ? g / 2 : 0, v = {
|
|
161
|
-
type: P.Labels,
|
|
162
|
-
key: "pie-labels",
|
|
163
|
-
animations: {
|
|
164
|
-
enabled: !0,
|
|
165
|
-
presetId: "chart-labels"
|
|
166
|
-
},
|
|
167
|
-
layout: { displayOrder: b.Labels },
|
|
168
|
-
settings: { sources: [{
|
|
169
|
-
component: `${P.Pie}`,
|
|
170
|
-
selector: ae.Path,
|
|
171
|
-
strategy: {
|
|
172
|
-
type: "slice",
|
|
173
|
-
settings: {
|
|
174
|
-
fontSize: x(d.dataLabels.size),
|
|
175
|
-
fontFamily: n.fonts.general.fontFamily,
|
|
176
|
-
labels: [{
|
|
177
|
-
label: le(e, d, o[0].sum),
|
|
178
|
-
placements: [{
|
|
179
|
-
position: "outside",
|
|
180
|
-
fill: m,
|
|
181
|
-
backdrop: p
|
|
182
|
-
}],
|
|
183
|
-
strokeDelta: _,
|
|
184
|
-
linkData: ({ data: e }) => e
|
|
185
|
-
}]
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}] },
|
|
189
|
-
brush: O([""], s, { valuePickerMode: s?.valuePickerMode })
|
|
190
|
-
};
|
|
191
|
-
return {
|
|
192
|
-
...r,
|
|
193
|
-
components: [...r.components, v]
|
|
194
|
-
};
|
|
195
|
-
}, Y = (e, t, n, r, i) => {
|
|
196
|
-
let a = n.data[t]?.value, o = s(e) || e.label || e.dataItem.name || "", c = a;
|
|
197
|
-
return !i && e.formatter ? c = r.formatter(e.formatter)(a, void 0, n.data) : i && (c = r.formatter(oe(e.formatter))(a, void 0, n.data)), {
|
|
198
|
-
label: o,
|
|
199
|
-
value: c
|
|
200
|
-
};
|
|
201
|
-
}, de = (e, n, r, a, o) => {
|
|
202
|
-
let s = !!e.measures.filter(i).filter((e) => e.role === t.PIE_CHART_LENGTH)?.[0], c = {
|
|
203
|
-
filter: (e) => e.filter((e) => e.key === P.Pie),
|
|
204
|
-
placement: {
|
|
205
|
-
type: "slice",
|
|
206
|
-
area: "target"
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
if (s) return k(e, n, r, c, "tooltip", o);
|
|
210
|
-
let l = N(e, o), u = A(e, n, fe, w, o?.[0]?.sum, l);
|
|
211
|
-
return k(e, n, r, {
|
|
212
|
-
...c,
|
|
213
|
-
extract: u
|
|
214
|
-
}, "tooltip", o);
|
|
215
|
-
}, fe = (e, t, n, r, a, o, s, l) => {
|
|
216
|
-
let u = [], d = e.filter(i), f = M(n), p = d.filter((e) => !f.has(c(e.dataItem)))?.[0] ?? d?.[0], m = Object.keys(t.data).find((e) => t.data[e]?.source?.field === c(p?.dataItem));
|
|
217
|
-
if (!m || !p ? u.push({
|
|
218
|
-
label: "",
|
|
219
|
-
value: ""
|
|
220
|
-
}) : u.push(Y(p, m, t, n, l)), d.filter((e) => f.has(c(e.dataItem))).forEach((e) => {
|
|
221
|
-
let r = c(e.dataItem), i = Object.keys(t.data).find((e) => t.data[e]?.source?.field === r);
|
|
222
|
-
i && u.push(Y(e, i, t, n, l));
|
|
223
|
-
}), s) return u;
|
|
224
|
-
let h = Object.values(o ?? {}).reduce((e, t) => e + Number(t), 0);
|
|
225
|
-
return u.push({
|
|
226
|
-
label: "Total",
|
|
227
|
-
value: p?.formatter ? n.formatter(p.formatter)(h) : h
|
|
228
|
-
}), u;
|
|
229
|
-
}, pe = class extends re {
|
|
230
|
-
constructor() {
|
|
231
|
-
super([
|
|
232
|
-
H,
|
|
233
|
-
B,
|
|
234
|
-
ce,
|
|
235
|
-
se,
|
|
236
|
-
ue,
|
|
237
|
-
j,
|
|
238
|
-
de
|
|
239
|
-
]);
|
|
240
|
-
}
|
|
241
|
-
preCompile(e) {
|
|
242
|
-
let t = e.dimensions.filter((e) => i(e))?.[0], n = e.measures.filter((e) => i(e))?.[0];
|
|
243
|
-
if (!t || !n) throw Error("Charts w/o dimensions or measures are not supported ATM.");
|
|
244
|
-
}
|
|
245
|
-
}, X = " ▼", Z = "...", Q = (e, t, n, r) => e.measureText({
|
|
246
|
-
text: t,
|
|
247
|
-
fontFamily: n,
|
|
248
|
-
fontSize: r
|
|
249
|
-
}).width, $ = (e, t, n, r, i) => {
|
|
250
|
-
if (t <= 0 || Q(n, e, r, i) <= t) return e;
|
|
251
|
-
let a = e.endsWith(X), o = a ? X : "", s = a ? e.slice(0, -2) : e;
|
|
252
|
-
if (Q(n, `${Z}${o}`, r, i) > t) return Z;
|
|
253
|
-
let c = 0, l = s.length;
|
|
254
|
-
for (; c < l;) {
|
|
255
|
-
let e = Math.ceil((c + l) / 2);
|
|
256
|
-
Q(n, `${s.slice(0, e)}${Z}${o}`, r, i) <= t ? c = e : l = e - 1;
|
|
257
|
-
}
|
|
258
|
-
return `${s.slice(0, c)}${Z}${o}`;
|
|
259
|
-
}, me = {
|
|
260
|
-
require: ["renderer"],
|
|
261
|
-
defaultSettings: { settings: {
|
|
262
|
-
dimensionLabel: "",
|
|
263
|
-
measureLabel: "",
|
|
264
|
-
fontSize: "12px",
|
|
265
|
-
color: "#000",
|
|
266
|
-
paddingLeft: 5,
|
|
267
|
-
paddingRight: 5,
|
|
268
|
-
paddingVertical: 5,
|
|
269
|
-
labelGap: 12
|
|
270
|
-
} },
|
|
271
|
-
preferredSize() {
|
|
272
|
-
let { fontFamily: e = "Arial", fontSize: t, paddingVertical: n } = this.settings.settings;
|
|
273
|
-
return this.renderer.measureText({
|
|
274
|
-
fontFamily: e,
|
|
275
|
-
fontSize: t
|
|
276
|
-
}).height + n * 2;
|
|
277
|
-
},
|
|
278
|
-
render() {
|
|
279
|
-
let { dimensionLabel: e, measureLabel: t, fontFamily: n = "Arial", fontSize: r, color: i, paddingLeft: a, paddingRight: o, labelGap: s } = this.settings.settings, c = t ? Q(this.renderer, t, n, r) : 0, l = this.rect.width - o, u = l - c, d = Math.max(Math.min(t ? u - s - a : this.rect.width - a - o, this.rect.width / 2), 0), f = e ? $(e, d, this.renderer, n, r) : "", p = f ? Q(this.renderer, f, n, r) : 0, m = [];
|
|
280
|
-
return t && m.push({
|
|
281
|
-
type: "rect",
|
|
282
|
-
x: Math.max(u, 0),
|
|
283
|
-
y: 0,
|
|
284
|
-
width: Math.min(c, this.rect.width),
|
|
285
|
-
height: this.rect.height,
|
|
286
|
-
fill: "rgba(0, 0, 0, 0)",
|
|
287
|
-
strokeWidth: 0,
|
|
288
|
-
data: { target: "measure" }
|
|
289
|
-
}), e && (m.push({
|
|
290
|
-
type: "rect",
|
|
291
|
-
x: a,
|
|
292
|
-
y: 0,
|
|
293
|
-
width: p,
|
|
294
|
-
height: this.rect.height,
|
|
295
|
-
fill: "rgba(0, 0, 0, 0)",
|
|
296
|
-
strokeWidth: 0,
|
|
297
|
-
data: { target: "dimension" }
|
|
298
|
-
}), m.push({
|
|
299
|
-
type: "text",
|
|
300
|
-
text: f,
|
|
301
|
-
x: a,
|
|
302
|
-
y: this.rect.height / 2,
|
|
303
|
-
anchor: "start",
|
|
304
|
-
baseline: "central",
|
|
305
|
-
fontFamily: n,
|
|
306
|
-
fontSize: r,
|
|
307
|
-
fill: i,
|
|
308
|
-
maxWidth: d,
|
|
309
|
-
data: { target: "dimension" }
|
|
310
|
-
})), t && m.push({
|
|
311
|
-
type: "text",
|
|
312
|
-
text: t,
|
|
313
|
-
x: l,
|
|
314
|
-
y: this.rect.height / 2,
|
|
315
|
-
anchor: "end",
|
|
316
|
-
baseline: "central",
|
|
317
|
-
fontFamily: n,
|
|
318
|
-
fontSize: r,
|
|
319
|
-
fill: i,
|
|
320
|
-
data: { target: "measure" }
|
|
321
|
-
}), m;
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
function he(e) {
|
|
325
|
-
e.component(U, me);
|
|
326
|
-
}
|
|
327
|
-
var ge = h(), _e = p(({ vSpec: e, vTheme: t, data: n, elementSize: i, vizProperties: a }) => {
|
|
328
|
-
let o = f(), [s] = (0, z.useState)(() => new pe()), { activeKey: u } = m(), d = {
|
|
329
|
-
...a,
|
|
330
|
-
valuePickerMode: !!u
|
|
331
|
-
}, p = t || r;
|
|
332
|
-
if (n?.[0]?.items && e?.measures?.length) {
|
|
333
|
-
let t = n[0].items.reduce((t, n) => t + n[c(e.measures[0].dataItem)], 0);
|
|
334
|
-
n[0].sum = t;
|
|
335
|
-
}
|
|
336
|
-
let h = s.compile(e, p, n, i, d, l.Pie, o, void 0, ie());
|
|
337
|
-
return h ? /* @__PURE__ */ (0, ge.jsx)(te, {
|
|
338
|
-
config: d,
|
|
339
|
-
definition: h,
|
|
340
|
-
size: i,
|
|
341
|
-
vSpec: e,
|
|
342
|
-
escobarPlugins: [he]
|
|
343
|
-
}) : null;
|
|
344
|
-
});
|
|
345
|
-
export { _e as PieChart };
|