@iyulab/u-widgets 0.9.1 → 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 +6 -0
- package/dist/format-DiXp3HTj.js +152 -0
- package/dist/format-DiXp3HTj.js.map +1 -0
- package/dist/tokens-byMop3gk.js +64 -0
- package/dist/tokens-byMop3gk.js.map +1 -0
- package/dist/u-widgets-charts.js +265 -257
- package/dist/u-widgets-charts.js.map +1 -1
- package/dist/u-widgets-math.d.ts +219 -0
- package/dist/u-widgets-math.js +95 -0
- package/dist/u-widgets-math.js.map +1 -0
- package/dist/u-widgets-tools.js +52 -21
- package/dist/u-widgets-tools.js.map +1 -1
- package/dist/u-widgets.d.ts +1 -1
- package/dist/u-widgets.js +68 -63
- package/dist/u-widgets.js.map +1 -1
- package/package.json +13 -3
- package/schema/u-widget.schema.json +1 -1
- package/dist/tokens-SjA7YdRs.js +0 -213
- package/dist/tokens-SjA7YdRs.js.map +0 -1
package/dist/u-widgets-charts.js
CHANGED
|
@@ -1,82 +1,87 @@
|
|
|
1
|
-
import { css as
|
|
1
|
+
import { css as E, LitElement as P, nothing as T, html as R } from "lit";
|
|
2
2
|
import { property as $, customElement as B } from "lit/decorators.js";
|
|
3
|
-
import { a as W, f as q
|
|
3
|
+
import { a as W, f as q } from "./format-DiXp3HTj.js";
|
|
4
|
+
import { t as G } from "./tokens-byMop3gk.js";
|
|
4
5
|
import * as O from "echarts/core";
|
|
5
6
|
import { BarChart as H, LineChart as U, PieChart as Y, ScatterChart as J, RadarChart as Q, HeatmapChart as X, BoxplotChart as Z, FunnelChart as K, TreemapChart as ee } from "echarts/charts";
|
|
6
|
-
import { GridComponent as te, TooltipComponent as re, LegendComponent as ie, RadarComponent as se, MarkLineComponent as ne, VisualMapComponent as
|
|
7
|
-
import { CanvasRenderer as
|
|
8
|
-
function M(e,
|
|
9
|
-
for (const
|
|
10
|
-
const t = e[
|
|
7
|
+
import { GridComponent as te, TooltipComponent as re, LegendComponent as ie, RadarComponent as se, MarkLineComponent as ne, VisualMapComponent as oe } from "echarts/components";
|
|
8
|
+
import { CanvasRenderer as ae } from "echarts/renderers";
|
|
9
|
+
function M(e, r) {
|
|
10
|
+
for (const i of r) {
|
|
11
|
+
const t = e[i.field];
|
|
11
12
|
if (t == null) continue;
|
|
12
13
|
const n = Number(t);
|
|
13
14
|
if (Number.isNaN(n)) continue;
|
|
14
|
-
const s =
|
|
15
|
-
if (s &&
|
|
15
|
+
const s = i.above === void 0 || n > i.above, f = i.below === void 0 || n < i.below;
|
|
16
|
+
if (s && f) return i;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
function le(e) {
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
20
|
+
const r = e.widget, i = e.data, t = e.mapping ? W(e.mapping) : void 0, n = e.options ?? {};
|
|
21
|
+
if (!i) return {};
|
|
21
22
|
let s;
|
|
22
|
-
switch (
|
|
23
|
+
switch (r) {
|
|
23
24
|
case "chart.bar":
|
|
24
|
-
s = N(
|
|
25
|
+
s = N(i, t, "bar", n);
|
|
25
26
|
break;
|
|
26
27
|
case "chart.line":
|
|
27
|
-
s = N(
|
|
28
|
+
s = N(i, t, "line", n);
|
|
28
29
|
break;
|
|
29
30
|
case "chart.area":
|
|
30
|
-
s = N(
|
|
31
|
+
s = N(i, t, "line", { ...n, _area: !0 });
|
|
31
32
|
break;
|
|
32
33
|
case "chart.pie":
|
|
33
|
-
s = ue(
|
|
34
|
+
s = ue(i, t, n);
|
|
34
35
|
break;
|
|
35
36
|
case "chart.scatter":
|
|
36
|
-
s = ce(
|
|
37
|
+
s = ce(i, t, n);
|
|
37
38
|
break;
|
|
38
39
|
case "chart.radar":
|
|
39
|
-
s = fe(
|
|
40
|
+
s = fe(i, t);
|
|
40
41
|
break;
|
|
41
42
|
case "chart.heatmap":
|
|
42
|
-
s = ye(
|
|
43
|
+
s = ye(i, t, n);
|
|
43
44
|
break;
|
|
44
45
|
case "chart.box":
|
|
45
|
-
s = he(
|
|
46
|
+
s = he(i, t);
|
|
46
47
|
break;
|
|
47
48
|
case "chart.funnel":
|
|
48
|
-
s = me(
|
|
49
|
+
s = me(i, t);
|
|
49
50
|
break;
|
|
50
51
|
case "chart.waterfall":
|
|
51
|
-
s = de(
|
|
52
|
+
s = de(i, t);
|
|
52
53
|
break;
|
|
53
54
|
case "chart.treemap":
|
|
54
|
-
s =
|
|
55
|
+
s = pe(i);
|
|
55
56
|
break;
|
|
56
57
|
case "chart.histogram":
|
|
57
|
-
s =
|
|
58
|
+
s = be(i, t, n);
|
|
58
59
|
break;
|
|
59
60
|
default:
|
|
60
61
|
return {};
|
|
61
62
|
}
|
|
62
|
-
n.legend === !1 && s.legend && (s.legend = { ...s.legend, show: !1 }), n.grid === !1
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
if (n.legend === !1 && s.legend && (s.legend = { ...s.legend, show: !1 }), n.grid === !1) {
|
|
64
|
+
const y = (u) => !u || typeof u != "object" ? u : Array.isArray(u) ? u.map(y) : { ...u, splitLine: { show: !1 } };
|
|
65
|
+
s.xAxis && (s.xAxis = y(s.xAxis)), s.yAxis && (s.yAxis = y(s.yAxis));
|
|
66
|
+
}
|
|
67
|
+
n.animate === !1 && (s.animation = !1), Array.isArray(n.colors) && n.colors.length > 0 && (s.color = n.colors);
|
|
68
|
+
const f = n.locale;
|
|
69
|
+
z(s, "xAxis", n.xFormat, f), z(s, "yAxis", n.yFormat, f);
|
|
65
70
|
const h = n.echarts;
|
|
66
71
|
return h && typeof h == "object" && (s = V(s, h)), s;
|
|
67
72
|
}
|
|
68
|
-
function N(e,
|
|
73
|
+
function N(e, r, i, t) {
|
|
69
74
|
if (!Array.isArray(e)) return {};
|
|
70
|
-
const n =
|
|
75
|
+
const n = r?.x ?? C(e), s = r?.y ?? [_(e)].filter(Boolean);
|
|
71
76
|
if (!n || s.length === 0) return {};
|
|
72
|
-
const
|
|
77
|
+
const f = e.map((o) => String(o[n] ?? "")), h = !!t.horizontal, y = Array.isArray(t.series) ? t.series : [], u = t.conditionalStyles, m = s.map((o, l) => {
|
|
73
78
|
const c = {
|
|
74
|
-
name:
|
|
75
|
-
type:
|
|
76
|
-
data: e.map((
|
|
77
|
-
const w =
|
|
78
|
-
if (
|
|
79
|
-
const v = M(
|
|
79
|
+
name: o,
|
|
80
|
+
type: i,
|
|
81
|
+
data: e.map((b) => {
|
|
82
|
+
const w = b[o] ?? null;
|
|
83
|
+
if (u?.length) {
|
|
84
|
+
const v = M(b, u);
|
|
80
85
|
if (v) {
|
|
81
86
|
const F = { value: w, itemStyle: { color: v.color } };
|
|
82
87
|
return v.symbol && (F.symbol = v.symbol), v.symbolSize && (F.symbolSize = v.symbolSize), F;
|
|
@@ -86,156 +91,156 @@ function N(e, i, r, t) {
|
|
|
86
91
|
})
|
|
87
92
|
};
|
|
88
93
|
t._area && (c.areaStyle = {}), t.smooth && (c.smooth = !0), t.step && (c.step = t.step === !0 ? "end" : t.step);
|
|
89
|
-
const
|
|
90
|
-
return
|
|
91
|
-
}),
|
|
92
|
-
t.histogram && (
|
|
93
|
-
|
|
94
|
+
const a = y[l];
|
|
95
|
+
return a && (a.color && (c.itemStyle = { color: a.color }, c.lineStyle = { ...c.lineStyle ?? {}, color: a.color }), a.lineStyle && (c.lineStyle = { ...c.lineStyle ?? {}, ...a.lineStyle }), a.symbol !== void 0 && (c.symbol = a.symbol), a.label && (c.name = a.label), a.type && (c.type = a.type), a.yAxisIndex !== void 0 && (c.yAxisIndex = a.yAxisIndex)), c;
|
|
96
|
+
}), g = { type: "category", data: f }, x = { type: "value" };
|
|
97
|
+
t.histogram && (g.axisTick = { alignWithLabel: !0 }, m.forEach((o) => {
|
|
98
|
+
o.barCategoryGap = "0%";
|
|
94
99
|
}));
|
|
95
|
-
const A = !h &&
|
|
96
|
-
let
|
|
100
|
+
const A = !h && m.some((o) => o.yAxisIndex >= 1);
|
|
101
|
+
let d;
|
|
97
102
|
if (A) {
|
|
98
|
-
const
|
|
99
|
-
|
|
103
|
+
const o = Array.isArray(t.yAxis) && t.yAxis.length >= 2 ? t.yAxis[1] : { type: "value" };
|
|
104
|
+
d = [x, o];
|
|
100
105
|
} else
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
xAxis: h ?
|
|
104
|
-
yAxis:
|
|
105
|
-
series:
|
|
106
|
+
d = h ? g : x;
|
|
107
|
+
const p = {
|
|
108
|
+
xAxis: h ? x : g,
|
|
109
|
+
yAxis: d,
|
|
110
|
+
series: m,
|
|
106
111
|
tooltip: { trigger: "axis" }
|
|
107
112
|
};
|
|
108
113
|
if (s.length > 1) {
|
|
109
|
-
const
|
|
110
|
-
|
|
114
|
+
const o = m.map((l) => l.name);
|
|
115
|
+
p.legend = { data: o };
|
|
111
116
|
}
|
|
112
|
-
t.stack &&
|
|
113
|
-
|
|
117
|
+
t.stack && p.series.forEach((o) => {
|
|
118
|
+
o.stack = "total";
|
|
114
119
|
});
|
|
115
120
|
const S = t.referenceLines;
|
|
116
|
-
return Array.isArray(S) && S.length > 0 &&
|
|
121
|
+
return Array.isArray(S) && S.length > 0 && m.length > 0 && (m[0].markLine = {
|
|
117
122
|
silent: !0,
|
|
118
123
|
symbol: "none",
|
|
119
|
-
data: S.map((
|
|
124
|
+
data: S.map((o) => {
|
|
120
125
|
const l = {};
|
|
121
|
-
|
|
126
|
+
o.axis === "x" ? l.xAxis = o.value : l.yAxis = o.value, o.label && (l.name = o.label);
|
|
122
127
|
const c = {};
|
|
123
|
-
return
|
|
128
|
+
return o.color && (c.color = o.color), o.style && (c.type = o.style), Object.keys(c).length > 0 && (l.lineStyle = c), o.label && (l.label = { formatter: o.label, position: "end" }), l;
|
|
124
129
|
})
|
|
125
|
-
}),
|
|
130
|
+
}), p;
|
|
126
131
|
}
|
|
127
|
-
function ce(e,
|
|
132
|
+
function ce(e, r, i) {
|
|
128
133
|
if (!Array.isArray(e)) return {};
|
|
129
|
-
const t = I(e), n =
|
|
134
|
+
const t = I(e), n = r?.x ?? t[0], s = (r?.y ?? [t[1]])[0], f = r?.color, h = r?.size, y = r?.opacity;
|
|
130
135
|
if (!n || !s) return {};
|
|
131
|
-
const
|
|
136
|
+
const u = {
|
|
132
137
|
xAxis: { type: "value" },
|
|
133
138
|
yAxis: { type: "value" },
|
|
134
139
|
tooltip: { trigger: "item" }
|
|
135
140
|
};
|
|
136
|
-
let
|
|
137
|
-
if (
|
|
138
|
-
for (const
|
|
139
|
-
const l = Number(
|
|
140
|
-
l <
|
|
141
|
+
let m = 1 / 0, g = -1 / 0;
|
|
142
|
+
if (y)
|
|
143
|
+
for (const o of e) {
|
|
144
|
+
const l = Number(o[y] ?? 0);
|
|
145
|
+
l < m && (m = l), l > g && (g = l);
|
|
141
146
|
}
|
|
142
|
-
const
|
|
143
|
-
const l = [Number(
|
|
144
|
-
if (h && l.push(Number(
|
|
145
|
-
const c = M(
|
|
147
|
+
const x = g - m || 1, A = i.conditionalStyles, d = (o) => {
|
|
148
|
+
const l = [Number(o[n] ?? 0), Number(o[s] ?? 0)];
|
|
149
|
+
if (h && l.push(Number(o[h] ?? 0)), A?.length) {
|
|
150
|
+
const c = M(o, A);
|
|
146
151
|
if (c) {
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
149
|
-
const w = Number(
|
|
150
|
-
|
|
152
|
+
const a = { color: c.color };
|
|
153
|
+
if (y) {
|
|
154
|
+
const w = Number(o[y] ?? 0);
|
|
155
|
+
a.opacity = Math.round((0.1 + 0.9 * ((w - m) / x)) * 100) / 100;
|
|
151
156
|
}
|
|
152
|
-
const
|
|
153
|
-
return c.symbol && (
|
|
157
|
+
const b = { value: l, itemStyle: a };
|
|
158
|
+
return c.symbol && (b.symbol = c.symbol), c.symbolSize && (b.symbolSize = c.symbolSize), b;
|
|
154
159
|
}
|
|
155
160
|
}
|
|
156
|
-
if (
|
|
157
|
-
const
|
|
158
|
-
return { value: l, itemStyle: { opacity: Math.round(
|
|
161
|
+
if (y) {
|
|
162
|
+
const a = 0.1 + 0.9 * ((Number(o[y] ?? 0) - m) / x);
|
|
163
|
+
return { value: l, itemStyle: { opacity: Math.round(a * 100) / 100 } };
|
|
159
164
|
}
|
|
160
165
|
return l;
|
|
161
|
-
},
|
|
162
|
-
const c = (Array.isArray(
|
|
166
|
+
}, p = h ? (o) => {
|
|
167
|
+
const c = (Array.isArray(o) ? o : o.value)[2] ?? 0;
|
|
163
168
|
return Math.max(4, Math.min(60, Math.sqrt(c) * 4));
|
|
164
169
|
} : void 0;
|
|
165
|
-
if (
|
|
166
|
-
const
|
|
170
|
+
if (f) {
|
|
171
|
+
const o = /* @__PURE__ */ new Map();
|
|
167
172
|
for (const c of e) {
|
|
168
|
-
const
|
|
169
|
-
|
|
173
|
+
const a = String(c[f] ?? "unknown");
|
|
174
|
+
o.has(a) || o.set(a, []), o.get(a).push(d(c));
|
|
170
175
|
}
|
|
171
176
|
const l = [];
|
|
172
|
-
for (const [c,
|
|
173
|
-
const
|
|
174
|
-
|
|
177
|
+
for (const [c, a] of o) {
|
|
178
|
+
const b = { name: c, type: "scatter", data: a };
|
|
179
|
+
p && (b.symbolSize = p), l.push(b);
|
|
175
180
|
}
|
|
176
|
-
|
|
181
|
+
u.series = l, u.legend = { data: Array.from(o.keys()) };
|
|
177
182
|
} else {
|
|
178
|
-
const l = { type: "scatter", data: e.map((c) =>
|
|
179
|
-
|
|
183
|
+
const l = { type: "scatter", data: e.map((c) => d(c)) };
|
|
184
|
+
p && (l.symbolSize = p), u.series = [l];
|
|
180
185
|
}
|
|
181
|
-
const S =
|
|
186
|
+
const S = i.referenceLines;
|
|
182
187
|
if (Array.isArray(S) && S.length > 0) {
|
|
183
|
-
const
|
|
184
|
-
|
|
188
|
+
const o = u.series[0];
|
|
189
|
+
o.markLine = {
|
|
185
190
|
silent: !0,
|
|
186
191
|
symbol: "none",
|
|
187
192
|
data: S.map((l) => {
|
|
188
193
|
const c = {};
|
|
189
194
|
l.axis === "x" ? c.xAxis = l.value : c.yAxis = l.value, l.label && (c.name = l.label);
|
|
190
|
-
const
|
|
191
|
-
return l.color && (
|
|
195
|
+
const a = {};
|
|
196
|
+
return l.color && (a.color = l.color), l.style && (a.type = l.style), Object.keys(a).length > 0 && (c.lineStyle = a), l.label && (c.label = { formatter: l.label, position: "end" }), c;
|
|
192
197
|
})
|
|
193
198
|
};
|
|
194
199
|
}
|
|
195
|
-
return
|
|
200
|
+
return u;
|
|
196
201
|
}
|
|
197
|
-
function ue(e,
|
|
202
|
+
function ue(e, r, i) {
|
|
198
203
|
if (!Array.isArray(e)) return {};
|
|
199
|
-
const t =
|
|
204
|
+
const t = r?.label ?? C(e), n = r?.value ?? _(e);
|
|
200
205
|
if (!t || !n) return {};
|
|
201
|
-
const s = e.map((
|
|
202
|
-
name: String(
|
|
203
|
-
value: Number(
|
|
206
|
+
const s = e.map((m) => ({
|
|
207
|
+
name: String(m[t] ?? ""),
|
|
208
|
+
value: Number(m[n] ?? 0)
|
|
204
209
|
})), h = {
|
|
205
210
|
type: "pie",
|
|
206
|
-
radius:
|
|
211
|
+
radius: i.donut ? ["40%", "70%"] : "50%",
|
|
207
212
|
data: s,
|
|
208
213
|
label: { overflow: "truncate", width: 80 }
|
|
209
214
|
};
|
|
210
|
-
|
|
211
|
-
const
|
|
215
|
+
i.showLabel === !1 && (h.label = { show: !1 });
|
|
216
|
+
const y = {
|
|
212
217
|
tooltip: { trigger: "item" },
|
|
213
218
|
legend: { orient: "vertical", left: "left" },
|
|
214
219
|
series: [h]
|
|
215
|
-
},
|
|
216
|
-
if (
|
|
217
|
-
const
|
|
218
|
-
|
|
220
|
+
}, u = i.center;
|
|
221
|
+
if (i.donut && u && (u.label || u.value)) {
|
|
222
|
+
const m = [];
|
|
223
|
+
u.label && m.push({
|
|
219
224
|
type: "text",
|
|
220
|
-
top:
|
|
221
|
-
style: { text:
|
|
222
|
-
}),
|
|
225
|
+
top: u.value ? -16 : 0,
|
|
226
|
+
style: { text: u.label, fontSize: 13, fill: "#999", textAlign: "center" }
|
|
227
|
+
}), u.value && m.push({
|
|
223
228
|
type: "text",
|
|
224
|
-
top:
|
|
225
|
-
style: { text:
|
|
226
|
-
}),
|
|
229
|
+
top: u.label ? 8 : 0,
|
|
230
|
+
style: { text: u.value, fontSize: 20, fontWeight: "bold", fill: "#333", textAlign: "center" }
|
|
231
|
+
}), y.graphic = [{ type: "group", left: "center", top: "middle", children: m }];
|
|
227
232
|
}
|
|
228
|
-
return
|
|
233
|
+
return y;
|
|
229
234
|
}
|
|
230
|
-
function fe(e,
|
|
235
|
+
function fe(e, r, i) {
|
|
231
236
|
if (!Array.isArray(e)) return {};
|
|
232
|
-
const t =
|
|
237
|
+
const t = r?.axis ?? C(e), n = r?.y ?? I(e);
|
|
233
238
|
if (!t || n.length === 0) return {};
|
|
234
239
|
const s = e.map((h) => ({
|
|
235
240
|
name: String(h[t] ?? "")
|
|
236
|
-
})),
|
|
241
|
+
})), f = n.map((h) => ({
|
|
237
242
|
name: h,
|
|
238
|
-
value: e.map((
|
|
243
|
+
value: e.map((y) => Number(y[h] ?? 0))
|
|
239
244
|
}));
|
|
240
245
|
return {
|
|
241
246
|
tooltip: {},
|
|
@@ -244,38 +249,38 @@ function fe(e, i, r) {
|
|
|
244
249
|
series: [
|
|
245
250
|
{
|
|
246
251
|
type: "radar",
|
|
247
|
-
data:
|
|
252
|
+
data: f
|
|
248
253
|
}
|
|
249
254
|
]
|
|
250
255
|
};
|
|
251
256
|
}
|
|
252
|
-
function ye(e,
|
|
257
|
+
function ye(e, r, i) {
|
|
253
258
|
if (!Array.isArray(e)) return {};
|
|
254
|
-
const t = e[0] ?? {}, n = Object.keys(t), s = n.filter((
|
|
255
|
-
if (!h || !
|
|
256
|
-
const
|
|
257
|
-
for (const
|
|
258
|
-
const
|
|
259
|
-
|
|
259
|
+
const t = e[0] ?? {}, n = Object.keys(t), s = n.filter((a) => typeof t[a] == "string"), f = n.filter((a) => typeof t[a] == "number"), h = r?.x ?? s[0], y = r?.y?.[0] ?? s.find((a) => a !== h), u = r?.value ?? f[0];
|
|
260
|
+
if (!h || !y || !u) return {};
|
|
261
|
+
const m = [], g = [], x = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Set();
|
|
262
|
+
for (const a of e) {
|
|
263
|
+
const b = String(a[h] ?? ""), w = String(a[y] ?? "");
|
|
264
|
+
x.has(b) || (x.add(b), m.push(b)), A.has(w) || (A.add(w), g.push(w));
|
|
260
265
|
}
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
const
|
|
264
|
-
|
|
266
|
+
const d = /* @__PURE__ */ new Map();
|
|
267
|
+
m.forEach((a, b) => d.set(a, b));
|
|
268
|
+
const p = /* @__PURE__ */ new Map();
|
|
269
|
+
g.forEach((a, b) => p.set(a, b));
|
|
265
270
|
const S = [];
|
|
266
|
-
let
|
|
267
|
-
for (const
|
|
268
|
-
const
|
|
269
|
-
S.push([
|
|
271
|
+
let o = 1 / 0, l = -1 / 0;
|
|
272
|
+
for (const a of e) {
|
|
273
|
+
const b = d.get(String(a[h] ?? "")) ?? 0, w = p.get(String(a[y] ?? "")) ?? 0, v = a[u] != null ? Number(a[u]) : null;
|
|
274
|
+
S.push([b, w, v]), v != null && (v < o && (o = v), v > l && (l = v));
|
|
270
275
|
}
|
|
271
|
-
isFinite(
|
|
272
|
-
const c =
|
|
276
|
+
isFinite(o) || (o = 0, l = 1);
|
|
277
|
+
const c = i.colorRange ?? ["#313695", "#4575b4", "#74add1", "#abd9e9", "#fee090", "#fdae61", "#f46d43", "#d73027"];
|
|
273
278
|
return {
|
|
274
|
-
xAxis: { type: "category", data:
|
|
275
|
-
yAxis: { type: "category", data:
|
|
279
|
+
xAxis: { type: "category", data: m, splitArea: { show: !0 } },
|
|
280
|
+
yAxis: { type: "category", data: g, splitArea: { show: !0 } },
|
|
276
281
|
visualMap: {
|
|
277
|
-
min:
|
|
278
|
-
max:
|
|
282
|
+
min: i.min != null ? Number(i.min) : o,
|
|
283
|
+
max: i.max != null ? Number(i.max) : l,
|
|
279
284
|
calculable: !0,
|
|
280
285
|
orient: "horizontal",
|
|
281
286
|
left: "center",
|
|
@@ -284,58 +289,58 @@ function ye(e, i, r) {
|
|
|
284
289
|
},
|
|
285
290
|
tooltip: {
|
|
286
291
|
trigger: "item",
|
|
287
|
-
formatter: (
|
|
288
|
-
const
|
|
289
|
-
return
|
|
292
|
+
formatter: (a) => {
|
|
293
|
+
const b = a.data;
|
|
294
|
+
return b ? `${m[b[0]]} × ${g[b[1]]}: ${b[2] != null ? b[2] : "-"}` : "";
|
|
290
295
|
}
|
|
291
296
|
},
|
|
292
297
|
grid: { bottom: 60 },
|
|
293
298
|
series: [{
|
|
294
299
|
type: "heatmap",
|
|
295
300
|
data: S,
|
|
296
|
-
label: { show:
|
|
301
|
+
label: { show: i.showLabel !== !1 }
|
|
297
302
|
}]
|
|
298
303
|
};
|
|
299
304
|
}
|
|
300
|
-
function he(e,
|
|
305
|
+
function he(e, r, i) {
|
|
301
306
|
if (!Array.isArray(e) || e.length === 0) return {};
|
|
302
|
-
const t = e[0] ?? {}, n = Object.keys(t), s = n.filter((
|
|
303
|
-
let
|
|
304
|
-
if (
|
|
305
|
-
|
|
307
|
+
const t = e[0] ?? {}, n = Object.keys(t), s = n.filter((x) => typeof t[x] == "string"), f = n.filter((x) => typeof t[x] == "number"), h = r?.x ?? s[0];
|
|
308
|
+
let y;
|
|
309
|
+
if (r?.y && r.y.length >= 5)
|
|
310
|
+
y = r.y.slice(0, 5);
|
|
306
311
|
else {
|
|
307
|
-
const A = ["min", "q1", "median", "q3", "max"].filter((
|
|
308
|
-
|
|
312
|
+
const A = ["min", "q1", "median", "q3", "max"].filter((d) => f.includes(d));
|
|
313
|
+
y = A.length === 5 ? A : f.slice(0, 5);
|
|
309
314
|
}
|
|
310
|
-
if (
|
|
311
|
-
const
|
|
312
|
-
(
|
|
313
|
-
),
|
|
315
|
+
if (y.length < 5) return {};
|
|
316
|
+
const u = h ? e.map((x) => String(x[h] ?? "")) : void 0, m = e.map(
|
|
317
|
+
(x) => y.map((A) => Number(x[A] ?? 0))
|
|
318
|
+
), g = {
|
|
314
319
|
tooltip: { trigger: "item" },
|
|
315
320
|
series: [{
|
|
316
321
|
type: "boxplot",
|
|
317
|
-
data:
|
|
322
|
+
data: m
|
|
318
323
|
}]
|
|
319
324
|
};
|
|
320
|
-
return
|
|
325
|
+
return u ? (g.xAxis = { type: "category", data: u }, g.yAxis = { type: "value" }) : (g.xAxis = { type: "category" }, g.yAxis = { type: "value" }), g;
|
|
321
326
|
}
|
|
322
327
|
function C(e) {
|
|
323
328
|
if (e.length === 0) return;
|
|
324
|
-
const
|
|
325
|
-
return Object.keys(
|
|
329
|
+
const r = e[0];
|
|
330
|
+
return Object.keys(r).find((i) => typeof r[i] == "string");
|
|
326
331
|
}
|
|
327
332
|
function _(e) {
|
|
328
333
|
if (e.length === 0) return;
|
|
329
|
-
const
|
|
330
|
-
return Object.keys(
|
|
334
|
+
const r = e[0];
|
|
335
|
+
return Object.keys(r).find((i) => typeof r[i] == "number");
|
|
331
336
|
}
|
|
332
|
-
function me(e,
|
|
337
|
+
function me(e, r, i) {
|
|
333
338
|
if (!Array.isArray(e)) return {};
|
|
334
|
-
const t =
|
|
339
|
+
const t = r?.label ?? C(e), n = r?.value ?? _(e);
|
|
335
340
|
if (!t || !n) return {};
|
|
336
|
-
const s = e.map((
|
|
337
|
-
name: String(
|
|
338
|
-
value: Number(
|
|
341
|
+
const s = e.map((f) => ({
|
|
342
|
+
name: String(f[t] ?? ""),
|
|
343
|
+
value: Number(f[n] ?? 0)
|
|
339
344
|
}));
|
|
340
345
|
return {
|
|
341
346
|
tooltip: { trigger: "item", formatter: "{b}: {c} ({d}%)" },
|
|
@@ -349,19 +354,19 @@ function me(e, i, r) {
|
|
|
349
354
|
}]
|
|
350
355
|
};
|
|
351
356
|
}
|
|
352
|
-
function de(e,
|
|
357
|
+
function de(e, r, i) {
|
|
353
358
|
if (!Array.isArray(e)) return {};
|
|
354
|
-
const t = e, n =
|
|
359
|
+
const t = e, n = r?.x ?? C(t), s = (r?.y ?? [_(t)])[0];
|
|
355
360
|
if (!n || !s) return {};
|
|
356
|
-
const
|
|
357
|
-
let
|
|
358
|
-
for (const
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
+
const f = [], h = [], y = [], u = [];
|
|
362
|
+
let m = 0;
|
|
363
|
+
for (const g of t) {
|
|
364
|
+
const x = String(g[n] ?? ""), A = Number(g[s] ?? 0);
|
|
365
|
+
f.push(x), A >= 0 ? (h.push(m), y.push(A), u.push(null)) : (h.push(m + A), y.push(null), u.push(Math.abs(A))), m += A;
|
|
361
366
|
}
|
|
362
367
|
return {
|
|
363
368
|
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
|
|
364
|
-
xAxis: { type: "category", data:
|
|
369
|
+
xAxis: { type: "category", data: f },
|
|
365
370
|
yAxis: { type: "value" },
|
|
366
371
|
series: [
|
|
367
372
|
{
|
|
@@ -376,25 +381,25 @@ function de(e, i, r) {
|
|
|
376
381
|
name: "Positive",
|
|
377
382
|
type: "bar",
|
|
378
383
|
stack: "waterfall",
|
|
379
|
-
data:
|
|
384
|
+
data: y
|
|
380
385
|
},
|
|
381
386
|
{
|
|
382
387
|
name: "Negative",
|
|
383
388
|
type: "bar",
|
|
384
389
|
stack: "waterfall",
|
|
385
|
-
data:
|
|
390
|
+
data: u
|
|
386
391
|
}
|
|
387
392
|
]
|
|
388
393
|
};
|
|
389
394
|
}
|
|
390
|
-
function
|
|
395
|
+
function pe(e, r) {
|
|
391
396
|
if (!Array.isArray(e)) return {};
|
|
392
|
-
const
|
|
397
|
+
const i = e.map((t) => j(t));
|
|
393
398
|
return {
|
|
394
399
|
tooltip: { trigger: "item" },
|
|
395
400
|
series: [{
|
|
396
401
|
type: "treemap",
|
|
397
|
-
data:
|
|
402
|
+
data: i,
|
|
398
403
|
leafDepth: 1,
|
|
399
404
|
roam: !1,
|
|
400
405
|
label: { show: !0, formatter: "{b}" }
|
|
@@ -402,80 +407,80 @@ function be(e, i) {
|
|
|
402
407
|
};
|
|
403
408
|
}
|
|
404
409
|
function j(e) {
|
|
405
|
-
const
|
|
410
|
+
const r = {
|
|
406
411
|
name: String(e.name ?? ""),
|
|
407
412
|
value: Number(e.value ?? 0)
|
|
408
413
|
};
|
|
409
|
-
return Array.isArray(e.children) && (
|
|
414
|
+
return Array.isArray(e.children) && (r.children = e.children.map((i) => j(i))), r;
|
|
410
415
|
}
|
|
411
|
-
function
|
|
416
|
+
function be(e, r, i) {
|
|
412
417
|
let t;
|
|
413
418
|
if (!Array.isArray(e) || e.length === 0) return {};
|
|
414
419
|
if (typeof e[0] == "number")
|
|
415
420
|
t = e;
|
|
416
421
|
else {
|
|
417
|
-
const
|
|
418
|
-
if (!
|
|
419
|
-
t = e.map((
|
|
422
|
+
const d = r?.value ?? _(e);
|
|
423
|
+
if (!d) return {};
|
|
424
|
+
t = e.map((p) => Number(p[d] ?? 0));
|
|
420
425
|
}
|
|
421
426
|
if (t.length === 0) return {};
|
|
422
|
-
const n = typeof
|
|
423
|
-
for (let
|
|
424
|
-
const
|
|
425
|
-
|
|
427
|
+
const n = typeof i.bins == "number" ? i.bins : Math.ceil(Math.log2(t.length) + 1), s = Math.min(...t), y = (Math.max(...t) - s) / n || 1, u = new Array(n).fill(0), m = [];
|
|
428
|
+
for (let d = 0; d < n; d++) {
|
|
429
|
+
const p = s + d * y, S = s + (d + 1) * y, o = (l) => Number.isInteger(l) ? String(l) : l.toFixed(1);
|
|
430
|
+
m.push(`${o(p)}–${o(S)}`);
|
|
426
431
|
}
|
|
427
|
-
for (const
|
|
428
|
-
let
|
|
429
|
-
|
|
432
|
+
for (const d of t) {
|
|
433
|
+
let p = Math.floor((d - s) / y);
|
|
434
|
+
p >= n && (p = n - 1), u[p]++;
|
|
430
435
|
}
|
|
431
|
-
const
|
|
436
|
+
const g = {
|
|
432
437
|
type: "bar",
|
|
433
|
-
data:
|
|
438
|
+
data: u,
|
|
434
439
|
barCategoryGap: "0%"
|
|
435
|
-
},
|
|
436
|
-
xAxis: { type: "category", data:
|
|
440
|
+
}, x = {
|
|
441
|
+
xAxis: { type: "category", data: m, axisTick: { alignWithLabel: !0 } },
|
|
437
442
|
yAxis: { type: "value" },
|
|
438
|
-
series: [
|
|
443
|
+
series: [g],
|
|
439
444
|
tooltip: { trigger: "axis" }
|
|
440
|
-
}, A =
|
|
441
|
-
return Array.isArray(A) && A.length > 0 && (
|
|
445
|
+
}, A = i.referenceLines;
|
|
446
|
+
return Array.isArray(A) && A.length > 0 && (g.markLine = {
|
|
442
447
|
silent: !0,
|
|
443
448
|
symbol: "none",
|
|
444
|
-
data: A.map((
|
|
445
|
-
const
|
|
446
|
-
|
|
449
|
+
data: A.map((d) => {
|
|
450
|
+
const p = {};
|
|
451
|
+
d.axis === "x" ? p.xAxis = d.value : p.yAxis = d.value, d.label && (p.name = d.label);
|
|
447
452
|
const S = {};
|
|
448
|
-
return
|
|
453
|
+
return d.color && (S.color = d.color), d.style && (S.type = d.style), Object.keys(S).length > 0 && (p.lineStyle = S), d.label && (p.label = { formatter: d.label, position: "end" }), p;
|
|
449
454
|
})
|
|
450
|
-
}),
|
|
455
|
+
}), x;
|
|
451
456
|
}
|
|
452
457
|
function I(e) {
|
|
453
458
|
if (e.length === 0) return [];
|
|
454
|
-
const
|
|
455
|
-
return Object.keys(
|
|
459
|
+
const r = e[0];
|
|
460
|
+
return Object.keys(r).filter((i) => typeof r[i] == "number");
|
|
456
461
|
}
|
|
457
|
-
function V(e,
|
|
458
|
-
const
|
|
459
|
-
for (const t of Object.keys(
|
|
460
|
-
const n = e[t], s =
|
|
461
|
-
|
|
462
|
+
function V(e, r) {
|
|
463
|
+
const i = { ...e };
|
|
464
|
+
for (const t of Object.keys(r)) {
|
|
465
|
+
const n = e[t], s = r[t];
|
|
466
|
+
L(n) && L(s) ? i[t] = V(n, s) : i[t] = s;
|
|
462
467
|
}
|
|
463
|
-
return
|
|
468
|
+
return i;
|
|
464
469
|
}
|
|
465
|
-
function
|
|
470
|
+
function L(e) {
|
|
466
471
|
return e != null && typeof e == "object" && !Array.isArray(e);
|
|
467
472
|
}
|
|
468
|
-
function
|
|
469
|
-
return (
|
|
473
|
+
function ge(e, r) {
|
|
474
|
+
return (i) => {
|
|
470
475
|
let t;
|
|
471
476
|
if (e.type) {
|
|
472
477
|
const n = e.type === "currency" && e.currency ? `currency:${e.currency}` : e.type;
|
|
473
|
-
t = q(
|
|
478
|
+
t = q(i, n, r), e.type === "percent" && (t = typeof i == "number" ? new Intl.NumberFormat(r, { maximumFractionDigits: e.decimals ?? 2 }).format(i) + "%" : String(i) + "%");
|
|
474
479
|
} else
|
|
475
|
-
t = String(
|
|
480
|
+
t = String(i);
|
|
476
481
|
if (e.decimals !== void 0 && e.type === "number") {
|
|
477
|
-
const n = Number(
|
|
478
|
-
isNaN(n) || (t = new Intl.NumberFormat(
|
|
482
|
+
const n = Number(i);
|
|
483
|
+
isNaN(n) || (t = new Intl.NumberFormat(r, {
|
|
479
484
|
minimumFractionDigits: e.decimals,
|
|
480
485
|
maximumFractionDigits: e.decimals
|
|
481
486
|
}).format(n));
|
|
@@ -483,20 +488,20 @@ function xe(e, i) {
|
|
|
483
488
|
return e.prefix && (t = e.prefix + t), e.suffix && (t = t + e.suffix), t;
|
|
484
489
|
};
|
|
485
490
|
}
|
|
486
|
-
function
|
|
487
|
-
if (!
|
|
488
|
-
const n =
|
|
491
|
+
function z(e, r, i, t) {
|
|
492
|
+
if (!i || !e[r]) return;
|
|
493
|
+
const n = ge(i, t), s = e[r];
|
|
489
494
|
if (Array.isArray(s))
|
|
490
|
-
e[
|
|
491
|
-
else if (
|
|
492
|
-
const
|
|
493
|
-
e[
|
|
495
|
+
e[r] = s.map((f) => f.type === "value" ? { ...f, axisLabel: { ...f.axisLabel ?? {}, formatter: n } } : f);
|
|
496
|
+
else if (L(s)) {
|
|
497
|
+
const f = s;
|
|
498
|
+
e[r] = { ...f, axisLabel: { ...f.axisLabel ?? {}, formatter: n } };
|
|
494
499
|
}
|
|
495
500
|
}
|
|
496
|
-
var
|
|
497
|
-
for (var n = t > 1 ? void 0 : t ? Ae(
|
|
498
|
-
(
|
|
499
|
-
return t && n &&
|
|
501
|
+
var xe = Object.defineProperty, Ae = Object.getOwnPropertyDescriptor, D = (e, r, i, t) => {
|
|
502
|
+
for (var n = t > 1 ? void 0 : t ? Ae(r, i) : r, s = e.length - 1, f; s >= 0; s--)
|
|
503
|
+
(f = e[s]) && (n = (t ? f(r, i, n) : f(n)) || n);
|
|
504
|
+
return t && n && xe(r, i, n), n;
|
|
500
505
|
};
|
|
501
506
|
O.use([
|
|
502
507
|
H,
|
|
@@ -513,15 +518,15 @@ O.use([
|
|
|
513
518
|
ie,
|
|
514
519
|
se,
|
|
515
520
|
ne,
|
|
516
|
-
|
|
517
|
-
|
|
521
|
+
oe,
|
|
522
|
+
ae
|
|
518
523
|
]);
|
|
519
|
-
let k = class extends
|
|
524
|
+
let k = class extends P {
|
|
520
525
|
constructor() {
|
|
521
526
|
super(...arguments), this.spec = null, this._chart = null, this._container = null, this._resizeObserver = null;
|
|
522
527
|
}
|
|
523
528
|
render() {
|
|
524
|
-
if (!this.spec) return
|
|
529
|
+
if (!this.spec) return T;
|
|
525
530
|
const e = this.spec.title ?? `${this.spec.widget} chart`;
|
|
526
531
|
return R`<div class="chart-container" part="chart" role="img" aria-label=${e}></div>`;
|
|
527
532
|
}
|
|
@@ -543,7 +548,7 @@ let k = class extends T {
|
|
|
543
548
|
}
|
|
544
549
|
_onChartClick(e) {
|
|
545
550
|
if (!this.spec) return;
|
|
546
|
-
const
|
|
551
|
+
const r = {
|
|
547
552
|
type: "select",
|
|
548
553
|
widget: this.spec.widget,
|
|
549
554
|
id: this.spec.id,
|
|
@@ -556,7 +561,7 @@ let k = class extends T {
|
|
|
556
561
|
};
|
|
557
562
|
this.dispatchEvent(
|
|
558
563
|
new CustomEvent("u-widget-internal", {
|
|
559
|
-
detail:
|
|
564
|
+
detail: r,
|
|
560
565
|
bubbles: !0,
|
|
561
566
|
composed: !0
|
|
562
567
|
})
|
|
@@ -568,38 +573,41 @@ let k = class extends T {
|
|
|
568
573
|
if (!(Array.isArray(
|
|
569
574
|
this.spec.options?.colors
|
|
570
575
|
) && this.spec.options.colors.length > 0)) {
|
|
571
|
-
const
|
|
572
|
-
|
|
576
|
+
const t = this._readThemeColors();
|
|
577
|
+
t.length > 0 && (e.color = t);
|
|
573
578
|
}
|
|
574
|
-
this._readCSSVar("--u-widget-bg") && (e.backgroundColor = "transparent"), this._applyThemeStyle(e), this._chart.setOption(e, !0);
|
|
579
|
+
!!!this.spec.options?.echarts?.backgroundColor && this._readCSSVar("--u-widget-bg") && (e.backgroundColor = "transparent"), this._applyThemeStyle(e), this._chart.setOption(e, !0);
|
|
575
580
|
}
|
|
576
581
|
_applyThemeStyle(e) {
|
|
577
|
-
const
|
|
578
|
-
if (!
|
|
579
|
-
e.textStyle = { ...e.textStyle, color:
|
|
582
|
+
const r = this._readCSSVar("--u-widget-text"), i = this._readCSSVar("--u-widget-text-secondary"), t = this._readCSSVar("--u-widget-border");
|
|
583
|
+
if (!r) return;
|
|
584
|
+
e.textStyle = { ...e.textStyle, color: r };
|
|
580
585
|
const n = (s) => {
|
|
581
586
|
if (!s || typeof s != "object") return s;
|
|
582
587
|
if (Array.isArray(s)) return s.map(n);
|
|
583
|
-
const u =
|
|
588
|
+
const f = s, h = f.axisLine ?? {}, y = h.lineStyle ?? {}, u = f.splitLine ?? {}, m = u.lineStyle ?? {};
|
|
584
589
|
return {
|
|
585
|
-
...
|
|
586
|
-
axisLabel: { ...
|
|
587
|
-
axisLine: { lineStyle: { color: t ||
|
|
588
|
-
splitLine: { lineStyle: { color: t } }
|
|
590
|
+
...f,
|
|
591
|
+
axisLabel: { ...f.axisLabel ?? {}, color: i || r },
|
|
592
|
+
axisLine: { ...h, lineStyle: { ...y, color: t || i } },
|
|
593
|
+
splitLine: { ...u, lineStyle: { ...m, color: t } }
|
|
589
594
|
};
|
|
590
595
|
};
|
|
591
|
-
e.xAxis && (e.xAxis = n(e.xAxis)), e.yAxis && (e.yAxis = n(e.yAxis)), e.legend && typeof e.legend == "object"
|
|
596
|
+
if (e.xAxis && (e.xAxis = n(e.xAxis)), e.yAxis && (e.yAxis = n(e.yAxis)), e.legend && typeof e.legend == "object") {
|
|
597
|
+
const s = e.legend;
|
|
598
|
+
e.legend = { ...s, textStyle: { ...s.textStyle ?? {}, color: r } };
|
|
599
|
+
}
|
|
592
600
|
}
|
|
593
601
|
_readThemeColors() {
|
|
594
602
|
const e = [];
|
|
595
|
-
for (let
|
|
596
|
-
const
|
|
597
|
-
if (
|
|
603
|
+
for (let r = 1; r <= 10; r++) {
|
|
604
|
+
const i = this._readCSSVar(`--u-widget-chart-color-${r}`);
|
|
605
|
+
if (i) e.push(i);
|
|
598
606
|
else break;
|
|
599
607
|
}
|
|
600
608
|
if (e.length === 0) {
|
|
601
|
-
const
|
|
602
|
-
|
|
609
|
+
const r = this._readCSSVar("--u-widget-primary");
|
|
610
|
+
r && e.push(r);
|
|
603
611
|
}
|
|
604
612
|
return e;
|
|
605
613
|
}
|
|
@@ -616,7 +624,7 @@ let k = class extends T {
|
|
|
616
624
|
};
|
|
617
625
|
k.styles = [
|
|
618
626
|
G,
|
|
619
|
-
|
|
627
|
+
E`
|
|
620
628
|
:host {
|
|
621
629
|
display: block;
|
|
622
630
|
container: uw-chart / inline-size;
|