st-comp 0.0.277 → 0.0.279

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.
Files changed (319) hide show
  1. package/README.md +19 -19
  2. package/es/ChartLayout.cjs +1 -1
  3. package/es/ChartLayout.js +1 -1
  4. package/es/ConfigProvider.cjs +1 -1
  5. package/es/ConfigProvider.js +3 -3
  6. package/es/Contextmenu.cjs +1 -1
  7. package/es/Contextmenu.js +7 -7
  8. package/es/CustomFunction.cjs +2 -2
  9. package/es/CustomFunction.js +514 -308
  10. package/es/FactorWarning.cjs +1 -1
  11. package/es/FactorWarning.js +37 -37
  12. package/es/HeatMap.cjs +1 -1
  13. package/es/HeatMap.js +7 -7
  14. package/es/Kline.cjs +1 -1
  15. package/es/Kline.js +18 -18
  16. package/es/KlineBasic.cjs +1 -1
  17. package/es/KlineBasic.js +93 -93
  18. package/es/KlineConfig.cjs +1 -1
  19. package/es/KlineConfig.js +17 -17
  20. package/es/KlineNew.cjs +1 -1
  21. package/es/KlineNew.js +14 -14
  22. package/es/KlinePlus.cjs +4 -4
  23. package/es/KlinePlus.js +760 -656
  24. package/es/LinearLegend.cjs +1 -1
  25. package/es/LinearLegend.js +1 -1
  26. package/es/Map.cjs +1 -1
  27. package/es/Map.js +1 -1
  28. package/es/MonacoEditor.cjs +1 -1
  29. package/es/MonacoEditor.js +18 -18
  30. package/es/Pagination.cjs +1 -1
  31. package/es/Pagination.js +76 -76
  32. package/es/PasswordPrompt.cjs +1 -1
  33. package/es/PasswordPrompt.js +2 -2
  34. package/es/Pie.cjs +2 -2
  35. package/es/Pie.js +14 -14
  36. package/es/Table.cjs +1 -1
  37. package/es/Table.js +22 -22
  38. package/es/TreeMap.cjs +1 -1
  39. package/es/TreeMap.js +4 -4
  40. package/es/User.cjs +1 -1
  41. package/es/User.js +73 -73
  42. package/es/VarSelectDialog.cjs +2 -2
  43. package/es/VarSelectDialog.js +21 -21
  44. package/es/VarietyAiHelper.cjs +4 -4
  45. package/es/VarietyAiHelper.js +139 -138
  46. package/es/VarietyAutoComplete.cjs +1 -1
  47. package/es/VarietyAutoComplete.js +16 -16
  48. package/es/VarietySearch.cjs +4 -4
  49. package/es/VarietySearch.js +861 -857
  50. package/es/{VarietySelect-6a166293.js → VarietySelect-41daac7b.js} +10 -10
  51. package/es/{VarietySelect-610903f0.cjs → VarietySelect-d58eee29.cjs} +1 -1
  52. package/es/VarietyTextCopy.cjs +2 -2
  53. package/es/VarietyTextCopy.js +25 -25
  54. package/es/VirtualTable.cjs +1 -1
  55. package/es/VirtualTable.js +6 -6
  56. package/es/{_initCloneObject-152b4f4e.js → _initCloneObject-5e73c9c8.js} +2 -2
  57. package/es/{_initCloneObject-76e116d0.cjs → _initCloneObject-a5832933.cjs} +1 -1
  58. package/es/aiTools-229609fb.cjs +2 -0
  59. package/es/aiTools-ce2f9281.js +115 -0
  60. package/es/aiTools.js +179 -176
  61. package/es/{config-provider-4c784baf.cjs → config-provider-06ea6b42.cjs} +1 -1
  62. package/es/{config-provider-7a3aca55.js → config-provider-88b637a8.js} +3 -3
  63. package/es/{dropdown-987c47fb.cjs → dropdown-4ce4c3e2.cjs} +1 -1
  64. package/es/{dropdown-01e09205.js → dropdown-72fbc15d.js} +2 -2
  65. package/es/{el-autocomplete-342ae823.js → el-autocomplete-6cafcdf1.js} +5 -5
  66. package/es/{el-autocomplete-16f66b34.cjs → el-autocomplete-e0857c5b.cjs} +1 -1
  67. package/es/{el-button-13dc915f.cjs → el-button-613e0bb2.cjs} +1 -1
  68. package/es/{el-button-314171a0.js → el-button-94d3de38.js} +3 -3
  69. package/es/{el-checkbox-5899681f.js → el-checkbox-6d4cb393.js} +3 -3
  70. package/es/{el-checkbox-bdf64663.cjs → el-checkbox-e90762df.cjs} +1 -1
  71. package/es/{el-dialog-0ef95df6.cjs → el-dialog-02942e22.cjs} +1 -1
  72. package/es/{el-dialog-86a3eec2.js → el-dialog-5e30161f.js} +4 -4
  73. package/es/{el-form-item-77ef6784.cjs → el-form-item-44f060d8.cjs} +1 -1
  74. package/es/{el-form-item-cda4d93c.js → el-form-item-9e8969ea.js} +5 -5
  75. package/es/{el-input-fa1445ad.js → el-input-342b2def.js} +13 -13
  76. package/es/{el-input-89222943.cjs → el-input-9a9a7f7f.cjs} +1 -1
  77. package/es/{el-input-number-d3338e5e.cjs → el-input-number-65c847d6.cjs} +1 -1
  78. package/es/{el-input-number-8f6dbf74.js → el-input-number-c22b803a.js} +35 -35
  79. package/es/{el-loading-84dde1a8.cjs → el-loading-8179b497.cjs} +1 -1
  80. package/es/{el-loading-9b671203.js → el-loading-bcc51e3d.js} +1 -1
  81. package/es/{el-menu-item-535fef90.js → el-menu-item-339baf6d.js} +21 -21
  82. package/es/{el-menu-item-4531fd0e.cjs → el-menu-item-83186444.cjs} +1 -1
  83. package/es/{el-message-box-621ed2f1.js → el-message-box-035b699c.js} +9 -9
  84. package/es/{el-message-box-f5717070.cjs → el-message-box-c62d3217.cjs} +1 -1
  85. package/es/{el-overlay-23de4324.js → el-overlay-3e17604b.js} +3 -3
  86. package/es/{el-overlay-151708cb.cjs → el-overlay-8f1da9e8.cjs} +1 -1
  87. package/es/{el-popconfirm-b8aa490e.cjs → el-popconfirm-4e32ec1b.cjs} +1 -1
  88. package/es/{el-popconfirm-bcff0aa5.js → el-popconfirm-f8a86e2c.js} +4 -4
  89. package/es/{el-popper-43ec37f4.cjs → el-popper-a4f3ae4d.cjs} +1 -1
  90. package/es/{el-popper-03988662.js → el-popper-fbd0dcea.js} +1 -1
  91. package/es/{el-segmented-db3a86be.js → el-segmented-56bd58a8.js} +2 -2
  92. package/es/{el-segmented-79a1367c.cjs → el-segmented-833ac177.cjs} +1 -1
  93. package/es/{el-select-4bd0010d.js → el-select-44fa547d.js} +8 -8
  94. package/es/{el-select-ec04e7ce.cjs → el-select-70806166.cjs} +1 -1
  95. package/es/{el-table-column-35e47229.cjs → el-table-column-3e2cdfca.cjs} +1 -1
  96. package/es/{el-table-column-7af2bec7.js → el-table-column-b74a857d.js} +9 -9
  97. package/es/{el-tag-bef9e83d.js → el-tag-66c83156.js} +2 -2
  98. package/es/{el-tag-5d5608e0.cjs → el-tag-9c2f329f.cjs} +1 -1
  99. package/es/{el-text-f998902c.js → el-text-034bd3f4.js} +1 -1
  100. package/es/{el-text-abf10fdf.cjs → el-text-6b2374bb.cjs} +1 -1
  101. package/es/index-00f6ca75.cjs +1 -0
  102. package/es/{index-a00e0534.cjs → index-185792a7.cjs} +1 -1
  103. package/es/{index-d1b554ac.js → index-1e2a38ab.js} +2 -2
  104. package/es/{index-0986e373.cjs → index-3153c1db.cjs} +1 -1
  105. package/es/{index-936e7dec.js → index-44a382a5.js} +2 -2
  106. package/es/{index-ce21e2ce.js → index-5216d5f5.js} +5 -5
  107. package/es/{index-7ed0999e.js → index-53cc4e43.js} +720 -716
  108. package/es/{index-cfcd60ca.cjs → index-5c0dd943.cjs} +1 -1
  109. package/es/{index-cfd00899.cjs → index-870b6c9d.cjs} +1 -1
  110. package/es/{index-a83ec4b7.js → index-8c2d7e05.js} +1 -1
  111. package/es/{index-8901a38c.cjs → index-94131fd7.cjs} +30 -30
  112. package/es/{index-db846633.cjs → index-9d16cea8.cjs} +1 -1
  113. package/es/{index-f3f6ee27.js → index-a33b2fb8.js} +178 -178
  114. package/es/{index-2d7ac156.cjs → index-a9246d17.cjs} +17 -17
  115. package/es/{index-60c69dd1.cjs → index-ac8dc53d.cjs} +1 -1
  116. package/es/{index-102edf6c.js → index-c5f2d372.js} +2 -2
  117. package/es/{index-6290ae0f.js → index-c6584658.js} +2 -2
  118. package/es/{index-5c44d71a.js → index-eb96e074.js} +149 -119
  119. package/es/{index-5ed42e9c.js → index-f034b910.js} +2 -2
  120. package/es/{index-c58e90e9.cjs → index-f58b2920.cjs} +1 -1
  121. package/es/{python-6cc6ec1b.js → python-8a1664e6.js} +18 -18
  122. package/es/{python-71f59893.cjs → python-a3db9620.cjs} +1 -1
  123. package/es/style.css +1 -1
  124. package/es/{use-form-common-props-02be4928.cjs → use-form-common-props-ac666630.cjs} +1 -1
  125. package/es/{use-form-common-props-76a09d89.js → use-form-common-props-ed72e914.js} +11 -11
  126. package/es/{use-global-config-31b3ec57.cjs → use-global-config-23472471.cjs} +1 -1
  127. package/es/{use-global-config-0f43458b.js → use-global-config-ee406d58.js} +2 -2
  128. package/es/{validator-ea292506.cjs → validator-366dbf39.cjs} +1 -1
  129. package/es/{validator-0e037618.js → validator-c60a8956.js} +1 -1
  130. package/es/{zh-cn-1227eb8a.js → zh-cn-b59a0910.js} +1 -1
  131. package/es/{zh-cn-0edc7234.cjs → zh-cn-c21d12d8.cjs} +1 -1
  132. package/lib/aiTools.js +179 -176
  133. package/lib/bundle.js +1 -1
  134. package/lib/bundle.umd.cjs +230 -230
  135. package/lib/{index-2a269748.js → index-62fa175a.js} +30149 -29800
  136. package/lib/{python-41da18e5.js → python-4a48fa39.js} +1 -1
  137. package/lib/style.css +1 -1
  138. package/package.json +53 -44
  139. package/auto-imports.d.ts +0 -13
  140. package/components.d.ts +0 -59
  141. package/es/aiTools-a3b095f6.js +0 -113
  142. package/es/aiTools-f36136a4.cjs +0 -2
  143. package/es/index-476c4459.cjs +0 -1
  144. package/index.html +0 -13
  145. package/packages/ChartLayout/index.ts +0 -8
  146. package/packages/ChartLayout/index.vue +0 -63
  147. package/packages/ConfigProvider/index.ts +0 -8
  148. package/packages/ConfigProvider/index.vue +0 -66
  149. package/packages/Contextmenu/index.ts +0 -8
  150. package/packages/Contextmenu/index.vue +0 -134
  151. package/packages/CustomFunction/components/ManageDialog.vue +0 -706
  152. package/packages/CustomFunction/index.ts +0 -8
  153. package/packages/CustomFunction/index.vue +0 -200
  154. package/packages/FactorWarning/index.ts +0 -8
  155. package/packages/FactorWarning/index.vue +0 -754
  156. package/packages/FactorWarning/tools.js +0 -10
  157. package/packages/HeatMap/index.ts +0 -8
  158. package/packages/HeatMap/index.vue +0 -141
  159. package/packages/Kline/components/Contextmenu/index.vue +0 -110
  160. package/packages/Kline/components/Tips/index.vue +0 -40
  161. package/packages/Kline/componentsNew/KlineSlide/index.vue +0 -155
  162. package/packages/Kline/componentsNew/KlineSub/index.vue +0 -297
  163. package/packages/Kline/componentsNew/KlineTips/index.vue +0 -66
  164. package/packages/Kline/componentsNew/KlineUtils/index.vue +0 -84
  165. package/packages/Kline/componentsNew/Tips/index.vue +0 -33
  166. package/packages/Kline/formatKlineData.ts +0 -109
  167. package/packages/Kline/images/buy.svg +0 -1
  168. package/packages/Kline/images/pen.png +0 -0
  169. package/packages/Kline/images/sell.svg +0 -1
  170. package/packages/Kline/images/t.svg +0 -1
  171. package/packages/Kline/index.ts +0 -16
  172. package/packages/Kline/index.vue +0 -891
  173. package/packages/Kline/option.ts +0 -539
  174. package/packages/Kline/type.d.ts +0 -219
  175. package/packages/Kline/utils.ts +0 -682
  176. package/packages/KlineBasic/api.js +0 -58
  177. package/packages/KlineBasic/components/AverageTips/index.vue +0 -33
  178. package/packages/KlineBasic/components/Contextmenu/index.vue +0 -105
  179. package/packages/KlineBasic/components/KlineSub/index.vue +0 -332
  180. package/packages/KlineBasic/components/KlineTips/index.vue +0 -99
  181. package/packages/KlineBasic/components/Tips/index.vue +0 -56
  182. package/packages/KlineBasic/index.ts +0 -8
  183. package/packages/KlineBasic/index.vue +0 -839
  184. package/packages/KlineBasic/utils.js +0 -258
  185. package/packages/KlineConfig/config.js +0 -46
  186. package/packages/KlineConfig/index.ts +0 -8
  187. package/packages/KlineConfig/index.vue +0 -356
  188. package/packages/KlineNew/components/KlineSlide/index.vue +0 -156
  189. package/packages/KlineNew/components/KlineSub/index.vue +0 -335
  190. package/packages/KlineNew/components/KlineTips/index.vue +0 -96
  191. package/packages/KlineNew/components/KlineUtils/index.vue +0 -341
  192. package/packages/KlineNew/components/Tips/index.vue +0 -33
  193. package/packages/KlineNew/index.ts +0 -14
  194. package/packages/KlinePlus/components/SliderChart.vue +0 -208
  195. package/packages/KlinePlus/components/Tips.vue +0 -36
  196. package/packages/KlinePlus/images/buy.svg +0 -1
  197. package/packages/KlinePlus/images/sell.svg +0 -1
  198. package/packages/KlinePlus/images/t.svg +0 -1
  199. package/packages/KlinePlus/index.ts +0 -8
  200. package/packages/KlinePlus/index.vue +0 -1067
  201. package/packages/KlinePlus/utils.js +0 -771
  202. package/packages/LinearLegend/index.ts +0 -8
  203. package/packages/LinearLegend/index.vue +0 -112
  204. package/packages/Map/China.json +0 -1
  205. package/packages/Map/index.ts +0 -8
  206. package/packages/Map/index.vue +0 -147
  207. package/packages/MonacoEditor/index.ts +0 -8
  208. package/packages/MonacoEditor/index.vue +0 -1141
  209. package/packages/MonacoEditor/tools.js +0 -18
  210. package/packages/Pagination/index.ts +0 -8
  211. package/packages/Pagination/index.vue +0 -87
  212. package/packages/PasswordPrompt/index.ts +0 -8
  213. package/packages/PasswordPrompt/index.vue +0 -267
  214. package/packages/Pie/index.ts +0 -8
  215. package/packages/Pie/index.vue +0 -148
  216. package/packages/Table/components/Button/index.vue +0 -61
  217. package/packages/Table/components/Formatter/index.vue +0 -26
  218. package/packages/Table/index.d.ts +0 -0
  219. package/packages/Table/index.ts +0 -8
  220. package/packages/Table/index.vue +0 -133
  221. package/packages/TreeMap/index.ts +0 -8
  222. package/packages/TreeMap/index.vue +0 -186
  223. package/packages/User/components/EditInfoDialog/Mobile.vue +0 -214
  224. package/packages/User/components/EditInfoDialog/index.vue +0 -161
  225. package/packages/User/components/EditPasswordDialog.vue +0 -168
  226. package/packages/User/components/SetPasswordDialog.vue +0 -160
  227. package/packages/User/index.ts +0 -8
  228. package/packages/User/index.vue +0 -117
  229. package/packages/VarSelectDialog/Mock.js +0 -495
  230. package/packages/VarSelectDialog/VarietySelect.vue +0 -78
  231. package/packages/VarSelectDialog/index.ts +0 -8
  232. package/packages/VarSelectDialog/index.vue +0 -323
  233. package/packages/VarietyAiHelper/images/like.png +0 -0
  234. package/packages/VarietyAiHelper/images/like_no.png +0 -0
  235. package/packages/VarietyAiHelper/index.ts +0 -8
  236. package/packages/VarietyAiHelper/index.vue +0 -910
  237. package/packages/VarietyAutoComplete/index.ts +0 -8
  238. package/packages/VarietyAutoComplete/index.vue +0 -89
  239. package/packages/VarietySearch/components/AddTag/index.vue +0 -268
  240. package/packages/VarietySearch/components/CommonIndicator/IndicatorTags.vue +0 -52
  241. package/packages/VarietySearch/components/CommonIndicator/index.vue +0 -697
  242. package/packages/VarietySearch/components/CommonIndicator/tools.js +0 -260
  243. package/packages/VarietySearch/components/CompositeOrder/index.vue +0 -260
  244. package/packages/VarietySearch/components/FactorScreen/FactorDescription.vue +0 -70
  245. package/packages/VarietySearch/components/FactorScreen/index.vue +0 -1158
  246. package/packages/VarietySearch/components/FactorScreen/tools.js +0 -34
  247. package/packages/VarietySearch/config.js +0 -539
  248. package/packages/VarietySearch/index.ts +0 -8
  249. package/packages/VarietySearch/index.vue +0 -688
  250. package/packages/VarietyTextCopy/index.ts +0 -8
  251. package/packages/VarietyTextCopy/index.vue +0 -136
  252. package/packages/VirtualTable/index.ts +0 -8
  253. package/packages/VirtualTable/index.vue +0 -241
  254. package/packages/index.ts +0 -59
  255. package/public/aiTools.js +0 -176
  256. package/public/talib.wasm +0 -0
  257. package/public/vite.svg +0 -1
  258. package/src/App.vue +0 -140
  259. package/src/assets/vue.svg +0 -1
  260. package/src/components/Dialog/index.vue +0 -16
  261. package/src/components/Kline/index.vue +0 -21
  262. package/src/components/Table/index.vue +0 -27
  263. package/src/main.ts +0 -17
  264. package/src/pages/ChartLayout/index.vue +0 -22
  265. package/src/pages/ConfigProvider/index.vue +0 -9
  266. package/src/pages/Contextmenu/index.vue +0 -46
  267. package/src/pages/CustomFunction/index.vue +0 -13
  268. package/src/pages/FactorWarning/index.vue +0 -203
  269. package/src/pages/HeatMap/index.vue +0 -128
  270. package/src/pages/Kline/index.vue +0 -12
  271. package/src/pages/KlineBasic/api.js +0 -48
  272. package/src/pages/KlineBasic/index.vue +0 -366
  273. package/src/pages/KlineBasic/indicator.js +0 -114
  274. package/src/pages/KlineConfig/index.vue +0 -20
  275. package/src/pages/KlineNew/components/KlineAction/components/ContextMenu/index.vue +0 -91
  276. package/src/pages/KlineNew/components/KlineAction/components/YearChart/index.vue +0 -532
  277. package/src/pages/KlineNew/components/KlineAction/images/pen.png +0 -0
  278. package/src/pages/KlineNew/components/KlineAction/index.vue +0 -716
  279. package/src/pages/KlineNew/components/KlineAction/mockApi/index.js +0 -13
  280. package/src/pages/KlineNew/components/KlineAction/utils.js +0 -571
  281. package/src/pages/KlineNew/components/KlineBasic/index.vue +0 -336
  282. package/src/pages/KlineNew/components/KlineBasic/utils.js +0 -46
  283. package/src/pages/KlineNew/components/KlineNew/index.vue +0 -316
  284. package/src/pages/KlineNew/components/KlineNew/utils.js +0 -31
  285. package/src/pages/KlineNew/components/KlineSlide/index.vue +0 -448
  286. package/src/pages/KlineNew/components/KlineSlide/utils.js +0 -78
  287. package/src/pages/KlineNew/components/KlineSlideNew/index.vue +0 -430
  288. package/src/pages/KlineNew/components/KlineSlideNew/utils.js +0 -78
  289. package/src/pages/KlineNew/index.vue +0 -92
  290. package/src/pages/KlinePlus/KlineDialog/MultiCycle.vue +0 -312
  291. package/src/pages/KlinePlus/KlineDialog/api.js +0 -108
  292. package/src/pages/KlinePlus/KlineDialog/index.vue +0 -582
  293. package/src/pages/KlinePlus/KlineDialog/indicator.js +0 -109
  294. package/src/pages/KlinePlus/KlineDialog/tools.js +0 -86
  295. package/src/pages/KlinePlus/index.vue +0 -30
  296. package/src/pages/KlinePlus/tradeLogMock.js +0 -1927
  297. package/src/pages/LinearLegend/index.vue +0 -92
  298. package/src/pages/Map/index.vue +0 -62
  299. package/src/pages/MonacoEditor/index.vue +0 -63
  300. package/src/pages/Pagination/index.vue +0 -24
  301. package/src/pages/PasswordPrompt/index.vue +0 -12
  302. package/src/pages/Pie/index.vue +0 -36
  303. package/src/pages/Table/index.vue +0 -117
  304. package/src/pages/TreeMap/index.vue +0 -542
  305. package/src/pages/User/index.vue +0 -24
  306. package/src/pages/VarSelectDialog/index.vue +0 -16
  307. package/src/pages/VarietyAiHelper/index.vue +0 -20
  308. package/src/pages/VarietyAutoComplete/index.vue +0 -19
  309. package/src/pages/VarietySearch/api.js +0 -70
  310. package/src/pages/VarietySearch/index.vue +0 -467
  311. package/src/pages/VarietyTextCopy/index.vue +0 -24
  312. package/src/pages/VirtualTable/demo.json +0 -6377
  313. package/src/pages/VirtualTable/index.vue +0 -79
  314. package/src/router/index.ts +0 -9
  315. package/src/router/routes.ts +0 -132
  316. package/src/style.css +0 -79
  317. package/src/vite-env.d.ts +0 -9
  318. package/tsconfig.json +0 -30
  319. package/tsconfig.node.json +0 -10
