@iyulab/u-widgets 0.6.2 → 0.7.1
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/dist/u-widgets-charts.d.ts +1 -1
- package/dist/u-widgets-charts.js +178 -157
- package/dist/u-widgets-charts.js.map +1 -1
- package/dist/u-widgets.js +303 -285
- package/dist/u-widgets.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ declare type FieldType = 'text' | 'email' | 'password' | 'tel' | 'url' | 'textar
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function toEChartsOption(spec: UWidgetSpec): Record<string, unknown>;
|
|
18
18
|
|
|
19
|
-
export declare class
|
|
19
|
+
export declare class UwChart extends LitElement {
|
|
20
20
|
static styles: CSSResult[];
|
|
21
21
|
spec: UWidgetSpec | null;
|
|
22
22
|
private _chart;
|
package/dist/u-widgets-charts.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as R, customElement as
|
|
3
|
-
import { a as
|
|
4
|
-
import * as
|
|
5
|
-
import { BarChart as B, LineChart as q, PieChart as
|
|
6
|
-
import { GridComponent as
|
|
1
|
+
import { css as M, LitElement as V, nothing as P, html as E } from "lit";
|
|
2
|
+
import { property as R, customElement as D } from "lit/decorators.js";
|
|
3
|
+
import { a as T, t as $ } from "./tokens-x1kDxgG8.js";
|
|
4
|
+
import * as z from "echarts/core";
|
|
5
|
+
import { BarChart as B, LineChart as q, PieChart as W, ScatterChart as G, RadarChart as H, HeatmapChart as K, BoxplotChart as U, FunnelChart as Y, TreemapChart as J } from "echarts/charts";
|
|
6
|
+
import { GridComponent as Q, TooltipComponent as X, LegendComponent as Z, RadarComponent as ee, MarkLineComponent as te, VisualMapComponent as re } from "echarts/components";
|
|
7
7
|
import { CanvasRenderer as se } from "echarts/renderers";
|
|
8
8
|
function ie(e) {
|
|
9
|
-
const t = e.widget, i = e.data, r = e.mapping ?
|
|
9
|
+
const t = e.widget, i = e.data, r = e.mapping ? T(e.mapping) : void 0, n = e.options ?? {};
|
|
10
10
|
if (!i) return {};
|
|
11
11
|
let s;
|
|
12
12
|
switch (t) {
|
|
@@ -41,143 +41,164 @@ function ie(e) {
|
|
|
41
41
|
s = fe(i, r);
|
|
42
42
|
break;
|
|
43
43
|
case "chart.treemap":
|
|
44
|
-
s =
|
|
44
|
+
s = ye(i);
|
|
45
45
|
break;
|
|
46
46
|
default:
|
|
47
47
|
return {};
|
|
48
48
|
}
|
|
49
|
-
n.legend === !1 && s.legend && (s.legend = { ...s.legend, show: !1 }), n.grid === !1 && (s.xAxis && typeof s.xAxis == "object" && (s.xAxis = { ...s.xAxis, splitLine: { show: !1 } }), s.yAxis && typeof s.yAxis == "object" && (s.yAxis = { ...s.yAxis, splitLine: { show: !1 } })), n.animate === !1 && (s.animation = !1), Array.isArray(n.colors) && n.colors.length > 0 && (s.color = n.colors);
|
|
50
|
-
const
|
|
51
|
-
return
|
|
49
|
+
n.legend === !1 && s.legend && (s.legend = { ...s.legend, show: !1 }), n.grid === !1 && (s.xAxis && typeof s.xAxis == "object" && !Array.isArray(s.xAxis) && (s.xAxis = { ...s.xAxis, splitLine: { show: !1 } }), s.yAxis && typeof s.yAxis == "object" && !Array.isArray(s.yAxis) && (s.yAxis = { ...s.yAxis, splitLine: { show: !1 } })), n.animate === !1 && (s.animation = !1), Array.isArray(n.colors) && n.colors.length > 0 && (s.color = n.colors);
|
|
50
|
+
const y = n.echarts;
|
|
51
|
+
return y && typeof y == "object" && (s = L(s, y)), s;
|
|
52
52
|
}
|
|
53
53
|
function F(e, t, i, r) {
|
|
54
54
|
if (!Array.isArray(e)) return {};
|
|
55
55
|
const n = t?.x ?? C(e), s = t?.y ?? [k(e)].filter(Boolean);
|
|
56
56
|
if (!n || s.length === 0) return {};
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
name:
|
|
57
|
+
const y = e.map((a) => String(a[n] ?? "")), f = !!r.horizontal, d = Array.isArray(r.series) ? r.series : [], c = s.map((a, o) => {
|
|
58
|
+
const l = {
|
|
59
|
+
name: a,
|
|
60
60
|
type: i,
|
|
61
|
-
data: e.map((
|
|
61
|
+
data: e.map((p) => p[a] ?? null)
|
|
62
62
|
};
|
|
63
|
-
r._area && (
|
|
64
|
-
const
|
|
65
|
-
return
|
|
66
|
-
}),
|
|
67
|
-
r.histogram && (
|
|
68
|
-
|
|
63
|
+
r._area && (l.areaStyle = {}), r.smooth && (l.smooth = !0), r.step && (l.step = r.step === !0 ? "end" : r.step);
|
|
64
|
+
const u = d[o];
|
|
65
|
+
return u && (u.color && (l.itemStyle = { color: u.color }, l.lineStyle = { ...l.lineStyle ?? {}, color: u.color }), u.lineStyle && (l.lineStyle = { ...l.lineStyle ?? {}, ...u.lineStyle }), u.symbol !== void 0 && (l.symbol = u.symbol), u.label && (l.name = u.label), u.type && (l.type = u.type), u.yAxisIndex !== void 0 && (l.yAxisIndex = u.yAxisIndex)), l;
|
|
66
|
+
}), h = { type: "category", data: y }, m = { type: "value" };
|
|
67
|
+
r.histogram && (h.axisTick = { alignWithLabel: !0 }, c.forEach((a) => {
|
|
68
|
+
a.barCategoryGap = "0%";
|
|
69
69
|
}));
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
const x = !f && c.some((a) => a.yAxisIndex >= 1);
|
|
71
|
+
let b;
|
|
72
|
+
if (x) {
|
|
73
|
+
const a = Array.isArray(r.yAxis) && r.yAxis.length >= 2 ? r.yAxis[1] : { type: "value" };
|
|
74
|
+
b = [m, a];
|
|
75
|
+
} else
|
|
76
|
+
b = f ? h : m;
|
|
77
|
+
const A = {
|
|
78
|
+
xAxis: f ? m : h,
|
|
79
|
+
yAxis: b,
|
|
80
|
+
series: c,
|
|
74
81
|
tooltip: { trigger: "axis" }
|
|
75
82
|
};
|
|
76
83
|
if (s.length > 1) {
|
|
77
|
-
const
|
|
78
|
-
|
|
84
|
+
const a = c.map((o) => o.name);
|
|
85
|
+
A.legend = { data: a };
|
|
79
86
|
}
|
|
80
|
-
r.stack &&
|
|
81
|
-
|
|
87
|
+
r.stack && A.series.forEach((a) => {
|
|
88
|
+
a.stack = "total";
|
|
82
89
|
});
|
|
83
|
-
const
|
|
84
|
-
return Array.isArray(
|
|
90
|
+
const v = r.referenceLines;
|
|
91
|
+
return Array.isArray(v) && v.length > 0 && c.length > 0 && (c[0].markLine = {
|
|
85
92
|
silent: !0,
|
|
86
93
|
symbol: "none",
|
|
87
|
-
data:
|
|
88
|
-
const x = {};
|
|
89
|
-
l.axis === "x" ? x.xAxis = l.value : x.yAxis = l.value, l.label && (x.name = l.label);
|
|
94
|
+
data: v.map((a) => {
|
|
90
95
|
const o = {};
|
|
91
|
-
|
|
96
|
+
a.axis === "x" ? o.xAxis = a.value : o.yAxis = a.value, a.label && (o.name = a.label);
|
|
97
|
+
const l = {};
|
|
98
|
+
return a.color && (l.color = a.color), a.style && (l.type = a.style), Object.keys(l).length > 0 && (o.lineStyle = l), a.label && (o.label = { formatter: a.label, position: "end" }), o;
|
|
92
99
|
})
|
|
93
|
-
}),
|
|
100
|
+
}), A;
|
|
94
101
|
}
|
|
95
102
|
function ne(e, t, i) {
|
|
96
103
|
if (!Array.isArray(e)) return {};
|
|
97
|
-
const r = j(e), n = t?.x ?? r[0], s = (t?.y ?? [r[1]])[0],
|
|
104
|
+
const r = j(e), n = t?.x ?? r[0], s = (t?.y ?? [r[1]])[0], y = t?.color, f = t?.size, d = t?.opacity;
|
|
98
105
|
if (!n || !s) return {};
|
|
99
|
-
const
|
|
106
|
+
const c = {
|
|
100
107
|
xAxis: { type: "value" },
|
|
101
108
|
yAxis: { type: "value" },
|
|
102
109
|
tooltip: { trigger: "item" }
|
|
103
110
|
};
|
|
104
|
-
let
|
|
105
|
-
if (
|
|
106
|
-
for (const
|
|
107
|
-
const
|
|
108
|
-
|
|
111
|
+
let h = 1 / 0, m = -1 / 0;
|
|
112
|
+
if (d)
|
|
113
|
+
for (const a of e) {
|
|
114
|
+
const o = Number(a[d] ?? 0);
|
|
115
|
+
o < h && (h = o), o > m && (m = o);
|
|
109
116
|
}
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
if (
|
|
113
|
-
const
|
|
114
|
-
return { value:
|
|
117
|
+
const x = m - h || 1, b = (a) => {
|
|
118
|
+
const o = [Number(a[n] ?? 0), Number(a[s] ?? 0)];
|
|
119
|
+
if (f && o.push(Number(a[f] ?? 0)), d) {
|
|
120
|
+
const u = 0.1 + 0.9 * ((Number(a[d] ?? 0) - h) / x);
|
|
121
|
+
return { value: o, itemStyle: { opacity: Math.round(u * 100) / 100 } };
|
|
115
122
|
}
|
|
116
|
-
return
|
|
117
|
-
},
|
|
118
|
-
const
|
|
119
|
-
return Math.max(4, Math.min(60, Math.sqrt(
|
|
123
|
+
return o;
|
|
124
|
+
}, A = f ? (a) => {
|
|
125
|
+
const l = (Array.isArray(a) ? a : a.value)[2] ?? 0;
|
|
126
|
+
return Math.max(4, Math.min(60, Math.sqrt(l) * 4));
|
|
120
127
|
} : void 0;
|
|
121
|
-
if (
|
|
122
|
-
const
|
|
123
|
-
for (const
|
|
124
|
-
const
|
|
125
|
-
|
|
128
|
+
if (y) {
|
|
129
|
+
const a = /* @__PURE__ */ new Map();
|
|
130
|
+
for (const l of e) {
|
|
131
|
+
const u = String(l[y] ?? "unknown");
|
|
132
|
+
a.has(u) || a.set(u, []), a.get(u).push(b(l));
|
|
126
133
|
}
|
|
127
|
-
const
|
|
128
|
-
for (const [
|
|
129
|
-
const
|
|
130
|
-
|
|
134
|
+
const o = [];
|
|
135
|
+
for (const [l, u] of a) {
|
|
136
|
+
const p = { name: l, type: "scatter", data: u };
|
|
137
|
+
A && (p.symbolSize = A), o.push(p);
|
|
131
138
|
}
|
|
132
|
-
|
|
139
|
+
c.series = o, c.legend = { data: Array.from(a.keys()) };
|
|
133
140
|
} else {
|
|
134
|
-
const
|
|
135
|
-
|
|
141
|
+
const o = { type: "scatter", data: e.map((l) => b(l)) };
|
|
142
|
+
A && (o.symbolSize = A), c.series = [o];
|
|
136
143
|
}
|
|
137
|
-
const
|
|
138
|
-
if (Array.isArray(
|
|
139
|
-
const
|
|
140
|
-
|
|
144
|
+
const v = i.referenceLines;
|
|
145
|
+
if (Array.isArray(v) && v.length > 0) {
|
|
146
|
+
const a = c.series[0];
|
|
147
|
+
a.markLine = {
|
|
141
148
|
silent: !0,
|
|
142
149
|
symbol: "none",
|
|
143
|
-
data:
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
return
|
|
150
|
+
data: v.map((o) => {
|
|
151
|
+
const l = {};
|
|
152
|
+
o.axis === "x" ? l.xAxis = o.value : l.yAxis = o.value, o.label && (l.name = o.label);
|
|
153
|
+
const u = {};
|
|
154
|
+
return o.color && (u.color = o.color), o.style && (u.type = o.style), Object.keys(u).length > 0 && (l.lineStyle = u), o.label && (l.label = { formatter: o.label, position: "end" }), l;
|
|
148
155
|
})
|
|
149
156
|
};
|
|
150
157
|
}
|
|
151
|
-
return
|
|
158
|
+
return c;
|
|
152
159
|
}
|
|
153
160
|
function ae(e, t, i) {
|
|
154
161
|
if (!Array.isArray(e)) return {};
|
|
155
162
|
const r = t?.label ?? C(e), n = t?.value ?? k(e);
|
|
156
163
|
if (!r || !n) return {};
|
|
157
|
-
const s = e.map((
|
|
158
|
-
name: String(
|
|
159
|
-
value: Number(
|
|
160
|
-
})),
|
|
164
|
+
const s = e.map((h) => ({
|
|
165
|
+
name: String(h[r] ?? ""),
|
|
166
|
+
value: Number(h[n] ?? 0)
|
|
167
|
+
})), f = {
|
|
161
168
|
type: "pie",
|
|
162
169
|
radius: i.donut ? ["40%", "70%"] : "50%",
|
|
163
170
|
data: s,
|
|
164
171
|
label: { overflow: "truncate", width: 80 }
|
|
165
172
|
};
|
|
166
|
-
|
|
173
|
+
i.showLabel === !1 && (f.label = { show: !1 });
|
|
174
|
+
const d = {
|
|
167
175
|
tooltip: { trigger: "item" },
|
|
168
176
|
legend: { orient: "vertical", left: "left" },
|
|
169
|
-
series: [
|
|
170
|
-
};
|
|
177
|
+
series: [f]
|
|
178
|
+
}, c = i.center;
|
|
179
|
+
if (i.donut && c && (c.label || c.value)) {
|
|
180
|
+
const h = [];
|
|
181
|
+
c.label && h.push({
|
|
182
|
+
type: "text",
|
|
183
|
+
top: c.value ? -16 : 0,
|
|
184
|
+
style: { text: c.label, fontSize: 13, fill: "#999", textAlign: "center" }
|
|
185
|
+
}), c.value && h.push({
|
|
186
|
+
type: "text",
|
|
187
|
+
top: c.label ? 8 : 0,
|
|
188
|
+
style: { text: c.value, fontSize: 20, fontWeight: "bold", fill: "#333", textAlign: "center" }
|
|
189
|
+
}), d.graphic = [{ type: "group", left: "center", top: "middle", children: h }];
|
|
190
|
+
}
|
|
191
|
+
return d;
|
|
171
192
|
}
|
|
172
193
|
function oe(e, t, i) {
|
|
173
194
|
if (!Array.isArray(e)) return {};
|
|
174
195
|
const r = t?.axis ?? C(e), n = t?.y ?? j(e);
|
|
175
196
|
if (!r || n.length === 0) return {};
|
|
176
|
-
const s = e.map((
|
|
177
|
-
name: String(
|
|
178
|
-
})),
|
|
179
|
-
name:
|
|
180
|
-
value: e.map((
|
|
197
|
+
const s = e.map((f) => ({
|
|
198
|
+
name: String(f[r] ?? "")
|
|
199
|
+
})), y = n.map((f) => ({
|
|
200
|
+
name: f,
|
|
201
|
+
value: e.map((d) => Number(d[f] ?? 0))
|
|
181
202
|
}));
|
|
182
203
|
return {
|
|
183
204
|
tooltip: {},
|
|
@@ -186,80 +207,80 @@ function oe(e, t, i) {
|
|
|
186
207
|
series: [
|
|
187
208
|
{
|
|
188
209
|
type: "radar",
|
|
189
|
-
data:
|
|
210
|
+
data: y
|
|
190
211
|
}
|
|
191
212
|
]
|
|
192
213
|
};
|
|
193
214
|
}
|
|
194
215
|
function le(e, t, i) {
|
|
195
216
|
if (!Array.isArray(e)) return {};
|
|
196
|
-
const r = e[0] ?? {}, n = Object.keys(r), s = n.filter((
|
|
197
|
-
if (!
|
|
198
|
-
const
|
|
199
|
-
for (const
|
|
200
|
-
const
|
|
201
|
-
|
|
217
|
+
const r = e[0] ?? {}, n = Object.keys(r), s = n.filter((p) => typeof r[p] == "string"), y = n.filter((p) => typeof r[p] == "number"), f = t?.x ?? s[0], d = t?.y?.[0] ?? s.find((p) => p !== f), c = t?.value ?? y[0];
|
|
218
|
+
if (!f || !d || !c) return {};
|
|
219
|
+
const h = [], m = [], x = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set();
|
|
220
|
+
for (const p of e) {
|
|
221
|
+
const g = String(p[f] ?? ""), w = String(p[d] ?? "");
|
|
222
|
+
x.has(g) || (x.add(g), h.push(g)), b.has(w) || (b.add(w), m.push(w));
|
|
202
223
|
}
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
let
|
|
209
|
-
for (const
|
|
210
|
-
const
|
|
211
|
-
|
|
224
|
+
const A = /* @__PURE__ */ new Map();
|
|
225
|
+
h.forEach((p, g) => A.set(p, g));
|
|
226
|
+
const v = /* @__PURE__ */ new Map();
|
|
227
|
+
m.forEach((p, g) => v.set(p, g));
|
|
228
|
+
const a = [];
|
|
229
|
+
let o = 1 / 0, l = -1 / 0;
|
|
230
|
+
for (const p of e) {
|
|
231
|
+
const g = A.get(String(p[f] ?? "")) ?? 0, w = v.get(String(p[d] ?? "")) ?? 0, S = p[c] != null ? Number(p[c]) : null;
|
|
232
|
+
a.push([g, w, S]), S != null && (S < o && (o = S), S > l && (l = S));
|
|
212
233
|
}
|
|
213
|
-
isFinite(
|
|
214
|
-
const
|
|
234
|
+
isFinite(o) || (o = 0, l = 1);
|
|
235
|
+
const u = i.colorRange ?? ["#313695", "#4575b4", "#74add1", "#abd9e9", "#fee090", "#fdae61", "#f46d43", "#d73027"];
|
|
215
236
|
return {
|
|
216
|
-
xAxis: { type: "category", data:
|
|
217
|
-
yAxis: { type: "category", data:
|
|
237
|
+
xAxis: { type: "category", data: h, splitArea: { show: !0 } },
|
|
238
|
+
yAxis: { type: "category", data: m, splitArea: { show: !0 } },
|
|
218
239
|
visualMap: {
|
|
219
|
-
min: i.min != null ? Number(i.min) :
|
|
220
|
-
max: i.max != null ? Number(i.max) :
|
|
240
|
+
min: i.min != null ? Number(i.min) : o,
|
|
241
|
+
max: i.max != null ? Number(i.max) : l,
|
|
221
242
|
calculable: !0,
|
|
222
243
|
orient: "horizontal",
|
|
223
244
|
left: "center",
|
|
224
245
|
bottom: 0,
|
|
225
|
-
inRange: { color:
|
|
246
|
+
inRange: { color: u }
|
|
226
247
|
},
|
|
227
248
|
tooltip: {
|
|
228
249
|
trigger: "item",
|
|
229
|
-
formatter: (
|
|
230
|
-
const
|
|
231
|
-
return
|
|
250
|
+
formatter: (p) => {
|
|
251
|
+
const g = p.data;
|
|
252
|
+
return g ? `${h[g[0]]} × ${m[g[1]]}: ${g[2] != null ? g[2] : "-"}` : "";
|
|
232
253
|
}
|
|
233
254
|
},
|
|
234
255
|
grid: { bottom: 60 },
|
|
235
256
|
series: [{
|
|
236
257
|
type: "heatmap",
|
|
237
|
-
data:
|
|
258
|
+
data: a,
|
|
238
259
|
label: { show: i.showLabel !== !1 }
|
|
239
260
|
}]
|
|
240
261
|
};
|
|
241
262
|
}
|
|
242
263
|
function ce(e, t, i) {
|
|
243
264
|
if (!Array.isArray(e) || e.length === 0) return {};
|
|
244
|
-
const r = e[0] ?? {}, n = Object.keys(r), s = n.filter((
|
|
245
|
-
let
|
|
265
|
+
const r = e[0] ?? {}, n = Object.keys(r), s = n.filter((x) => typeof r[x] == "string"), y = n.filter((x) => typeof r[x] == "number"), f = t?.x ?? s[0];
|
|
266
|
+
let d;
|
|
246
267
|
if (t?.y && t.y.length >= 5)
|
|
247
|
-
|
|
268
|
+
d = t.y.slice(0, 5);
|
|
248
269
|
else {
|
|
249
|
-
const
|
|
250
|
-
|
|
270
|
+
const b = ["min", "q1", "median", "q3", "max"].filter((A) => y.includes(A));
|
|
271
|
+
d = b.length === 5 ? b : y.slice(0, 5);
|
|
251
272
|
}
|
|
252
|
-
if (
|
|
253
|
-
const
|
|
254
|
-
(
|
|
255
|
-
),
|
|
273
|
+
if (d.length < 5) return {};
|
|
274
|
+
const c = f ? e.map((x) => String(x[f] ?? "")) : void 0, h = e.map(
|
|
275
|
+
(x) => d.map((b) => Number(x[b] ?? 0))
|
|
276
|
+
), m = {
|
|
256
277
|
tooltip: { trigger: "item" },
|
|
257
278
|
series: [{
|
|
258
279
|
type: "boxplot",
|
|
259
|
-
data:
|
|
280
|
+
data: h
|
|
260
281
|
}]
|
|
261
282
|
};
|
|
262
|
-
return
|
|
283
|
+
return c ? (m.xAxis = { type: "category", data: c }, m.yAxis = { type: "value" }) : (m.xAxis = { type: "category" }, m.yAxis = { type: "value" }), m;
|
|
263
284
|
}
|
|
264
285
|
function C(e) {
|
|
265
286
|
if (e.length === 0) return;
|
|
@@ -275,9 +296,9 @@ function ue(e, t, i) {
|
|
|
275
296
|
if (!Array.isArray(e)) return {};
|
|
276
297
|
const r = t?.label ?? C(e), n = t?.value ?? k(e);
|
|
277
298
|
if (!r || !n) return {};
|
|
278
|
-
const s = e.map((
|
|
279
|
-
name: String(
|
|
280
|
-
value: Number(
|
|
299
|
+
const s = e.map((y) => ({
|
|
300
|
+
name: String(y[r] ?? ""),
|
|
301
|
+
value: Number(y[n] ?? 0)
|
|
281
302
|
}));
|
|
282
303
|
return {
|
|
283
304
|
tooltip: { trigger: "item", formatter: "{b}: {c} ({d}%)" },
|
|
@@ -295,15 +316,15 @@ function fe(e, t, i) {
|
|
|
295
316
|
if (!Array.isArray(e)) return {};
|
|
296
317
|
const r = e, n = t?.x ?? C(r), s = (t?.y ?? [k(r)])[0];
|
|
297
318
|
if (!n || !s) return {};
|
|
298
|
-
const
|
|
299
|
-
let
|
|
300
|
-
for (const
|
|
301
|
-
const
|
|
302
|
-
|
|
319
|
+
const y = [], f = [], d = [], c = [];
|
|
320
|
+
let h = 0;
|
|
321
|
+
for (const m of r) {
|
|
322
|
+
const x = String(m[n] ?? ""), b = Number(m[s] ?? 0);
|
|
323
|
+
y.push(x), b >= 0 ? (f.push(h), d.push(b), c.push(null)) : (f.push(h + b), d.push(null), c.push(Math.abs(b))), h += b;
|
|
303
324
|
}
|
|
304
325
|
return {
|
|
305
326
|
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
|
|
306
|
-
xAxis: { type: "category", data:
|
|
327
|
+
xAxis: { type: "category", data: y },
|
|
307
328
|
yAxis: { type: "value" },
|
|
308
329
|
series: [
|
|
309
330
|
{
|
|
@@ -312,26 +333,26 @@ function fe(e, t, i) {
|
|
|
312
333
|
stack: "waterfall",
|
|
313
334
|
itemStyle: { borderColor: "transparent", color: "transparent" },
|
|
314
335
|
emphasis: { itemStyle: { borderColor: "transparent", color: "transparent" } },
|
|
315
|
-
data:
|
|
336
|
+
data: f
|
|
316
337
|
},
|
|
317
338
|
{
|
|
318
339
|
name: "Positive",
|
|
319
340
|
type: "bar",
|
|
320
341
|
stack: "waterfall",
|
|
321
|
-
data:
|
|
342
|
+
data: d
|
|
322
343
|
},
|
|
323
344
|
{
|
|
324
345
|
name: "Negative",
|
|
325
346
|
type: "bar",
|
|
326
347
|
stack: "waterfall",
|
|
327
|
-
data:
|
|
348
|
+
data: c
|
|
328
349
|
}
|
|
329
350
|
]
|
|
330
351
|
};
|
|
331
352
|
}
|
|
332
|
-
function
|
|
353
|
+
function ye(e, t) {
|
|
333
354
|
if (!Array.isArray(e)) return {};
|
|
334
|
-
const i = e.map((r) =>
|
|
355
|
+
const i = e.map((r) => N(r));
|
|
335
356
|
return {
|
|
336
357
|
tooltip: { trigger: "item" },
|
|
337
358
|
series: [{
|
|
@@ -343,12 +364,12 @@ function he(e, t) {
|
|
|
343
364
|
}]
|
|
344
365
|
};
|
|
345
366
|
}
|
|
346
|
-
function
|
|
367
|
+
function N(e) {
|
|
347
368
|
const t = {
|
|
348
369
|
name: String(e.name ?? ""),
|
|
349
370
|
value: Number(e.value ?? 0)
|
|
350
371
|
};
|
|
351
|
-
return Array.isArray(e.children) && (t.children = e.children.map((i) =>
|
|
372
|
+
return Array.isArray(e.children) && (t.children = e.children.map((i) => N(i))), t;
|
|
352
373
|
}
|
|
353
374
|
function j(e) {
|
|
354
375
|
if (e.length === 0) return [];
|
|
@@ -366,30 +387,30 @@ function L(e, t) {
|
|
|
366
387
|
function O(e) {
|
|
367
388
|
return e != null && typeof e == "object" && !Array.isArray(e);
|
|
368
389
|
}
|
|
369
|
-
var
|
|
370
|
-
for (var n = r > 1 ? void 0 : r ? de(t, i) : t, s = e.length - 1,
|
|
371
|
-
(
|
|
372
|
-
return r && n &&
|
|
390
|
+
var he = Object.defineProperty, de = Object.getOwnPropertyDescriptor, I = (e, t, i, r) => {
|
|
391
|
+
for (var n = r > 1 ? void 0 : r ? de(t, i) : t, s = e.length - 1, y; s >= 0; s--)
|
|
392
|
+
(y = e[s]) && (n = (r ? y(t, i, n) : y(n)) || n);
|
|
393
|
+
return r && n && he(t, i, n), n;
|
|
373
394
|
};
|
|
374
|
-
|
|
395
|
+
z.use([
|
|
375
396
|
B,
|
|
376
397
|
q,
|
|
398
|
+
W,
|
|
377
399
|
G,
|
|
378
400
|
H,
|
|
379
401
|
K,
|
|
380
402
|
U,
|
|
381
|
-
|
|
403
|
+
Y,
|
|
382
404
|
J,
|
|
383
405
|
Q,
|
|
384
406
|
X,
|
|
385
|
-
Y,
|
|
386
407
|
Z,
|
|
387
408
|
ee,
|
|
388
409
|
te,
|
|
389
410
|
re,
|
|
390
411
|
se
|
|
391
412
|
]);
|
|
392
|
-
let _ = class extends
|
|
413
|
+
let _ = class extends V {
|
|
393
414
|
constructor() {
|
|
394
415
|
super(...arguments), this.spec = null, this._chart = null, this._container = null, this._resizeObserver = null;
|
|
395
416
|
}
|
|
@@ -407,11 +428,11 @@ let _ = class extends I {
|
|
|
407
428
|
_initChart() {
|
|
408
429
|
if (!(!this._container || !this.spec))
|
|
409
430
|
try {
|
|
410
|
-
this._chart =
|
|
431
|
+
this._chart = z.init(this._container), this._chart.on("click", (e) => {
|
|
411
432
|
this._onChartClick(e);
|
|
412
433
|
}), this._updateChart();
|
|
413
434
|
} catch (e) {
|
|
414
|
-
console.warn("[
|
|
435
|
+
console.warn("[uw-chart] Failed to initialize ECharts:", e.message);
|
|
415
436
|
}
|
|
416
437
|
}
|
|
417
438
|
_onChartClick(e) {
|
|
@@ -477,10 +498,10 @@ let _ = class extends I {
|
|
|
477
498
|
};
|
|
478
499
|
_.styles = [
|
|
479
500
|
$,
|
|
480
|
-
|
|
501
|
+
M`
|
|
481
502
|
:host {
|
|
482
503
|
display: block;
|
|
483
|
-
container:
|
|
504
|
+
container: uw-chart / inline-size;
|
|
484
505
|
}
|
|
485
506
|
|
|
486
507
|
.chart-container {
|
|
@@ -488,21 +509,21 @@ _.styles = [
|
|
|
488
509
|
height: var(--u-widget-chart-height, 300px);
|
|
489
510
|
}
|
|
490
511
|
|
|
491
|
-
@container
|
|
512
|
+
@container uw-chart (max-width: 20rem) {
|
|
492
513
|
.chart-container {
|
|
493
514
|
height: var(--u-widget-chart-height-narrow, 200px);
|
|
494
515
|
}
|
|
495
516
|
}
|
|
496
517
|
`
|
|
497
518
|
];
|
|
498
|
-
|
|
519
|
+
I([
|
|
499
520
|
R({ type: Object })
|
|
500
521
|
], _.prototype, "spec", 2);
|
|
501
|
-
_ =
|
|
502
|
-
|
|
522
|
+
_ = I([
|
|
523
|
+
D("uw-chart")
|
|
503
524
|
], _);
|
|
504
525
|
export {
|
|
505
|
-
_ as
|
|
526
|
+
_ as UwChart,
|
|
506
527
|
ie as toEChartsOption
|
|
507
528
|
};
|
|
508
529
|
//# sourceMappingURL=u-widgets-charts.js.map
|