@worm-print-platform/echarts 1.6.0 → 1.6.2
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 +9 -21
- package/dist/bind.d.ts +1 -1
- package/dist/browser/executor.iife.d.ts +1 -1
- package/dist/browser-bundle.d.ts +1 -1
- package/dist/config.d.ts +3 -1
- package/dist/constants.d.ts +5 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/echarts.d.ts +1 -1
- package/dist/echarts.js +38 -14
- package/dist/executor.iife.global.d.ts +1 -1
- package/dist/executor.iife.global.js +29 -17
- package/dist/i18n/en-US.json +153 -0
- package/dist/i18n/th-TH.json +153 -0
- package/dist/i18n/zh-CN.json +153 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/kinds.d.ts +5 -1
- package/dist/kit.cjs +2 -2
- package/dist/kit.d.ts +1 -1
- package/dist/kit.js +2 -2
- package/dist/label.d.ts +3 -1
- package/dist/marketplace.d.ts +1 -1
- package/dist/marketplace.js +650 -136
- package/dist/node.cjs +46 -19
- package/dist/node.d.ts +1 -1
- package/dist/node.js +46 -19
- package/dist/normalize.d.ts +1 -1
- package/dist/option-utils.d.ts +1 -1
- package/dist/plugin-8R67OtBD.cjs +6 -0
- package/dist/plugin-CKyaiHYF.js +960 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/renderer.d.ts +1 -1
- package/dist/test-setup.d.ts +7 -0
- package/dist/type-augmentation.d.ts +1 -1
- package/dist/ui.cjs +650 -136
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +650 -136
- package/dist/units.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +29 -3
- package/dist/plugin-BWmSrZ3m.cjs +0 -6
- package/dist/plugin-Dvcrcg_Z.js +0 -933
|
@@ -0,0 +1,960 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @worm-print-platform/echarts v1.6.2
|
|
3
|
+
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
|
+
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/import { t as A } from "@worm-print-platform/core/i18n";
|
|
7
|
+
import { getPluginConfig as te, configurePlugin as re, defineElementPlugin as ae, getElementPluginById as se, registerElementPlugin as j } from "@worm-print-platform/core/designer";
|
|
8
|
+
import { evaluateTemplate as ie } from "@worm-print-platform/core";
|
|
9
|
+
import { BarChart as ne, LineChart as oe, PieChart as le, ScatterChart as ce, RadarChart as ue, FunnelChart as fe, GaugeChart as de } from "echarts/charts";
|
|
10
|
+
import { GridComponent as ye, TooltipComponent as be, LegendComponent as he, TitleComponent as pe, DatasetComponent as me } from "echarts/components";
|
|
11
|
+
import * as M from "echarts/core";
|
|
12
|
+
import { SVGRenderer as ge } from "echarts/renderers";
|
|
13
|
+
const p = ["left", "top", "width", "height", "chartOption"], T = ["dataSource", "categoryField", "valueFields", "seriesField"], m = ["title", "legend", "palette"], H = [
|
|
14
|
+
{
|
|
15
|
+
type: "barChart",
|
|
16
|
+
label: "柱状图",
|
|
17
|
+
labelKey: "echarts.series.typeNames.bar",
|
|
18
|
+
icon: "ChartColumn",
|
|
19
|
+
seriesType: "bar",
|
|
20
|
+
orientation: "vertical",
|
|
21
|
+
fields: [...T, ...m, "stack", "label"],
|
|
22
|
+
requiredOptionKeys: p,
|
|
23
|
+
defaultWidth: 100,
|
|
24
|
+
defaultHeight: 60,
|
|
25
|
+
notes: "柱状图:类目 + 多个数值字段,每字段一个 series;series[].data 写 $data 占位;固定高,禁止 autoHeight",
|
|
26
|
+
notesKey: "echarts.notes.bar"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: "barHChart",
|
|
30
|
+
label: "条形图",
|
|
31
|
+
labelKey: "echarts.series.typeNames.barH",
|
|
32
|
+
icon: "ChartBar",
|
|
33
|
+
seriesType: "bar",
|
|
34
|
+
orientation: "horizontal",
|
|
35
|
+
fields: [...T, ...m, "stack", "label"],
|
|
36
|
+
requiredOptionKeys: p,
|
|
37
|
+
defaultWidth: 100,
|
|
38
|
+
defaultHeight: 60,
|
|
39
|
+
notes: "横向条形图:xAxis 为数值、yAxis 为类目;类目写 yAxis.data 的 $data 占位",
|
|
40
|
+
notesKey: "echarts.notes.barH"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: "lineChart",
|
|
44
|
+
label: "折线图",
|
|
45
|
+
labelKey: "echarts.series.typeNames.line",
|
|
46
|
+
icon: "ChartLine",
|
|
47
|
+
seriesType: "line",
|
|
48
|
+
fields: [...T, ...m, "stack", "label"],
|
|
49
|
+
requiredOptionKeys: p,
|
|
50
|
+
defaultWidth: 100,
|
|
51
|
+
defaultHeight: 60,
|
|
52
|
+
notes: "折线图:类目 + 多个数值字段;不写 areaStyle",
|
|
53
|
+
notesKey: "echarts.notes.line"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: "areaChart",
|
|
57
|
+
label: "面积图",
|
|
58
|
+
labelKey: "echarts.series.typeNames.area",
|
|
59
|
+
icon: "ChartArea",
|
|
60
|
+
seriesType: "line",
|
|
61
|
+
fields: [...T, ...m, "stack", "label"],
|
|
62
|
+
requiredOptionKeys: p,
|
|
63
|
+
defaultWidth: 100,
|
|
64
|
+
defaultHeight: 60,
|
|
65
|
+
notes: "面积图:折线 + series[].areaStyle;其余同折线图",
|
|
66
|
+
notesKey: "echarts.notes.area"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: "pieChart",
|
|
70
|
+
label: "饼图",
|
|
71
|
+
labelKey: "echarts.series.typeNames.pie",
|
|
72
|
+
icon: "ChartPie",
|
|
73
|
+
seriesType: "pie",
|
|
74
|
+
fields: ["dataSource", "categoryField", "valueFields", ...m, "label"],
|
|
75
|
+
requiredOptionKeys: p,
|
|
76
|
+
defaultWidth: 60,
|
|
77
|
+
defaultHeight: 60,
|
|
78
|
+
notes: "饼图:类目 + 首个数值字段生成 { name, value };只需一个数值字段",
|
|
79
|
+
notesKey: "echarts.notes.pie"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: "doughnutChart",
|
|
83
|
+
label: "环形图",
|
|
84
|
+
labelKey: "echarts.series.typeNames.doughnut",
|
|
85
|
+
icon: "Donut",
|
|
86
|
+
seriesType: "pie",
|
|
87
|
+
fields: ["dataSource", "categoryField", "valueFields", ...m, "innerRadius", "label"],
|
|
88
|
+
requiredOptionKeys: p,
|
|
89
|
+
defaultWidth: 60,
|
|
90
|
+
defaultHeight: 60,
|
|
91
|
+
notes: "环形图:饼图 + radius:[内径,外径];内径由面板配置",
|
|
92
|
+
notesKey: "echarts.notes.doughnut"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: "scatterChart",
|
|
96
|
+
label: "散点图",
|
|
97
|
+
labelKey: "echarts.series.typeNames.scatter",
|
|
98
|
+
icon: "ChartScatter",
|
|
99
|
+
seriesType: "scatter",
|
|
100
|
+
fields: ["dataSource", "categoryField", "valueFields", ...m, "bubble", "label"],
|
|
101
|
+
requiredOptionKeys: p,
|
|
102
|
+
defaultWidth: 80,
|
|
103
|
+
defaultHeight: 60,
|
|
104
|
+
notes: "散点图:类目字段作 x、首个数值字段作 y;chartBubble 开启时用第二个数值字段作点大小",
|
|
105
|
+
notesKey: "echarts.notes.scatter"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: "radarChart",
|
|
109
|
+
label: "雷达图",
|
|
110
|
+
labelKey: "echarts.series.typeNames.radar",
|
|
111
|
+
icon: "Radar",
|
|
112
|
+
seriesType: "radar",
|
|
113
|
+
fields: ["dataSource", "categoryField", "valueFields", ...m, "radius", "label"],
|
|
114
|
+
requiredOptionKeys: p,
|
|
115
|
+
defaultWidth: 70,
|
|
116
|
+
defaultHeight: 60,
|
|
117
|
+
notes: "雷达图:每个数值字段是一个维度(radar.indicator),每行数据是一个系列(类目字段作系列名);半径由面板写 radar.radius(%,默认 75)",
|
|
118
|
+
notesKey: "echarts.notes.radar"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: "funnelChart",
|
|
122
|
+
label: "漏斗图",
|
|
123
|
+
labelKey: "echarts.series.typeNames.funnel",
|
|
124
|
+
icon: "Funnel",
|
|
125
|
+
seriesType: "funnel",
|
|
126
|
+
fields: ["dataSource", "categoryField", "valueFields", ...m, "padding", "label"],
|
|
127
|
+
requiredOptionKeys: p,
|
|
128
|
+
defaultWidth: 60,
|
|
129
|
+
defaultHeight: 60,
|
|
130
|
+
notes: "漏斗图:类目 + 首个数值字段,按数值降序;四边内边距由面板写 series.left/right/top/bottom(%,右侧需留外置标签空间)",
|
|
131
|
+
notesKey: "echarts.notes.funnel"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: "gaugeChart",
|
|
135
|
+
label: "仪表盘",
|
|
136
|
+
labelKey: "echarts.series.typeNames.gauge",
|
|
137
|
+
icon: "Gauge",
|
|
138
|
+
seriesType: "gauge",
|
|
139
|
+
fields: ["dataSource", "valueFields", ...m, "gaugeRange", "label"],
|
|
140
|
+
requiredOptionKeys: p,
|
|
141
|
+
defaultWidth: 60,
|
|
142
|
+
defaultHeight: 60,
|
|
143
|
+
notes: "仪表盘:取首行数据的首个数值字段作指针值;min/max 由面板写入 series[0].min/max",
|
|
144
|
+
notesKey: "echarts.notes.gauge"
|
|
145
|
+
}
|
|
146
|
+
], lt = H.map((e) => e.type);
|
|
147
|
+
function b(e) {
|
|
148
|
+
return H.find((t) => t.type === e);
|
|
149
|
+
}
|
|
150
|
+
function ct(e) {
|
|
151
|
+
return b(e)?.fields ?? [];
|
|
152
|
+
}
|
|
153
|
+
function Ae(e) {
|
|
154
|
+
const t = typeof e == "number" ? e : Number(e);
|
|
155
|
+
return Number.isFinite(t) ? t : 0;
|
|
156
|
+
}
|
|
157
|
+
function P(e, t, r = !1) {
|
|
158
|
+
if (typeof e == "string")
|
|
159
|
+
return e.startsWith("$data") || r ? e : e.includes("{") ? ie(e, t) : e;
|
|
160
|
+
if (Array.isArray(e)) return e.map((a) => P(a, t, r));
|
|
161
|
+
if (e && typeof e == "object") {
|
|
162
|
+
const a = {};
|
|
163
|
+
for (const [s, i] of Object.entries(e)) {
|
|
164
|
+
const o = r || s === "label" || s === "detail";
|
|
165
|
+
a[s] = P(i, t, o);
|
|
166
|
+
}
|
|
167
|
+
return a;
|
|
168
|
+
}
|
|
169
|
+
return e;
|
|
170
|
+
}
|
|
171
|
+
function S(e) {
|
|
172
|
+
return Array.isArray(e.data) && e.data.includes("$data");
|
|
173
|
+
}
|
|
174
|
+
function Se(e, t) {
|
|
175
|
+
const r = e.dataSource;
|
|
176
|
+
if (typeof r == "string" && Array.isArray(t[r])) return t[r];
|
|
177
|
+
for (const a of Object.values(t))
|
|
178
|
+
if (Array.isArray(a)) return a;
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
function B(e) {
|
|
182
|
+
return typeof e == "string" && e.length > 0 ? e : void 0;
|
|
183
|
+
}
|
|
184
|
+
function xe(e) {
|
|
185
|
+
return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.length > 0) : [];
|
|
186
|
+
}
|
|
187
|
+
function K(e) {
|
|
188
|
+
return Array.isArray(e.series) ? e.series : [];
|
|
189
|
+
}
|
|
190
|
+
function g(e, t) {
|
|
191
|
+
return t ? Ae(e[t]) : 0;
|
|
192
|
+
}
|
|
193
|
+
function U(e, t) {
|
|
194
|
+
for (const r of ["xAxis", "yAxis"]) {
|
|
195
|
+
const a = e[r], s = Array.isArray(a) ? a : a ? [a] : [];
|
|
196
|
+
for (const i of s)
|
|
197
|
+
i && typeof i == "object" && Array.isArray(i.data) && i.data.includes("$data") && (i.data = [...t]);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function Ce(e, t, r, a, s) {
|
|
201
|
+
const i = K(e);
|
|
202
|
+
if (!i.some(S)) return;
|
|
203
|
+
const o = t.map((c, u) => r ? c[r] : u + 1), l = (c) => a[Math.min(c, a.length - 1)];
|
|
204
|
+
if (s) {
|
|
205
|
+
const c = i[0], u = /* @__PURE__ */ new Map();
|
|
206
|
+
for (const d of t) {
|
|
207
|
+
const y = String(d[s] ?? ""), h = u.get(y) ?? /* @__PURE__ */ new Map(), W = String(d[r ?? ""]);
|
|
208
|
+
h.set(W, (h.get(W) ?? 0) + g(d, l(0))), u.set(y, h);
|
|
209
|
+
}
|
|
210
|
+
const f = [...new Set(o)];
|
|
211
|
+
e.series = [...u.entries()].map(([d, y]) => ({
|
|
212
|
+
...c,
|
|
213
|
+
name: d,
|
|
214
|
+
data: f.map((h) => y.get(String(h)) ?? null)
|
|
215
|
+
})), U(e, f);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const n = i[i.length - 1];
|
|
219
|
+
for (; i.length < a.length; ) i.push({ ...n, data: ["$data"] });
|
|
220
|
+
e.series = i.map((c, u) => S(c) ? { ...c, data: t.map((f) => g(f, l(u))) } : c), U(e, o);
|
|
221
|
+
}
|
|
222
|
+
function q(e, t, r, a, s) {
|
|
223
|
+
const i = K(e);
|
|
224
|
+
if (!i.some(S)) return;
|
|
225
|
+
const o = t.map((l) => ({
|
|
226
|
+
name: r ? String(l[r] ?? "") : "",
|
|
227
|
+
value: g(l, a)
|
|
228
|
+
}));
|
|
229
|
+
s && o.sort((l, n) => n.value - l.value), e.series = i.map((l) => ({ ...l, data: o }));
|
|
230
|
+
}
|
|
231
|
+
function Ke(e, t, r, a, s) {
|
|
232
|
+
const i = K(e);
|
|
233
|
+
if (!i.some(S)) return;
|
|
234
|
+
const o = a[0], l = s ? a[1] : void 0, n = l ? t.map((d) => g(d, l)) : [], c = n.length > 0 ? Math.min(...n) : 0, u = n.length > 0 ? Math.max(...n) : 0, f = (d) => u === c ? 12 : Math.round(6 + (d - c) / (u - c) * 18);
|
|
235
|
+
e.series = i.map((d) => ({
|
|
236
|
+
...d,
|
|
237
|
+
data: t.map((y) => {
|
|
238
|
+
const h = [g(y, r), g(y, o)];
|
|
239
|
+
return l ? { value: h, symbolSize: f(g(y, l)) } : h;
|
|
240
|
+
})
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
function ve(e) {
|
|
244
|
+
if (e <= 0) return 10;
|
|
245
|
+
const t = 10 ** Math.floor(Math.log10(e)), r = t >= 10 ? t : 10;
|
|
246
|
+
return Math.ceil(e / r) * r;
|
|
247
|
+
}
|
|
248
|
+
function Te(e, t, r, a) {
|
|
249
|
+
const s = K(e);
|
|
250
|
+
if (!s.some(S)) return;
|
|
251
|
+
const i = a.map((o) => Math.max(0, ...t.map((l) => g(l, o))));
|
|
252
|
+
e.radar = {
|
|
253
|
+
...e.radar ?? {},
|
|
254
|
+
// 维度 = 数值字段;max 取该列最大值上浮取整
|
|
255
|
+
indicator: a.map((o, l) => ({ name: o, max: ve(i[l]) }))
|
|
256
|
+
}, e.series = s.map((o) => ({
|
|
257
|
+
...o,
|
|
258
|
+
data: t.map((l) => ({
|
|
259
|
+
name: r ? String(l[r] ?? "") : "",
|
|
260
|
+
value: a.map((n) => g(l, n))
|
|
261
|
+
}))
|
|
262
|
+
}));
|
|
263
|
+
}
|
|
264
|
+
function Oe(e, t, r) {
|
|
265
|
+
const a = K(e);
|
|
266
|
+
if (!a.some(S)) return;
|
|
267
|
+
const s = t[0] ?? {};
|
|
268
|
+
e.series = a.map((i) => ({ ...i, data: [{ value: g(s, r), name: r }] }));
|
|
269
|
+
}
|
|
270
|
+
function ke(e, t, r) {
|
|
271
|
+
const a = t.chartOption;
|
|
272
|
+
if (!a || typeof a != "object" || Array.isArray(a)) return {};
|
|
273
|
+
const s = P(a, r), i = xe(t.chartValueFields);
|
|
274
|
+
if (i.length === 0) return { _chartOption: s };
|
|
275
|
+
const o = Se({ ...t, dataSource: t.chartDataSource ?? t.dataSource }, r);
|
|
276
|
+
if (o.length === 0) return { _chartOption: s };
|
|
277
|
+
const l = B(t.chartCategoryField);
|
|
278
|
+
switch (b(e)?.seriesType) {
|
|
279
|
+
case "radar":
|
|
280
|
+
Te(s, o, l, i);
|
|
281
|
+
break;
|
|
282
|
+
case "gauge":
|
|
283
|
+
Oe(s, o, i[0]);
|
|
284
|
+
break;
|
|
285
|
+
case "funnel":
|
|
286
|
+
q(s, o, l, i[0], !0);
|
|
287
|
+
break;
|
|
288
|
+
case "pie":
|
|
289
|
+
q(s, o, l, i[0], !1);
|
|
290
|
+
break;
|
|
291
|
+
case "scatter":
|
|
292
|
+
Ke(s, o, l, i, t.chartBubble === !0);
|
|
293
|
+
break;
|
|
294
|
+
default:
|
|
295
|
+
Ce(s, o, l, i, B(t.chartSeriesField));
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
return { _chartOption: s };
|
|
299
|
+
}
|
|
300
|
+
const _ = "@worm-print-platform/echarts", G = [
|
|
301
|
+
{ key: "default", label: "默认蓝", labelKey: "echarts.palette.default", colors: ["#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de"] },
|
|
302
|
+
{ key: "fresh", label: "清新绿", labelKey: "echarts.palette.fresh", colors: ["#2f9e6e", "#5cc9a7", "#9ad6c1", "#f2c94c", "#4a90e2"] },
|
|
303
|
+
{ key: "warm", label: "暖橙红", labelKey: "echarts.palette.warm", colors: ["#f2704e", "#f7a35c", "#f7d56d", "#c54e3f", "#8f5a4a"] },
|
|
304
|
+
{ key: "purple", label: "紫灰", labelKey: "echarts.palette.purple", colors: ["#7b61ff", "#9b8cff", "#c3baff", "#596275", "#8d99ae"] }
|
|
305
|
+
], Fe = ["示例一", "示例二", "示例三"], Ee = { top: 6, right: 25, bottom: 6, left: 5 }, Le = 75, we = 50, O = { top: 60, right: 80, bottom: 65, left: 80 }, V = { left: "8%", right: "8%", bottom: "12%", top: "18%", containLabel: !0 };
|
|
306
|
+
function _e(e) {
|
|
307
|
+
return {
|
|
308
|
+
top: `${e.top}%`,
|
|
309
|
+
right: `${e.right}%`,
|
|
310
|
+
bottom: `${e.bottom}%`,
|
|
311
|
+
left: `${e.left}%`
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function Ne(e) {
|
|
315
|
+
const t = b(e), r = { text: "" };
|
|
316
|
+
switch (t?.seriesType) {
|
|
317
|
+
case "pie":
|
|
318
|
+
return {
|
|
319
|
+
title: r,
|
|
320
|
+
tooltip: { trigger: "item" },
|
|
321
|
+
series: [{
|
|
322
|
+
type: "pie",
|
|
323
|
+
name: "数量",
|
|
324
|
+
data: ["$data"],
|
|
325
|
+
radius: e === "doughnutChart" ? ["40%", "70%"] : "62%"
|
|
326
|
+
}]
|
|
327
|
+
};
|
|
328
|
+
case "scatter":
|
|
329
|
+
return {
|
|
330
|
+
title: r,
|
|
331
|
+
grid: V,
|
|
332
|
+
tooltip: { trigger: "axis" },
|
|
333
|
+
xAxis: { type: "value" },
|
|
334
|
+
yAxis: { type: "value" },
|
|
335
|
+
series: [{ type: "scatter", name: "数量", data: ["$data"], symbolSize: 8 }]
|
|
336
|
+
};
|
|
337
|
+
case "radar":
|
|
338
|
+
return {
|
|
339
|
+
title: r,
|
|
340
|
+
tooltip: { trigger: "item" },
|
|
341
|
+
// indicator 由绑定阶段按 chartValueFields 生成;设计态预览见 previewChartOption
|
|
342
|
+
radar: { indicator: [], radius: `${Le}%` },
|
|
343
|
+
series: [{ type: "radar", name: "数量", data: ["$data"] }]
|
|
344
|
+
};
|
|
345
|
+
case "funnel":
|
|
346
|
+
return {
|
|
347
|
+
title: r,
|
|
348
|
+
tooltip: { trigger: "item" },
|
|
349
|
+
legend: { show: !1 },
|
|
350
|
+
// 不写内边距会吃 ECharts 的 px 默认(左右 80/上下 60~65),小框里图形只占一半不到
|
|
351
|
+
series: [{ type: "funnel", name: "数量", data: ["$data"], sort: "descending", ..._e(Ee) }]
|
|
352
|
+
};
|
|
353
|
+
case "gauge":
|
|
354
|
+
return {
|
|
355
|
+
title: r,
|
|
356
|
+
tooltip: { trigger: "item" },
|
|
357
|
+
series: [{ type: "gauge", name: "数量", min: 0, max: 100, data: [{ value: 0, name: "数量" }] }]
|
|
358
|
+
};
|
|
359
|
+
default: {
|
|
360
|
+
const a = t?.orientation === "horizontal", s = t?.seriesType === "line" && e === "areaChart", i = t?.seriesType === "line" ? "line" : "bar";
|
|
361
|
+
return {
|
|
362
|
+
title: r,
|
|
363
|
+
grid: V,
|
|
364
|
+
tooltip: { trigger: "axis" },
|
|
365
|
+
xAxis: a ? { type: "value" } : { type: "category", data: ["$data"] },
|
|
366
|
+
yAxis: a ? { type: "category", data: ["$data"] } : { type: "value" },
|
|
367
|
+
series: [{ type: i, name: "数量", data: ["$data"], ...s ? { areaStyle: {} } : {} }]
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function ut(e) {
|
|
373
|
+
re(_, e);
|
|
374
|
+
}
|
|
375
|
+
function N() {
|
|
376
|
+
return te(_);
|
|
377
|
+
}
|
|
378
|
+
function ft() {
|
|
379
|
+
const e = N().palettes ?? {}, t = G.map((a) => {
|
|
380
|
+
const s = e[a.key];
|
|
381
|
+
return s ? { key: a.key, label: s.label ?? a.label, labelKey: s.label ? void 0 : a.labelKey, colors: s.colors } : { key: a.key, label: a.label, labelKey: a.labelKey, colors: a.colors };
|
|
382
|
+
}), r = Object.entries(e).filter(([a]) => !G.some((s) => s.key === a)).map(([a, s]) => ({ key: a, label: s.label ?? a, colors: s.colors }));
|
|
383
|
+
return [...t, ...r];
|
|
384
|
+
}
|
|
385
|
+
function Re() {
|
|
386
|
+
const e = N().sampleCategories;
|
|
387
|
+
return Array.isArray(e) && e.length > 0 ? e : Fe;
|
|
388
|
+
}
|
|
389
|
+
function Pe(e, t) {
|
|
390
|
+
const r = N(), a = b(e);
|
|
391
|
+
return {
|
|
392
|
+
width: typeof r.defaultWidth == "number" ? r.defaultWidth : a?.defaultWidth ?? 100,
|
|
393
|
+
height: typeof r.defaultHeight == "number" ? r.defaultHeight : a?.defaultHeight ?? 60,
|
|
394
|
+
title: a?.label ?? "图表",
|
|
395
|
+
chartOption: Ne(e),
|
|
396
|
+
chartDataSource: "",
|
|
397
|
+
chartCategoryField: "name",
|
|
398
|
+
chartValueFields: ["value"],
|
|
399
|
+
chartSeriesField: "",
|
|
400
|
+
...t
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
M.use([
|
|
404
|
+
ne,
|
|
405
|
+
oe,
|
|
406
|
+
le,
|
|
407
|
+
ce,
|
|
408
|
+
ue,
|
|
409
|
+
fe,
|
|
410
|
+
de,
|
|
411
|
+
ye,
|
|
412
|
+
be,
|
|
413
|
+
he,
|
|
414
|
+
pe,
|
|
415
|
+
me,
|
|
416
|
+
ge
|
|
417
|
+
]);
|
|
418
|
+
const Y = /* @__PURE__ */ new Set();
|
|
419
|
+
function De() {
|
|
420
|
+
const t = (N().components ?? []).filter((r) => r != null && !Y.has(r));
|
|
421
|
+
if (t.length !== 0) {
|
|
422
|
+
M.use(t);
|
|
423
|
+
for (const r of t) Y.add(r);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
const Me = 96 / 25.4;
|
|
427
|
+
function x(e) {
|
|
428
|
+
const t = Number.isFinite(e) ? e : 0;
|
|
429
|
+
return Math.max(1, Math.round(t * Me));
|
|
430
|
+
}
|
|
431
|
+
const He = [12, 20, 15];
|
|
432
|
+
function v(e) {
|
|
433
|
+
try {
|
|
434
|
+
return JSON.parse(JSON.stringify(e));
|
|
435
|
+
} catch {
|
|
436
|
+
return e;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
function dt(e, t) {
|
|
440
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return {};
|
|
441
|
+
const r = v(t), a = b(e), s = [...Re()], i = [...He], o = Array.isArray(r.series) ? r.series : [], l = (c) => {
|
|
442
|
+
for (const u of o)
|
|
443
|
+
Array.isArray(u.data) && u.data.includes("$data") && (u.data = c(u));
|
|
444
|
+
}, n = () => {
|
|
445
|
+
for (const c of ["xAxis", "yAxis"]) {
|
|
446
|
+
const u = Array.isArray(r[c]) ? r[c] : r[c] ? [r[c]] : [];
|
|
447
|
+
for (const f of u)
|
|
448
|
+
f && Array.isArray(f.data) && f.data.includes("$data") && (f.data = [...s]);
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
switch (a?.seriesType) {
|
|
452
|
+
case "pie":
|
|
453
|
+
l(() => s.map((c, u) => ({ name: c, value: i[u] ?? 10 })));
|
|
454
|
+
break;
|
|
455
|
+
case "funnel":
|
|
456
|
+
l(() => s.map((c, u) => ({ name: c, value: i[u] ?? 10 })));
|
|
457
|
+
break;
|
|
458
|
+
case "scatter":
|
|
459
|
+
l(() => i.map((c) => [c, c + 6]));
|
|
460
|
+
break;
|
|
461
|
+
case "radar":
|
|
462
|
+
r.radar = {
|
|
463
|
+
...r.radar ?? {},
|
|
464
|
+
indicator: s.map((c) => ({ name: c, max: 30 }))
|
|
465
|
+
}, l(() => [{ name: "示例", value: i }]);
|
|
466
|
+
break;
|
|
467
|
+
case "gauge":
|
|
468
|
+
l(() => [{ value: i[0] ?? 40, name: "数量" }]);
|
|
469
|
+
break;
|
|
470
|
+
default:
|
|
471
|
+
l(() => [...i]), n();
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
474
|
+
return r;
|
|
475
|
+
}
|
|
476
|
+
function yt(e, t) {
|
|
477
|
+
const r = Array.isArray(e?.color) ? (e?.color).map(String) : [];
|
|
478
|
+
return t.find((s) => s.colors.every((i, o) => i === r[o]) && r.length === s.colors.length)?.key ?? "default";
|
|
479
|
+
}
|
|
480
|
+
function Q(e) {
|
|
481
|
+
return Array.isArray(e) ? e[0] && typeof e[0] == "object" ? { ...e[0] } : {} : e && typeof e == "object" ? { ...e } : {};
|
|
482
|
+
}
|
|
483
|
+
function bt(e, t, r) {
|
|
484
|
+
const a = v(e), s = Array.isArray(a.series) ? a.series : [], i = b(r), o = s[0] ?? { type: i?.seriesType === "line" ? "line" : "bar", data: ["$data"] };
|
|
485
|
+
return a.series = Array.from({ length: Math.max(t, 1) }, (l, n) => ({
|
|
486
|
+
...o,
|
|
487
|
+
...s[n] ?? {},
|
|
488
|
+
data: ["$data"]
|
|
489
|
+
})), a;
|
|
490
|
+
}
|
|
491
|
+
const R = (e) => Math.round(e * 10) / 10;
|
|
492
|
+
function D(e, t) {
|
|
493
|
+
return t > 0 ? R(e / t * 100) : 0;
|
|
494
|
+
}
|
|
495
|
+
function k(e, t, r) {
|
|
496
|
+
if (typeof e == "string" && e.trim().endsWith("%")) {
|
|
497
|
+
const a = Number.parseFloat(e);
|
|
498
|
+
if (Number.isFinite(a)) return R(a);
|
|
499
|
+
}
|
|
500
|
+
return typeof e == "number" && Number.isFinite(e) ? D(e, t) : D(r, t);
|
|
501
|
+
}
|
|
502
|
+
function Z(e, t, r) {
|
|
503
|
+
return Math.min(r, Math.max(t, e));
|
|
504
|
+
}
|
|
505
|
+
function C(e) {
|
|
506
|
+
return `${Z(R(e), 0, 100)}%`;
|
|
507
|
+
}
|
|
508
|
+
function $e(e) {
|
|
509
|
+
const r = (Array.isArray(e.series) ? e.series : [])[0];
|
|
510
|
+
return r && typeof r == "object" ? r : {};
|
|
511
|
+
}
|
|
512
|
+
function ht(e, t, r) {
|
|
513
|
+
const s = $e(e && typeof e == "object" ? e : {}), i = x(t), o = x(r);
|
|
514
|
+
return {
|
|
515
|
+
top: k(s.top, o, O.top),
|
|
516
|
+
right: k(s.right, i, O.right),
|
|
517
|
+
bottom: k(s.bottom, o, O.bottom),
|
|
518
|
+
left: k(s.left, i, O.left)
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
function pt(e, t) {
|
|
522
|
+
const r = v(e), a = Array.isArray(r.series) ? r.series : [];
|
|
523
|
+
a.length === 0 && a.push({ type: "funnel", data: ["$data"] });
|
|
524
|
+
const s = a[0];
|
|
525
|
+
return s.top = C(t.top), s.right = C(t.right), s.bottom = C(t.bottom), s.left = C(t.left), r.series = a, r;
|
|
526
|
+
}
|
|
527
|
+
function mt(e, t, r) {
|
|
528
|
+
const s = Q((e && typeof e == "object" ? e : {}).radar).radius, i = Array.isArray(s) ? s[s.length - 1] : s, o = x(t), l = x(r), n = Math.min(o, l) / 2;
|
|
529
|
+
if (typeof i == "string" && i.trim().endsWith("%")) {
|
|
530
|
+
const c = Number.parseFloat(i);
|
|
531
|
+
if (Number.isFinite(c)) return R(c);
|
|
532
|
+
}
|
|
533
|
+
return typeof i == "number" && Number.isFinite(i) ? D(i, n) : we;
|
|
534
|
+
}
|
|
535
|
+
function gt(e, t) {
|
|
536
|
+
const r = v(e);
|
|
537
|
+
return r.radar = { ...Q(r.radar), radius: C(Z(t, 20, 100)) }, r;
|
|
538
|
+
}
|
|
539
|
+
const At = [
|
|
540
|
+
{ key: "value", label: "数值", labelKey: "echarts.label.formatter.value", formatter: "{c}" },
|
|
541
|
+
{ key: "name-value", label: "名称: 数值", labelKey: "echarts.label.formatter.nameValue", formatter: "{b}: {c}" },
|
|
542
|
+
{ key: "name", label: "名称", labelKey: "echarts.label.formatter.name", formatter: "{b}" },
|
|
543
|
+
{ key: "percent", label: "百分比", labelKey: "echarts.label.formatter.percent", formatter: "{d}%" }
|
|
544
|
+
], St = {
|
|
545
|
+
bar: [
|
|
546
|
+
{ value: "top", label: "顶部", labelKey: "echarts.label.position.bar.top" },
|
|
547
|
+
{ value: "inside", label: "内部", labelKey: "echarts.label.position.bar.inside" },
|
|
548
|
+
{ value: "insideTop", label: "内部顶端", labelKey: "echarts.label.position.bar.insideTop" },
|
|
549
|
+
{ value: "bottom", label: "底部", labelKey: "echarts.label.position.bar.bottom" },
|
|
550
|
+
{ value: "insideBottom", label: "内部底端", labelKey: "echarts.label.position.bar.insideBottom" },
|
|
551
|
+
{ value: "right", label: "右侧", labelKey: "echarts.label.position.bar.right" },
|
|
552
|
+
{ value: "left", label: "左侧", labelKey: "echarts.label.position.bar.left" },
|
|
553
|
+
{ value: "middle", label: "居中", labelKey: "echarts.label.position.bar.middle" }
|
|
554
|
+
],
|
|
555
|
+
line: [
|
|
556
|
+
{ value: "top", label: "顶部", labelKey: "echarts.label.position.line.top" },
|
|
557
|
+
{ value: "bottom", label: "底部", labelKey: "echarts.label.position.line.bottom" },
|
|
558
|
+
{ value: "inside", label: "内部", labelKey: "echarts.label.position.line.inside" },
|
|
559
|
+
{ value: "left", label: "左侧", labelKey: "echarts.label.position.line.left" },
|
|
560
|
+
{ value: "right", label: "右侧", labelKey: "echarts.label.position.line.right" }
|
|
561
|
+
],
|
|
562
|
+
pie: [
|
|
563
|
+
{ value: "outside", label: "外侧", labelKey: "echarts.label.position.pie.outside" },
|
|
564
|
+
{ value: "inside", label: "内部", labelKey: "echarts.label.position.pie.inside" },
|
|
565
|
+
{ value: "center", label: "中心", labelKey: "echarts.label.position.pie.center" }
|
|
566
|
+
],
|
|
567
|
+
scatter: [
|
|
568
|
+
{ value: "top", label: "顶部", labelKey: "echarts.label.position.scatter.top" },
|
|
569
|
+
{ value: "bottom", label: "底部", labelKey: "echarts.label.position.scatter.bottom" },
|
|
570
|
+
{ value: "left", label: "左侧", labelKey: "echarts.label.position.scatter.left" },
|
|
571
|
+
{ value: "right", label: "右侧", labelKey: "echarts.label.position.scatter.right" },
|
|
572
|
+
{ value: "inside", label: "内部", labelKey: "echarts.label.position.scatter.inside" }
|
|
573
|
+
],
|
|
574
|
+
radar: [
|
|
575
|
+
{ value: "top", label: "顶部", labelKey: "echarts.label.position.radar.top" },
|
|
576
|
+
{ value: "bottom", label: "底部", labelKey: "echarts.label.position.radar.bottom" },
|
|
577
|
+
{ value: "left", label: "左侧", labelKey: "echarts.label.position.radar.left" },
|
|
578
|
+
{ value: "right", label: "右侧", labelKey: "echarts.label.position.radar.right" },
|
|
579
|
+
{ value: "inside", label: "内部", labelKey: "echarts.label.position.radar.inside" }
|
|
580
|
+
],
|
|
581
|
+
funnel: [
|
|
582
|
+
{ value: "outer", label: "外侧", labelKey: "echarts.label.position.funnel.outer" },
|
|
583
|
+
{ value: "inner", label: "内部", labelKey: "echarts.label.position.funnel.inner" },
|
|
584
|
+
{ value: "left", label: "左侧", labelKey: "echarts.label.position.funnel.left" },
|
|
585
|
+
{ value: "right", label: "右侧", labelKey: "echarts.label.position.funnel.right" },
|
|
586
|
+
{ value: "top", label: "顶部", labelKey: "echarts.label.position.funnel.top" },
|
|
587
|
+
{ value: "bottom", label: "底部", labelKey: "echarts.label.position.funnel.bottom" }
|
|
588
|
+
],
|
|
589
|
+
gauge: []
|
|
590
|
+
}, ze = {
|
|
591
|
+
bar: !1,
|
|
592
|
+
line: !1,
|
|
593
|
+
pie: !0,
|
|
594
|
+
scatter: !1,
|
|
595
|
+
radar: !1,
|
|
596
|
+
funnel: !0,
|
|
597
|
+
gauge: !0
|
|
598
|
+
}, Ie = {
|
|
599
|
+
bar: { position: "top", fontSize: 12 },
|
|
600
|
+
line: { position: "top", fontSize: 12 },
|
|
601
|
+
pie: { position: "outside", overflow: "none", fontSize: 11 },
|
|
602
|
+
scatter: { position: "top", fontSize: 11 },
|
|
603
|
+
radar: { position: "top", fontSize: 10 },
|
|
604
|
+
funnel: { position: "outer", fontSize: 11 },
|
|
605
|
+
gauge: { fontSize: 14 }
|
|
606
|
+
}, We = {
|
|
607
|
+
barHChart: { position: "right", fontSize: 12 }
|
|
608
|
+
}, je = {
|
|
609
|
+
bar: [
|
|
610
|
+
"formatter",
|
|
611
|
+
"overflow",
|
|
612
|
+
"position",
|
|
613
|
+
"rotate",
|
|
614
|
+
"offset",
|
|
615
|
+
"fontSize",
|
|
616
|
+
"fontWeight",
|
|
617
|
+
"color",
|
|
618
|
+
"backgroundColor",
|
|
619
|
+
"borderColor",
|
|
620
|
+
"borderWidth",
|
|
621
|
+
"borderRadius",
|
|
622
|
+
"padding"
|
|
623
|
+
],
|
|
624
|
+
line: [
|
|
625
|
+
"formatter",
|
|
626
|
+
"overflow",
|
|
627
|
+
"position",
|
|
628
|
+
"rotate",
|
|
629
|
+
"offset",
|
|
630
|
+
"fontSize",
|
|
631
|
+
"fontWeight",
|
|
632
|
+
"color",
|
|
633
|
+
"backgroundColor",
|
|
634
|
+
"borderColor",
|
|
635
|
+
"borderWidth",
|
|
636
|
+
"borderRadius",
|
|
637
|
+
"padding"
|
|
638
|
+
],
|
|
639
|
+
pie: [
|
|
640
|
+
"formatter",
|
|
641
|
+
"overflow",
|
|
642
|
+
"position",
|
|
643
|
+
"distance",
|
|
644
|
+
"offset",
|
|
645
|
+
"fontSize",
|
|
646
|
+
"fontWeight",
|
|
647
|
+
"color",
|
|
648
|
+
"backgroundColor",
|
|
649
|
+
"borderColor",
|
|
650
|
+
"borderWidth",
|
|
651
|
+
"borderRadius",
|
|
652
|
+
"padding",
|
|
653
|
+
"labelLine.show",
|
|
654
|
+
"labelLine.length",
|
|
655
|
+
"labelLine.length2",
|
|
656
|
+
"labelLine.smooth"
|
|
657
|
+
],
|
|
658
|
+
scatter: [
|
|
659
|
+
"formatter",
|
|
660
|
+
"overflow",
|
|
661
|
+
"position",
|
|
662
|
+
"distance",
|
|
663
|
+
"rotate",
|
|
664
|
+
"offset",
|
|
665
|
+
"fontSize",
|
|
666
|
+
"fontWeight",
|
|
667
|
+
"color",
|
|
668
|
+
"backgroundColor",
|
|
669
|
+
"borderColor",
|
|
670
|
+
"borderWidth",
|
|
671
|
+
"borderRadius",
|
|
672
|
+
"padding"
|
|
673
|
+
],
|
|
674
|
+
radar: ["formatter", "fontSize", "fontWeight", "color"],
|
|
675
|
+
funnel: [
|
|
676
|
+
"formatter",
|
|
677
|
+
"overflow",
|
|
678
|
+
"position",
|
|
679
|
+
"distance",
|
|
680
|
+
"fontSize",
|
|
681
|
+
"fontWeight",
|
|
682
|
+
"color",
|
|
683
|
+
"labelLine.show",
|
|
684
|
+
"labelLine.length",
|
|
685
|
+
"labelLine.smooth"
|
|
686
|
+
],
|
|
687
|
+
gauge: ["formatter", "fontSize", "fontWeight", "color", "offset"]
|
|
688
|
+
}, Be = [
|
|
689
|
+
"formatter",
|
|
690
|
+
"overflow",
|
|
691
|
+
"position",
|
|
692
|
+
"distance",
|
|
693
|
+
"rotate",
|
|
694
|
+
"offset",
|
|
695
|
+
"fontSize",
|
|
696
|
+
"fontWeight",
|
|
697
|
+
"color",
|
|
698
|
+
"backgroundColor",
|
|
699
|
+
"borderColor",
|
|
700
|
+
"borderWidth",
|
|
701
|
+
"borderRadius",
|
|
702
|
+
"padding"
|
|
703
|
+
];
|
|
704
|
+
function Ue(e) {
|
|
705
|
+
const t = e?.series;
|
|
706
|
+
return Array.isArray(t) ? t : [];
|
|
707
|
+
}
|
|
708
|
+
function L(e) {
|
|
709
|
+
return e && typeof e == "object" && !Array.isArray(e) ? { ...e } : {};
|
|
710
|
+
}
|
|
711
|
+
function $(e) {
|
|
712
|
+
typeof e.offsetX != "number" && typeof e.offsetY != "number" || (Array.isArray(e.offset) || (e.offset = [
|
|
713
|
+
typeof e.offsetX == "number" ? e.offsetX : 0,
|
|
714
|
+
typeof e.offsetY == "number" ? e.offsetY : 0
|
|
715
|
+
]), delete e.offsetX, delete e.offsetY);
|
|
716
|
+
}
|
|
717
|
+
function z(e) {
|
|
718
|
+
return b(e)?.seriesType === "gauge" ? "detail" : "label";
|
|
719
|
+
}
|
|
720
|
+
function xt(e) {
|
|
721
|
+
const t = b(e);
|
|
722
|
+
return t ? je[t.seriesType] : [];
|
|
723
|
+
}
|
|
724
|
+
function Ct(e, t) {
|
|
725
|
+
const r = b(t), a = Ue(e), s = L(a[0]?.[z(t)]);
|
|
726
|
+
$(s);
|
|
727
|
+
const i = {
|
|
728
|
+
show: typeof s.show == "boolean" ? s.show : r ? ze[r.seriesType] : !1,
|
|
729
|
+
// labelLine 在 ECharts 里是 series 顶层键(与 label 平级),不是 label 的子键
|
|
730
|
+
labelLine: L(a[0]?.labelLine)
|
|
731
|
+
};
|
|
732
|
+
for (const l of Be) {
|
|
733
|
+
const n = s[l];
|
|
734
|
+
l !== "offset" && (typeof n == "string" || typeof n == "number") && (i[l] = n);
|
|
735
|
+
}
|
|
736
|
+
const o = s.offset;
|
|
737
|
+
return Array.isArray(o) && typeof o[0] == "number" && typeof o[1] == "number" && (i.offset = [o[0], o[1]]), i;
|
|
738
|
+
}
|
|
739
|
+
function qe(e) {
|
|
740
|
+
const t = b(e);
|
|
741
|
+
return t ? { ...Ie[t.seriesType], ...We[e] } : {};
|
|
742
|
+
}
|
|
743
|
+
function X(e) {
|
|
744
|
+
return e == null || e === "";
|
|
745
|
+
}
|
|
746
|
+
function Kt(e, t, r) {
|
|
747
|
+
const a = v(e ?? {}), s = Array.isArray(a.series) ? a.series : [];
|
|
748
|
+
if (!b(t) || s.length === 0) return a;
|
|
749
|
+
const o = z(t), { enabled: l, labelLine: n, ...c } = r;
|
|
750
|
+
for (const u of s) {
|
|
751
|
+
if (!u || typeof u != "object") continue;
|
|
752
|
+
const f = L(u[o]);
|
|
753
|
+
$(f), l === !0 ? Object.assign(f, { ...qe(t), ...f, show: !0 }) : l === !1 && (f.show = !1);
|
|
754
|
+
for (const [d, y] of Object.entries(c))
|
|
755
|
+
X(y) ? delete f[d] : f[d] = y;
|
|
756
|
+
if (n) {
|
|
757
|
+
const d = L(u.labelLine);
|
|
758
|
+
for (const [y, h] of Object.entries(n))
|
|
759
|
+
X(h) ? delete d[y] : d[y] = h;
|
|
760
|
+
u.labelLine = d;
|
|
761
|
+
}
|
|
762
|
+
u[o] = f;
|
|
763
|
+
}
|
|
764
|
+
return a;
|
|
765
|
+
}
|
|
766
|
+
function Ge(e) {
|
|
767
|
+
return Array.isArray(e) ? e.map((t) => ({ ...t })) : [];
|
|
768
|
+
}
|
|
769
|
+
function Ve(e, t) {
|
|
770
|
+
const r = { ...e, type: t ? "value" : "category" };
|
|
771
|
+
return t ? delete r.data : Array.isArray(r.data) || (r.data = ["$data"]), r;
|
|
772
|
+
}
|
|
773
|
+
function Ye(e, t) {
|
|
774
|
+
const r = { ...e, type: t ? "category" : "value" };
|
|
775
|
+
return t && !Array.isArray(r.data) && (r.data = ["$data"]), t || delete r.data, r;
|
|
776
|
+
}
|
|
777
|
+
function F(e, t) {
|
|
778
|
+
return Array.isArray(e) ? e.map((r) => t({ ...r })) : t(e && typeof e == "object" ? { ...e } : {});
|
|
779
|
+
}
|
|
780
|
+
function Xe(e, t) {
|
|
781
|
+
const r = b(e);
|
|
782
|
+
if (!r) return t;
|
|
783
|
+
const a = structuredClone(t), s = Ge(a.series);
|
|
784
|
+
if (s.length === 0) return a;
|
|
785
|
+
const i = z(e);
|
|
786
|
+
for (const n of s) {
|
|
787
|
+
const c = n[i];
|
|
788
|
+
if (c && typeof c == "object" && !Array.isArray(c)) {
|
|
789
|
+
const u = { ...c };
|
|
790
|
+
$(u), n[i] = u;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
if (r.seriesType === "pie")
|
|
794
|
+
return a.series = s.map((n) => ({
|
|
795
|
+
...n,
|
|
796
|
+
type: "pie",
|
|
797
|
+
...e === "doughnutChart" ? { radius: n.radius ?? ["40%", "70%"] } : {}
|
|
798
|
+
})), delete a.xAxis, delete a.yAxis, a;
|
|
799
|
+
if (r.seriesType === "scatter")
|
|
800
|
+
return a.series = s.map((n) => ({ ...n, type: "scatter" })), a.xAxis = F(a.xAxis, (n) => ({ ...n, type: "value", data: void 0 })), a.yAxis = F(a.yAxis, (n) => ({ ...n, type: "value", data: void 0 })), a;
|
|
801
|
+
if (r.seriesType === "radar")
|
|
802
|
+
return a.series = s.map((n) => ({ ...n, type: "radar" })), a;
|
|
803
|
+
if (r.seriesType === "funnel")
|
|
804
|
+
return a.series = s.map((n) => ({ ...n, type: "funnel", sort: "descending" })), a;
|
|
805
|
+
if (r.seriesType === "gauge")
|
|
806
|
+
return a.series = s.map((n) => ({ ...n, type: "gauge" })), a;
|
|
807
|
+
const o = r.orientation === "horizontal", l = r.seriesType === "line" ? "line" : "bar";
|
|
808
|
+
return a.xAxis = F(a.xAxis, (n) => Ve(n, o)), a.yAxis = F(a.yAxis, (n) => Ye(n, o)), a.series = s.map((n) => {
|
|
809
|
+
const c = { ...n, type: l };
|
|
810
|
+
return e === "areaChart" ? c.areaStyle = n.areaStyle ?? {} : delete c.areaStyle, c;
|
|
811
|
+
}), a;
|
|
812
|
+
}
|
|
813
|
+
function Je(e, t, r) {
|
|
814
|
+
const a = /<svg\b[^>]*>/i.exec(e);
|
|
815
|
+
if (!a) return e;
|
|
816
|
+
const s = a[0], i = s.slice(4, -1), l = (/\sstyle\s*=\s*"([^"]*)"/i.exec(i)?.[1] ?? "").split(";").map((f) => f.trim()).filter((f) => f && !/^(width|height|display)\s*:/i.test(f)).join(";"), n = i.replace(/\s(width|height|style|viewBox)\s*=\s*"[^"]*"/gi, "").trimEnd(), c = ["display:block", "width:100%", "height:100%", l].filter(Boolean).join(";"), u = `<svg${n} width="100%" height="100%" viewBox="0 0 ${t} ${r}" style="${c}">`;
|
|
817
|
+
return e.slice(0, a.index) + u + e.slice(a.index + s.length);
|
|
818
|
+
}
|
|
819
|
+
function Qe(e) {
|
|
820
|
+
De();
|
|
821
|
+
const t = Xe(e.type, e.option);
|
|
822
|
+
if (!t || typeof t != "object" || Array.isArray(t))
|
|
823
|
+
throw new Error("图表 option 非法:需要对象");
|
|
824
|
+
const r = x(e.widthMm), a = x(e.heightMm), s = M.init(null, null, { renderer: "svg", ssr: !0, width: r, height: a });
|
|
825
|
+
try {
|
|
826
|
+
const i = t.textStyle && typeof t.textStyle == "object" && !Array.isArray(t.textStyle) ? t.textStyle : void 0, o = {
|
|
827
|
+
...e.fontFamily ? { fontFamily: e.fontFamily } : {},
|
|
828
|
+
...i ?? {}
|
|
829
|
+
};
|
|
830
|
+
return s.setOption({
|
|
831
|
+
animation: !1,
|
|
832
|
+
...t,
|
|
833
|
+
...Object.keys(o).length > 0 ? { textStyle: o } : {}
|
|
834
|
+
}), Je(s.renderToSVGString(), r, a);
|
|
835
|
+
} finally {
|
|
836
|
+
s.dispose();
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
function Ze(e) {
|
|
840
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
841
|
+
}
|
|
842
|
+
function J(e) {
|
|
843
|
+
const t = e._chartOption ?? e.chartOption, r = `<span>${Ze(String(e.title ?? "图表"))}</span>`;
|
|
844
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return r;
|
|
845
|
+
try {
|
|
846
|
+
return Qe({
|
|
847
|
+
key: String(e.key ?? ""),
|
|
848
|
+
type: String(e.type ?? ""),
|
|
849
|
+
option: t,
|
|
850
|
+
widthMm: Number(e.widthMm ?? 0),
|
|
851
|
+
heightMm: Number(e.heightMm ?? 0),
|
|
852
|
+
fontFamily: typeof e.fontFamily == "string" ? e.fontFamily : void 0
|
|
853
|
+
});
|
|
854
|
+
} catch {
|
|
855
|
+
return r;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
const et = "2", ee = {
|
|
859
|
+
chartOption: { kind: "object", label: A("echarts.meta.chartOption") },
|
|
860
|
+
chartDataSource: { kind: "text", label: A("echarts.meta.dataSource") },
|
|
861
|
+
chartCategoryField: { kind: "text", label: A("echarts.meta.categoryField") },
|
|
862
|
+
chartValueFields: { kind: "object", label: A("echarts.meta.valueFields") },
|
|
863
|
+
chartSeriesField: { kind: "text", label: A("echarts.meta.seriesField") }
|
|
864
|
+
}, tt = {
|
|
865
|
+
...ee,
|
|
866
|
+
chartBubble: { kind: "bool", label: A("echarts.meta.bubbleSize") }
|
|
867
|
+
}, E = ae({
|
|
868
|
+
id: _,
|
|
869
|
+
version: et,
|
|
870
|
+
kinds: H.map((e) => ({
|
|
871
|
+
type: e.type,
|
|
872
|
+
// getter:每次读取按当前实例语言取词,避免模块加载期冻结为单一语言
|
|
873
|
+
get label() {
|
|
874
|
+
return A(e.labelKey);
|
|
875
|
+
},
|
|
876
|
+
icon: e.icon,
|
|
877
|
+
fixedHeight: !0,
|
|
878
|
+
requiredOptionKeys: e.requiredOptionKeys,
|
|
879
|
+
// getter:每次读取按当前实例语言取词,避免模块加载期冻结为单一语言
|
|
880
|
+
get notes() {
|
|
881
|
+
return A(e.notesKey);
|
|
882
|
+
},
|
|
883
|
+
optionMeta: e.type === "scatterChart" ? tt : ee,
|
|
884
|
+
defaultOptions: (t) => Pe(e.type, t),
|
|
885
|
+
binding: { bind: (t, r) => ke(e.type, t, r) }
|
|
886
|
+
})),
|
|
887
|
+
render: {
|
|
888
|
+
html: J,
|
|
889
|
+
createRenderer: () => ({ render: J })
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
let w;
|
|
893
|
+
function I(e, t) {
|
|
894
|
+
const r = se(_);
|
|
895
|
+
if (!e && !t) {
|
|
896
|
+
const i = j(E);
|
|
897
|
+
return w = i, i;
|
|
898
|
+
}
|
|
899
|
+
const a = {
|
|
900
|
+
...E,
|
|
901
|
+
designer: e ?? r?.designer ?? E.designer,
|
|
902
|
+
render: { ...E.render, ...r?.render, ...t }
|
|
903
|
+
}, s = j(a);
|
|
904
|
+
return w = s, s;
|
|
905
|
+
}
|
|
906
|
+
function vt(e) {
|
|
907
|
+
return I(e);
|
|
908
|
+
}
|
|
909
|
+
function Tt(e) {
|
|
910
|
+
return I(void 0, { executorBundle: e });
|
|
911
|
+
}
|
|
912
|
+
function Ot() {
|
|
913
|
+
w?.(), w = void 0;
|
|
914
|
+
}
|
|
915
|
+
I();
|
|
916
|
+
export {
|
|
917
|
+
mt as A,
|
|
918
|
+
vt as B,
|
|
919
|
+
lt as C,
|
|
920
|
+
Tt as D,
|
|
921
|
+
O as E,
|
|
922
|
+
Fe as F,
|
|
923
|
+
I as G,
|
|
924
|
+
J as H,
|
|
925
|
+
Qe as I,
|
|
926
|
+
ct as J,
|
|
927
|
+
bt as K,
|
|
928
|
+
St as L,
|
|
929
|
+
Ot as M,
|
|
930
|
+
Kt as N,
|
|
931
|
+
pt as O,
|
|
932
|
+
gt as P,
|
|
933
|
+
Le as R,
|
|
934
|
+
H as a,
|
|
935
|
+
G as b,
|
|
936
|
+
E as c,
|
|
937
|
+
_ as d,
|
|
938
|
+
we as e,
|
|
939
|
+
Ee as f,
|
|
940
|
+
At as g,
|
|
941
|
+
Q as h,
|
|
942
|
+
ke as i,
|
|
943
|
+
Pe as j,
|
|
944
|
+
v as k,
|
|
945
|
+
ut as l,
|
|
946
|
+
Ne as m,
|
|
947
|
+
Je as n,
|
|
948
|
+
b as o,
|
|
949
|
+
ft as p,
|
|
950
|
+
N as q,
|
|
951
|
+
Re as r,
|
|
952
|
+
xt as s,
|
|
953
|
+
z as t,
|
|
954
|
+
x as u,
|
|
955
|
+
Xe as v,
|
|
956
|
+
dt as w,
|
|
957
|
+
Ct as x,
|
|
958
|
+
ht as y,
|
|
959
|
+
yt as z
|
|
960
|
+
};
|