@@ -1,539 +0,0 @@
1
- import { stMath } from "st-func";
2
- import formatKlineData from "./formatKlineData";
3
- import type { EChartsType } from "echarts";
4
- import type {
5
- KlineDataType,
6
- IndicatorConfigType,
7
- InConfig,
8
- LineDataType,
9
- WarningDataItem,
10
- PositionDataItem,
11
- ConditionDataItem,
12
- GraphicEvent,
13
- } from "./type.d.ts";
14
- import { formatValue, getWarningItem, getPositionItem, getConditionItem, handlePoint } from "./utils";
15
-
16
- /**
17
- * @description: 格式化K线图配置项
18
- * @param {KlineDataType} klineData
19
- * @param {IndicatorConfigType} indicatorConfig
20
- * @param {any} markData
21
- * @param {InConfig} config
22
- *
23
- * @return {option} echarts基础配置
24
- */
25
- export const getOption = async (
26
- klineData: KlineDataType,
27
- markData: any,
28
- indicatorConfig: IndicatorConfigType,
29
- config: InConfig,
30
- netPositionData: any[],
31
- relevanceData: any[],
32
- ) => {
33
- const { totalBarCount, defaultShowBarCount, maxValueSpan, gridLeft, gridTop, gridRight, gridBottom, zoomLock } =
34
- config;
35
- /**
36
- * @todo: 1.数据处理
37
- * @returns {Array<'YYYY-MM-DD HH:mm:ss'>} time 用于X轴的时间数组
38
- * @returns {Array<{开,高,低,收}>} KLine 用于渲染candlestick[K线]
39
- * @returns {Array<{时间,开,高,低,收,成交量,成交额}>} originData 源数据K线
40
- * @returns {Array<{key:'DKX',color:'#FFFFFF',data:[开]}>} indicator 用于渲染line[指标线]
41
- */
42
- const { time, kLine, originData, indicator } = await formatKlineData(klineData, indicatorConfig, totalBarCount);
43
- /**
44
- * @todo: 2.指标线渲染项处理
45
- */
46
- const lineSeries = indicator.map((item) => {
47
- const { key, data, color } = item;
48
- return {
49
- name: key,
50
- type: "line",
51
- silent: true,
52
- symbol: "none",
53
- data,
54
- lineStyle: {
55
- width: 1,
56
- },
57
- itemStyle: {
58
- color,
59
- },
60
- };
61
- });
62
- /**
63
- * @todo: 3.标注点位渲染项处理
64
- */
65
- const markPointData = handlePoint(markData, originData);
66
- /**
67
- * @todo: 4.标注点位连线渲染处理
68
- */
69
- let markLineData = [];
70
- markPointData.forEach((item) => {
71
- if (item.markLineTarget) {
72
- markLineData = [...markLineData, ...item.markLineTarget];
73
- }
74
- });
75
- // -----return------
76
- return {
77
- animation: false,
78
- dataset: {
79
- id: "data",
80
- source: {
81
- klineData: kLine,
82
- indicatorData: indicator,
83
- },
84
- },
85
- grid: {
86
- left: `${gridLeft}px`,
87
- top: `${gridTop}px`,
88
- right: `${gridRight}px`,
89
- bottom: `${gridBottom}px`,
90
- },
91
- tooltip: {
92
- trigger: "axis",
93
- axisPointer: {
94
- type: "cross",
95
- label: {
96
- formatter: (data: any) => {
97
- const { axisDimension, value } = data;
98
- if (axisDimension === "x") {
99
- return value;
100
- } else {
101
- return String(formatValue(value));
102
- }
103
- },
104
- },
105
- },
106
- formatter: (params) => {
107
- let html: null | string = null;
108
- let body: string = "";
109
- params.forEach((item) => {
110
- // 资产持仓净值tooltip渲染逻辑
111
- if (item.seriesName === "资产持仓净值" && item.data !== null) {
112
- body += `<div>资产持仓净值: ${item.data}</div>`;
113
- }
114
- if (item.componentSubType === "candlestick") {
115
- // 买卖/开平tooltip渲染逻辑
116
- markData.forEach((mark) => {
117
- const { key, data } = mark;
118
- if (key === "sellBuy") {
119
- // 买卖点渲染逻辑
120
- const sellBuy = data.filter((i) => i.time === item.axisValue);
121
- let buy = 0;
122
- let sell = 0;
123
- sellBuy.forEach((i) => {
124
- if (i.tradeType === "开多" || i.tradeType === "平空") {
125
- // 买
126
- buy += i.amount;
127
- } else {
128
- // 卖
129
- sell += i.amount;
130
- }
131
- });
132
- if (buy) {
133
- body += `<div>买: ${buy}</div>`;
134
- }
135
- if (sell) {
136
- body += `<div>卖: ${sell}</div>`;
137
- }
138
- }
139
- if (key === "openClose") {
140
- // 开平点渲染逻辑
141
- data.forEach((i) => {
142
- if (i.time === item.axisValue) {
143
- body += i.tooltip;
144
- }
145
- });
146
- }
147
- });
148
- }
149
- if (body) {
150
- html = `<div><span style="font-weight: bold;">${item.axisValue}</span>${body}</div>`;
151
- }
152
- });
153
- return html;
154
- },
155
- },
156
- xAxis: {
157
- type: "category",
158
- data: time,
159
- axisLine: {
160
- show: true,
161
- },
162
- splitLine: {
163
- show: true,
164
- lineStyle: {
165
- type: "dotted",
166
- color: "#333",
167
- },
168
- },
169
- axisLabel: {
170
- show: true,
171
- formatter: (data: string) => data,
172
- },
173
- },
174
- yAxis: [
175
- {
176
- index: 0,
177
- splitLine: {
178
- show: true,
179
- lineStyle: {
180
- type: "dotted",
181
- color: "#333",
182
- },
183
- },
184
- min: (value: any) => {
185
- const { min, max } = value;
186
- const interval = Math.abs((max - min) / 10);
187
- return min - interval;
188
- },
189
- max: (value: any) => {
190
- const { min, max } = value;
191
- const interval = Math.abs((max - min) / 10);
192
- return max + interval;
193
- },
194
- axisLine: {
195
- show: true,
196
- },
197
- axisLabel: {
198
- formatter: (value: number) => formatValue(value),
199
- showMaxLabel: false,
200
- },
201
- },
202
- {
203
- show: false,
204
- min: "dataMin",
205
- },
206
- ],
207
- dataZoom: [
208
- {
209
- type: "inside",
210
- xAxisIndex: [0, 0],
211
- zoomLock,
212
- maxValueSpan,
213
- start: kLine.length >= defaultShowBarCount ? ((kLine.length - defaultShowBarCount) / kLine.length) * 100 : 0,
214
- end: 99.99,
215
- // startValue: kLine.length >= defaultShowBarCount ? kLine.length - defaultShowBarCount : 0,
216
- // endValue: kLine.length - 1,
217
- },
218
- ],
219
- series: [
220
- {
221
- name: "k线",
222
- type: "candlestick",
223
- data: kLine,
224
- markPoint: {
225
- data: markPointData,
226
- },
227
- markLine: {
228
- position: "middle",
229
- textStyle: { color: "blue", fontSize: 15 },
230
- animation: false,
231
- data: markLineData,
232
- lineStyle: {
233
- width: 3,
234
- type: "solid",
235
- },
236
- symbol: ["none", "none"],
237
- },
238
- itemStyle: {
239
- color: "transparent",
240
- color0: "#00FFFF",
241
- borderColor: "#FF0000",
242
- borderColor0: "#00FFFF",
243
- borderWidth: 1,
244
- },
245
- z: 1,
246
- },
247
- ...lineSeries,
248
- {
249
- name: "资产持仓净值",
250
- type: "line",
251
- data: netPositionData ?? [],
252
- symbol: "none",
253
- yAxisIndex: 1,
254
- connectNulls: true,
255
- itemStyle: {
256
- color: "#666",
257
- },
258
- },
259
- {
260
- name: "二腿相关度",
261
- type: "line",
262
- data: relevanceData ?? [],
263
- symbol: "none",
264
- yAxisIndex: 1,
265
- connectNulls: true,
266
- itemStyle: {
267
- color: "#FFF",
268
- },
269
- lineStyle: {
270
- // type: "dashed", // 虚线
271
- width: 2,
272
- },
273
- label: {
274
- show: true, // 显示文字
275
- position: "top", // 文字位置
276
- formatter: (params: any) => {
277
- return `相关度: ${params.data[1]}`;
278
- },
279
- textStyle: {
280
- color: "#FFF", // 文字颜色
281
- fontSize: 14, // 文字字体大小
282
- },
283
- },
284
- }
285
- ],
286
- toolbox: {
287
- show: false,
288
- },
289
- brush: {
290
- xAxisIndex: "all",
291
- brushLink: "all",
292
- transformable: false,
293
- outOfBrush: {
294
- colorAlpha: 1,
295
- },
296
- brushStyle: {
297
- color: "rgba(120,140,180,0)",
298
- borderColor: "rgba(255,255,255,0.4)",
299
- },
300
- },
301
- };
302
- };
303
-
304
- /**
305
- * @description: 格式化其他画线配置项
306
- * @param {LineDataType} data
307
- * @param {InConfig} config
308
- * @param {EChartsType} echartsInstance
309
- *
310
- * @return {graphicType} graphic绘线配置
311
- */
312
- export const getLineOption = (data: LineDataType, config: InConfig, echartsInstance: EChartsType) => {
313
- const { gridLeft, gridRight, gridBottom, warningConfig, positionConfig, conditionConfig, isOpenDS } = config;
314
- let elements: any = [];
315
-
316
- if ((echartsInstance as any)?.getModel()?.getComponent) {
317
- const [minValue, maxValue] = (echartsInstance as any).getModel().getComponent("yAxis").axis.scale._extent;
318
- // -----数据初始化----
319
- let warningData: WarningDataItem[] = [];
320
- let warningEvent: GraphicEvent = {};
321
- let positionData: PositionDataItem[] = [];
322
- let positionEvent: GraphicEvent = {};
323
- let conditionData: ConditionDataItem[] = [];
324
- let conditionEvent: GraphicEvent = {};
325
- data.forEach(({ key, data, ...events }) => {
326
- if (key === "warning") {
327
- warningData = data as WarningDataItem[];
328
- warningEvent = events;
329
- } else if (key === "position") {
330
- positionData = data as PositionDataItem[];
331
- positionEvent = events;
332
- } else if (key === "condition") {
333
- conditionData = data as ConditionDataItem[];
334
- conditionEvent = events;
335
- }
336
- });
337
-
338
- // -----处理预警线-----
339
- if (warningData.length > 0) {
340
- elements = warningData.reduce((res, item: WarningDataItem) => {
341
- const { value, text, info, config } = item;
342
- if (value > maxValue || value < minValue) {
343
- // 当前数值超出图表范围,不绘制
344
- return res;
345
- }
346
- const params = {
347
- y: echartsInstance.convertToPixel({ yAxisIndex: 0 }, value),
348
- text,
349
- info: { info, config: { ...warningConfig, ...config }, event: { ...warningEvent } },
350
- gridLeft,
351
- gridRight,
352
- echartsWidth: echartsInstance.getWidth(),
353
- echartsInstance,
354
- };
355
- return [...res, getWarningItem(params)];
356
- }, elements);
357
- }
358
- // -----处理持仓线-----
359
- if (positionData.length > 0) {
360
- elements = positionData.reduce((res, item: PositionDataItem) => {
361
- const { value, text, info, config } = item;
362
- // 数值超出图表范围的不绘制, 直接return
363
- if (value > maxValue || value < minValue) {
364
- // 当前数值超出图表范围,不绘制
365
- return res;
366
- }
367
- const params = {
368
- y: echartsInstance.convertToPixel({ yAxisIndex: 0 }, value),
369
- text,
370
- info: { info, config: { ...positionConfig, ...config }, event: { ...positionEvent } },
371
- gridLeft,
372
- gridRight,
373
- echartsWidth: echartsInstance.getWidth(),
374
- echartsInstance,
375
- };
376
- return [...res, getPositionItem(params)];
377
- }, elements);
378
- }
379
- // -----处理条件单-----
380
- if (conditionData.length > 0) {
381
- elements = conditionData.reduce((res, item: ConditionDataItem) => {
382
- const { value, text, profitValue, profitText, lossValue, lossText, info, config } = item;
383
- // 数值超出图表范围的不绘制, 直接return
384
- if (value > maxValue || value < minValue) {
385
- return res;
386
- }
387
- const params = {
388
- y: echartsInstance.convertToPixel({ yAxisIndex: 0 }, value),
389
- text,
390
- profitY: echartsInstance.convertToPixel({ yAxisIndex: 0 }, profitValue),
391
- profitText,
392
- lossY: echartsInstance.convertToPixel({ yAxisIndex: 0 }, lossValue),
393
- lossText,
394
- info: { info, config: { ...conditionConfig, ...config }, event: { ...conditionEvent } },
395
- gridLeft,
396
- gridRight,
397
- echartsWidth: echartsInstance.getWidth(),
398
- echartsInstance,
399
- };
400
- return [...res, getConditionItem(params)];
401
- }, elements);
402
- }
403
- // -----处理分布图-----
404
- if (isOpenDS) {
405
- const option = echartsInstance.getOption() as any;
406
- const countKline = option.dataset[0].source.klineData.slice(
407
- option.dataZoom[0].startValue,
408
- option.dataZoom[0].endValue + 1
409
- );
410
- // 1.统计它们的收盘价出现的次数
411
- const countMap = {};
412
- countKline.forEach((item: any) => {
413
- if (countMap[item[1]]) {
414
- countMap[item[1]] += 1;
415
- } else {
416
- countMap[item[1]] = 1;
417
- }
418
- });
419
- const lastKlineValue = countKline[countKline.length - 1][1];
420
- const meanValue =
421
- countKline.reduce((res: number, item: any) => {
422
- return res + item[1];
423
- }, 0) / countKline.length;
424
- const disMeanValue = lastKlineValue - meanValue;
425
- const medianValue = percentToValue(countKline, 1, 50);
426
- const standardDeviationValue = calculateStandardDeviation(countKline);
427
- const disMeanSDValue = standardDeviationValue ? disMeanValue / standardDeviationValue : 0;
428
- const percentileValue = valueToPercent(countKline, 1, lastKlineValue);
429
- // 2.生成对应的分布图配置样式
430
- elements = [
431
- ...elements,
432
- {
433
- type: "group",
434
- draggable: false,
435
- children: Object.keys(countMap).map((key: any) => {
436
- return {
437
- type: "line",
438
- shape: {
439
- x1: echartsInstance.getWidth() - gridRight - 100 * countMap[key],
440
- y1: echartsInstance.convertToPixel({ yAxisIndex: 0 }, key),
441
- x2: echartsInstance.getWidth() - gridRight,
442
- y2: echartsInstance.convertToPixel({ yAxisIndex: 0 }, key),
443
- },
444
- style: {
445
- stroke: "rgb(124,124,124)",
446
- lineWidth: 1,
447
- },
448
- z: 10,
449
- };
450
- }),
451
- },
452
- {
453
- type: "text",
454
- x: gridLeft + 6,
455
- y: echartsInstance.getHeight() - gridBottom - 20,
456
- style: {
457
- fill: "#FFF",
458
- text: `均值: ${formatValue(meanValue)}\xa0\xa0\xa0\xa0距均值: ${formatValue(
459
- disMeanValue
460
- )}\xa0\xa0\xa0\xa0中值: ${formatValue(medianValue)}\xa0\xa0\xa0\xa0标准差: ${formatValue(
461
- standardDeviationValue
462
- )}\xa0\xa0\xa0\xa0距均值/标准差: ${formatValue(disMeanSDValue)}\xa0\xa0\xa0\xa0百分位: ${formatValue(
463
- percentileValue
464
- )}%`,
465
- lineWidth: 1,
466
- opacity: 1,
467
- },
468
- z: 10,
469
- },
470
- ];
471
- }
472
- }
473
-
474
- // -----return------
475
- return { elements };
476
- };
477
-
478
- // 根据值计算分位
479
- const valueToPercent = (data, dataIndex, value) => {
480
- const { round, add, subtract, multiply, divide } = stMath;
481
- const sortData = data.map((i) => i[dataIndex]).sort((a, b) => a - b);
482
- let position = 0;
483
- for (let i = 0; i < sortData.length; i++) {
484
- if (sortData[i] === value) {
485
- // 位置为整数
486
- position = i;
487
- break;
488
- } else if (sortData[i] >= value) {
489
- // 位置为小数
490
- position = add(i, divide(subtract(sortData[i + 1], sortData[i]), sortData[i]));
491
- break;
492
- }
493
- }
494
- return round(divide(multiply(position, 100), data.length + 1));
495
- };
496
- // 根据分位计算值
497
- const percentToValue = (data, dataIndex, percent) => {
498
- const { round, add, subtract, multiply, divide } = stMath;
499
- const sortData = data.map((i) => i[dataIndex]).sort((a, b) => a - b);
500
- const position = multiply(data.length + 1, divide(percent, 100));
501
- const positionInterger = Math.floor(position);
502
- const positionDecimal = subtract(position, positionInterger);
503
- if (positionDecimal === 0) {
504
- // 位置为整数
505
- return round(sortData[position]);
506
- } else {
507
- // 位置为小数
508
- return round(
509
- add(
510
- sortData[positionInterger],
511
- multiply(
512
- subtract(
513
- sortData[positionInterger >= data.length - 1 ? positionInterger : positionInterger + 1],
514
- sortData[positionInterger]
515
- ),
516
- positionDecimal
517
- )
518
- )
519
- );
520
- }
521
- };
522
- // 计算K线数组中数值的标准差
523
- function calculateStandardDeviation(data) {
524
- const numbers = data.map((i) => i[1]);
525
- const n = numbers.length;
526
- let sum = 0;
527
- let squaredSum = 0;
528
- // 计算平均值(均值)
529
- for (const num of numbers) {
530
- sum += num;
531
- }
532
- const mean = sum / n;
533
- // 计算平方和
534
- for (const num of numbers) {
535
- squaredSum += Math.pow(num - mean, 2);
536
- }
537
- // 计算并返回标准差
538
- return Math.sqrt(squaredSum / n);
539
- }