@astrato-io/visualizations 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +129 -4
  3. package/VISUALIZATION_DEFINITIONS.md +3 -1
  4. package/chunks/{Button-CPG4WX8X.js → Button-CQdoKSXX.js} +3 -3
  5. package/chunks/{CircularProgress-PSLW8HmD.js → CircularProgress-DpT1lwWw.js} +18 -18
  6. package/chunks/FieldTypeIcon-Cg4F9Q5D.js +22 -0
  7. package/chunks/{LinearProgress-KQ2EQlGL.js → LinearProgress-B7S0Q26A.js} +8 -8
  8. package/chunks/{MenuOption-B-6K7kks.js → MenuOption-DpKFJxmo.js} +133 -133
  9. package/chunks/{Title-BmvwZYkh.js → Title-m5damhc0.js} +10 -10
  10. package/chunks/{_createAggregator-CFmH6gUN.js → _createAggregator-BA8_iU9q.js} +7 -7
  11. package/chunks/{app-filter-bar.compiler-BY5-T16I.js → app-filter-bar.compiler--T4Qz3Wu.js} +3 -3
  12. package/chunks/{bar-layout-BNou0dZF.js → bar-layout-OFhxn2Go.js} +2 -2
  13. package/chunks/{bar.compiler-BkhO7sDd.js → bar.compiler-hWZBYYvV.js} +62 -62
  14. package/chunks/{builder-CNjuqD2z.js → builder-7w_bgV_h.js} +31 -31
  15. package/chunks/{coloring-BOiP0rmn.js → coloring-Cd6p0GQJ.js} +88 -83
  16. package/chunks/{createSimplePaletteValueFilter-BkgQ7MFE.js → createSimplePaletteValueFilter-CiJT8s1s.js} +55 -55
  17. package/chunks/defaults-CMFqXvaJ.js +3 -0
  18. package/chunks/{definitions-AS9GcavE.js → definitions-DTauTjIX.js} +412 -406
  19. package/chunks/{escobar-cQ1eQ64G.js → escobar-CMvphKSK.js} +4787 -4717
  20. package/chunks/{extend-preset-BlCbcXKR.js → extend-preset-BpXttHFk.js} +371 -372
  21. package/chunks/{filter.compiler-CI7dDNM1.js → filter.compiler-DOGFweJz.js} +4 -4
  22. package/chunks/{filtering-Dwi7hDPZ.js → filtering-NOnDcGbo.js} +183 -183
  23. package/chunks/handlers-CyYFSfhM.js +15393 -0
  24. package/chunks/{icon-picker-styles-CBlxEu3s.js → icon-picker-styles-DuSERhBU.js} +2 -2
  25. package/chunks/{isEqual-BdHo6wqq.js → isEqual-4f8yUUtC.js} +1 -1
  26. package/chunks/{isFocusVisible-C1nlVUwL.js → isFocusVisible-Czm70MGc.js} +1 -1
  27. package/chunks/line.compiler-B-4H55_T.js +203 -0
  28. package/chunks/{logger-Bc-DqDM_.js → logger-Cioob-QV.js} +71 -70
  29. package/chunks/{map.compiler-CRO6XpdI.js → map.compiler-Cv5V6EhF.js} +13 -13
  30. package/chunks/measure-axis-label-format-COy8U_dd.js +27 -0
  31. package/chunks/{measure-format-default-B6ghxih7.js → measure-format-default-B_kuGSzi.js} +7 -3
  32. package/chunks/{metadata-CtkvZEhS.js → metadata-dGSe5UWy.js} +5 -5
  33. package/chunks/{number.compiler-kV4lobCZ.js → number.compiler-D7nMcEMv.js} +8 -8
  34. package/chunks/{operations-COl9wgqi.js → operations-CgfehCad.js} +11462 -11223
  35. package/chunks/{range-CMJ5yc5Z.js → range-Dmwp9kVB.js} +2 -2
  36. package/chunks/{react-dom-BjsCbYHq.js → react-dom-CfuL-m78.js} +24 -24
  37. package/chunks/{render-wrappers-DFHi3Wkr.js → render-wrappers--g-zPFBW.js} +1 -1
  38. package/chunks/{requirements-C5YLmHKe.js → requirements-DHayNJ2C.js} +83 -83
  39. package/chunks/{shared-DyqxOie0.js → shared-DoEN9nNM.js} +282 -277
  40. package/chunks/standalone-B3hRGgYi.js +773 -0
  41. package/chunks/{standalone-BYK2U0Vd.js → standalone-BPNXgFft.js} +380 -380
  42. package/chunks/standalone-BPTT8XEu.js +424 -0
  43. package/chunks/standalone-BgAeHROc.js +2 -0
  44. package/chunks/{standalone-I5kRIsp8.js → standalone-BkQxag7M.js} +81 -81
  45. package/chunks/{standalone-DYVYccmY.js → standalone-Bxa3x6dg.js} +913 -913
  46. package/chunks/standalone-C0If-V6O.js +773 -0
  47. package/chunks/standalone-C1TOyflX.js +287 -0
  48. package/chunks/{standalone-DaNxWIKn.js → standalone-CE5PwJN0.js} +21 -21
  49. package/chunks/{standalone-K2OvRAQM.js → standalone-CG7IFN6n.js} +121 -121
  50. package/chunks/{standalone-Db_HNuWx.js → standalone-CKlgGu80.js} +44 -44
  51. package/chunks/standalone-CNf-oA2U.js +355 -0
  52. package/chunks/{standalone-9jrQ3zJT.js → standalone-CXPdWFlw.js} +10 -10
  53. package/chunks/{standalone-c4CPN6ug.js → standalone-Cf0_5tbu.js} +5783 -5785
  54. package/chunks/{standalone-Bp4G3MDx.js → standalone-DMi4-Vp3.js} +118 -118
  55. package/chunks/{standalone-BrjtMIdd.js → standalone-DTEX67C8.js} +108 -108
  56. package/chunks/{standalone-iOnJhCvA.js → standalone-DU46-kYv.js} +181 -181
  57. package/chunks/standalone-Dbn3jSH6.js +690 -0
  58. package/chunks/{standalone-CS5VGoja.js → standalone-DdcAL_k_.js} +833 -837
  59. package/chunks/standalone-DwCIA0UG.js +1057 -0
  60. package/chunks/standalone-Dz13tl3P.js +357 -0
  61. package/chunks/{standalone-CIjNYyya.js → standalone-H9GFzFk_.js} +937 -938
  62. package/chunks/{standalone-ChfEHb28.js → standalone-MduR0qre.js} +1279 -1279
  63. package/chunks/standalone-ejTz66P3.js +2 -0
  64. package/chunks/{standalone-D9k5SCd8.js → standalone-keB-0wK3.js} +189 -189
  65. package/chunks/{standalone-Bsfz5vnJ.js → standalone-nnkuQd0K.js} +35 -35
  66. package/chunks/standalone-vGGR6Vcn.js +6 -0
  67. package/chunks/{table.compiler-CMH_dtYs.js → table.compiler-mS4UvhLT.js} +12 -12
  68. package/chunks/theme-MYp6Rj1J.js +232 -0
  69. package/chunks/{useFieldName-BfxBzhhH.js → useFieldName-AdSak4Ch.js} +1 -1
  70. package/chunks/{utils-BdJrEeIQ.js → utils-CUKgR7it.js} +3265 -3133
  71. package/chunks/{view-Q-_XIrWE.js → view-BeYwpcVD.js} +478 -478
  72. package/chunks/{visualization-filters-BwS0xUqs.js → visualization-filters-B9qik5_K.js} +2706 -2384
  73. package/chunks/{with-html-element-D_ooGNWI.js → with-html-element-1GSeLT59.js} +3888 -3870
  74. package/definitions.js +2 -2
  75. package/docs/operations/astrato-app-filter-bar.md +1 -1
  76. package/docs/operations/bar.md +115 -32
  77. package/docs/operations/combo.md +50 -17
  78. package/docs/operations/date-picker.md +4 -4
  79. package/docs/operations/distribution-gauge.md +18 -16
  80. package/docs/operations/dot.md +107 -24
  81. package/docs/operations/filter.md +10 -8
  82. package/docs/operations/gauge.md +20 -18
  83. package/docs/operations/heatMap.md +73 -21
  84. package/docs/operations/histogram.md +45 -12
  85. package/docs/operations/iframe.md +1 -1
  86. package/docs/operations/image.md +1 -1
  87. package/docs/operations/index.md +11 -11
  88. package/docs/operations/line.md +57 -24
  89. package/docs/operations/map.md +16 -16
  90. package/docs/operations/number.md +10 -9
  91. package/docs/operations/pie.md +23 -21
  92. package/docs/operations/radar.md +13 -11
  93. package/docs/operations/sankey.md +19 -17
  94. package/docs/operations/scatter.md +111 -28
  95. package/docs/operations/shape.md +5 -5
  96. package/docs/operations/simpleTextObject.md +4 -4
  97. package/docs/operations/slider.md +1 -1
  98. package/docs/operations/table.md +27 -25
  99. package/docs/operations/tree.md +5 -3
  100. package/docs/operations/treemap.md +70 -18
  101. package/docs/operations/waterfall.md +40 -7
  102. package/docs/operations/word-cloud.md +69 -17
  103. package/getters.js +2 -2
  104. package/index.js +474 -525
  105. package/metadata.js +2 -2
  106. package/operations.js +24 -17
  107. package/package.json +71 -72
  108. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1 -1
  109. package/src/definitions/model/definitions/schema-registry.d.ts +13 -12
  110. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -2
  111. package/src/definitions/model/definitions/schemas/common.schema.d.ts +5 -4
  112. package/src/definitions/model/definitions/schemas/line.schema.d.ts +3 -2
  113. package/src/definitions/model/definitions/schemas/number.schema.d.ts +1 -1
  114. package/src/definitions/model/definitions/schemas/table.schema.d.ts +14 -14
  115. package/src/index.d.ts +1 -1
  116. package/src/operations/index.d.ts +11 -1
  117. package/src/types.d.ts +166 -1
  118. package/chunks/FieldTypeIcon-5k2bkqd0.js +0 -22
  119. package/chunks/category-axis-D1OVyMrr.js +0 -20
  120. package/chunks/color-rules-DYJL4fIW.js +0 -15
  121. package/chunks/color-settings-DJFoFTip.js +0 -5
  122. package/chunks/defaults-B5_8S-J-.js +0 -3
  123. package/chunks/handlers-C63NVo7i.js +0 -15433
  124. package/chunks/line.compiler-DCv3h42f.js +0 -198
  125. package/chunks/standalone-06i1wmIX.js +0 -6
  126. package/chunks/standalone-B6zUvxNQ.js +0 -357
  127. package/chunks/standalone-Be5APcVv.js +0 -762
  128. package/chunks/standalone-BuXpKMnc.js +0 -2
  129. package/chunks/standalone-CUGt2FUF.js +0 -2
  130. package/chunks/standalone-CnF2OYLQ.js +0 -355
  131. package/chunks/standalone-CznEEiq3.js +0 -422
  132. package/chunks/standalone-DcuE8KBa.js +0 -287
  133. package/chunks/standalone-pCrzBiTy.js +0 -773
  134. package/chunks/standalone-qrZaimgC.js +0 -689
  135. package/chunks/standalone-yqDJ8h3K.js +0 -1012
