st-comp 0.0.121 → 0.0.122
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/es/KlineNew.cjs +1 -1
- package/es/KlineNew.js +246 -224
- package/es/style.css +1 -1
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +1 -1
- package/lib/{index-dbad59c9.js → index-62c62885.js} +35 -13
- package/lib/{python-ab788b86.js → python-6cdad7a6.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/KlineNew/components/KlineTips/index.vue +31 -3
package/es/KlineNew.js
CHANGED
|
@@ -17,57 +17,57 @@ import "./scroll-3b521d81.js";
|
|
|
17
17
|
import "./debounce-2336e546.js";
|
|
18
18
|
const oe = /* @__PURE__ */ R({
|
|
19
19
|
__name: "index",
|
|
20
|
-
setup(
|
|
21
|
-
let S = !1,
|
|
22
|
-
const
|
|
23
|
-
return
|
|
20
|
+
setup(k, { expose: D }) {
|
|
21
|
+
let S = !1, h = !0, v = [];
|
|
22
|
+
const y = (f, c) => f.length > c ? f.slice(f.length - c) : f;
|
|
23
|
+
return D({
|
|
24
24
|
// 注册计算指标线方法
|
|
25
25
|
initTalib: async () => {
|
|
26
26
|
if (!S)
|
|
27
|
-
S = !0, await te("./talib.wasm"),
|
|
28
|
-
|
|
27
|
+
S = !0, await te("./talib.wasm"), h = !1, v.forEach((f) => {
|
|
28
|
+
f();
|
|
29
29
|
});
|
|
30
|
-
else if (
|
|
31
|
-
return new Promise((
|
|
32
|
-
|
|
30
|
+
else if (h)
|
|
31
|
+
return new Promise((f) => {
|
|
32
|
+
v.push(f);
|
|
33
33
|
});
|
|
34
34
|
},
|
|
35
35
|
// 键盘事件处理
|
|
36
|
-
handleKeyDown: (
|
|
37
|
-
let { startValue:
|
|
38
|
-
if (
|
|
39
|
-
if (
|
|
36
|
+
handleKeyDown: (f, c) => {
|
|
37
|
+
let { startValue: o, endValue: u, maxIndex: p } = c;
|
|
38
|
+
if (f.code === "ArrowLeft") {
|
|
39
|
+
if (o === 0)
|
|
40
40
|
return;
|
|
41
|
-
|
|
42
|
-
} else if (
|
|
43
|
-
if (u ===
|
|
41
|
+
o = o - 1, u = u - 1;
|
|
42
|
+
} else if (f.code === "ArrowRight") {
|
|
43
|
+
if (u === p)
|
|
44
44
|
return;
|
|
45
|
-
|
|
46
|
-
} else if (
|
|
47
|
-
if (u -
|
|
45
|
+
o = o + 1, u = u + 1;
|
|
46
|
+
} else if (f.code === "ArrowUp") {
|
|
47
|
+
if (u - o < 5)
|
|
48
48
|
return;
|
|
49
|
-
const d = Math.floor((u -
|
|
50
|
-
|
|
51
|
-
} else if (
|
|
52
|
-
const d = Math.min(500, u -
|
|
53
|
-
|
|
49
|
+
const d = Math.floor((u - o) / 2) + 1;
|
|
50
|
+
o = o + d, u - o < 5 && (o = u - 4);
|
|
51
|
+
} else if (f.code === "ArrowDown") {
|
|
52
|
+
const d = Math.min(500, u - o);
|
|
53
|
+
o = o - d - 1;
|
|
54
54
|
}
|
|
55
55
|
return {
|
|
56
|
-
startValue:
|
|
56
|
+
startValue: o,
|
|
57
57
|
endValue: u
|
|
58
58
|
};
|
|
59
59
|
},
|
|
60
60
|
// 根据时间解析dataZoom
|
|
61
|
-
getDataZoomInfoByTime: (
|
|
62
|
-
const { showStartTime: c, showEndTime:
|
|
63
|
-
let d = -1, e = -1,
|
|
64
|
-
return u.forEach((t,
|
|
65
|
-
const
|
|
66
|
-
r
|
|
61
|
+
getDataZoomInfoByTime: (f) => {
|
|
62
|
+
const { showStartTime: c, showEndTime: o, xAxisData: u, maxShowDays: p } = f;
|
|
63
|
+
let d = -1, e = -1, i = {};
|
|
64
|
+
return u.forEach((t, a) => {
|
|
65
|
+
const r = t.split(" ")[0];
|
|
66
|
+
i[r] = i[r] || 0, i[r] += 1, new Date(t) >= new Date(c) && d === -1 && (d = a), new Date(t) <= new Date(o) && (e = a);
|
|
67
67
|
}), {
|
|
68
68
|
startValue: d,
|
|
69
69
|
endValue: e,
|
|
70
|
-
maxValueSpan: Math.max(...Object.values(
|
|
70
|
+
maxValueSpan: Math.max(...Object.values(i)) * p
|
|
71
71
|
};
|
|
72
72
|
},
|
|
73
73
|
/**
|
|
@@ -83,68 +83,68 @@ const oe = /* @__PURE__ */ R({
|
|
|
83
83
|
* length, // 便捷数据 - K线长度
|
|
84
84
|
* }
|
|
85
85
|
*/
|
|
86
|
-
formatDataBySlide: (
|
|
87
|
-
const { originDrawData: c, addData:
|
|
88
|
-
let
|
|
89
|
-
u &&
|
|
90
|
-
...
|
|
86
|
+
formatDataBySlide: (f) => {
|
|
87
|
+
const { originDrawData: c, addData: o, startTime: u, endTime: p } = f, { mainIndicator: d, mainIndicatorList: e, subIndicator: i, subIndicatorList: t, config: a, timeRange: r } = f, { loadAddCount: x, preLoadCount: A } = a;
|
|
88
|
+
let g = [], _ = [], F = [], I = [];
|
|
89
|
+
u && p ? (g = o.filter((l) => new Date(l[0]) >= new Date(u) && new Date(l[0]) <= new Date(p)), I = [...o]) : p ? (g = [
|
|
90
|
+
...o.filter((l, n) => n >= o.length - x && new Date(r[0]) <= new Date(l[0]) && new Date(l[0]) <= new Date(r[1])),
|
|
91
91
|
...c.originData
|
|
92
|
-
],
|
|
92
|
+
], I = [...o, ...c.originData]) : u && (g = [
|
|
93
93
|
...c.originData,
|
|
94
|
-
...
|
|
95
|
-
],
|
|
96
|
-
_.push([
|
|
94
|
+
...o.filter((l, n) => n >= A && new Date(r[0]) <= new Date(l[0]) && new Date(l[0]) <= new Date(r[1]))
|
|
95
|
+
], I = g), g.forEach((l, n) => {
|
|
96
|
+
_.push([l[1], l[4], l[3], l[2], n === 0 ? 0 : g[n - 1][4], l[6]]), F.push(l[0]);
|
|
97
97
|
});
|
|
98
|
-
let
|
|
99
|
-
const
|
|
98
|
+
let s = [], m = [];
|
|
99
|
+
const b = {
|
|
100
100
|
time: [],
|
|
101
101
|
open: [],
|
|
102
102
|
close: [],
|
|
103
103
|
high: [],
|
|
104
104
|
low: [],
|
|
105
|
-
originData:
|
|
105
|
+
originData: I
|
|
106
106
|
};
|
|
107
107
|
let E = null, C = null;
|
|
108
|
-
return
|
|
109
|
-
|
|
110
|
-
}),
|
|
111
|
-
const { calculationFn:
|
|
108
|
+
return I.forEach((l, n) => {
|
|
109
|
+
b.time.push(l[0]), b.open.push(l[1]), b.close.push(l[4]), b.high.push(l[2]), b.low.push(l[3]), l[0] === g[0][0] && (E = n), l[0] === g[g.length - 1][0] && (C = n + 1);
|
|
110
|
+
}), s = e.find(({ value: l }) => l === d).config.map((l) => {
|
|
111
|
+
const { calculationFn: n } = l;
|
|
112
112
|
return {
|
|
113
|
-
...
|
|
114
|
-
data:
|
|
113
|
+
...l,
|
|
114
|
+
data: n ? n(z, b, { time: [], open: [], close: [], high: [], low: [], originData: [] }).slice(E, C) : []
|
|
115
115
|
};
|
|
116
|
-
}),
|
|
117
|
-
const { source:
|
|
118
|
-
return
|
|
119
|
-
...
|
|
116
|
+
}), m = t.find(({ value: l }) => l === i).config.reduce((l, n) => {
|
|
117
|
+
const { source: w, calculationFn: V } = n;
|
|
118
|
+
return w === "calculation" ? [
|
|
119
|
+
...l,
|
|
120
120
|
{
|
|
121
|
-
...
|
|
122
|
-
data: V ? V(z,
|
|
121
|
+
...n,
|
|
122
|
+
data: V ? V(z, b).slice(E, C) : []
|
|
123
123
|
}
|
|
124
|
-
] :
|
|
124
|
+
] : l;
|
|
125
125
|
}, []), {
|
|
126
|
-
originData:
|
|
126
|
+
originData: g,
|
|
127
127
|
candlestickData: _,
|
|
128
|
-
mainIndicatorData:
|
|
129
|
-
subIndicatorData:
|
|
128
|
+
mainIndicatorData: s,
|
|
129
|
+
subIndicatorData: m,
|
|
130
130
|
xAxisData: F,
|
|
131
|
-
startTime:
|
|
132
|
-
endTime:
|
|
133
|
-
length:
|
|
131
|
+
startTime: g[0][0],
|
|
132
|
+
endTime: g[g.length - 1][0],
|
|
133
|
+
length: g.length
|
|
134
134
|
};
|
|
135
135
|
},
|
|
136
136
|
// 计算绘图数据(根据长度使用)
|
|
137
|
-
formatDataByCount: (
|
|
138
|
-
const { originDrawData: c, addData:
|
|
137
|
+
formatDataByCount: (f) => {
|
|
138
|
+
const { originDrawData: c, addData: o, mainIndicator: u, mainIndicatorList: p, subIndicator: d, subIndicatorList: e, config: i } = f;
|
|
139
139
|
let t = {};
|
|
140
|
-
const { addCount:
|
|
141
|
-
let
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
...
|
|
146
|
-
data:
|
|
147
|
-
|
|
140
|
+
const { addCount: a, preLoadCount: r } = i, x = [], A = [], g = [], _ = [], F = [];
|
|
141
|
+
let I = [], s = [];
|
|
142
|
+
const m = o.filter((n, w) => (x.push(n[0]), A.push(n[1]), g.push(n[4]), _.push(n[2]), F.push(n[3]), I.push(n[0]), s.push([n[1], n[4], n[3], n[2], w === 0 ? 0 : o[w - 1][4], n[6]]), o.length >= a + r - 1 ? w >= r : !0));
|
|
143
|
+
I = y(I, m.length), s = y(s, m.length);
|
|
144
|
+
const b = { time: x, open: A, close: g, high: _, low: F, originData: o }, C = p.find((n) => n.value === u).config.map((n) => ({
|
|
145
|
+
...n,
|
|
146
|
+
data: y(
|
|
147
|
+
n.calculationFn ? n.calculationFn(z, b, {
|
|
148
148
|
time: [],
|
|
149
149
|
open: [],
|
|
150
150
|
close: [],
|
|
@@ -152,52 +152,52 @@ const oe = /* @__PURE__ */ R({
|
|
|
152
152
|
low: [],
|
|
153
153
|
originData: []
|
|
154
154
|
}) : [],
|
|
155
|
-
|
|
155
|
+
I.length
|
|
156
156
|
)
|
|
157
157
|
}));
|
|
158
|
-
let
|
|
159
|
-
return d && e && (
|
|
160
|
-
...
|
|
158
|
+
let l = [];
|
|
159
|
+
return d && e && (l = e.find((w) => w.value === d).config.reduce((w, V) => V.source === "calculation" ? [
|
|
160
|
+
...w,
|
|
161
161
|
{
|
|
162
162
|
...V,
|
|
163
|
-
data:
|
|
164
|
-
V.calculationFn ? V.calculationFn(z,
|
|
165
|
-
|
|
163
|
+
data: y(
|
|
164
|
+
V.calculationFn ? V.calculationFn(z, b) : [],
|
|
165
|
+
I.length
|
|
166
166
|
)
|
|
167
167
|
}
|
|
168
|
-
] :
|
|
169
|
-
originData: [...
|
|
168
|
+
] : w, [])), c.length ? t = {
|
|
169
|
+
originData: [...m, ...c.originData],
|
|
170
170
|
// 原数据
|
|
171
|
-
xAxisData: [...
|
|
171
|
+
xAxisData: [...I, ...c.xAxisData],
|
|
172
172
|
// 时间数据
|
|
173
|
-
candlestickData: [...
|
|
173
|
+
candlestickData: [...s, ...c.candlestickData],
|
|
174
174
|
// k线数据
|
|
175
|
-
mainIndicatorData: c.mainIndicatorData.map((
|
|
176
|
-
...
|
|
177
|
-
data: [...C[
|
|
175
|
+
mainIndicatorData: c.mainIndicatorData.map((n, w) => ({
|
|
176
|
+
...n,
|
|
177
|
+
data: [...C[w].data, ...n.data]
|
|
178
178
|
})),
|
|
179
179
|
// 主图指标线数据
|
|
180
|
-
subIndicatorData: c.subIndicatorData.map((
|
|
181
|
-
...
|
|
182
|
-
data: [...
|
|
180
|
+
subIndicatorData: c.subIndicatorData.map((n, w) => ({
|
|
181
|
+
...n,
|
|
182
|
+
data: [...l[w].data, ...n.data]
|
|
183
183
|
}))
|
|
184
184
|
// 副图数据
|
|
185
185
|
} : t = {
|
|
186
|
-
originData:
|
|
186
|
+
originData: m,
|
|
187
187
|
// 原数据
|
|
188
|
-
xAxisData:
|
|
188
|
+
xAxisData: I,
|
|
189
189
|
// 时间数据
|
|
190
|
-
candlestickData:
|
|
190
|
+
candlestickData: s,
|
|
191
191
|
// k线数据
|
|
192
192
|
mainIndicatorData: C,
|
|
193
193
|
// 主图指标线数据
|
|
194
|
-
subIndicatorData:
|
|
194
|
+
subIndicatorData: l
|
|
195
195
|
// 副图数据
|
|
196
196
|
}, t.length = t.xAxisData.length, t.startTime = t.xAxisData[0], t.endTime = t.xAxisData[t.length - 1], t;
|
|
197
197
|
},
|
|
198
198
|
fn: () => {
|
|
199
199
|
}
|
|
200
|
-
}), (
|
|
200
|
+
}), (f, c) => null;
|
|
201
201
|
}
|
|
202
202
|
}), re = { class: "kline-tips" }, ie = /* @__PURE__ */ R({
|
|
203
203
|
__name: "index",
|
|
@@ -208,17 +208,17 @@ const oe = /* @__PURE__ */ R({
|
|
|
208
208
|
require: !0
|
|
209
209
|
}
|
|
210
210
|
},
|
|
211
|
-
setup(
|
|
212
|
-
return (
|
|
213
|
-
(T(!0), L(K, null, Z(
|
|
214
|
-
key:
|
|
211
|
+
setup(k) {
|
|
212
|
+
return (D, S) => (T(), L("div", re, [
|
|
213
|
+
(T(!0), L(K, null, Z(k.data, (h, v) => (T(), L("div", {
|
|
214
|
+
key: v,
|
|
215
215
|
class: "kline-tips-item",
|
|
216
|
-
style: H({ color:
|
|
217
|
-
}, N(
|
|
216
|
+
style: H({ color: h.color })
|
|
217
|
+
}, N(h.label) + " " + N(h.value), 5))), 128))
|
|
218
218
|
]));
|
|
219
219
|
}
|
|
220
220
|
});
|
|
221
|
-
const M = /* @__PURE__ */ q(ie, [["__scopeId", "data-v-2a02e841"]]),
|
|
221
|
+
const M = /* @__PURE__ */ q(ie, [["__scopeId", "data-v-2a02e841"]]), le = { class: "kline-tips" }, se = /* @__PURE__ */ R({
|
|
222
222
|
__name: "index",
|
|
223
223
|
props: {
|
|
224
224
|
// 提示数据
|
|
@@ -226,39 +226,61 @@ const M = /* @__PURE__ */ q(ie, [["__scopeId", "data-v-2a02e841"]]), se = { clas
|
|
|
226
226
|
type: Object,
|
|
227
227
|
require: !0
|
|
228
228
|
},
|
|
229
|
+
// K线数据
|
|
230
|
+
// candlestickData: [开, 收, 低, 高, 成交额, 涨跌值, 涨跌百分比]
|
|
231
|
+
candlestickData: {
|
|
232
|
+
type: Array,
|
|
233
|
+
default: () => null
|
|
234
|
+
},
|
|
235
|
+
// 主图指标数据
|
|
236
|
+
// mainIndicatorData: [key, data, color]
|
|
237
|
+
mainIndicatorData: {
|
|
238
|
+
type: Array,
|
|
239
|
+
default: () => null
|
|
240
|
+
},
|
|
229
241
|
activeIndex: {
|
|
230
242
|
type: Number,
|
|
231
243
|
require: !0
|
|
232
244
|
}
|
|
233
245
|
},
|
|
234
|
-
setup(
|
|
235
|
-
const { round:
|
|
236
|
-
const { drawData: u, activeIndex:
|
|
237
|
-
if (
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
{ label: "
|
|
241
|
-
{ label: "
|
|
242
|
-
{ label: "
|
|
246
|
+
setup(k) {
|
|
247
|
+
const { round: D, multiply: S, divide: h, subtract: v, formatValue: y } = G, f = k, c = $(() => {
|
|
248
|
+
const { drawData: u, activeIndex: p, candlestickData: d } = f;
|
|
249
|
+
if (d != null && d.length && d[p]) {
|
|
250
|
+
let e;
|
|
251
|
+
return d[p][6] > 0 ? e = "red" : d[p][6] < 0 && (e = "green"), [
|
|
252
|
+
{ label: "开", value: D(d[p][0]) },
|
|
253
|
+
{ label: "高", value: D(d[p][3]) },
|
|
254
|
+
{ label: "低", value: D(d[p][2]) },
|
|
255
|
+
{ label: "收", value: D(d[p][1]) },
|
|
256
|
+
{ label: "额", value: y(d[p][4]) },
|
|
257
|
+
{ label: "涨跌", value: `${D(d[p][6])}%`, color: e }
|
|
258
|
+
];
|
|
259
|
+
} else if (u.candlestickData && u.candlestickData[p]) {
|
|
260
|
+
const e = u.candlestickData[p], i = [
|
|
261
|
+
{ label: "开", value: D(e[0]) },
|
|
262
|
+
{ label: "高", value: D(e[3]) },
|
|
263
|
+
{ label: "低", value: D(e[2]) },
|
|
264
|
+
{ label: "收", value: D(e[1]) }
|
|
243
265
|
];
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
let
|
|
247
|
-
return
|
|
266
|
+
e[5] !== void 0 && i.push({ label: "额", value: y(e[5]) });
|
|
267
|
+
const t = D(S(h(v(e[1], e[4]), Math.abs(e[4])), 100));
|
|
268
|
+
let a;
|
|
269
|
+
return t > 0 ? a = "red" : t < 0 && (a = "green"), i.push({ label: "涨跌", value: `${t}%`, color: a }), i;
|
|
248
270
|
}
|
|
249
271
|
return [];
|
|
250
|
-
}),
|
|
272
|
+
}), o = $(() => {
|
|
251
273
|
var d;
|
|
252
|
-
const { drawData: u, activeIndex:
|
|
253
|
-
return ((d = u == null ? void 0 : u.mainIndicatorData) == null ? void 0 : d.map((e) => ({ label: e.key, value:
|
|
274
|
+
const { drawData: u, activeIndex: p } = f;
|
|
275
|
+
return ((d = u == null ? void 0 : u.mainIndicatorData) == null ? void 0 : d.map((e) => ({ label: e.key, value: D(e.data[p]), color: e.color }))) || [];
|
|
254
276
|
});
|
|
255
|
-
return (u,
|
|
277
|
+
return (u, p) => (T(), L("div", le, [
|
|
256
278
|
O(M, { data: c.value }, null, 8, ["data"]),
|
|
257
|
-
O(M, { data:
|
|
279
|
+
O(M, { data: o.value }, null, 8, ["data"])
|
|
258
280
|
]));
|
|
259
281
|
}
|
|
260
282
|
});
|
|
261
|
-
const ce = /* @__PURE__ */ q(
|
|
283
|
+
const ce = /* @__PURE__ */ q(se, [["__scopeId", "data-v-234f3f41"]]), ue = { class: "klineSub" }, de = { class: "klineSub-tips" }, pe = {
|
|
262
284
|
key: 0,
|
|
263
285
|
class: "klineSub-tips-select"
|
|
264
286
|
}, fe = /* @__PURE__ */ R({
|
|
@@ -274,44 +296,44 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
|
|
|
274
296
|
// 配置
|
|
275
297
|
},
|
|
276
298
|
emits: ["update:modelValue"],
|
|
277
|
-
setup(
|
|
278
|
-
const { round:
|
|
279
|
-
let
|
|
280
|
-
const
|
|
299
|
+
setup(k, { expose: D, emit: S }) {
|
|
300
|
+
const { round: h } = G;
|
|
301
|
+
let v, y;
|
|
302
|
+
const f = S, c = k, o = j(), u = $({
|
|
281
303
|
get() {
|
|
282
304
|
return c.modelValue;
|
|
283
305
|
},
|
|
284
306
|
set(e) {
|
|
285
|
-
|
|
307
|
+
f("update:modelValue", e);
|
|
286
308
|
}
|
|
287
|
-
}),
|
|
288
|
-
const { drawData: e, activeIndex:
|
|
289
|
-
return e.originData && e.originData[
|
|
290
|
-
var x,
|
|
291
|
-
let
|
|
292
|
-
return
|
|
293
|
-
label:
|
|
294
|
-
color:
|
|
295
|
-
value:
|
|
309
|
+
}), p = $(() => {
|
|
310
|
+
const { drawData: e, activeIndex: i } = c, t = c.subIndicatorList.find((a) => a.value === u.value);
|
|
311
|
+
return e.originData && e.originData[i] ? t.config.map((a) => {
|
|
312
|
+
var x, A;
|
|
313
|
+
let r = "-";
|
|
314
|
+
return a.source === "origin" ? r = e.originData[i][a.dataIndex] || "-" : a.source === "calculation" && (r = (((A = (x = e.subIndicatorData) == null ? void 0 : x.find((_) => _.key === a.key)) == null ? void 0 : A.data) || [])[i]), {
|
|
315
|
+
label: a.key,
|
|
316
|
+
color: a.color,
|
|
317
|
+
value: r === "-" ? r : h(r)
|
|
296
318
|
};
|
|
297
319
|
}) : [];
|
|
298
320
|
});
|
|
299
321
|
U(() => {
|
|
300
|
-
|
|
322
|
+
v = B.init(o.value);
|
|
301
323
|
let e = !0;
|
|
302
|
-
|
|
324
|
+
y = new ResizeObserver(() => {
|
|
303
325
|
if (e) {
|
|
304
326
|
e = null;
|
|
305
327
|
return;
|
|
306
328
|
}
|
|
307
|
-
|
|
308
|
-
}),
|
|
329
|
+
v.resize();
|
|
330
|
+
}), y.observe(o.value);
|
|
309
331
|
}), Y(() => {
|
|
310
|
-
|
|
332
|
+
v.dispose(), y.disconnect(), y = null;
|
|
311
333
|
});
|
|
312
|
-
const d = (e,
|
|
313
|
-
const t = e[
|
|
314
|
-
return t[0] === t[1] ? t[0] >=
|
|
334
|
+
const d = (e, i) => {
|
|
335
|
+
const t = e[i], a = i === 0 ? e[i] : e[i - 1];
|
|
336
|
+
return t[0] === t[1] ? t[0] >= a[1] ? {
|
|
315
337
|
color: "transparent",
|
|
316
338
|
borderColor: "#FF0000"
|
|
317
339
|
} : {
|
|
@@ -323,60 +345,60 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
|
|
|
323
345
|
color: "#00FFFF"
|
|
324
346
|
};
|
|
325
347
|
};
|
|
326
|
-
return
|
|
348
|
+
return D({
|
|
327
349
|
connect: (e) => {
|
|
328
|
-
B.connect([e,
|
|
350
|
+
B.connect([e, v]);
|
|
329
351
|
},
|
|
330
352
|
// 联动
|
|
331
353
|
draw: (e) => {
|
|
332
354
|
J(() => {
|
|
333
|
-
var
|
|
334
|
-
const { startValue:
|
|
355
|
+
var I;
|
|
356
|
+
const { startValue: i, endValue: t, maxValueSpan: a } = e, { xAxisData: r, subIndicatorData: x, candlestickData: A, originData: g } = c.drawData, _ = c.subIndicatorList.find((s) => s.value === u.value), F = [];
|
|
335
357
|
if (_.series === "bar") {
|
|
336
|
-
let
|
|
337
|
-
_.source === "origin" ?
|
|
358
|
+
let s = [];
|
|
359
|
+
_.source === "origin" ? s = g.map((m) => m[_.dataIndex]) : s = ((I = x == null ? void 0 : x.find((m) => m.key === _.dataIndex)) == null ? void 0 : I.data) || [], F.push({
|
|
338
360
|
name: "subMain",
|
|
339
361
|
xAxisIndex: 0,
|
|
340
362
|
yAxisIndex: 1,
|
|
341
363
|
type: "bar",
|
|
342
364
|
silent: !0,
|
|
343
365
|
symbol: "none",
|
|
344
|
-
data:
|
|
345
|
-
value:
|
|
346
|
-
itemStyle: d(
|
|
366
|
+
data: s.map((m, b) => _.color === "kline" ? {
|
|
367
|
+
value: m,
|
|
368
|
+
itemStyle: d(A, b)
|
|
347
369
|
} : _.color === "value" ? {
|
|
348
|
-
value:
|
|
370
|
+
value: m,
|
|
349
371
|
itemStyle: {
|
|
350
|
-
color:
|
|
372
|
+
color: m >= 0 ? "#FF0000" : "#00FFFF"
|
|
351
373
|
}
|
|
352
374
|
} : {
|
|
353
|
-
value:
|
|
375
|
+
value: m,
|
|
354
376
|
itemStyle: {
|
|
355
377
|
color: _.color
|
|
356
378
|
}
|
|
357
379
|
})
|
|
358
380
|
});
|
|
359
381
|
}
|
|
360
|
-
x.forEach((
|
|
361
|
-
if (
|
|
362
|
-
let
|
|
363
|
-
|
|
382
|
+
x.forEach((s) => {
|
|
383
|
+
if (s.series === "line") {
|
|
384
|
+
let m = [];
|
|
385
|
+
s.source === "origin" ? m = g.map((b) => b[s.dataIndex]) : s.source === "calculation" && (m = s.data), F.push({
|
|
364
386
|
xAxisIndex: 0,
|
|
365
|
-
yAxisIndex:
|
|
366
|
-
name:
|
|
387
|
+
yAxisIndex: s.yAxis === "right" ? 2 : 1,
|
|
388
|
+
name: s.key,
|
|
367
389
|
type: "line",
|
|
368
390
|
silent: !0,
|
|
369
391
|
symbol: "none",
|
|
370
|
-
data:
|
|
392
|
+
data: m,
|
|
371
393
|
lineStyle: {
|
|
372
394
|
width: 1
|
|
373
395
|
},
|
|
374
396
|
itemStyle: {
|
|
375
|
-
color:
|
|
397
|
+
color: s.color
|
|
376
398
|
}
|
|
377
399
|
});
|
|
378
400
|
}
|
|
379
|
-
}),
|
|
401
|
+
}), v.setOption(
|
|
380
402
|
{
|
|
381
403
|
animation: !1,
|
|
382
404
|
grid: {
|
|
@@ -388,9 +410,9 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
|
|
|
388
410
|
dataZoom: [
|
|
389
411
|
{
|
|
390
412
|
type: "inside",
|
|
391
|
-
startValue:
|
|
413
|
+
startValue: i,
|
|
392
414
|
endValue: t,
|
|
393
|
-
maxValueSpan:
|
|
415
|
+
maxValueSpan: a
|
|
394
416
|
}
|
|
395
417
|
],
|
|
396
418
|
tooltip: {
|
|
@@ -401,12 +423,12 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
|
|
|
401
423
|
type: "cross",
|
|
402
424
|
label: {
|
|
403
425
|
rich: {},
|
|
404
|
-
formatter: (
|
|
405
|
-
const { axisDimension:
|
|
406
|
-
if (
|
|
407
|
-
return
|
|
408
|
-
if (
|
|
409
|
-
return String(
|
|
426
|
+
formatter: (s) => {
|
|
427
|
+
const { axisDimension: m, value: b } = s;
|
|
428
|
+
if (m === "x")
|
|
429
|
+
return b;
|
|
430
|
+
if (s.axisIndex === 1)
|
|
431
|
+
return String(h(b));
|
|
410
432
|
}
|
|
411
433
|
}
|
|
412
434
|
},
|
|
@@ -414,7 +436,7 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
|
|
|
414
436
|
},
|
|
415
437
|
xAxis: {
|
|
416
438
|
type: "category",
|
|
417
|
-
data:
|
|
439
|
+
data: r,
|
|
418
440
|
axisLine: {
|
|
419
441
|
show: !0
|
|
420
442
|
},
|
|
@@ -423,7 +445,7 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
|
|
|
423
445
|
},
|
|
424
446
|
axisLabel: {
|
|
425
447
|
show: !0,
|
|
426
|
-
formatter: (
|
|
448
|
+
formatter: (s) => s
|
|
427
449
|
}
|
|
428
450
|
},
|
|
429
451
|
yAxis: [
|
|
@@ -432,8 +454,8 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
|
|
|
432
454
|
},
|
|
433
455
|
{
|
|
434
456
|
position: "left",
|
|
435
|
-
min: _.leftYAxisRange === "cover" ? (
|
|
436
|
-
max: _.leftYAxisRange === "cover" ? (
|
|
457
|
+
min: _.leftYAxisRange === "cover" ? (s) => s.min : null,
|
|
458
|
+
max: _.leftYAxisRange === "cover" ? (s) => s.max : null,
|
|
437
459
|
splitNumber: 1,
|
|
438
460
|
axisLine: {
|
|
439
461
|
show: !0
|
|
@@ -448,8 +470,8 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
|
|
|
448
470
|
},
|
|
449
471
|
{
|
|
450
472
|
position: "right",
|
|
451
|
-
min: _.rightYAxisRange === "cover" ? (
|
|
452
|
-
max: _.rightYAxisRange === "cover" ? (
|
|
473
|
+
min: _.rightYAxisRange === "cover" ? (s) => s.min : null,
|
|
474
|
+
max: _.rightYAxisRange === "cover" ? (s) => s.max : null,
|
|
453
475
|
splitNumber: 1,
|
|
454
476
|
axisLine: {
|
|
455
477
|
show: !1
|
|
@@ -469,34 +491,34 @@ const ce = /* @__PURE__ */ q(le, [["__scopeId", "data-v-a1302914"]]), ue = { cla
|
|
|
469
491
|
});
|
|
470
492
|
}
|
|
471
493
|
// 重置
|
|
472
|
-
}), (e,
|
|
473
|
-
const t = ae,
|
|
494
|
+
}), (e, i) => {
|
|
495
|
+
const t = ae, a = ne;
|
|
474
496
|
return T(), L("div", ue, [
|
|
475
497
|
P("div", de, [
|
|
476
|
-
|
|
477
|
-
O(
|
|
498
|
+
p.value.length ? (T(), L("div", pe, [
|
|
499
|
+
O(a, {
|
|
478
500
|
modelValue: u.value,
|
|
479
|
-
"onUpdate:modelValue":
|
|
501
|
+
"onUpdate:modelValue": i[0] || (i[0] = (r) => u.value = r),
|
|
480
502
|
size: "small",
|
|
481
503
|
"popper-class": "element-dark",
|
|
482
504
|
class: "element-dark subIndicator"
|
|
483
505
|
}, {
|
|
484
506
|
default: Q(() => [
|
|
485
|
-
(T(!0), L(K, null, Z(
|
|
486
|
-
key:
|
|
487
|
-
label:
|
|
488
|
-
value:
|
|
507
|
+
(T(!0), L(K, null, Z(k.subIndicatorList, (r) => (T(), W(t, {
|
|
508
|
+
key: r.value,
|
|
509
|
+
label: r.label,
|
|
510
|
+
value: r.value
|
|
489
511
|
}, null, 8, ["label", "value"]))), 128))
|
|
490
512
|
]),
|
|
491
513
|
_: 1
|
|
492
514
|
}, 8, ["modelValue"])
|
|
493
515
|
])) : X("", !0),
|
|
494
|
-
O(M, { data:
|
|
516
|
+
O(M, { data: p.value }, null, 8, ["data"])
|
|
495
517
|
]),
|
|
496
518
|
P("div", {
|
|
497
519
|
class: "klineSub-chart",
|
|
498
520
|
ref_key: "subChartRef",
|
|
499
|
-
ref:
|
|
521
|
+
ref: o
|
|
500
522
|
}, null, 512)
|
|
501
523
|
]);
|
|
502
524
|
};
|
|
@@ -509,9 +531,9 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
|
|
|
509
531
|
// 时间数据
|
|
510
532
|
},
|
|
511
533
|
emits: ["change"],
|
|
512
|
-
setup(
|
|
513
|
-
let
|
|
514
|
-
const
|
|
534
|
+
setup(k, { expose: D, emit: S }) {
|
|
535
|
+
let h, v, y = null;
|
|
536
|
+
const f = S, c = k, o = j();
|
|
515
537
|
ee(
|
|
516
538
|
() => c.data,
|
|
517
539
|
() => {
|
|
@@ -519,40 +541,40 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
|
|
|
519
541
|
},
|
|
520
542
|
{ deep: !0 }
|
|
521
543
|
), U(() => {
|
|
522
|
-
|
|
544
|
+
h = B.init(o.value), u(), d();
|
|
523
545
|
let e = !0;
|
|
524
|
-
|
|
546
|
+
v = new ResizeObserver(() => {
|
|
525
547
|
if (e) {
|
|
526
548
|
e = null;
|
|
527
549
|
return;
|
|
528
550
|
}
|
|
529
|
-
|
|
530
|
-
}),
|
|
551
|
+
h.resize();
|
|
552
|
+
}), v.observe(o.value);
|
|
531
553
|
}), Y(() => {
|
|
532
|
-
|
|
554
|
+
h.off("datazoom"), h.dispose(), v.disconnect(), v = null;
|
|
533
555
|
});
|
|
534
556
|
const u = () => {
|
|
535
|
-
|
|
536
|
-
e.dataZoomId && (clearTimeout(
|
|
537
|
-
const { data:
|
|
538
|
-
|
|
557
|
+
h.on("datazoom", (e) => {
|
|
558
|
+
e.dataZoomId && (clearTimeout(y), y = setTimeout(() => {
|
|
559
|
+
const { data: i } = c, { start: t, end: a } = e, r = Math.floor(t * i.length / 100), x = a === 100 ? i.length - 1 : Math.floor(a * i.length / 100);
|
|
560
|
+
p(r, x), clearTimeout(y);
|
|
539
561
|
}, 100));
|
|
540
562
|
});
|
|
541
|
-
},
|
|
563
|
+
}, p = (e, i) => {
|
|
542
564
|
const t = c.data;
|
|
543
565
|
if (t.length === 0)
|
|
544
566
|
return;
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
startTime: `${
|
|
548
|
-
endTime: `${
|
|
567
|
+
const a = t[e][0].split(" ")[0], r = t[i][0].split(" ")[0];
|
|
568
|
+
f("change", {
|
|
569
|
+
startTime: `${a} 00:00:00`,
|
|
570
|
+
endTime: `${r} 24:00:00`
|
|
549
571
|
});
|
|
550
572
|
}, d = () => {
|
|
551
573
|
const { data: e } = c;
|
|
552
574
|
if (e.length === 0)
|
|
553
575
|
return;
|
|
554
|
-
const
|
|
555
|
-
|
|
576
|
+
const i = e.map((a) => a[0].split(" ")[0]), t = e.map((a) => a[1]);
|
|
577
|
+
h.setOption({
|
|
556
578
|
grid: {
|
|
557
579
|
height: 0,
|
|
558
580
|
left: "80px",
|
|
@@ -560,7 +582,7 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
|
|
|
560
582
|
},
|
|
561
583
|
xAxis: {
|
|
562
584
|
type: "category",
|
|
563
|
-
data:
|
|
585
|
+
data: i,
|
|
564
586
|
show: !1
|
|
565
587
|
},
|
|
566
588
|
yAxis: {
|
|
@@ -574,17 +596,17 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
|
|
|
574
596
|
]
|
|
575
597
|
}, !0);
|
|
576
598
|
};
|
|
577
|
-
return
|
|
578
|
-
resetSlide: (e,
|
|
579
|
-
let
|
|
580
|
-
c.data.forEach((x,
|
|
581
|
-
|
|
582
|
-
}),
|
|
599
|
+
return D({
|
|
600
|
+
resetSlide: (e, i, t) => {
|
|
601
|
+
let a = -1, r = -1;
|
|
602
|
+
c.data.forEach((x, A) => {
|
|
603
|
+
a === -1 && x[0] === e ? a = A : a === -1 && new Date(x[0]) > new Date(e) && (a = A - 1), (r === -1 && x[0] === i || r === -1 && new Date(x[0]) > new Date(i)) && (r = A);
|
|
604
|
+
}), r = r === -1 ? c.data.length - 1 : r, h.setOption({
|
|
583
605
|
dataZoom: [
|
|
584
606
|
{
|
|
585
607
|
show: !0,
|
|
586
|
-
startValue:
|
|
587
|
-
endValue:
|
|
608
|
+
startValue: a,
|
|
609
|
+
endValue: r,
|
|
588
610
|
maxValueSpan: t,
|
|
589
611
|
textStyle: {
|
|
590
612
|
color: "#ccc"
|
|
@@ -592,8 +614,8 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
|
|
|
592
614
|
},
|
|
593
615
|
{
|
|
594
616
|
type: "inside",
|
|
595
|
-
startValue:
|
|
596
|
-
endValue:
|
|
617
|
+
startValue: a,
|
|
618
|
+
endValue: r,
|
|
597
619
|
maxValueSpan: t
|
|
598
620
|
}
|
|
599
621
|
]
|
|
@@ -601,18 +623,18 @@ const he = /* @__PURE__ */ q(fe, [["__scopeId", "data-v-0a2f256e"]]), me = /* @_
|
|
|
601
623
|
},
|
|
602
624
|
// 重置
|
|
603
625
|
resize: () => {
|
|
604
|
-
|
|
626
|
+
h == null || h.resize();
|
|
605
627
|
}
|
|
606
|
-
}), (e,
|
|
628
|
+
}), (e, i) => (T(), L("div", {
|
|
607
629
|
class: "klineSlide",
|
|
608
630
|
ref_key: "slideChartRef",
|
|
609
|
-
ref:
|
|
631
|
+
ref: o
|
|
610
632
|
}, null, 512));
|
|
611
633
|
}
|
|
612
634
|
});
|
|
613
635
|
const ge = /* @__PURE__ */ q(me, [["__scopeId", "data-v-5008746a"]]), Re = {
|
|
614
|
-
install(
|
|
615
|
-
|
|
636
|
+
install(k) {
|
|
637
|
+
k.component("st-klineUtils", oe), k.component("st-klineSub", he), k.component("st-klineTips", ce), k.component("st-klineSlide", ge);
|
|
616
638
|
}
|
|
617
639
|
};
|
|
618
640
|
export {
|