@baishuyun/ui-business 4.1.1 → 4.1.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/dist/BubbleChart/AutoGridEChart-DubWMmib.js +126 -0
- package/dist/BubbleChart/BubbleChart-D5Ro_YLD.js +235 -0
- package/dist/BubbleChart/index.d.ts +6 -0
- package/dist/BubbleChart/index.js +4 -0
- package/dist/Scatterplot/{Scatterplot-DFOLhAMO.js → Scatterplot-DzgKCqsu.js} +36 -56
- package/dist/Scatterplot/index.js +1 -1
- package/dist/components/BubbleChart/AutoGridEChart.d.ts +14 -0
- package/dist/components/BubbleChart/BubbleChart.d.ts +3 -0
- package/dist/components/BubbleChart/BubbleChart.type.d.ts +71 -0
- package/dist/components/BubbleChart/index.d.ts +3 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.js +10 -8
- package/dist/utils/getLegendHeight.d.ts +1 -0
- package/dist/vendors/echarts.js +4193 -4196
- package/package.json +1 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsxs as y, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as O, useRef as h, useState as S, useImperativeHandle as w, useEffect as p } from "react";
|
|
3
|
+
import { i as C } from "../vendors/echarts.js";
|
|
4
|
+
import { c as m } from "../vendors/clsx.js";
|
|
5
|
+
function v(t, x, s, o) {
|
|
6
|
+
let c = 0, a = 0;
|
|
7
|
+
const f = parseInt(o.fontSize) || 10;
|
|
8
|
+
function u(e) {
|
|
9
|
+
let n = "";
|
|
10
|
+
if (e.fontSize || e.fontFamily || e.fontWeight) {
|
|
11
|
+
let i = "";
|
|
12
|
+
typeof e.fontSize == "string" && (e.fontSize.indexOf("px") !== -1 || e.fontSize.indexOf("rem") !== -1 || e.fontSize.indexOf("em") !== -1) ? i = e.fontSize : isNaN(+e.fontSize) ? i = "12px" : i = e.fontSize + "px", n = [e.fontStyle, e.fontWeight, i, e.fontFamily || "sans-serif"].join(
|
|
13
|
+
" "
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
return n && n.trim() || e.textFont || e.font;
|
|
17
|
+
}
|
|
18
|
+
function l(e, n) {
|
|
19
|
+
n.fontSize = parseInt(n.fontSize), n.fontFamily = n.fontFamily || "verdana";
|
|
20
|
+
const i = u(n), z = document.createElement("canvas").getContext("2d") || {};
|
|
21
|
+
return z.font = i, z?.measureText(e)?.width || 0;
|
|
22
|
+
}
|
|
23
|
+
function r(e, n) {
|
|
24
|
+
if (Array.isArray(e))
|
|
25
|
+
for (let i = 0, A = e.length; i < A && n.apply(e[i], [i, e[i]]) !== !1; i++) ;
|
|
26
|
+
else if (e && typeof e == "object") {
|
|
27
|
+
for (const i in e)
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(e, i) && n.apply(e[i], [i, e[i]]) === !1) break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return t.legend.type === "scroll" ? f + 10 : (r(x, (e, n) => {
|
|
32
|
+
const i = l(
|
|
33
|
+
n,
|
|
34
|
+
o || {
|
|
35
|
+
fontFamily: "verdana",
|
|
36
|
+
fontSize: 10,
|
|
37
|
+
fontStyle: "normal",
|
|
38
|
+
fontWeight: "normal"
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
a += i + 10 + 14 + 5, a > s && (c++, a = i + 10 + 14 + 5);
|
|
42
|
+
}), (c + 1) * (f + 10));
|
|
43
|
+
}
|
|
44
|
+
const g = {
|
|
45
|
+
"auto-grid-echart": "_auto-grid-echart_w04s7_1",
|
|
46
|
+
"xAxis-title": "_xAxis-title_w04s7_6",
|
|
47
|
+
"yAxis-title": "_yAxis-title_w04s7_11"
|
|
48
|
+
}, b = (t, x) => {
|
|
49
|
+
const s = h(null), o = h(null), c = h(null), [a, f] = S("10px"), u = t.dataList.map((r) => r.name), l = () => {
|
|
50
|
+
if (s.current) {
|
|
51
|
+
let r = v(
|
|
52
|
+
t.option,
|
|
53
|
+
u,
|
|
54
|
+
s.current.offsetWidth,
|
|
55
|
+
t.option.legend.textStyle
|
|
56
|
+
) + 30;
|
|
57
|
+
return t.options.legend.position === t.options.xAxis.position ? f(
|
|
58
|
+
v(
|
|
59
|
+
t.option,
|
|
60
|
+
u,
|
|
61
|
+
s.current.offsetWidth,
|
|
62
|
+
t.option.legend.textStyle
|
|
63
|
+
) + 10
|
|
64
|
+
) : f("0"), t.options.xAxis?.title.text && t.options.xAxis?.title.text.length > 0 && t.options.legend.position === t.options.xAxis.position && (r += 30), {
|
|
65
|
+
...t.option,
|
|
66
|
+
grid: {
|
|
67
|
+
top: t.options.legend.position === "top" ? r : 40,
|
|
68
|
+
bottom: t.options.legend.position === "bottom" ? r : 40,
|
|
69
|
+
left: t.options.legend.position === "left" ? r : 40,
|
|
70
|
+
right: t.options.legend.position === "right" ? r : 40
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
...t.option
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
return w(x, () => ({
|
|
79
|
+
resizeEchart: () => {
|
|
80
|
+
o.current?.resize();
|
|
81
|
+
}
|
|
82
|
+
})), p(() => {
|
|
83
|
+
if (!s.current) return;
|
|
84
|
+
o.current = C(s.current);
|
|
85
|
+
const r = l();
|
|
86
|
+
o.current.setOption(r, !0), o.current.on("click", function(n) {
|
|
87
|
+
t.onChartClick && t.onChartClick(n, t.options, t.dataList);
|
|
88
|
+
});
|
|
89
|
+
const e = () => {
|
|
90
|
+
if (o.current) {
|
|
91
|
+
const n = l();
|
|
92
|
+
o.current.setOption(n, !1);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return setTimeout(e, 100), t.onChartReady && t.onChartReady(o.current), c.current = new ResizeObserver(() => {
|
|
96
|
+
o.current?.resize(), setTimeout(e, 50);
|
|
97
|
+
}), s.current && c.current.observe(s.current), () => {
|
|
98
|
+
c.current?.disconnect(), o.current?.dispose();
|
|
99
|
+
};
|
|
100
|
+
}, []), p(() => {
|
|
101
|
+
if (!o.current) return;
|
|
102
|
+
const r = l();
|
|
103
|
+
o.current.setOption(r, !0);
|
|
104
|
+
}, [t.option]), /* @__PURE__ */ y("div", { className: m(t.className, g["auto-grid-echart"]), children: [
|
|
105
|
+
/* @__PURE__ */ d("div", { ref: s, style: { width: "100%", height: "100%", ...t.style } }),
|
|
106
|
+
/* @__PURE__ */ d(
|
|
107
|
+
"div",
|
|
108
|
+
{
|
|
109
|
+
className: m(g["xAxis-title"]),
|
|
110
|
+
style: t.option.xAxis?.position === "bottom" ? { bottom: a } : t.option.xAxis?.position === "top" ? { top: a } : void 0,
|
|
111
|
+
children: /* @__PURE__ */ d("span", { children: t.option.xAxis?.title })
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
/* @__PURE__ */ d(
|
|
115
|
+
"div",
|
|
116
|
+
{
|
|
117
|
+
className: m(g["yAxis-title"]),
|
|
118
|
+
style: t.option.yAxis?.position === "left" ? { left: "20px" } : t.option.yAxis?.position === "right" ? { right: "20px" } : void 0,
|
|
119
|
+
children: /* @__PURE__ */ d("span", { children: t.option.yAxis?.title })
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] });
|
|
123
|
+
}, R = O(b);
|
|
124
|
+
export {
|
|
125
|
+
R as A
|
|
126
|
+
};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as y, useRef as v, useImperativeHandle as m } from "react";
|
|
3
|
+
import { R as A } from "../vendors/echarts.js";
|
|
4
|
+
import { A as S } from "./AutoGridEChart-DubWMmib.js";
|
|
5
|
+
const w = (t, g) => {
|
|
6
|
+
const r = v(null), c = (o) => {
|
|
7
|
+
const n = {
|
|
8
|
+
index0: [],
|
|
9
|
+
// 所有系列的第一个数据(data[0])
|
|
10
|
+
index1: []
|
|
11
|
+
// 所有系列的第二个数据(data[1])
|
|
12
|
+
};
|
|
13
|
+
return o.forEach((e) => {
|
|
14
|
+
n.index0.push(e.data[0]), n.index1.push(e.data[1]);
|
|
15
|
+
}), n;
|
|
16
|
+
}, d = (o) => {
|
|
17
|
+
const n = Math.max(...o), e = Math.min(...o), i = (o.reduce((a, b) => a + b, 0) / o.length).toFixed(2);
|
|
18
|
+
return { max: n, min: e, avg: Number(i) };
|
|
19
|
+
}, x = c(t.dataList), l = d(x.index0), s = d(x.index1), f = t.options.xFields[t.options.xFields.length - 1].colors || [], u = {
|
|
20
|
+
xAxis: {
|
|
21
|
+
axisLabel: {
|
|
22
|
+
color: "#666666",
|
|
23
|
+
fontSize: 10,
|
|
24
|
+
show: !0,
|
|
25
|
+
rotate: t.options.xAxis?.label?.rotation || 45
|
|
26
|
+
// 文字顺时针旋转 90°(完全竖向)
|
|
27
|
+
},
|
|
28
|
+
min: t.options.xAxis?.min || void 0,
|
|
29
|
+
// 固定X轴最小值
|
|
30
|
+
max: t.options.xAxis?.max || void 0,
|
|
31
|
+
// 固定X轴最大值
|
|
32
|
+
title: t.options.xAxis?.title?.text,
|
|
33
|
+
position: t.options.xAxis?.position
|
|
34
|
+
},
|
|
35
|
+
yAxis: {
|
|
36
|
+
axisLabel: {
|
|
37
|
+
color: "#666666",
|
|
38
|
+
fontSize: 10,
|
|
39
|
+
show: !0,
|
|
40
|
+
rotate: t.options.yAxis?.label?.rotation || 45
|
|
41
|
+
// 文字顺时针旋转 90°(完全竖向)
|
|
42
|
+
},
|
|
43
|
+
min: t.options.yAxis?.min || void 0,
|
|
44
|
+
// 固定X轴最小值
|
|
45
|
+
max: t.options.yAxis?.max || void 0,
|
|
46
|
+
// 固定X轴最大值
|
|
47
|
+
title: t.options.yAxis?.title?.text,
|
|
48
|
+
position: t.options.yAxis?.position
|
|
49
|
+
},
|
|
50
|
+
grid: {
|
|
51
|
+
top: 20,
|
|
52
|
+
bottom: 20,
|
|
53
|
+
left: 20,
|
|
54
|
+
right: 30
|
|
55
|
+
},
|
|
56
|
+
tooltip: {
|
|
57
|
+
trigger: "item",
|
|
58
|
+
// 触发方式:axis(坐标轴触发)/ item(数据项触发)/ none(不触发)
|
|
59
|
+
axisPointer: {
|
|
60
|
+
// 坐标轴指示器(仅 trigger: 'axis' 时生效)
|
|
61
|
+
type: "shadow"
|
|
62
|
+
// 指示器类型:line(直线)/ shadow(阴影)/ cross(十字线)
|
|
63
|
+
},
|
|
64
|
+
textStyle: {
|
|
65
|
+
// 提示框文本样式
|
|
66
|
+
fontSize: 14,
|
|
67
|
+
color: "#333"
|
|
68
|
+
},
|
|
69
|
+
backgroundColor: "#fff",
|
|
70
|
+
// 背景色(支持透明)
|
|
71
|
+
borderColor: "#fff",
|
|
72
|
+
// 边框颜色
|
|
73
|
+
borderWidth: 1,
|
|
74
|
+
// 边框宽度
|
|
75
|
+
padding: 10,
|
|
76
|
+
// 内边距(上下左右)
|
|
77
|
+
borderRadius: 4,
|
|
78
|
+
// 圆角半径
|
|
79
|
+
formatter: (o) => {
|
|
80
|
+
let n = `<div>${o.seriesName}</div>`;
|
|
81
|
+
return n += `<div><span>${t.options.xFields[0].title}:</span><span>${o.value[0]}</span></div>`, n += `<div><span>${t.options.yFields[0].title}:</span><span>${o.value[1]}</span></div>`, o.componentType === "series" ? n : "";
|
|
82
|
+
},
|
|
83
|
+
triggerOn: "mousemove",
|
|
84
|
+
// 触发时机:mousemove(鼠标移动)/ click(点击)/ mousemove|click(两者)
|
|
85
|
+
showDelay: 0,
|
|
86
|
+
// 显示延迟(ms),默认0
|
|
87
|
+
hideDelay: 100,
|
|
88
|
+
// 隐藏延迟(ms),默认100
|
|
89
|
+
enterable: !1
|
|
90
|
+
// 是否允许鼠标进入提示框(默认false,防止触发其他交互)
|
|
91
|
+
},
|
|
92
|
+
legend: {
|
|
93
|
+
show: t.options.legend.enable,
|
|
94
|
+
orient: ["left", "right"].includes(t.options.legend.position) ? "vertical" : "horizontal",
|
|
95
|
+
// 纵向布局
|
|
96
|
+
left: ["left", "right"].includes(t.options.legend.position) && t.options.legend.position || "center",
|
|
97
|
+
// 居右
|
|
98
|
+
top: ["top", "bottom"].includes(t.options.legend.position) && t.options.legend.position || "middle",
|
|
99
|
+
// 垂直居中
|
|
100
|
+
// itemGap: 10, // 图例项间距 20px
|
|
101
|
+
bottom: 0,
|
|
102
|
+
padding: 10,
|
|
103
|
+
itemWidth: 12,
|
|
104
|
+
itemHeight: 12,
|
|
105
|
+
textStyle: {
|
|
106
|
+
fontStyle: "normal"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
graphic: t.options.guideline?.map((o) => ({
|
|
110
|
+
type: "line",
|
|
111
|
+
// 类型:线
|
|
112
|
+
shape: {
|
|
113
|
+
x1: 1,
|
|
114
|
+
y1: 8,
|
|
115
|
+
// 起点(X=0,Y=50)
|
|
116
|
+
x2: 2,
|
|
117
|
+
y2: 8
|
|
118
|
+
// 终点(X=100,Y=50)→ 水平
|
|
119
|
+
},
|
|
120
|
+
style: {
|
|
121
|
+
stroke: o.color,
|
|
122
|
+
// 线条颜色
|
|
123
|
+
lineWidth: 2
|
|
124
|
+
// 线条宽度
|
|
125
|
+
}
|
|
126
|
+
})),
|
|
127
|
+
series: t.dataList.map((o, n) => ({
|
|
128
|
+
symbolSize: () => (o.data[2] || 0) >= t.options.bubbleOptions.maxSize ? t.options.bubbleOptions.maxSize : (o.data[2] || 0) <= t.options.bubbleOptions.minSize ? t.options.bubbleOptions.minSize : o.data[2] || 10,
|
|
129
|
+
//气泡大小
|
|
130
|
+
data: [o.data],
|
|
131
|
+
name: o.name,
|
|
132
|
+
markLine: {
|
|
133
|
+
// 1. 标记线整体样式
|
|
134
|
+
symbol: ["none", "none"],
|
|
135
|
+
// 起点/终点标记图形(默认有箭头,none 隐藏)
|
|
136
|
+
lineStyle: {
|
|
137
|
+
// 线的样式
|
|
138
|
+
width: 1,
|
|
139
|
+
type: "dashed"
|
|
140
|
+
// solid/dashed/dotted
|
|
141
|
+
},
|
|
142
|
+
// 2. 标记线的数据(关键)
|
|
143
|
+
data: n === 0 && t.options.guideline?.map((e) => {
|
|
144
|
+
const i = {
|
|
145
|
+
lineStyle: {
|
|
146
|
+
// 线的样式
|
|
147
|
+
color: e.color,
|
|
148
|
+
width: 1,
|
|
149
|
+
type: "dashed"
|
|
150
|
+
// solid/dashed/dotted
|
|
151
|
+
},
|
|
152
|
+
label: {
|
|
153
|
+
show: !0,
|
|
154
|
+
position: "end",
|
|
155
|
+
// 标签位置:start/middle/end
|
|
156
|
+
formatter: (a) => {
|
|
157
|
+
if (e.is_label_visible && e.is_value_visible)
|
|
158
|
+
return e.label + ":" + a.value;
|
|
159
|
+
if (e.is_label_visible)
|
|
160
|
+
return e.label;
|
|
161
|
+
if (e.is_value_visible)
|
|
162
|
+
return a.value;
|
|
163
|
+
},
|
|
164
|
+
// 格式化文本({b}名称,{c}数值)
|
|
165
|
+
fontSize: 12,
|
|
166
|
+
color: e.color
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
return e.type === "fixed" && (e.field === t.options.xFields[0].tag && (i.xAxis = e.value || 0), e.field === t.options.yFields[0].tag && (i.yAxis = e.value || 0)), e.type === "dynamic" && (e.field === t.options.xFields[0].tag && (e.aggregate === "max" && (i.xAxis = l.max), e.aggregate === "min" && (i.xAxis = l.min), e.aggregate === "avg" && (i.xAxis = l.avg)), e.field === t.options.yFields[0].tag && (e.aggregate === "max" && (i.yAxis = s.max), e.aggregate === "min" && (i.yAxis = s.min), e.aggregate === "avg" && (i.yAxis = s.avg)), i.type, e.aggregate), i;
|
|
170
|
+
})
|
|
171
|
+
},
|
|
172
|
+
color: f.find((e) => e.title === o.name) ? f.find((e) => e.title === o.name).color : "",
|
|
173
|
+
label: {
|
|
174
|
+
show: t.options.chart_label.enable,
|
|
175
|
+
position: "top",
|
|
176
|
+
// 文本在气泡上方
|
|
177
|
+
distance: 5,
|
|
178
|
+
// 与气泡的距离(避免紧贴)
|
|
179
|
+
formatter: () => `${t.options.chart_label.dimension?.enable ? o.name : ""} ${t.options.chart_label.value?.enable ? "(" + o.data[0] + "," + o.data[1] + ")" : ""}`,
|
|
180
|
+
textStyle: {
|
|
181
|
+
fontSize: 11,
|
|
182
|
+
color: "#666",
|
|
183
|
+
fontWeight: 500
|
|
184
|
+
// 加粗
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
itemStyle: {
|
|
188
|
+
borderColor: "#666",
|
|
189
|
+
// 气泡边框色
|
|
190
|
+
borderWidth: 1,
|
|
191
|
+
// 边框宽度
|
|
192
|
+
// 阴影核心配置
|
|
193
|
+
shadowColor: "rgba(0, 0, 0, 0.2)",
|
|
194
|
+
// 阴影颜色(半透明黑色,柔和不突兀)
|
|
195
|
+
shadowBlur: 10,
|
|
196
|
+
// 阴影模糊度(10 为适中值,越大越柔和)
|
|
197
|
+
shadowOffsetX: 3,
|
|
198
|
+
// 水平偏移 3px(向右)
|
|
199
|
+
shadowOffsetY: 5,
|
|
200
|
+
// 垂直偏移 3px(向下)
|
|
201
|
+
shadowOpacity: 0.8,
|
|
202
|
+
// 阴影透明度(0.8 适中,避免过暗)
|
|
203
|
+
color: new A(0.4, 0.3, 1, [
|
|
204
|
+
{
|
|
205
|
+
offset: 0,
|
|
206
|
+
color: o.color && o.color[0] || "rgb(129, 227, 238)"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
offset: 1,
|
|
210
|
+
color: o.color && o.color[1] || "rgb(25, 183, 207)"
|
|
211
|
+
}
|
|
212
|
+
])
|
|
213
|
+
},
|
|
214
|
+
type: "scatter"
|
|
215
|
+
}))
|
|
216
|
+
};
|
|
217
|
+
return m(g, () => ({
|
|
218
|
+
resizeEchart: () => {
|
|
219
|
+
r.current.resizeEchart();
|
|
220
|
+
}
|
|
221
|
+
})), /* @__PURE__ */ h(
|
|
222
|
+
S,
|
|
223
|
+
{
|
|
224
|
+
ref: r,
|
|
225
|
+
option: u,
|
|
226
|
+
options: t.options,
|
|
227
|
+
dataList: t.dataList,
|
|
228
|
+
onChartReady: t.onChartReady,
|
|
229
|
+
onChartClick: t.onChartClick
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
}, F = y(w);
|
|
233
|
+
export {
|
|
234
|
+
F as B
|
|
235
|
+
};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
"scatter-plot-page": "_scatter-plot-page_1h1ig_1",
|
|
7
|
-
"xAxis-title": "_xAxis-title_1h1ig_6",
|
|
8
|
-
"yAxis-title": "_yAxis-title_1h1ig_11"
|
|
9
|
-
}, R = (t, p) => {
|
|
10
|
-
const d = b(null), x = b(null), A = (i) => {
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as b, useRef as v, useImperativeHandle as m } from "react";
|
|
3
|
+
import { A } from "../BubbleChart/AutoGridEChart-DubWMmib.js";
|
|
4
|
+
const S = (t, c) => {
|
|
5
|
+
const d = v(null), f = (i) => {
|
|
11
6
|
const n = {
|
|
12
7
|
index0: [],
|
|
13
8
|
// 所有系列的第一个数据(data[0])
|
|
@@ -17,10 +12,10 @@ const u = {
|
|
|
17
12
|
return i.forEach((e) => {
|
|
18
13
|
n.index0.push(e.data[0]), n.index1.push(e.data[1]);
|
|
19
14
|
}), n;
|
|
20
|
-
},
|
|
21
|
-
const n = Math.max(...i), e = Math.min(...i), o = (i.reduce((
|
|
15
|
+
}, r = (i) => {
|
|
16
|
+
const n = Math.max(...i), e = Math.min(...i), o = (i.reduce((a, h) => a + h, 0) / i.length).toFixed(2);
|
|
22
17
|
return { max: n, min: e, avg: Number(o) };
|
|
23
|
-
},
|
|
18
|
+
}, x = f(t.dataList), l = r(x.index0), s = r(x.index1), g = t.options.xFields[t.options.xFields.length - 1].colors || [], u = {
|
|
24
19
|
xAxis: {
|
|
25
20
|
axisLabel: {
|
|
26
21
|
color: "#666666",
|
|
@@ -95,8 +90,14 @@ const u = {
|
|
|
95
90
|
// 居右
|
|
96
91
|
top: ["top", "bottom"].includes(t.options.legend.position) && t.options.legend.position || "middle",
|
|
97
92
|
// 垂直居中
|
|
98
|
-
itemGap:
|
|
99
|
-
|
|
93
|
+
// itemGap: 10, // 图例项间距 20px
|
|
94
|
+
bottom: 0,
|
|
95
|
+
padding: 10,
|
|
96
|
+
itemWidth: 12,
|
|
97
|
+
itemHeight: 12,
|
|
98
|
+
textStyle: {
|
|
99
|
+
fontStyle: "normal"
|
|
100
|
+
}
|
|
100
101
|
},
|
|
101
102
|
graphic: t.options.guideline?.map((i) => ({
|
|
102
103
|
type: "line",
|
|
@@ -145,23 +146,23 @@ const u = {
|
|
|
145
146
|
show: !0,
|
|
146
147
|
position: "end",
|
|
147
148
|
// 标签位置:start/middle/end
|
|
148
|
-
formatter: (
|
|
149
|
+
formatter: (a) => {
|
|
149
150
|
if (e.is_label_visible && e.is_value_visible)
|
|
150
|
-
return e.label + ":" +
|
|
151
|
+
return e.label + ":" + a.value;
|
|
151
152
|
if (e.is_label_visible)
|
|
152
153
|
return e.label;
|
|
153
154
|
if (e.is_value_visible)
|
|
154
|
-
return
|
|
155
|
+
return a.value;
|
|
155
156
|
},
|
|
156
157
|
// 格式化文本({b}名称,{c}数值)
|
|
157
158
|
fontSize: 12,
|
|
158
159
|
color: e.color
|
|
159
160
|
}
|
|
160
161
|
};
|
|
161
|
-
return e.type === "fixed" && (e.field === t.options.xFields[0].tag && (o.xAxis = e.value || 0), e.field === t.options.yFields[0].tag && (o.yAxis = e.value || 0)), e.type === "dynamic" && (e.field === t.options.xFields[0].tag && (e.aggregate === "max" && (o.xAxis =
|
|
162
|
+
return e.type === "fixed" && (e.field === t.options.xFields[0].tag && (o.xAxis = e.value || 0), e.field === t.options.yFields[0].tag && (o.yAxis = e.value || 0)), e.type === "dynamic" && (e.field === t.options.xFields[0].tag && (e.aggregate === "max" && (o.xAxis = l.max), e.aggregate === "min" && (o.xAxis = l.min), e.aggregate === "avg" && (o.xAxis = l.avg)), e.field === t.options.yFields[0].tag && (e.aggregate === "max" && (o.yAxis = s.max), e.aggregate === "min" && (o.yAxis = s.min), e.aggregate === "avg" && (o.yAxis = s.avg)), o.type, e.aggregate), o;
|
|
162
163
|
})
|
|
163
164
|
},
|
|
164
|
-
color:
|
|
165
|
+
color: g.find((e) => e.title === i.name) ? g.find((e) => e.title === i.name).color : "",
|
|
165
166
|
label: {
|
|
166
167
|
show: t.options.chart_label.enable,
|
|
167
168
|
position: "top",
|
|
@@ -179,43 +180,22 @@ const u = {
|
|
|
179
180
|
type: "scatter"
|
|
180
181
|
}))
|
|
181
182
|
};
|
|
182
|
-
|
|
183
|
-
const m = () => {
|
|
184
|
-
if (!d.current) return;
|
|
185
|
-
x.current && L(x.current), a = C(d.current), x.current = a, a.setOption(s), a.on("click", function(n) {
|
|
186
|
-
t.onChartClick && t.onChartClick(n, t.options, t.dataList);
|
|
187
|
-
}), t.onChartReady && t.onChartReady(a);
|
|
188
|
-
const i = () => {
|
|
189
|
-
a.resize();
|
|
190
|
-
};
|
|
191
|
-
return window.addEventListener("resize", i), () => {
|
|
192
|
-
window.removeEventListener("resize", i), a.dispose();
|
|
193
|
-
};
|
|
194
|
-
};
|
|
195
|
-
return z(p, () => ({
|
|
183
|
+
return m(c, () => ({
|
|
196
184
|
resizeEchart: () => {
|
|
197
|
-
|
|
185
|
+
d.current.resizeEchart();
|
|
198
186
|
}
|
|
199
|
-
})),
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
{
|
|
212
|
-
className: f(u["yAxis-title"]),
|
|
213
|
-
style: s.yAxis?.position === "left" ? { left: "20px" } : s.yAxis?.position === "right" ? { right: "20px" } : void 0,
|
|
214
|
-
children: /* @__PURE__ */ l("span", { children: s.yAxis?.title })
|
|
215
|
-
}
|
|
216
|
-
)
|
|
217
|
-
] });
|
|
218
|
-
}, N = S(R);
|
|
187
|
+
})), /* @__PURE__ */ y(
|
|
188
|
+
A,
|
|
189
|
+
{
|
|
190
|
+
ref: d,
|
|
191
|
+
option: u,
|
|
192
|
+
options: t.options,
|
|
193
|
+
dataList: t.dataList,
|
|
194
|
+
onChartReady: t.onChartReady,
|
|
195
|
+
onChartClick: t.onChartClick
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
}, z = b(S);
|
|
219
199
|
export {
|
|
220
|
-
|
|
200
|
+
z as S
|
|
221
201
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { EChartsType } from 'echarts';
|
|
3
|
+
interface AutoGridEChartProps {
|
|
4
|
+
option: any;
|
|
5
|
+
options: any;
|
|
6
|
+
dataList: any[];
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
ref?: React.Ref<unknown> | undefined;
|
|
10
|
+
onChartReady?: (instance: EChartsType) => void;
|
|
11
|
+
onChartClick?: (params: any, options: any, dataList: any[]) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<AutoGridEChartProps, "ref"> & React.RefAttributes<unknown>>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
type BubbleChartConfig = {
|
|
2
|
+
options: {
|
|
3
|
+
bubbleOptions: {
|
|
4
|
+
displayNegative: boolean;
|
|
5
|
+
shadow: boolean;
|
|
6
|
+
minSize: number;
|
|
7
|
+
maxSize: number;
|
|
8
|
+
field?: Object;
|
|
9
|
+
};
|
|
10
|
+
metrics: Array<any>;
|
|
11
|
+
xFields: Array<any>;
|
|
12
|
+
yFields: Array<any>;
|
|
13
|
+
xAxis?: {
|
|
14
|
+
label?: {
|
|
15
|
+
rotation: number;
|
|
16
|
+
step: boolean;
|
|
17
|
+
};
|
|
18
|
+
title?: {
|
|
19
|
+
text: string;
|
|
20
|
+
};
|
|
21
|
+
min?: number;
|
|
22
|
+
max?: number;
|
|
23
|
+
position?: string;
|
|
24
|
+
};
|
|
25
|
+
yAxis?: {
|
|
26
|
+
label?: {
|
|
27
|
+
rotation: number;
|
|
28
|
+
};
|
|
29
|
+
min?: number;
|
|
30
|
+
max?: number;
|
|
31
|
+
title?: {
|
|
32
|
+
text: string;
|
|
33
|
+
};
|
|
34
|
+
position?: string;
|
|
35
|
+
};
|
|
36
|
+
chart_label: {
|
|
37
|
+
enable: boolean;
|
|
38
|
+
dimension?: {
|
|
39
|
+
enable: boolean;
|
|
40
|
+
};
|
|
41
|
+
value?: {
|
|
42
|
+
enable: boolean;
|
|
43
|
+
};
|
|
44
|
+
value_percent?: {
|
|
45
|
+
enable: boolean;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
legend: {
|
|
49
|
+
enable: boolean;
|
|
50
|
+
position: string;
|
|
51
|
+
};
|
|
52
|
+
guideline?: Array<{
|
|
53
|
+
label: string;
|
|
54
|
+
type: string;
|
|
55
|
+
color: string;
|
|
56
|
+
is_label_visible: boolean;
|
|
57
|
+
is_value_visible: boolean;
|
|
58
|
+
field?: string;
|
|
59
|
+
value?: number;
|
|
60
|
+
aggregate?: string;
|
|
61
|
+
}>;
|
|
62
|
+
};
|
|
63
|
+
dataList: Array<{
|
|
64
|
+
color?: any;
|
|
65
|
+
data: [number, number, number, string, string | number];
|
|
66
|
+
name: string;
|
|
67
|
+
}>;
|
|
68
|
+
onChartReady?: (data: any) => void;
|
|
69
|
+
onChartClick?: (data: any, options: any, dataList: any) => void;
|
|
70
|
+
};
|
|
71
|
+
export type { BubbleChartConfig };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as DeptsMemberSelector } from './DeptsMember/DeptsMember';
|
|
2
2
|
export { default as ConfigProvider } from './ConfigProvider/ConfigProvider';
|
|
3
|
+
export { default as BubbleChart } from './BubbleChart/BubbleChart';
|
|
3
4
|
export { default as Scatterplot } from './Scatterplot/Scatterplot';
|
|
4
5
|
export type { ConfigProps, Locale, PreFetchedNode } from './ConfigProvider/ConfigProvider.type';
|