st-comp 0.0.38 → 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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "st-comp",
3
3
  "public": true,
4
- "version": "0.0.38",
4
+ "version": "0.0.39",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -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
- // 买卖点tooltip渲染逻辑
120
- timePointData.forEach((i) => {
121
- if (i.time === item.axisValue) {
122
- body += i.tooltip;
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
  }
@@ -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,
@@ -77,7 +77,7 @@ export const queryPairedRecordByVariety = async (data: any) => {
77
77
  return axios({
78
78
  method: 'post',
79
79
  headers: {
80
- token: 'e077632625ea4b11506db312e186dd06',
80
+ token: 'b1ef55eb206f7ae49b85b528231c5d87',
81
81
  },
82
82
  url: 'http://192.168.12.49:88/invest/analysis/queryPairedRecordByVariety',
83
83
  data