st-comp 0.0.133 → 0.0.135
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/KlineBasic.cjs +1 -1
- package/es/KlineBasic.js +707 -640
- package/es/style.css +1 -1
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +194 -194
- package/lib/{index-53e2cd6c.js → index-4f204e72.js} +20341 -20274
- package/lib/{python-cb6db8ac.js → python-4729ac83.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/KlineBasic/index.vue +284 -153
- package/packages/KlineBasic/utils.js +39 -20
- package/src/pages/KlineBasic/api.js +1 -1
- package/src/pages/KlineBasic/index.vue +1 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { stMath } from "st-func";
|
|
2
|
-
import { updateWarningLine } from
|
|
2
|
+
import { updateWarningLine } from "./api";
|
|
3
3
|
|
|
4
4
|
const { round } = stMath;
|
|
5
5
|
|
|
6
6
|
// 获取主图配置
|
|
7
7
|
export const getMainOptions = (chartData, config, startValue, endValue) => {
|
|
8
|
-
const { data, time } = chartData
|
|
9
|
-
const { gridTop, gridRight, gridLeft, maxShowCounts, showSubChart } = config
|
|
8
|
+
const { data, time } = chartData;
|
|
9
|
+
const { gridTop, gridRight, gridLeft, maxShowCounts, showSubChart } = config;
|
|
10
10
|
return {
|
|
11
11
|
animation: false,
|
|
12
12
|
grid: {
|
|
13
13
|
top: `${gridTop}px`,
|
|
14
14
|
right: `${gridRight}px`,
|
|
15
|
-
bottom: showSubChart ?
|
|
15
|
+
bottom: showSubChart ? "6px" : "24px",
|
|
16
16
|
left: `${gridLeft}px`,
|
|
17
17
|
},
|
|
18
18
|
dataZoom: [
|
|
@@ -81,29 +81,44 @@ export const getMainOptions = (chartData, config, startValue, endValue) => {
|
|
|
81
81
|
...chartData.mainIndicator.map((item) => {
|
|
82
82
|
return {
|
|
83
83
|
name: item.key,
|
|
84
|
-
type:
|
|
84
|
+
type: "line",
|
|
85
85
|
silent: true,
|
|
86
|
-
symbol:
|
|
86
|
+
symbol: "none",
|
|
87
87
|
data: item.data,
|
|
88
88
|
lineStyle: {
|
|
89
89
|
width: item.width || 1,
|
|
90
90
|
},
|
|
91
91
|
itemStyle: {
|
|
92
92
|
color: item.color,
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
})
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}),
|
|
96
96
|
],
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
toolbox: {
|
|
98
|
+
show: false,
|
|
99
|
+
},
|
|
100
|
+
brush: {
|
|
101
|
+
xAxisIndex: "all",
|
|
102
|
+
brushLink: "all",
|
|
103
|
+
transformable: false,
|
|
104
|
+
outOfBrush: {
|
|
105
|
+
colorAlpha: 2,
|
|
106
|
+
},
|
|
107
|
+
brushStyle: {
|
|
108
|
+
color: "rgba(255,255,255,0.1)",
|
|
109
|
+
borderColor: "rgba(255,255,255,0.4)",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
};
|
|
99
114
|
|
|
100
115
|
// 获取画线预警配置
|
|
101
116
|
export const getWarningLineOptions = (mainChartIns, warningLineData, props, config, callback) => {
|
|
102
|
-
const { variety, featureId, featureType } = props
|
|
117
|
+
const { variety, featureId, featureType } = props;
|
|
103
118
|
const { gridTop, gridLeft, gridRight } = config;
|
|
104
119
|
return warningLineData.reduce((res, item) => {
|
|
105
120
|
const { warnPrice } = item;
|
|
106
|
-
const y = mainChartIns?.convertToPixel({ yAxisIndex: 0 }, warnPrice)
|
|
121
|
+
const y = mainChartIns?.convertToPixel({ yAxisIndex: 0 }, warnPrice);
|
|
107
122
|
// 位于顶部的预警线不绘制
|
|
108
123
|
if (y <= gridTop) return res;
|
|
109
124
|
// 超出图表的预警线不绘制
|
|
@@ -152,10 +167,14 @@ export const getWarningLineOptions = (mainChartIns, warningLineData, props, conf
|
|
|
152
167
|
ondragstart: (params) => {
|
|
153
168
|
dragStart = params.offsetY; // 记录拖拽开始坐标
|
|
154
169
|
},
|
|
155
|
-
ondrag: params => {
|
|
170
|
+
ondrag: (params) => {
|
|
156
171
|
if (params.target && params.target.childAt(1)) {
|
|
157
|
-
const newValue = mainChartIns.convertFromPixel({ yAxisIndex: 0 }, y + (params.offsetY - dragStart))
|
|
158
|
-
params.target
|
|
172
|
+
const newValue = mainChartIns.convertFromPixel({ yAxisIndex: 0 }, y + (params.offsetY - dragStart));
|
|
173
|
+
params.target
|
|
174
|
+
.childAt(1)
|
|
175
|
+
?.animate("style", false)
|
|
176
|
+
.when(1, { text: round(newValue, 3) })
|
|
177
|
+
.start();
|
|
159
178
|
}
|
|
160
179
|
},
|
|
161
180
|
// 事件:结束拖拽
|
|
@@ -181,7 +200,7 @@ export const getWarningLineOptions = (mainChartIns, warningLineData, props, conf
|
|
|
181
200
|
callback && callback();
|
|
182
201
|
}
|
|
183
202
|
},
|
|
184
|
-
}
|
|
185
|
-
]
|
|
186
|
-
}, [])
|
|
187
|
-
};
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
}, []);
|
|
206
|
+
};
|