@@ -1,422 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { Cc as t, Ec as n, Et as r, Hc as i, Io as a, Lo as o, Uo as s, Wa as c, cr as l, fa as u, no as d, rc as f, ri as p, ro as m } from "./visualization-filters-BwS0xUqs.js";
3
- import { Br as h, I as g, Mt as _, P as v, Qt as y, R as b, Ut as x, W as S, li as C } from "./utils-BdJrEeIQ.js";
4
- import { v_ as w, y_ as T } from "./handlers-C63NVo7i.js";
5
- import "./logger-Bc-DqDM_.js";
6
- import { An as E, Cn as D, Gt as O, L as ee, Mt as k, Nt as te, Tn as A, Xt as ne, Yt as j, _ as M, _n as N, an as P, gn as F, i as re, in as I, jn as L, ln as ie, qt as ae, t as oe, tn as se, v as ce, vn as le, xn as R, zt as z } from "./escobar-cQ1eQ64G.js";
7
- import { t as B } from "./coloring-BOiP0rmn.js";
8
- import { t as V } from "./debounce-fn-CUixuz45.js";
9
- import { t as H } from "./set-coloring-datafield-B3uIS1Pe.js";
10
- import { r as U } from "./builder-CNjuqD2z.js";
11
- var W = 100, G = (e, t, n) => {
12
- let r = e.element.getBoundingClientRect(), i = {
13
- x: t.clientX - r.left,
14
- y: t.clientY - r.top
15
- };
16
- return e.chart?.shapesAt(i, {
17
- components: [{
18
- key: n,
19
- opts: { propagation: "stop" }
20
- }],
21
- propagation: "stop"
22
- })?.[0];
23
- }, ue = (e, t) => {
24
- let n = null, r = V((r, i) => {
25
- let a = G(r, i, e);
26
- !a && n && (t(e, "mouseleave", n.key, i, n), n = null), a?.data?._ID && n?.data?._ID && a.data._ID !== n.data._ID && (t(e, "mouseleave", n.key, i, n), n = null), a && (t(e, "mousemove", a.key, i, a), n = a);
27
- }, W), i = V((r) => {
28
- n &&= (t(e, "mouseleave", n.key, r, n), null);
29
- }, W);
30
- return {
31
- type: "native",
32
- key: "action-events-interaction",
33
- events: {
34
- click(n) {
35
- let r = G(this, n, e);
36
- r && t(e, "click", r.key, n, r);
37
- },
38
- mousemove(e) {
39
- r(this, e);
40
- },
41
- mouseleave(e) {
42
- i(e);
43
- }
44
- }
45
- };
46
- }, K = /* @__PURE__ */ e(C()), de = o.Rectangle, q = (e) => ({
47
- shape: e?.heatMapSettings?.shape ?? de,
48
- minSize: e?.heatMapSettings?.minSize ?? .1,
49
- maxSize: e?.heatMapSettings?.maxSize ?? 1
50
- }), fe = (e, t, n, r, i, a, o, s) => {
51
- let c = [], { shape: l } = q(e), u = `${L.Point}-${l}`;
52
- if ((e?.enableEmitEvents ?? !1) && s) {
53
- let e = ue(u, s);
54
- c.push(e);
55
- }
56
- return {
57
- ...n,
58
- interactions: n.interactions ? [...n.interactions, ...c] : [...c]
59
- };
60
- }, pe = (e, t, n) => {
61
- let r = e.dimensions.filter(p), i = r.filter((e) => e.role === d.HEAT_MAP_HORIZONTAL), a = r.filter((e) => e.role === d.HEAT_MAP_VERTICAL), o = i[0], s = a[0], [c, l] = ne([{
62
- showAxisTooltip: e?.axes?.dimension?.showAxisTooltip,
63
- formatter: o?.formatter,
64
- scale: le(e),
65
- key: O.Dimension,
66
- settings: { direction: ae(e) }
67
- }, {
68
- showAxisTooltip: e?.axes?.secondaryDimension?.showAxisTooltip,
69
- formatter: s?.formatter,
70
- scale: R.YAxisScale,
71
- key: O.DimensionSec,
72
- settings: {
73
- direction: j(e),
74
- isVerticalDimension: !0
75
- }
76
- }]);
77
- return {
78
- ...n,
79
- components: [...n.components ?? [], ...c],
80
- interactions: [...n.interactions ?? [], ...l]
81
- };
82
- }, me = (e, t, n, r, i, a, o, u) => {
83
- let f = [], m = [], h = [];
84
- if (u) {
85
- let e = se(L.Text, u);
86
- h.push(e);
87
- }
88
- let g = e.dimensions.filter((e) => e.role === d.HEAT_MAP_HORIZONTAL), _ = g.filter(p), v = e.dimensions.filter((e) => e.role === d.HEAT_MAP_VERTICAL), y = v.filter(p), b = {
89
- ...t.axis.dimension,
90
- ...t.fonts
91
- }, x = {
92
- ...t.axis.measure,
93
- ...t.fonts
94
- }, S = _[0], C = y[0], w = e.measures.filter((e) => e.role === c.HEAT_MAP_COLOR), T = w.filter(p), E = {};
95
- if (S) {
96
- let t = e.axes?.dimension || E, n = t.secondaryAxis ? s.Top : s.Bottom;
97
- if (f.push(I(R.XAxisScale, t, b, n, S.formatter, a)), t.showAxisName) {
98
- let r = l(g, e.enableAlternate, a?.isPrintMode);
99
- m.push(P(_, r, n, b, t.colors?.title, t.axisTitle ? t.axisTitle : F(S, o), t.titleFontSize));
100
- }
101
- }
102
- if (C) {
103
- let t = e.axes?.secondaryDimension || E, n = t.secondaryAxis ? s.Right : s.Left;
104
- if (f.push(I(R.YAxisScale, t, b, n, C.formatter, a)), t.showAxisName) {
105
- let r = l(v, e.enableAlternate, a?.isPrintMode);
106
- m.push(P(y, r, n, b, t.colors?.title, t.axisTitle ? t.axisTitle : F(C, o), t.titleFontSize));
107
- }
108
- }
109
- if (w.length > 1) {
110
- let t = e.axes?.primaryMeasure || {}, n = l(w, e.enableAlternate, a?.isPrintMode);
111
- m.push(P(T, n, s.Right, x, t.colors?.title, t.axisTitle, t.titleFontSize));
112
- }
113
- return {
114
- ...n,
115
- components: [
116
- ...n.components,
117
- ...f,
118
- ...m
119
- ],
120
- interactions: [...n.interactions ?? [], ...h]
121
- };
122
- }, he = /* @__PURE__ */ e(r()), ge = (e) => (t, n) => t.value === e ? -1 : +(n.value === e), _e = (e) => (t, n) => t.value === e ? 1 : n.value === e ? -1 : 0, J = (e, t = 0) => (n, r) => {
123
- let i = e ? n[e] : n, a = e ? r[e] : r;
124
- return i.value !== a.value && i.value === null ? -t : i.value !== a.value && a.value === null ? t : i.value === a.value ? 0 : i.value < a.value ? -t : t;
125
- }, ve = (e) => (t, n) => {
126
- let r = 0;
127
- for (let i = 0; i < e.length; i++) if (r = e[i](t, n), r !== 0) return r;
128
- return r;
129
- }, ye = (e) => {
130
- let t = e.aggregation?.funcName;
131
- return t && [
132
- "SUM",
133
- "MIN",
134
- "MAX",
135
- "AVG"
136
- ].includes(t) ? t.toLowerCase() : t === "COUNT" ? "sum" : "avg";
137
- }, Y = (e, t, n) => {
138
- let r = n?.sortingOrder ?? [], o = r.findIndex((t) => i(t.dataItem) === i(e));
139
- if (o < 0) return;
140
- let s = r[o], c = p(s), l = (c ? r.slice(0, o) : r).filter((e) => e.fieldType === "measure" && p(e));
141
- if (s) {
142
- let e, r = [];
143
- n?.topN?.enabled && n.topN.showOthers && ((0, he.default)(n.topN.dimensionIdx) || n.topN.dimensionIdx === t) && (e = n.topN.othersPosition === T.First ? ge(n.topN.othersLabel?.stringLabel ?? "Others") : n.topN.othersPosition === T.Last ? _e(n.topN.othersLabel?.stringLabel ?? "Others") : void 0, e && r.push(e));
144
- let o = {};
145
- return l.forEach((e, t) => {
146
- let n = `m${t}`;
147
- r.push(J(n, e.sortDirection === a.Asc ? 1 : -1)), o[n] = {
148
- field: i(e.dataItem),
149
- reduce: ye(e.dataItem)
150
- };
151
- }), c && r.push(J("", s.sortDirection === a.Asc ? 1 : -1)), {
152
- props: o,
153
- sort: ve(r)
154
- };
155
- }
156
- }, be = (e, t, r) => {
157
- let a = e.dimensions.filter(p), o = e.measures.filter(p), s = a.filter((e) => e.role === d.HEAT_MAP_HORIZONTAL), l = a.filter((e) => e.role === d.HEAT_MAP_VERTICAL), u = o.filter((e) => e.role === c.HEAT_MAP_COLOR), f = o.filter((e) => e.role === c.HEAT_MAP_SIZE), m = s[0], h = l[0], g = u[0], _ = f[0], { coloring: v } = e || {}, y = v?.fieldId;
158
- e.coloring?.type === n.Gradient && (y ||= i(g.dataItem)), y && k(r, 0, { color: { field: y } });
159
- let b = z(H(e, y ?? null), t, {});
160
- if (m) {
161
- let t = Y(m.dataItem, 0, e.querySettings);
162
- b[R.XAxisScale] = {
163
- data: {
164
- extract: {
165
- field: i(m.dataItem),
166
- trackBy: (e) => e,
167
- reduce: "first",
168
- props: t?.props
169
- },
170
- sort: t?.sort
171
- },
172
- type: A.Band
173
- };
174
- }
175
- if (h) {
176
- let t = Y(h.dataItem, 1, e.querySettings);
177
- b[R.YAxisScale] = {
178
- data: {
179
- extract: {
180
- field: i(h.dataItem),
181
- trackBy: (e) => e,
182
- reduce: "first",
183
- props: t?.props
184
- },
185
- sort: t?.sort
186
- },
187
- type: A.Band
188
- };
189
- }
190
- let x = i(g.dataItem);
191
- if (b[x] = { data: { field: x } }, _) {
192
- let e = i(_.dataItem);
193
- b[e] = {
194
- type: A.Linear,
195
- data: { extract: { field: e } }
196
- };
197
- }
198
- return {
199
- ...r,
200
- scales: b
201
- };
202
- }, X = {
203
- measure: "measure",
204
- group: "group",
205
- size: "size"
206
- }, xe = (e, t, n) => {
207
- let r = e.dimensions.filter(p), a = e.measures.filter(p), o = ce((e.supportingMeasures ?? []).filter(p)), s = r.filter((e) => e.role === d.HEAT_MAP_HORIZONTAL), l = r.filter((e) => e.role === d.HEAT_MAP_VERTICAL), u = a.filter((e) => e.role === c.HEAT_MAP_COLOR), f = a.filter((e) => e.role === c.HEAT_MAP_SIZE);
208
- if (!r.length) return n;
209
- let m = s[0], h = l[0], g = u[0], _ = f[0], v = i(g?.dataItem), y = i(_?.dataItem), b = i(m?.dataItem), x = i(h?.dataItem), S = {
210
- [X.measure]: { field: v },
211
- [X.group]: { field: x },
212
- [X.size]: _ ? { field: y } : void 0,
213
- secondColorOverwrite: { field: x },
214
- ...o
215
- };
216
- v && (S[v] = { field: v }), y && (S[y] = { field: y });
217
- let C = [{
218
- key: R.Collection,
219
- data: { extract: [{
220
- field: b,
221
- props: S
222
- }] }
223
- }];
224
- return {
225
- ...n,
226
- collections: C
227
- };
228
- }, Se = (e, t, r, a, o, s) => {
229
- let l = e.measures.filter(p), u = l.filter((e) => e.role === c.HEAT_MAP_COLOR), d = l.filter((e) => e.role === c.HEAT_MAP_SIZE), f = u[0], m = d[0], { shape: h, minSize: g, maxSize: _ } = q(e), v = _;
230
- m && (v = (e) => e.resources.scale(i(m.dataItem))(e.datum.size.value) * (_ - g) + g);
231
- let y = new B(e, t, o?.[0]?.itemsNotAffectedByFiltering), b = {
232
- type: L.Point,
233
- key: `${L.Point}-${h}`,
234
- data: { collection: R.Collection },
235
- settings: {
236
- x: { scale: R.XAxisScale },
237
- y: {
238
- scale: R.YAxisScale,
239
- ref: X.group
240
- },
241
- fill: y.getColorDefinition({
242
- ref: "color",
243
- overwriteSources: [
244
- y.MAIN_FIELD,
245
- "secondColorOverwrite",
246
- "color"
247
- ],
248
- dataItemId: e.coloring?.type === n.Single ? i(f?.dataItem) : null
249
- }),
250
- shape: h,
251
- size: v
252
- },
253
- animations: {
254
- enabled: !0,
255
- presetId: "simple-opacity"
256
- },
257
- brush: ie(["", X.group], s, void 0, E.AndSubset)
258
- };
259
- return {
260
- ...r,
261
- components: [...r.components, b]
262
- };
263
- }, Z = {
264
- top: 0,
265
- bottom: 0,
266
- left: 2,
267
- right: 2
268
- }, Ce = (e, t, n, r) => {
269
- let a;
270
- return i(e.dataItem) === i(n.dataItem) ? a = r?.measure : i(t.dataItem) === i(n.dataItem) && (a = r?.size), a ? a.value === null ? "-" : a.label ?? "" : "";
271
- }, we = (e, t, n, r) => {
272
- if (i(e.dataItem) === i(n.dataItem)) return r.measure?.value;
273
- if (i(t.dataItem) === i(n.dataItem)) return r.size?.value;
274
- }, Q = (e, t, n) => {
275
- let r, i = e.measures.filter(p), a = i.filter((e) => e.role === c.HEAT_MAP_COLOR), s = i.filter((e) => e.role === c.HEAT_MAP_SIZE), l = a[0], u = s[0], { shape: d } = q(e), f;
276
- switch (d) {
277
- case o.Circle:
278
- f = D.Circle;
279
- break;
280
- case o.Square:
281
- case o.Rectangle:
282
- case o.Bar:
283
- f = D.Rect;
284
- break;
285
- default: f = D.Path;
286
- }
287
- if (l?.dataLabels?.show) r = l;
288
- else if (u?.dataLabels?.show) r = u;
289
- else return n;
290
- let h = {
291
- type: L.Labels,
292
- key: "heat-map-label",
293
- settings: { sources: [{
294
- component: `${L.Point}-${d}`,
295
- selector: f,
296
- strategy: {
297
- type: "bar",
298
- settings: {
299
- direction: "right",
300
- fontFamily: t.fonts.general.fontFamily,
301
- fontSize: N(r.dataLabels?.size),
302
- labels: [{
303
- label({ data: e, formatter: t }) {
304
- if (!e) return "";
305
- let n = Ce(l, u, r, e);
306
- if (m(r.formatter)) {
307
- let t = we(l, u, r, e);
308
- return t === null ? "-" : t === void 0 ? "" : x(r.formatter.format, r.formatter)(t, void 0, e);
309
- }
310
- return r.formatter && typeof t == "function" && n && n !== "-" ? t(r.formatter)(n) : n;
311
- },
312
- placements: [{
313
- position: w.Inside,
314
- fill: "#fff",
315
- align: .5,
316
- justify: .5,
317
- padding: Z
318
- }, {
319
- position: w.Inside,
320
- fill: "#000",
321
- align: .5,
322
- justify: .5,
323
- padding: Z
324
- }]
325
- }]
326
- }
327
- }
328
- }] },
329
- animations: {
330
- enabled: !0,
331
- presetId: "chart-labels"
332
- }
333
- };
334
- return {
335
- ...n,
336
- components: [...n?.components ?? [], h]
337
- };
338
- }, Te = (e, t, n) => {
339
- let { shape: r } = q(e), i = `${L.Point}-${r}`;
340
- return ee(e, t, n, {
341
- filter: (e) => e.filter((e) => e.key === i),
342
- placement: {
343
- type: "pointer",
344
- area: "target"
345
- }
346
- });
347
- }, Ee = class extends M {
348
- constructor() {
349
- super([
350
- xe,
351
- be,
352
- me,
353
- Se,
354
- te,
355
- Te,
356
- Q,
357
- pe,
358
- fe
359
- ]);
360
- }
361
- preCompile(e) {
362
- let t = e.dimensions.filter(p), n = e.measures.filter(p), r = t.filter((e) => e.role === d.HEAT_MAP_HORIZONTAL), i = t.filter((e) => e.role === d.HEAT_MAP_VERTICAL), a = n.filter((e) => e.role === c.HEAT_MAP_COLOR), o = r[0], s = i[0], l = a[0];
363
- if (!o || !s || !l) throw Error("Charts w/o horizontal or vertical dimension or color measure are not supported ATM.");
364
- }
365
- }, De = ({ id: e, clientX: t, clientY: n, vBackendAPI: r, ...i }) => {
366
- let { top: a, left: o } = r.daedalus.convertCoordinatesToContainerPosition(t, n);
367
- U({
368
- id: e,
369
- top: a,
370
- left: o,
371
- ...i
372
- }, { vBackendAPI: r });
373
- }, $ = (e, t, n, r, a) => {
374
- let o, s, [c, l, u, d] = r, f = c.name, p = l.name, m = u.name, h = n.data.value, g = n.data.group.value, _ = n.data.measure.value;
375
- if (d) {
376
- let e = i(d);
377
- o = n.data[e].value, s = d.name;
378
- }
379
- De({
380
- id: e,
381
- clientX: t.clientX,
382
- clientY: t.clientY,
383
- xAxisValue: h,
384
- yAxisValue: g,
385
- measureColorValue: _,
386
- measureSizeValue: o,
387
- xAxisName: f,
388
- yAxisName: p,
389
- measureColorName: m,
390
- measureSizeName: s,
391
- vBackendAPI: a
392
- });
393
- }, Oe = (e) => U({ id: "onCellLeave" }, { vBackendAPI: e }), ke = () => {
394
- let e = y(), t = b(), n = S();
395
- return (0, K.useCallback)((r, i, a, o, s) => {
396
- let c;
397
- switch (i) {
398
- case "click":
399
- r === L.Text ? c = oe(r, n, o, a) : s?.key && o && $("onCellClick", o, s, t, e);
400
- break;
401
- case "mousemove":
402
- if (!o || !s) break;
403
- $("onCellHover", o, s, t, e);
404
- break;
405
- case "mouseleave":
406
- Oe(e);
407
- break;
408
- }
409
- c && e.emitEvent(c.action, c.payload);
410
- }, [e, t]);
411
- }, Ae = h(), je = _(({ vSpec: e, vTheme: n, data: r, elementSize: i, vizProperties: a }) => {
412
- let o = v(), [s] = (0, K.useState)(() => new Ee()), c = g(), l = ke();
413
- if (!e || !f(e) || !i) return null;
414
- let d = n || u, p = s.compile(e, d, r, i, a, t.HeatMap, o, c, l);
415
- return p ? /* @__PURE__ */ (0, Ae.jsx)(re, {
416
- config: a,
417
- definition: p,
418
- size: i,
419
- vSpec: e
420
- }) : null;
421
- });
422
- export { je as HeatMapChart };
@@ -1,287 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { $t as t, Ao as n, Cc as r, Ec as i, Hc as a, Na as o, Vt as s, Wc as c, Wo as l, fa as u, js as d, ko as f, qt as p, ri as m } from "./visualization-filters-BwS0xUqs.js";
3
- import { Br as h, I as g, Mt as _, P as v, li as y } from "./utils-BdJrEeIQ.js";
4
- import { v_ as b } from "./handlers-C63NVo7i.js";
5
- import { r as x } from "./label-format-type-C46pzgx7.js";
6
- import { t as S } from "./stroke-dash-UgMEcCS4.js";
7
- import "./logger-Bc-DqDM_.js";
8
- import { $t as C, C as w, Cn as T, D as E, Dn as D, Dt as O, Ft as k, I as A, Kt as j, M, Mt as N, Nt as P, Ot as F, Qt as I, St as L, Ut as R, _ as z, _n as B, bn as V, i as H, jn as U, jt as W, kt as G, ln as K, n as q, rn as J, v as Y, vn as X, w as Z, wt as ee, y as Q, yn as $, zt as te } from "./escobar-cQ1eQ64G.js";
9
- import { s as ne, t as re } from "./coloring-BOiP0rmn.js";
10
- import { t as ie } from "./set-coloring-datafield-B3uIS1Pe.js";
11
- var ae = /* @__PURE__ */ e(y()), oe = (e, n, o) => {
12
- let l = e.dimensions.filter((e) => m(e)), u = e.measures.filter((e) => m(e)), d = l[0], f = u[0], p = !1, h = {}, { coloring: g } = e || {}, _ = g?.fieldId ?? null;
13
- if (g?.type === i.Categorical && (_ ||= d ? a(d.dataItem) : null), g?.type === i.Gradient && (_ ||= f ? a(f.dataItem) : null), _ && N(o, 0, { color: { field: _ } }), d && e?.axes?.dimension?.continuousAxis) {
14
- let e = c(d.dataItem), n = !!d.datePart, r = s(e) || t(e);
15
- p = !n && r;
16
- }
17
- if (h = te(ie(e, _), n, h), h = M(e, h, o.collections, p, !0), u.filter((e) => e.graphType === r.Bar).length > 1 && !e.barSettings?.grouped) {
18
- let t = $(e, u.find((e) => e.graphType === r.Bar));
19
- h[t].data = { collection: R.ComboChartCollection };
20
- }
21
- return {
22
- ...o,
23
- scales: h
24
- };
25
- }, se = (e, t, n) => {
26
- let i = e.measures.filter((e) => m(e)), o = e.dimensions.filter((e) => m(e)), s = (e.supportingMeasures ?? []).filter((e) => m(e)), c = i.reduce((e, t) => {
27
- let n = a(t.dataItem);
28
- return e[n] = { field: n }, e;
29
- }, {}), l = Y(s), u = o.reduce((e, t) => {
30
- let n = a(t.dataItem);
31
- return e[n] = { field: n }, e;
32
- }, {}), d = o[0];
33
- if (!d) return n;
34
- let f = a(d.dataItem), p = {
35
- key: R.ComboChartCollection,
36
- data: { extract: [] }
37
- };
38
- if (p.data.extract = i.map((e, t) => {
39
- let n = a(e.dataItem);
40
- return {
41
- field: f,
42
- props: {
43
- end: { field: n },
44
- ...c,
45
- ...l,
46
- ...u,
47
- start: 0,
48
- graphType: e.graphType,
49
- measureIndex: t,
50
- fieldId: n
51
- }
52
- };
53
- }), i.filter((e) => e.graphType === r.Bar).length > 1) {
54
- let t = !!i.find((e) => e.graphType === r.Bar)?.secondaryAxis, n = new Map(i.map((e) => [a(e.dataItem), !!e.secondaryAxis]));
55
- e.barSettings?.grouped || (p.data.stack = {
56
- stackKey: (e) => e.graphType.value === r.Bar ? `${e.value}` : `${e.value}-${e.graphType.value}-${e.measureIndex.value}`,
57
- value: (e) => {
58
- let r = e.fieldId?.value;
59
- if (typeof r != "string" || n.get(r) !== t) return 0;
60
- let i = e.end.value;
61
- return typeof i == "number" || typeof i == "string" ? i : 0;
62
- },
63
- offset: x.Diverging
64
- });
65
- }
66
- return {
67
- ...n,
68
- collections: [...n.collections ?? [], p]
69
- };
70
- }, ce = (e, t, n, i, o, s) => {
71
- let c = [];
72
- return e.measures.filter((e) => m(e)).forEach((i) => {
73
- let l = a(i.dataItem), u = (e) => e.fieldId.value === l;
74
- switch (i.graphType || e.type) {
75
- case r.Bar:
76
- c.push(ue(e, t, o ?? [], n, i, s, u));
77
- break;
78
- case r.Point:
79
- c.push(G(e, t, n, i, !1, R.ComboChartCollection, u));
80
- break;
81
- default: c.push(le(e, t, n, i, u)), c.push(G(e, t, n, i, !i.showDataPoints, R.ComboChartCollection, u));
82
- }
83
- }), c.sort((e) => e.type === U.Box ? -1 : 0), {
84
- ...n,
85
- components: [...n.components, ...c]
86
- };
87
- };
88
- function le(e, t, n, i, o) {
89
- let s = e.dimensions.filter((e) => m(e));
90
- if (!s[0]) throw Error("Combo chart without dimension is not supported.");
91
- if (s.length > 1) throw Error("Combo chart currently support only one dimension.");
92
- let c = S(i.strokeDash), u = a(i.dataItem), f = ne(e, n, t, i, u);
93
- return {
94
- type: U.Line,
95
- layout: { displayOrder: C.VisualizationElement },
96
- key: W(e, i, r.Line),
97
- data: d({
98
- collection: R.ComboChartCollection,
99
- filter: o
100
- }),
101
- settings: {
102
- orientation: e.orientation === l.Horizontal ? l.Vertical : l.Horizontal,
103
- coordinates: {
104
- major: { scale: X(e) },
105
- minor: {
106
- scale: $(e, i),
107
- ref: u
108
- }
109
- },
110
- layers: {
111
- curve: e.lineSettings?.lineCurve,
112
- skipCollisions: !0,
113
- line: {
114
- stroke: f,
115
- strokeWidth: i.strokeWidth,
116
- strokeDasharray: c
117
- }
118
- }
119
- },
120
- animations: {
121
- enabled: !0,
122
- presetId: "simple-opacity"
123
- }
124
- };
125
- }
126
- function ue(e, t, n, i, o, s, c) {
127
- let u = e.dimensions.filter((e) => m(e)), f = e.measures.filter((e) => m(e) && e.graphType === r.Bar);
128
- if (!u[0]) throw Error("Combo chart without dimension is not supported.");
129
- let h = { scale: X(e) }, g = {
130
- scale: $(e, o),
131
- end: { ref: "end" }
132
- }, _ = {
133
- minWidthPx: 2,
134
- rx: p(e?.barSettings.barRadius, 0),
135
- roundAllEdges: e?.barSettings?.roundAllEdges,
136
- useCustomBoxRounding: !0,
137
- boxPadding: e?.barSettings?.barPadding ?? D.scale.padding
138
- };
139
- _.fill = new re(e, t, n?.[0]?.itemsNotAffectedByFiltering).getColorDefinition({ ref: "fieldId" });
140
- let v = {
141
- enabled: !0,
142
- presetId: "bar-chart"
143
- }, y = o?.graphType !== r.Bar;
144
- if (f.length > 1 && e.barSettings?.grouped) {
145
- let t = 1 * (1 / f.length), n = (1 - (e.barSettings?.barPadding ?? 0)) * t, r = .5 / f.length, i = (1 + 0 * (f.length - 1)) * r, s = f.findIndex((e) => a(e.dataItem) === a(o.dataItem));
146
- h.fn = (n) => {
147
- let r = n.resources.scale(X(e));
148
- return r(n.datum.value) + i * r.bandwidth?.() + s * r.bandwidth?.() * t;
149
- }, _.width = n;
150
- }
151
- return {
152
- type: U.Box,
153
- layout: { displayOrder: C.VisualizationElement },
154
- key: W(e, o, r.Bar),
155
- data: d({
156
- collection: R.ComboChartCollection,
157
- filter: c
158
- }),
159
- settings: {
160
- orientation: e.orientation ?? l.Vertical,
161
- major: h,
162
- minor: g,
163
- box: _
164
- },
165
- animations: v,
166
- brush: y ? null : K([""], s)
167
- };
168
- }
169
- var de = (e, t) => {
170
- let n = t ? [b.Inside] : [
171
- b.Inside,
172
- b.Outside,
173
- b.Opposite
174
- ];
175
- return (e || [
176
- {
177
- position: b.Inside,
178
- justify: 1
179
- },
180
- { position: b.Outside },
181
- { position: b.Opposite }
182
- ]).map((e) => ({
183
- ...e,
184
- possible: n.includes(e.position)
185
- }));
186
- }, fe = ({ data: e }) => e ? e.end.value > e.start.value ? "up" : "down" : null, pe = ({ data: e }) => e ? e.end.value > e.start.value ? "right" : "left" : null, me = (e, t, i, s, c, l) => {
187
- let u = e.measures.filter((e) => m(e)), d = u.filter((e) => e.graphType === r.Bar), p = d.filter((e) => e.dataLabels?.show), h = d.length >= 2 && !("barSettings" in e && e.barSettings?.grouped), g = V(e), _ = p.map((n) => {
188
- let i = !!n.dataLabels?.barLabelPlacements, a = de(n.dataLabels?.barLabelPlacements, h).filter((e) => e.possible).map((e) => ({
189
- position: e.position,
190
- fill: e.position === b.Inside ? o.white : "#242424",
191
- ...e.justify === void 0 ? {} : { justify: e.justify },
192
- ...i ? { overflow: [b.Outside, b.Opposite].includes(e.position) } : {}
193
- }));
194
- return n.dataLabels?.showBackdrop && !h && (a = a.map((e) => Q(e, t, g))), {
195
- key: `combo-bar-labels-${n.dataItem.uniqueSignature}`,
196
- type: U.Labels,
197
- layout: { displayOrder: C.Labels },
198
- settings: { sources: [{
199
- component: W(e, n, r.Bar),
200
- selector: T.Rect,
201
- strategy: {
202
- type: "bar",
203
- settings: {
204
- direction: g ? pe : fe,
205
- fontSize: B(n.dataLabels?.size),
206
- fontFamily: t.fonts.general.fontFamily,
207
- labels: [{
208
- label: w(n),
209
- placements: a
210
- }]
211
- }
212
- }
213
- }] },
214
- animations: {
215
- enabled: !0,
216
- presetId: "chart-labels"
217
- }
218
- };
219
- }), v = {}, y = {}, x = u.filter((e) => e.graphType !== r.Bar).map((t) => {
220
- let i = a(t.dataItem), o = W(e, t, r.Point);
221
- return y[o] = i, v[o] = {
222
- enabled: t.dataLabels?.show || !1,
223
- fontSize: B(t.dataLabels?.size),
224
- backdropColor: t.dataLabels?.backdropColor,
225
- textColor: t.dataLabels?.textColor,
226
- isColored: t.dataLabels?.isColored,
227
- colorType: t.dataLabels?.showBackdrop ? f.Backdrop : f.Text,
228
- density: t.dataLabels?.density || n.Medium
229
- }, o;
230
- }).filter((e) => v[e].enabled), S = x.length ? [E({
231
- targetComponentKeys: x,
232
- targetSelector: `.${F}`,
233
- label: ({ data: e, node: t }) => e[y[t.key]]?.label,
234
- skipBrush: !0
235
- }, v, l, t)] : [];
236
- if (_.length && S.length) {
237
- let e = {
238
- ...S[0],
239
- settings: {
240
- ...S[0].settings,
241
- sources: [..._.flatMap((e) => e.settings?.sources ?? []), ...S[0].settings?.sources ?? []]
242
- }
243
- };
244
- return {
245
- ...i,
246
- components: [...i.components, e]
247
- };
248
- }
249
- return {
250
- ...i,
251
- components: [
252
- ...i.components,
253
- ..._,
254
- ...S
255
- ]
256
- };
257
- }, he = class extends z {
258
- constructor() {
259
- super([
260
- se,
261
- oe,
262
- J,
263
- k,
264
- ce,
265
- ee,
266
- P,
267
- me,
268
- L,
269
- A,
270
- j,
271
- I,
272
- O,
273
- Z
274
- ]);
275
- }
276
- }, ge = h(), _e = _(({ vSpec: e, vTheme: t, data: n, elementSize: i, vizProperties: a }) => {
277
- let o = v(), [s] = (0, ae.useState)(() => new he()), c = g(), l = q();
278
- if (!e || !i) return null;
279
- let d = t || u, f = s.compile(e, d, n, i, a, r.Combo, o, c, l);
280
- return f ? /* @__PURE__ */ (0, ge.jsx)(H, {
281
- config: a,
282
- definition: f,
283
- size: i,
284
- vSpec: e
285
- }) : null;
286
- });
287
- export { _e as ComboChart };