st-comp 0.0.37 → 0.0.39
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/lib/bundle.js +3095 -3076
- package/lib/bundle.umd.cjs +27 -27
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/Kline/index.vue +7 -0
- package/packages/Kline/option.ts +33 -12
- package/packages/Kline/type.d.ts +1 -0
- package/packages/TreeMap/index.vue +5 -1
- package/src/pages/Kline/api.ts +1 -1
package/package.json
CHANGED
package/packages/Kline/index.vue
CHANGED
|
@@ -78,6 +78,7 @@ const defaultConfig: InConfig = {
|
|
|
78
78
|
totalBarCount: 2000,
|
|
79
79
|
defaultShowBarCount: 200,
|
|
80
80
|
preBarCount: 800,
|
|
81
|
+
maxValueSpan: 10000,
|
|
81
82
|
gridLeft: 60,
|
|
82
83
|
gridTop: 0,
|
|
83
84
|
gridRight: 60,
|
|
@@ -295,6 +296,7 @@ const draw = async (type?: string) => {
|
|
|
295
296
|
type: "inside",
|
|
296
297
|
xAxisIndex: [0, 0],
|
|
297
298
|
zoomLock: config.value.zoomLock,
|
|
299
|
+
maxValueSpan: config.value.maxValueSpan,
|
|
298
300
|
startValue: chartOption.dataZoom[0].startValue + addDataLength,
|
|
299
301
|
endValue: chartOption.dataZoom[0].endValue + addDataLength,
|
|
300
302
|
},
|
|
@@ -506,6 +508,7 @@ const keyDownEvent = (e: KeyboardEvent) => {
|
|
|
506
508
|
type: "dataZoom",
|
|
507
509
|
startValue,
|
|
508
510
|
endValue,
|
|
511
|
+
maxValueSpan: config.value.maxValueSpan,
|
|
509
512
|
});
|
|
510
513
|
};
|
|
511
514
|
const handleRight = () => {
|
|
@@ -518,6 +521,7 @@ const keyDownEvent = (e: KeyboardEvent) => {
|
|
|
518
521
|
type: "dataZoom",
|
|
519
522
|
startValue,
|
|
520
523
|
endValue,
|
|
524
|
+
maxValueSpan: config.value.maxValueSpan,
|
|
521
525
|
});
|
|
522
526
|
} else {
|
|
523
527
|
if (endValue === option.xAxis[0].data.length - 1) {
|
|
@@ -529,6 +533,7 @@ const keyDownEvent = (e: KeyboardEvent) => {
|
|
|
529
533
|
type: "dataZoom",
|
|
530
534
|
startValue,
|
|
531
535
|
endValue,
|
|
536
|
+
maxValueSpan: config.value.maxValueSpan,
|
|
532
537
|
});
|
|
533
538
|
}
|
|
534
539
|
};
|
|
@@ -547,6 +552,7 @@ const keyDownEvent = (e: KeyboardEvent) => {
|
|
|
547
552
|
startValue,
|
|
548
553
|
endValue,
|
|
549
554
|
actionIsWheel: true, // 标记为缩放
|
|
555
|
+
maxValueSpan: config.value.maxValueSpan,
|
|
550
556
|
});
|
|
551
557
|
};
|
|
552
558
|
const handleDown = () => {
|
|
@@ -559,6 +565,7 @@ const keyDownEvent = (e: KeyboardEvent) => {
|
|
|
559
565
|
start,
|
|
560
566
|
end,
|
|
561
567
|
actionIsWheel: true, // 标记为缩放
|
|
568
|
+
maxValueSpan: config.value.maxValueSpan,
|
|
562
569
|
});
|
|
563
570
|
};
|
|
564
571
|
const callBackMap = new Map([
|
package/packages/Kline/option.ts
CHANGED
|
@@ -28,7 +28,7 @@ export const getOption = async (
|
|
|
28
28
|
config: InConfig,
|
|
29
29
|
netPositionData: any
|
|
30
30
|
) => {
|
|
31
|
-
const { totalBarCount, defaultShowBarCount, gridLeft, gridTop, gridRight, gridBottom, zoomLock } = config;
|
|
31
|
+
const { totalBarCount, defaultShowBarCount, maxValueSpan, gridLeft, gridTop, gridRight, gridBottom, zoomLock } = config;
|
|
32
32
|
/**
|
|
33
33
|
* @todo: 1.数据处理
|
|
34
34
|
* @returns {Array<'YYYY-MM-DD HH:mm:ss'>} time 用于X轴的时间数组
|
|
@@ -60,13 +60,6 @@ export const getOption = async (
|
|
|
60
60
|
* @todo: 3.标注点位渲染项处理
|
|
61
61
|
*/
|
|
62
62
|
const markPointData = handlePoint(markData, originData);
|
|
63
|
-
const timePointData = markData.reduce((result, next) => {
|
|
64
|
-
const { data } = next;
|
|
65
|
-
// 无数据直接循环下一组数据
|
|
66
|
-
if (data === null || data.length === 0) return result;
|
|
67
|
-
result.push(...data);
|
|
68
|
-
return result;
|
|
69
|
-
}, []);
|
|
70
63
|
/**
|
|
71
64
|
* @todo: 4.标注点位连线渲染处理
|
|
72
65
|
*/
|
|
@@ -116,10 +109,37 @@ export const getOption = async (
|
|
|
116
109
|
body += `<div>资产持仓净值: ${item.data}</div>`;
|
|
117
110
|
}
|
|
118
111
|
if (item.componentSubType === "candlestick") {
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
// 买卖/开平tooltip渲染逻辑
|
|
113
|
+
markData.forEach((mark) => {
|
|
114
|
+
const { key, data } = mark;
|
|
115
|
+
if (key === "sellBuy") {
|
|
116
|
+
// 买卖点渲染逻辑
|
|
117
|
+
const sellBuy = data.filter((i) => i.time === item.axisValue);
|
|
118
|
+
let buy = 0;
|
|
119
|
+
let sell = 0;
|
|
120
|
+
sellBuy.forEach((i) => {
|
|
121
|
+
if (i.tradeType === "开多" || i.tradeType === "平空") {
|
|
122
|
+
// 买
|
|
123
|
+
buy += i.amount;
|
|
124
|
+
} else {
|
|
125
|
+
// 卖
|
|
126
|
+
sell += i.amount;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
if (buy) {
|
|
130
|
+
body += `<div>买: ${buy}</div>`;
|
|
131
|
+
}
|
|
132
|
+
if (sell) {
|
|
133
|
+
body += `<div>卖: ${sell}</div>`;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (key === "openClose") {
|
|
137
|
+
// 开平点渲染逻辑
|
|
138
|
+
data.forEach((i) => {
|
|
139
|
+
if (i.time === item.axisValue) {
|
|
140
|
+
body += i.tooltip;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
123
143
|
}
|
|
124
144
|
});
|
|
125
145
|
}
|
|
@@ -186,6 +206,7 @@ export const getOption = async (
|
|
|
186
206
|
type: "inside",
|
|
187
207
|
xAxisIndex: [0, 0],
|
|
188
208
|
zoomLock,
|
|
209
|
+
maxValueSpan,
|
|
189
210
|
start: kLine.length >= defaultShowBarCount ? ((kLine.length - defaultShowBarCount) / kLine.length) * 100 : 0,
|
|
190
211
|
end: 99.99,
|
|
191
212
|
// startValue: kLine.length >= defaultShowBarCount ? kLine.length - defaultShowBarCount : 0,
|
package/packages/Kline/type.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface InConfig {
|
|
|
19
19
|
totalBarCount: number // k线总条数
|
|
20
20
|
defaultShowBarCount: number // k线默认展示条数
|
|
21
21
|
preBarCount: number // k线预加载条数,用于计算指标线
|
|
22
|
+
maxValueSpan: number // k线一屏最大数量
|
|
22
23
|
gridLeft: number // k线组件 grid.left
|
|
23
24
|
gridTop: number // k线组件 grid.top
|
|
24
25
|
gridRight: number // k线组件 grid.right
|
|
@@ -108,13 +108,17 @@
|
|
|
108
108
|
upperLabel: {
|
|
109
109
|
padding: [8, 0, 0, 0],
|
|
110
110
|
formatter: (params: any) => {
|
|
111
|
-
return `{title|${params.data.name} ${params.data.labelValue}} {${params.data.percent >= 0 ? 'redPercent' : 'greenPercent'}|${params.data.percent}%}`
|
|
111
|
+
return `{title|${params.data.name} ${params.data.labelValue}} ${params.data.percent === null ? '' : `{${params.data.percent >= 0 ? params.data.percent === 0 ? 'defaultPercent' : 'redPercent' : 'greenPercent'}|${params.data.percent}%}`}`
|
|
112
112
|
},
|
|
113
113
|
rich: {
|
|
114
114
|
title: {
|
|
115
115
|
color: '#fff',
|
|
116
116
|
fontSize: 14,
|
|
117
117
|
},
|
|
118
|
+
defaultPercent: {
|
|
119
|
+
color: '#fff',
|
|
120
|
+
fontSize: 14,
|
|
121
|
+
},
|
|
118
122
|
redPercent: {
|
|
119
123
|
color: 'red',
|
|
120
124
|
fontSize: 14,
|
package/src/pages/Kline/api.ts
CHANGED
|
@@ -77,7 +77,7 @@ export const queryPairedRecordByVariety = async (data: any) => {
|
|
|
77
77
|
return axios({
|
|
78
78
|
method: 'post',
|
|
79
79
|
headers: {
|
|
80
|
-
token: '
|
|
80
|
+
token: 'b1ef55eb206f7ae49b85b528231c5d87',
|
|
81
81
|
},
|
|
82
82
|
url: 'http://192.168.12.49:88/invest/analysis/queryPairedRecordByVariety',
|
|
83
83
|
data
|