hqchart 1.1.12693 → 1.1.12708

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 (229) hide show
  1. package/package.json +15 -47
  2. package/src/jscommon/readmo.txt +2 -2
  3. package/src/jscommon/umychart.resource/js/codemirror/javascript.js +1 -1
  4. package/.babelrc +0 -6
  5. package/.vscode/settings.json +0 -4
  6. package/Makefile +0 -9
  7. package/README.md +0 -452
  8. package/index.js +0 -17
  9. package/postcss.config.js +0 -5
  10. package/src/index.html +0 -18
  11. package/src/jscommon/backup/announcement.png +0 -0
  12. package/src/jscommon/backup/announcement2.png +0 -0
  13. package/src/jscommon/backup/blocktrading.png +0 -0
  14. package/src/jscommon/backup/investor.png +0 -0
  15. package/src/jscommon/backup/pforecast.png +0 -0
  16. package/src/jscommon/backup/research.png +0 -0
  17. package/src/jscommon/backup/tradedetail.png +0 -0
  18. package/src/jscommon/backup/umychart - backup.js +0 -17631
  19. package/src/jscommon/backup/umychart.macro.js +0 -4
  20. package/src/jscommon/backup/umychart.macro.vue.js +0 -3
  21. package/src/jscommon/commonindextree.json +0 -92
  22. package/src/jscommon/index.html +0 -13
  23. package/src/jscommon/jschinamapdata.js +0 -3
  24. package/src/jscommon/phoneHorizontal/hengping.css +0 -283
  25. package/src/jscommon/phoneHorizontal/phone.html +0 -448
  26. package/src/jscommon/phoneHorizontal/rem.js +0 -28
  27. package/src/jscommon/umychart.NetworkFilterTest.js +0 -48803
  28. package/src/jscommon/umychart.aliYunnetwork.js +0 -47
  29. package/src/jscommon/umychart.cninfo.components/readme.txt +0 -1
  30. package/src/jscommon/umychart.complier.js +0 -25293
  31. package/src/jscommon/umychart.complier.node/umychart.complier.controller.js +0 -559
  32. package/src/jscommon/umychart.complier.node/umychart.complier.node.js +0 -7043
  33. package/src/jscommon/umychart.complier.node/umychart.data.node.js +0 -816
  34. package/src/jscommon/umychart.console.js +0 -12
  35. package/src/jscommon/umychart.deal.js +0 -1452
  36. package/src/jscommon/umychart.dragdiv.js +0 -48
  37. package/src/jscommon/umychart.index.data.js +0 -4132
  38. package/src/jscommon/umychart.js +0 -90542
  39. package/src/jscommon/umychart.keyboard.js +0 -1659
  40. package/src/jscommon/umychart.listctrl.js +0 -690
  41. package/src/jscommon/umychart.mind.js +0 -2203
  42. package/src/jscommon/umychart.network.js +0 -44
  43. package/src/jscommon/umychart.news.js +0 -823
  44. package/src/jscommon/umychart.node.build/buildall.bat +0 -1
  45. package/src/jscommon/umychart.node.build/umychart.node.bat +0 -1
  46. package/src/jscommon/umychart.node.build/umychart.node.export.js +0 -40
  47. package/src/jscommon/umychart.regressiontest.js +0 -400
  48. package/src/jscommon/umychart.report.js +0 -5803
  49. package/src/jscommon/umychart.scrollbar.js +0 -1345
  50. package/src/jscommon/umychart.stock.js +0 -4218
  51. package/src/jscommon/umychart.style.js +0 -625
  52. package/src/jscommon/umychart.testdata.js +0 -150
  53. package/src/jscommon/umychart.uniapp.build/buildall.bat +0 -1
  54. package/src/jscommon/umychart.uniapp.build/umychart.bat +0 -1
  55. package/src/jscommon/umychart.uniapp.build/umychart.export.js +0 -70
  56. package/src/jscommon/umychart.user.js +0 -137
  57. package/src/jscommon/umychart.version.js +0 -30
  58. package/src/jscommon/umychart.vue/umychart.aliYunnetwork.vue.js +0 -56
  59. package/src/jscommon/umychart.vue.build/buildall.bat +0 -4
  60. package/src/jscommon/umychart.vue.build/copy_codemirror.bat +0 -2
  61. package/src/jscommon/umychart.vue.build/umychart.aliYunnetwork.vue.export.js +0 -9
  62. package/src/jscommon/umychart.vue.build/umychart.dragdiv.bat +0 -1
  63. package/src/jscommon/umychart.vue.build/umychart.dragdiv.export.js +0 -6
  64. package/src/jscommon/umychart.vue.build/umychart.index.data.bat +0 -1
  65. package/src/jscommon/umychart.vue.build/umychart.index.data.export.js +0 -4
  66. package/src/jscommon/umychart.vue.build/umychart.listctrl.vue.export.js +0 -15
  67. package/src/jscommon/umychart.vue.build/umychart.regressiontest.vue.export.js +0 -7
  68. package/src/jscommon/umychart.vue.build/umychart.regressiontest.wechat.export.js +0 -12
  69. package/src/jscommon/umychart.vue.build/umychart.stock.bat +0 -1
  70. package/src/jscommon/umychart.vue.build/umychart.stock.vue.export.js +0 -16
  71. package/src/jscommon/umychart.vue.build/umychart.testdata.bat +0 -3
  72. package/src/jscommon/umychart.vue.build/umychart.testdata.vue.export.js +0 -7
  73. package/src/jscommon/umychart.vue.build/umychart.vue.bat +0 -8
  74. package/src/jscommon/umychart.vue.build/umychart.vue.export.js +0 -112
  75. package/src/jscommon/umychart.vue.components/empyt.vue +0 -51
  76. package/src/jscommon/umychart.vue.components/historydayline.vue +0 -240
  77. package/src/jscommon/umychart.vue.components/jsloader.adddialog.vue +0 -315
  78. package/src/jscommon/umychart.vue.components/jsloader.vue +0 -93
  79. package/src/jscommon/umychart.vue.components/jsvuecontainer.vue +0 -160
  80. package/src/jscommon/umychart.vue.components/jsvuecontainer2.0.vue +0 -391
  81. package/src/jscommon/umychart.vue.components/login.vue +0 -178
  82. package/src/jscommon/umychart.vue.components/queryContent.vue +0 -750
  83. package/src/jscommon/umychart.vue.components/readme.txt +0 -8
  84. package/src/jscommon/umychart.vue.components/searchsymbol.vue +0 -299
  85. package/src/jscommon/umychart.vue.components/simulatetrade.vue +0 -1471
  86. package/src/jscommon/umychart.vue.components/stockchart.vue +0 -343
  87. package/src/jscommon/umychart.vue.components/stockchartV2.vue +0 -195
  88. package/src/jscommon/umychart.vue.components/stockdeal.vue +0 -358
  89. package/src/jscommon/umychart.vue.components/stockdealcount.vue +0 -262
  90. package/src/jscommon/umychart.vue.components/stockdeallastest.vue +0 -316
  91. package/src/jscommon/umychart.vue.components/stockdrawtool.vue +0 -343
  92. package/src/jscommon/umychart.vue.components/stockfull.vue +0 -355
  93. package/src/jscommon/umychart.vue.components/stockinfo.demo.vue +0 -153
  94. package/src/jscommon/umychart.vue.components/stockinfo.vue +0 -685
  95. package/src/jscommon/umychart.vue.components/stockkline.demo.vue +0 -1904
  96. package/src/jscommon/umychart.vue.components/stockmultiorder.vue +0 -174
  97. package/src/jscommon/umychart.vue.components/stockmultiperiod.vue +0 -222
  98. package/src/jscommon/umychart.vue.components/stockorder.vue +0 -320
  99. package/src/jscommon/umychart.vue.components/stocktradeinfo.demo.vue +0 -250
  100. package/src/jscommon/umychart.vue.components/stocktradeinfo.vue +0 -1907
  101. package/src/jscommon/umychart.vue.components/test.vue +0 -0
  102. package/src/jscommon/umychart.wechat/getDate.wechat.js +0 -91
  103. package/src/jscommon/umychart.wechat/lighter.news.wechat.js +0 -262
  104. package/src/jscommon/umychart.wechat/readme.txt +0 -3
  105. package/src/jscommon/umychart.wechat/umychart.analyze.wechat.js +0 -551
  106. package/src/jscommon/umychart.wechat/umychart.apidraw.wechat.js +0 -126
  107. package/src/jscommon/umychart.wechat/umychart.bigV.wechat.js +0 -2510
  108. package/src/jscommon/umychart.wechat/umychart.chartframe.wechat.js +0 -2942
  109. package/src/jscommon/umychart.wechat/umychart.chartpaint.wechat.js +0 -9752
  110. package/src/jscommon/umychart.wechat/umychart.charttitle.wechat.js +0 -2023
  111. package/src/jscommon/umychart.wechat/umychart.complier.wechat.js +0 -14726
  112. package/src/jscommon/umychart.wechat/umychart.console.wechat.js +0 -8
  113. package/src/jscommon/umychart.wechat/umychart.coordinatedata.wechat.js +0 -3654
  114. package/src/jscommon/umychart.wechat/umychart.data.wechat.js +0 -2243
  115. package/src/jscommon/umychart.wechat/umychart.element.wechart.js +0 -132
  116. package/src/jscommon/umychart.wechat/umychart.explainer.wechat.js +0 -1077
  117. package/src/jscommon/umychart.wechat/umychart.extendchart.wechat.js +0 -1140
  118. package/src/jscommon/umychart.wechat/umychart.framesplit.wechat.js +0 -2247
  119. package/src/jscommon/umychart.wechat/umychart.hqIndexformula.wechat.js +0 -941
  120. package/src/jscommon/umychart.wechat/umychart.index.data.wechat.js +0 -3628
  121. package/src/jscommon/umychart.wechat/umychart.index.wechat.js +0 -4074
  122. package/src/jscommon/umychart.wechat/umychart.klineinfo.wechat.js +0 -836
  123. package/src/jscommon/umychart.wechat/umychart.markethot.js +0 -50
  124. package/src/jscommon/umychart.wechat/umychart.network.wechart.js +0 -62
  125. package/src/jscommon/umychart.wechat/umychart.news.wechat.js +0 -3568
  126. package/src/jscommon/umychart.wechat/umychart.regressiontest.wechat.js +0 -412
  127. package/src/jscommon/umychart.wechat/umychart.report.wechat.js +0 -3983
  128. package/src/jscommon/umychart.wechat/umychart.resource.wechat.js +0 -919
  129. package/src/jscommon/umychart.wechat/umychart.shareimage.wechat.js +0 -681
  130. package/src/jscommon/umychart.wechat/umychart.simulatetrade.wechat.js +0 -238
  131. package/src/jscommon/umychart.wechat/umychart.stock.wechat.js +0 -4035
  132. package/src/jscommon/umychart.wechat/umychart.style.wechat.js +0 -419
  133. package/src/jscommon/umychart.wechat/umychart.uniapp.canvas.helper.js +0 -99
  134. package/src/jscommon/umychart.wechat/umychart.user.wechat.js +0 -588
  135. package/src/jscommon/umychart.wechat/umychart.userlog.wechat.js +0 -240
  136. package/src/jscommon/umychart.wechat/umychart.vedio.wechat.js +0 -112
  137. package/src/jscommon/umychart.wechat/umychart.version.wechat.js +0 -36
  138. package/src/jscommon/umychart.wechat/umychart.wechat.3.0.js +0 -12055
  139. package/src/jscommon/umychart.wechat/umychart.wechat.js +0 -15460
  140. package/src/jscommon/umychart.worker.js +0 -114
  141. package/src/jscommon/umychart.ws.stock.js +0 -110
  142. package/src/jscommon/umychart_python/.vscode/launch.json +0 -15
  143. package/src/jscommon/umychart_python/__init__.py +0 -4
  144. package/src/jscommon/umychart_python/build.cmd +0 -2
  145. package/src/jscommon/umychart_python/setup.py +0 -25
  146. package/src/jscommon/umychart_python/umychart_cache_testcase.py +0 -165
  147. package/src/jscommon/umychart_python/umychart_complier_data.py +0 -781
  148. package/src/jscommon/umychart_python/umychart_complier_help.py +0 -175
  149. package/src/jscommon/umychart_python/umychart_complier_job.py +0 -193
  150. package/src/jscommon/umychart_python/umychart_complier_jsalgorithm.py +0 -4144
  151. package/src/jscommon/umychart_python/umychart_complier_jscomplier.py +0 -177
  152. package/src/jscommon/umychart_python/umychart_complier_jsexecute.py +0 -517
  153. package/src/jscommon/umychart_python/umychart_complier_jsparser.py +0 -864
  154. package/src/jscommon/umychart_python/umychart_complier_jssymboldata.py +0 -1238
  155. package/src/jscommon/umychart_python/umychart_complier_jssymboldata_cache.py +0 -146
  156. package/src/jscommon/umychart_python/umychart_complier_jssymboldata_json.py +0 -106
  157. package/src/jscommon/umychart_python/umychart_complier_pandas_help.py +0 -80
  158. package/src/jscommon/umychart_python/umychart_complier_scanner.py +0 -554
  159. package/src/jscommon/umychart_python/umychart_complier_testcase.py +0 -362
  160. package/src/jscommon/umychart_python/umychart_complier_util.py +0 -30
  161. package/src/jscommon/umychart_python/umychart_webtemplate.py +0 -131
  162. package/src/jscommon/umychart_python/updatehqchartweb.bat +0 -5
  163. package/src/jscommon/vendor.js +0 -2
  164. package/src/pages/block.list.demo.page/App.vue +0 -117
  165. package/src/pages/block.list.demo.page/index.js +0 -12
  166. package/src/pages/brushTool.demo.page/App.vue +0 -19
  167. package/src/pages/brushTool.demo.page/index.js +0 -12
  168. package/src/pages/container.demo.page/App.vue +0 -118
  169. package/src/pages/container.demo.page/index.js +0 -18
  170. package/src/pages/dataZoom.demo.page/App.vue +0 -265
  171. package/src/pages/dataZoom.demo.page/components/dataZoom.vue +0 -303
  172. package/src/pages/dataZoom.demo.page/index.js +0 -12
  173. package/src/pages/historydayline.demo.page/App.vue +0 -57
  174. package/src/pages/historydayline.demo.page/index.js +0 -12
  175. package/src/pages/hq.demo.page/App.vue +0 -163
  176. package/src/pages/hq.demo.page/index.js +0 -12
  177. package/src/pages/hqchart.black/App.vue +0 -90
  178. package/src/pages/hqchart.black/components/searchsymbol.vue +0 -299
  179. package/src/pages/hqchart.black/components/stockdrawtool.vue +0 -300
  180. package/src/pages/hqchart.black/components/stockfull.vue +0 -313
  181. package/src/pages/hqchart.black/components/stockinfo.vue +0 -428
  182. package/src/pages/hqchart.black/components/stockkline.demo.vue +0 -1652
  183. package/src/pages/hqchart.black/components/stocktradeinfo.vue +0 -1337
  184. package/src/pages/hqchart.black/index.js +0 -30
  185. package/src/pages/hqchart.black/router/candlestickChart.vue +0 -108
  186. package/src/pages/hqchart.black/router/pricePointsTable.vue +0 -294
  187. package/src/pages/hqchart.black/router/stockDeallas.vue +0 -417
  188. package/src/pages/hqchart.black/router/timeShareChart.vue +0 -108
  189. package/src/pages/hqchart.page/App.vue +0 -101
  190. package/src/pages/hqchart.page/index.js +0 -18
  191. package/src/pages/index/App.vue +0 -1408
  192. package/src/pages/index/index.js +0 -7
  193. package/src/pages/indexHq/App.vue +0 -110
  194. package/src/pages/indexHq/index.js +0 -18
  195. package/src/pages/login.demo.page/App.vue +0 -22
  196. package/src/pages/login.demo.page/index.js +0 -12
  197. package/src/pages/queryContent.demo.page/App.vue +0 -29
  198. package/src/pages/queryContent.demo.page/index.js +0 -18
  199. package/src/pages/ranking.black/App.vue +0 -199
  200. package/src/pages/ranking.black/index.js +0 -18
  201. package/src/pages/search.demo.page/App.vue +0 -28
  202. package/src/pages/search.demo.page/index.js +0 -12
  203. package/src/pages/simulatetrade.demo.page/app.vue +0 -121
  204. package/src/pages/simulatetrade.demo.page/index.js +0 -17
  205. package/src/pages/stockdeal.demo.page/App.vue +0 -63
  206. package/src/pages/stockdeal.demo.page/index.js +0 -19
  207. package/src/pages/stockdealcount.demo.page/App.vue +0 -37
  208. package/src/pages/stockdealcount.demo.page/index.js +0 -12
  209. package/src/pages/stockdeallastest.demo.page/App.vue +0 -74
  210. package/src/pages/stockdeallastest.demo.page/index.js +0 -18
  211. package/src/pages/stockinfo.demo.page/App.vue +0 -92
  212. package/src/pages/stockinfo.demo.page/index.html +0 -13
  213. package/src/pages/stockinfo.demo.page/index.js +0 -19
  214. package/src/pages/stockkline.demo.page/App.vue +0 -55
  215. package/src/pages/stockkline.demo.page/index.js +0 -18
  216. package/src/pages/stockmultiorder.demo.page/App.vue +0 -149
  217. package/src/pages/stockmultiorder.demo.page/index.js +0 -18
  218. package/src/pages/stockmultiperiod.demo.page/App.vue +0 -87
  219. package/src/pages/stockmultiperiod.demo.page/index.js +0 -18
  220. package/src/pages/stockorder.demo.page/App.vue +0 -69
  221. package/src/pages/stockorder.demo.page/index.js +0 -18
  222. package/src/pages/test/App.vue +0 -22
  223. package/src/pages/test/index.js +0 -7
  224. package/src/pages/tradeinfopage/app.vue +0 -40
  225. package/src/pages/tradeinfopage/index.js +0 -7
  226. package/src/pages/tradeinfopage/tradeinfo.html +0 -12
  227. package/src/utils/urlObj.js +0 -81
  228. package/src/vendor.js +0 -2
  229. package/webpack.config.js +0 -104
@@ -1,1140 +0,0 @@
1
- /*
2
- copyright (c) 2018 jones
3
-
4
- http://www.apache.org/licenses/LICENSE-2.0
5
-
6
- 开源项目 https://github.com/jones2000/HQChart
7
-
8
- jones_2000@163.com
9
-
10
- 图形扩展画法
11
- */
12
- //日志
13
- import { JSConsole } from "./umychart.console.wechat.js"
14
-
15
- //行情数据结构体 及涉及到的行情算法(复权,周期等)
16
- import
17
- {
18
- ChartData, HistoryData,
19
- SingleData, MinuteData,
20
- Guid,
21
- ToFixedPoint,
22
- ToFixedRect,
23
- } from "./umychart.data.wechat.js";
24
-
25
- import
26
- {
27
- JSCommonCoordinateData,
28
- MARKET_SUFFIX_NAME
29
- } from "./umychart.coordinatedata.wechat.js";
30
-
31
- import
32
- {
33
- g_JSChartResource,
34
- JSCHART_LANGUAGE_ID,
35
- g_JSChartLocalization,
36
- } from './umychart.resource.wechat.js'
37
-
38
- import
39
- {
40
- IFrameSplitOperator,
41
- } from './umychart.framesplit.wechat.js'
42
-
43
- function IExtendChartPainting()
44
- {
45
- this.Canvas; //画布
46
- this.ChartBorder; //边框信息
47
- this.ChartFrame; //框架画法
48
- this.Name; //名称
49
- this.Data; // = new ChartData(); //数据区
50
- this.ClassName = 'IExtendChartPainting';
51
- this.IsDynamic = false;
52
- this.IsEraseBG = false; //是否每次画的时候需要擦除K线图背景
53
- this.IsAnimation=false;
54
- this.DrawAfterTitle = false; //是否在动态标题画完以后再画,防止动态标题覆盖
55
-
56
- //上下左右间距
57
- this.Left = 5;
58
- this.Right = 5;
59
- this.Top = 5;
60
- this.Bottom = 5;
61
-
62
- this.Draw = function () { } //画图接口
63
- this.SetOption = function (option) { } //设置参数接口
64
- }
65
-
66
- //K线Tooltip, 显示在左边或右边
67
- function KLineTooltipPaint()
68
- {
69
- this.newMethod = IExtendChartPainting; //派生
70
- this.newMethod();
71
- delete this.newMethod;
72
-
73
- this.IsDynamic = true;
74
- this.IsEraseBG = true;
75
- this.DrawAfterTitle = true;
76
- this.ClassName = 'KLineTooltipPaint';
77
- this.LatestPoint; //手势位置
78
- this.ShowPosition=0; //显示位置 0=左 1=右
79
-
80
- this.BorderColor = g_JSChartResource.TooltipPaint.BorderColor; //边框颜色
81
- this.BGColor = g_JSChartResource.TooltipPaint.BGColor; //背景色
82
- this.TitleColor = g_JSChartResource.TooltipPaint.TitleColor; //标题颜色
83
- this.Font = [g_JSChartResource.TooltipPaint.TitleFont];
84
- this.Mergin={ Left:2, Top:3, Bottom:5, Right:5 };
85
- this.ExtendLineWidth=5;
86
-
87
- this.Width = 50;
88
- this.Height = 100;
89
- this.LineHeight = 15; //行高
90
- this.LineSpace=2; //行间距
91
-
92
- this.Left = 1;
93
- this.Top = 0;
94
-
95
- this.HQChart;
96
- this.KLineTitlePaint;
97
- this.IsHScreen = false; //是否横屏
98
- this.LanguageID = JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;
99
-
100
- this.GetLeft = function ()
101
- {
102
- if (this.IsHScreen)
103
- {
104
- return this.ChartBorder.GetRightEx()-this.Height-this.Top;
105
- }
106
- else
107
- {
108
- if (this.ShowPosition==0)
109
- return this.ChartBorder.GetLeft()+this.Left;
110
- else
111
- return this.ChartBorder.GetRight()-this.Width-this.Left;
112
- }
113
- }
114
-
115
- this.GetTop = function ()
116
- {
117
- if (this.IsHScreen)
118
- {
119
- if (this.ShowPosition==0)
120
- return this.ChartBorder.GetTop()+this.Left;
121
- else
122
- return this.ChartBorder.GetBottom()-this.Width-this.Left;
123
- }
124
- else
125
- {
126
- return this.ChartBorder.GetTopEx()+this.Top;
127
- }
128
- }
129
-
130
- //是否显示
131
- this.IsEnableDraw=function()
132
- {
133
- if (!this.HQChart || !this.HQChart.TitlePaint || !this.HQChart.TitlePaint[0]) return false;
134
-
135
- if (this.HQChart.EnableClickModel)
136
- {
137
- if (this.HQChart.ClickModel.IsShowCorssCursor===false) return false;
138
- }
139
- else if (!this.HQChart.IsOnTouch)
140
- {
141
- return false;
142
- }
143
-
144
- return true;
145
- }
146
-
147
- this.Draw = function ()
148
- {
149
- if (!this.IsEnableDraw()) return;
150
-
151
- this.IsHScreen=this.ChartFrame.IsHScreen===true;
152
- this.KLineTitlePaint = this.HQChart.TitlePaint[0];
153
- var klineData = this.KLineTitlePaint.GetCurrentKLineData();
154
- if (!klineData) return;
155
-
156
- var titleData=this.GetFormatTitle({Data:klineData});
157
- if (!titleData || !IFrameSplitOperator.IsNonEmptyArray(titleData.AryText)) return;
158
-
159
- this.CalculateTooltipSize(titleData);
160
- this.CalculateShowPosition();
161
- this.DrawBG();
162
- this.DrawTooltipData(titleData);
163
- this.DrawBorder();
164
- }
165
-
166
- //[{ Text:, Color, Title:, TitleColor, }]
167
- this.GetFormatTitle=function(data)
168
- {
169
- if (!data || !data.Data) return;
170
-
171
- var item=data.Data;
172
- var upperSymbol;
173
- if (this.HQChart.Symbol) upperSymbol = this.HQChart.Symbol.toUpperCase();
174
- var defaultfloatPrecision = JSCommonCoordinateData.GetfloatPrecision(this.HQChart.Symbol);//价格小数位数
175
- var aryText=[];
176
- var result={ AryText:aryText };
177
- var text, title, color;
178
-
179
- text=IFrameSplitOperator.FormatDateString(item.Date);
180
- aryText.push({ Text:text, Color:this.TitleColor });
181
-
182
- var period = this.HQChart.Period;
183
- if (ChartData.IsMinutePeriod(period, true) && IFrameSplitOperator.IsNumber(item.Time))
184
- {
185
- text = this.HQChart.FormatTimeString(item.Time);
186
- aryText.push({ Text:text, Color:this.TitleColor });
187
- }
188
- else if (ChartData.IsSecondPeriod(period) && IFrameSplitOperator.IsNumber(item.Time))
189
- {
190
- text = this.HQChart.FormatTimeString(item.Time,"HH:MM:SS");
191
- aryText.push({ Text:text, Color:this.TitleColor });
192
- }
193
-
194
- if (IFrameSplitOperator.IsNumber(item.Open)) //开
195
- {
196
- title = g_JSChartLocalization.GetText('Tooltip-Open', this.LanguageID);
197
- var color = this.KLineTitlePaint.GetColor(item.Open, item.YClose);
198
- text = item.Open.toFixed(defaultfloatPrecision);
199
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:color });
200
- }
201
-
202
- if (IFrameSplitOperator.IsNumber(item.High)) //高
203
- {
204
- title=g_JSChartLocalization.GetText('Tooltip-High',this.LanguageID);
205
- color=this.KLineTitlePaint.GetColor(item.High,item.YClose);
206
- text=item.High.toFixed(defaultfloatPrecision);
207
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:color });
208
- }
209
-
210
- if (IFrameSplitOperator.IsNumber(item.Low)) //低
211
- {
212
- title=g_JSChartLocalization.GetText('Tooltip-Low',this.LanguageID);
213
- color=this.KLineTitlePaint.GetColor(item.Low,item.YClose);
214
- text=item.Low.toFixed(defaultfloatPrecision);
215
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:color });
216
- }
217
-
218
- if (IFrameSplitOperator.IsNumber(item.Close)) //收
219
- {
220
- title=g_JSChartLocalization.GetText('Tooltip-Close',this.LanguageID);
221
- color=this.KLineTitlePaint.GetColor(item.Close,item.YClose);
222
- text=item.Close.toFixed(defaultfloatPrecision);
223
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:color });
224
- }
225
-
226
- //涨幅
227
- title=g_JSChartLocalization.GetText('Tooltip-Increase',this.LanguageID);
228
- if (item.YClose>0)
229
- {
230
- var value = (item.Close - item.YClose) / item.YClose * 100;
231
- color = this.KLineTitlePaint.GetColor(value, 0);
232
- text = value.toFixed(2) + '%';
233
- }
234
- else
235
- {
236
- text='--.--';
237
- color = this.KLineTitlePaint.GetColor(0, 0);
238
- }
239
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:color });
240
-
241
-
242
- if (IFrameSplitOperator.IsNumber(item.Vol))
243
- {
244
- title = g_JSChartLocalization.GetText('Tooltip-Vol', this.LanguageID);
245
- text = this.HQChart.FormatValueString(item.Vol, 2, this.LanguageID);
246
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:this.TitleColor });
247
- }
248
-
249
- if (IFrameSplitOperator.IsNumber(item.Amount))
250
- {
251
- title = g_JSChartLocalization.GetText('Tooltip-Amount',this.LanguageID);
252
- text = this.HQChart.FormatValueString(item.Amount, 2, this.LanguageID);
253
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:this.TitleColor });
254
- }
255
-
256
- //持仓量
257
- if (MARKET_SUFFIX_NAME.IsChinaFutures(upperSymbol) && IFrameSplitOperator.IsNumber(item.Position))
258
- {
259
- title = g_JSChartLocalization.GetText('Tooltip-Position', this.LanguageID);
260
- text = IFrameSplitOperator.FormatValueString(item.Position, 2, this.LanguageID);
261
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:this.TitleColor });
262
- }
263
-
264
- return result;
265
- }
266
-
267
- this.CalculateTooltipSize=function(titleData)
268
- {
269
- this.Canvas.font=this.Font[0];
270
- this.LineHeight=this.Canvas.measureText("擎").width;
271
- var height=0;
272
- var maxTitleWidth=0, maxTextWidth=0, maxLineWidth=0;
273
- for(var i=0; i<titleData.AryText.length; ++i)
274
- {
275
- var item=titleData.AryText[i];
276
-
277
- if (height>0) height+=this.LineSpace;
278
-
279
- var lineWidth=0;
280
- if (item.Title)
281
- {
282
- var textWidth=this.Canvas.measureText(item.Title).width+2;
283
- if (maxTitleWidth<textWidth) maxTitleWidth=textWidth;
284
- lineWidth+=textWidth;
285
- }
286
-
287
- if (item.Text)
288
- {
289
- var textWidth=this.Canvas.measureText(item.Text).width+2;
290
- if (maxTextWidth<textWidth) maxTextWidth=textWidth;
291
- lineWidth+=textWidth;
292
- }
293
-
294
- if (maxLineWidth<lineWidth) maxLineWidth=lineWidth;
295
-
296
- height+=this.LineHeight;
297
- }
298
-
299
- this.Height=height+(this.Mergin.Top+this.Mergin.Bottom);
300
- this.Width=(maxLineWidth)+(this.Mergin.Left+this.Mergin.Right)+this.ExtendLineWidth;
301
-
302
- return { Height:this.Height, Width:this.Width, MaxTitleWidth:maxTitleWidth, MaxTextWidth:maxTextWidth };
303
- }
304
-
305
- //判断显示位置
306
- this.CalculateShowPosition=function()
307
- {
308
- this.ShowPosition=0;
309
- if (!this.LatestPoint) return;
310
-
311
- if(this.IsHScreen)
312
- {
313
- var top=this.ChartBorder.GetTop();
314
- var height=this.ChartBorder.GetHeight();
315
- var yCenter=top+height/2;
316
- if (this.LatestPoint.Y<yCenter) this.ShowPosition=1;
317
- }
318
- else
319
- {
320
- var left=this.ChartBorder.GetLeft();
321
- var width=this.ChartBorder.GetWidth();
322
- var xCenter=left+width/2;
323
- if (this.LatestPoint.X<xCenter) this.ShowPosition=1;
324
- }
325
- }
326
-
327
- this.DrawBorder = function ()
328
- {
329
- var isHScreen = (this.ChartFrame.IsHScreen === true);
330
- var left = this.GetLeft();
331
- var top = this.GetTop();
332
- this.Canvas.strokeStyle = this.BorderColor;
333
- if (isHScreen)
334
- {
335
- this.Canvas.strokeRect(this.HQChart.ToFixedPoint(left), this.HQChart.ToFixedPoint(top),
336
- this.HQChart.ToFixedRect(this.Height), this.HQChart.ToFixedRect(this.Width));
337
- }
338
- else
339
- {
340
- this.Canvas.strokeRect(this.HQChart.ToFixedPoint(left), this.HQChart.ToFixedPoint(top),
341
- this.HQChart.ToFixedRect(this.Width), this.HQChart.ToFixedRect(this.Height));
342
- }
343
- }
344
-
345
- this.DrawBG = function ()
346
- {
347
- var isHScreen = (this.ChartFrame.IsHScreen === true);
348
- var left = this.GetLeft();
349
- var top = this.GetTop();
350
- this.Canvas.fillStyle = this.BGColor;
351
- if (isHScreen) this.Canvas.fillRect(left, top, this.Height, this.Width);
352
- else this.Canvas.fillRect(left, top, this.Width, this.Height);
353
- }
354
-
355
- this.DrawTooltipData = function (titleData)
356
- {
357
- //console.log('[KLineTooltipPaint::DrawKLineData] ', item);
358
- var left = this.GetLeft();
359
- var top = this.GetTop();
360
-
361
- if (this.IsHScreen)
362
- {
363
- this.Canvas.save();
364
- var x = this.GetLeft() + this.Height, y = this.GetTop();
365
-
366
- this.Canvas.translate(x, y);
367
- this.Canvas.rotate(90 * Math.PI / 180);
368
-
369
- //x, y 作为原点
370
- left =0;
371
- top = 0;
372
- }
373
-
374
- this.Canvas.textBaseline="top";
375
- var right=left+this.Width-this.Mergin.Right;
376
- left+=this.Mergin.Left;
377
- top+=this.Mergin.Top;
378
-
379
- for(var i=0; i<titleData.AryText.length; ++i)
380
- {
381
- var item=titleData.AryText[i];
382
-
383
- if (item.Title)
384
- {
385
- this.Canvas.textAlign="left";
386
- this.Canvas.fillStyle=item.TitleColor;
387
- this.Canvas.fillText(item.Title,left,top);
388
- }
389
-
390
- if (item.Text)
391
- {
392
- this.Canvas.textAlign="right";
393
- this.Canvas.fillStyle=item.Color;
394
- this.Canvas.fillText(item.Text,right,top);
395
- }
396
-
397
- top+=this.LineHeight+this.LineSpace;
398
- }
399
-
400
- if (this.IsHScreen) this.Canvas.restore();
401
- }
402
-
403
- //设置参数接口
404
- this.SetOption = function (option)
405
- {
406
- if (option.LineHeight > 0) this.LineHeight = option.LineHeight;
407
- if (option.BGColor) this.BGColor = option.BGColor;
408
- if (option.LanguageID > 0) this.LanguageID = option.LanguageID;
409
- }
410
- }
411
-
412
- function MinuteTooltipPaint()
413
- {
414
- this.newMethod = KLineTooltipPaint; //派生
415
- this.newMethod();
416
- delete this.newMethod;
417
-
418
- this.ClassName = 'MinuteTooltipPaint';
419
- this.IsShowAveragePrice=true;
420
-
421
- this.GetTop=function()
422
- {
423
- if (this.IsHScreen)
424
- {
425
- if (this.ShowPosition==0)
426
- return this.ChartBorder.GetTop()+this.Left;
427
- else
428
- return this.ChartBorder.GetBottom()-this.Width-this.Left;
429
- }
430
- else
431
- {
432
- return this.ChartBorder.GetTop()+this.Top;
433
- }
434
- }
435
-
436
- this.GetLeft=function()
437
- {
438
- if (this.IsHScreen)
439
- {
440
- return this.ChartBorder.GetRight()-this.Height-this.Top;
441
- }
442
- else
443
- {
444
- if (this.ShowPosition==0)
445
- return this.ChartBorder.GetLeft()+this.Left;
446
- else
447
- return this.ChartBorder.GetRight()-this.Width-this.Left;
448
- }
449
- }
450
-
451
- this.GetFormatTitle=function(data)
452
- {
453
- if (!data || !data.Data) return;
454
- var item=data.Data;
455
- var upperSymbol;
456
- if (this.HQChart.Symbol) upperSymbol=this.HQChart.Symbol.toUpperCase();
457
- var defaultfloatPrecision = JSCommonCoordinateData.GetfloatPrecision(this.HQChart.Symbol);//价格小数位数
458
- var isFutures=MARKET_SUFFIX_NAME.IsFutures(upperSymbol); //期货
459
- this.YClose = this.KLineTitlePaint.YClose;
460
- this.YClose=item.YClose;
461
- if (isFutures && IFrameSplitOperator.IsNumber(item.YClearing)) this.YClose=item.YClearing;
462
-
463
- var aryText=[];
464
- var result={ AryText:aryText };
465
- var text, title, color, value;
466
-
467
- if (IFrameSplitOperator.IsNumber(item.Date))
468
- {
469
- text=IFrameSplitOperator.FormatDateString(item.Date);
470
- aryText.push({ Text:text, Color:this.TitleColor });
471
- }
472
-
473
- if (IFrameSplitOperator.IsNumber(item.Time))
474
- {
475
- text=IFrameSplitOperator.FormatTimeString(item.Time);
476
- aryText.push({ Text:text, Color:this.TitleColor });
477
- }
478
-
479
- if (IFrameSplitOperator.IsNumber(item.Close)) //最新
480
- {
481
- title = g_JSChartLocalization.GetText('Tooltip-Price', this.LanguageID);
482
- color = this.KLineTitlePaint.GetColor(item.Close, this.YClose);
483
- text = item.Close.toFixed(defaultfloatPrecision);
484
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:color });
485
- }
486
-
487
- if (IFrameSplitOperator.IsNumber(item.AvPrice) && this.IsShowAveragePrice==true) //均价
488
- {
489
- title = g_JSChartLocalization.GetText('Tooltip-AvPrice', this.LanguageID);
490
- color = this.KLineTitlePaint.GetColor(item.AvPrice, this.YClose);
491
- text = item.AvPrice.toFixed(defaultfloatPrecision);
492
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:color });
493
- }
494
-
495
- if (IFrameSplitOperator.IsNumber(item.Close) && IFrameSplitOperator.IsNumber(this.YClose)) //涨幅
496
- {
497
- title = g_JSChartLocalization.GetText('Tooltip-Increase', this.LanguageID);
498
- value = (item.Close - this.YClose) / this.YClose * 100;
499
- color = this.KLineTitlePaint.GetColor(value, 0);
500
- text = value.toFixed(2) + '%';
501
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:color });
502
- }
503
-
504
- if (IFrameSplitOperator.IsNumber(item.Vol))
505
- {
506
- title = g_JSChartLocalization.GetText('Tooltip-Vol', this.LanguageID);
507
- text = this.HQChart.FormatValueString(item.Vol, 2, this.LanguageID);
508
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:this.TitleColor });
509
- }
510
-
511
- if (IFrameSplitOperator.IsNumber(item.Amount))
512
- {
513
- title = g_JSChartLocalization.GetText('Tooltip-Amount', this.LanguageID);
514
- text = this.HQChart.FormatValueString(item.Amount, 2, this.LanguageID);
515
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:this.TitleColor });
516
- }
517
-
518
- if (MARKET_SUFFIX_NAME.IsChinaFutures(upperSymbol) && IFrameSplitOperator.IsNumber(item.Position)) //持仓量
519
- {
520
- title = g_JSChartLocalization.GetText('Tooltip-Position', this.LanguageID);
521
- text = IFrameSplitOperator.FormatValueString(item.Position, 2, this.LanguageID);
522
- aryText.push({Title:title, TitleColor:this.TitleColor, Text:text, Color:this.TitleColor });
523
- }
524
-
525
- return result;
526
- }
527
-
528
- /*
529
- this.DrawTooltipData = function (item)
530
- {
531
- //console.log('[KLineTooltipPaint::DrawKLineData] ', item);
532
- var defaultfloatPrecision = JSCommonCoordinateData.GetfloatPrecision(this.HQChart.Symbol);//价格小数位数
533
- var left = this.GetLeft() + 2;
534
- var top = this.GetTop() + 3;
535
- this.YClose = this.KLineTitlePaint.YClose;
536
-
537
- if (this.IsHScreen)
538
- {
539
- this.Canvas.save();
540
- var x = this.GetLeft() + this.Height, y = this.GetTop();
541
-
542
- this.Canvas.translate(x, y);
543
- this.Canvas.rotate(90 * Math.PI / 180);
544
-
545
- //x, y 作为原点
546
- left = 2;
547
- top = 3;
548
- }
549
-
550
- this.Canvas.textBaseline = "top";
551
- this.Canvas.textAlign = "left";
552
- this.Canvas.font = this.Font[0];
553
- var labelWidth = this.Canvas.measureText('擎: ').width;
554
-
555
- var aryDateTime = item.DateTime.split(' ');
556
- if (aryDateTime && aryDateTime.length == 2)
557
- {
558
- var text = this.HQChart.FormatDateString(aryDateTime[0]);
559
- this.Canvas.fillStyle = this.TitleColor;
560
- this.Canvas.fillText(text, left, top);
561
-
562
- top += this.LineHeight;
563
- text = this.HQChart.FormatTimeString(aryDateTime[1]);
564
- this.Canvas.fillText(text, left, top);
565
- }
566
-
567
- top += this.LineHeight;
568
- this.Canvas.fillStyle = this.TitleColor;
569
- text = g_JSChartLocalization.GetText('Tooltip-Price', this.LanguageID);
570
- this.Canvas.fillText(text, left, top);
571
- var color = this.KLineTitlePaint.GetColor(item.Close, this.YClose);
572
- text = item.Close.toFixed(defaultfloatPrecision);
573
- this.Canvas.fillStyle = color;
574
- this.Canvas.fillText(text, left + labelWidth, top);
575
-
576
- if (IFrameSplitOperator.IsNumber(item.AvPrice) && this.IsShowAveragePrice==true)
577
- {
578
- top += this.LineHeight;
579
- this.Canvas.fillStyle = this.TitleColor;
580
- text = g_JSChartLocalization.GetText('Tooltip-AvPrice', this.LanguageID);
581
- this.Canvas.fillText(text, left, top);
582
- var color = this.KLineTitlePaint.GetColor(item.AvPrice, this.YClose);
583
- var text = item.AvPrice.toFixed(defaultfloatPrecision);
584
- this.Canvas.fillStyle = color;
585
- this.Canvas.fillText(text, left + labelWidth, top);
586
- }
587
-
588
- top += this.LineHeight;
589
- this.Canvas.fillStyle = this.TitleColor;
590
- text = g_JSChartLocalization.GetText('Tooltip-Increase', this.LanguageID);
591
- this.Canvas.fillText(text, left, top);
592
- var value = (item.Close - this.YClose) / this.YClose * 100;
593
- var color = this.KLineTitlePaint.GetColor(value, 0);
594
- var text = value.toFixed(2) + '%';
595
- this.Canvas.fillStyle = color;
596
- this.Canvas.fillText(text, left + labelWidth, top);
597
-
598
- if (IFrameSplitOperator.IsNumber(item.Vol))
599
- {
600
- this.Canvas.fillStyle = this.TitleColor;
601
- top += this.LineHeight;
602
- text = g_JSChartLocalization.GetText('Tooltip-Vol', this.LanguageID);
603
- this.Canvas.fillText(text, left, top);
604
- var text = this.HQChart.FormatValueString(item.Vol, 2, this.LanguageID);
605
- this.Canvas.fillText(text, left + labelWidth, top);
606
- }
607
-
608
- if (IFrameSplitOperator.IsNumber(item.Amount))
609
- {
610
- top += this.LineHeight;
611
- text = g_JSChartLocalization.GetText('Tooltip-Amount', this.LanguageID);
612
- this.Canvas.fillText(text, left, top);
613
- var text = this.HQChart.FormatValueString(item.Amount, 2, this.LanguageID);
614
- this.Canvas.fillText(text, left + labelWidth, top);
615
- }
616
-
617
- //持仓量
618
- var upperSymbol;
619
- if (this.HQChart.Symbol) upperSymbol = this.HQChart.Symbol.toUpperCase();
620
- if (MARKET_SUFFIX_NAME.IsChinaFutures(upperSymbol) && IFrameSplitOperator.IsNumber(item.Position))
621
- {
622
- this.Canvas.fillStyle = this.TitleColor;
623
- top += this.LineHeight;
624
- text = g_JSChartLocalization.GetText('Tooltip-Position', this.LanguageID);
625
- this.Canvas.fillText(text, left, top);
626
- var text = IFrameSplitOperator.FormatValueString(item.Position, 2, this.LanguageID);
627
- this.Canvas.fillText(text, left + labelWidth, top);
628
- }
629
-
630
-
631
- if (this.IsHScreen) this.Canvas.restore();
632
- }
633
- */
634
- }
635
-
636
-
637
- //////////////////////////////////////////////////////////////////////////////
638
- // 弹幕
639
- //弹幕数据 { X:X偏移, Y:Y偏移, Text:内容, Color:颜色 }
640
- function BarrageList()
641
- {
642
- this.PlayList = []; //正在播放队列
643
- this.Cache = []; //没有播放的弹幕数据
644
- this.MinLineHeight = 40;
645
- this.Height; //高度
646
- this.Step = 1;
647
-
648
- //{Canves:画布, Right:右边坐标, Left:左边坐标, Font:默认字体 }
649
- this.GetPlayList = function (obj)
650
- {
651
- var canves = obj.Canves;
652
- var right = obj.Right;
653
- var left = obj.Left;
654
- var width = right - left;
655
- var isMoveStep = obj.IsMoveStep;
656
-
657
- var list = [];
658
- var yOffset = 0;
659
- for (var i = 0; i < this.PlayList.length; ++i)
660
- {
661
- var ary = this.PlayList[i];
662
- var lineHeight = this.MinLineHeight;
663
- if (ary.Height > this.MinLineHeight) lineHeight = ary.Height;
664
-
665
- var bAddNewItem = true; //是否需要加入新弹幕
666
- var bRemoveFirst = false; //是否删除第1个数据
667
- for (var j = 0; j < ary.Data.length; ++j)
668
- {
669
- var item = ary.Data[j];
670
- var playItem = { X: item.X, Y: yOffset, Text: item.Text, Color: item.Color, Height: lineHeight, Font: item.Font, Info: item.Info };
671
- list.push(playItem);
672
-
673
- if (!isMoveStep) continue;
674
-
675
- if (j == ary.Data.length - 1 && this.Cache.length > 0) //最后一个数据了 判断是否需要增加弹幕
676
- {
677
- bAddNewItem = false;
678
- if (!item.TextWidth)
679
- {
680
- if (item.Font && item.Font.Name) canves.font = item.Font.Name;
681
- else canves.font = obj.Font;
682
- item.TextWidth = canves.measureText(playItem.Text + '擎擎').width;
683
- }
684
-
685
- if (item.X >= item.TextWidth)
686
- bAddNewItem = true;
687
- }
688
- else if (j == 0)
689
- {
690
- bRemoveFirst = false;
691
- if (!item.TextWidth)
692
- {
693
- if (item.Font && item.Font.Name) canves.font = item.Font.Name;
694
- else canves.font = obj.Font;
695
- item.TextWidth = canves.measureText(playItem.Text + '擎擎').width;
696
- }
697
-
698
- if (item.X > width + item.TextWidth) bRemoveFirst = true;
699
- }
700
-
701
- item.X += this.Step;
702
- }
703
-
704
- if (isMoveStep && bAddNewItem && this.Cache.length > 0) //最后一个数据了 判断是否需要增加弹幕
705
- {
706
- var cacheItem = this.Cache.shift();
707
- var newItem = { X: 0, Text: cacheItem.Text, Color: cacheItem.Color, Font: cacheItem.Font, Info: cacheItem.Info };
708
- ary.Data.push(newItem);
709
- }
710
-
711
- if (isMoveStep && bRemoveFirst && ary.Data.length > 0)
712
- {
713
- var removeItem = ary.Data.shift();
714
- this.OnItemPlayEnd(obj.HQChart, removeItem);
715
- }
716
-
717
- yOffset += lineHeight;
718
- }
719
-
720
- return list;
721
- }
722
-
723
- //根据高度计算播放队列个数
724
- this.CacluatePlayLine = function (height)
725
- {
726
- this.Height = height;
727
- var lineCount = parseInt(height / this.MinLineHeight);
728
- if (this.PlayList.length < lineCount)
729
- {
730
- var addCount = lineCount - this.PlayList.length;
731
- for (var i = 0; i < addCount; ++i)
732
- {
733
- this.PlayList.push({ Data: [] });
734
- }
735
- }
736
- else if (this.PlayList.length > lineCount)
737
- {
738
- var removeCount = this.PlayList.length - lineCount;
739
- for (var i = 0; i < removeCount; ++i)
740
- {
741
- var ary = this.PlayList.pop();
742
- for (var j = 0; j < ary.Data.length; ++j)
743
- {
744
- var item = ary.Data[j];
745
- var cacheItem = { Text: item.Text, Color: item.Color, Font: item.Font, Info: item.Info };
746
- this.Cache.unshift(cacheItem);
747
- }
748
- }
749
- }
750
-
751
- JSConsole.Chart.Log(`[BarrageList::CacluatePlayLine] LineCount=${this.PlayList.length} Height=${this.Height}`)
752
- }
753
-
754
- //添加弹幕
755
- this.AddBarrage = function (barrageData)
756
- {
757
- for (var i in barrageData) {
758
- var item = barrageData[i];
759
- this.Cache.push(item);
760
- }
761
- }
762
-
763
- this.OnItemPlayEnd = function (hqChart, item) //单挑弹幕播放完毕
764
- {
765
- //监听事件
766
- var event = hqChart.GetBarrageEvent();
767
- if (!event || !event.Callback) return;
768
-
769
- event.Callback(event, item, this);
770
- }
771
-
772
- this.Count = function () { return this.Cache.length; } //未播放的弹幕个数
773
- }
774
-
775
- //背景图 支持横屏
776
- function BackgroundPaint()
777
- {
778
- this.newMethod = IExtendChartPainting; //派生
779
- this.newMethod();
780
- delete this.newMethod;
781
-
782
- this.ClassName = 'BackgroundPaint';
783
-
784
- this.IsDynamic = false;
785
- this.IsCallbackDraw = true; //在回调函数里绘制, 不在Draw()中绘制
786
-
787
- this.FrameID = 0;
788
- this.Data; //背景数据 { Start:, End:, Color:[] }
789
- this.ID = Guid(); //唯一的ID
790
-
791
- /*
792
- this.Data=
793
- [
794
- { Start:{ Date:20181201 }, End:{ Date:20181230 }, Color:'rgb(44,55,44)' } ,
795
- { Start:{ Date:20190308 }, End:{ Date:20190404 }, Color:['rgb(44,55,255)','rgb(200,55,255)'] }
796
- ]
797
- */
798
-
799
- this.ChartSubFrame;
800
- this.ChartBorder;
801
- this.KData;
802
- this.Period;
803
- this.XPointCount = 0;
804
-
805
- this.SetOption = function (option) //设置
806
- {
807
- if (option.FrameID > 0) this.FrameID = option.FrameID;
808
- if (IFrameSplitOperator.IsObjectExist(option.ID)) this.ID = option.ID;
809
- }
810
-
811
- this.Draw = function ()
812
- {
813
- if (!this.Data || !this.HQChart) return;
814
- if (!this.ChartFrame || !this.ChartFrame.SubFrame || this.ChartFrame.SubFrame.length <= this.FrameID) return;
815
- var klineChart = this.HQChart.ChartPaint[0];
816
- if (!klineChart || !klineChart.Data) return;
817
-
818
- this.ChartSubFrame = this.ChartFrame.SubFrame[this.FrameID].Frame;
819
- this.ChartBorder = this.ChartSubFrame.ChartBorder;
820
- this.KData = klineChart.Data;
821
- this.Period = this.HQChart.Period;
822
- if (!this.KData || this.KData.Data.length <= 0) return;
823
-
824
- var isHScreen = (this.ChartSubFrame.IsHScreen === true);
825
- this.XPointCount = this.ChartSubFrame.XPointCount;
826
- var xPointCount = this.ChartSubFrame.XPointCount;
827
-
828
- var firstKItem = this.KData.Data[this.KData.DataOffset];
829
- var endIndex = this.KData.DataOffset + xPointCount - 1;
830
- if (endIndex >= this.KData.Data.length) endIndex = this.KData.Data.length - 1;
831
- var endKItem = this.KData.Data[endIndex];
832
- var showData = this.GetShowData(firstKItem, endKItem);
833
- if (!showData || showData.length <= 0) return;
834
-
835
- var kLineMap = this.BuildKLineMap();
836
- var bottom = this.ChartBorder.GetBottomEx();
837
- var top = this.ChartBorder.GetTopEx();
838
- var height = this.ChartBorder.GetHeightEx();
839
- if (isHScreen)
840
- {
841
- top = this.ChartBorder.GetRightEx();
842
- bottom = this.ChartBorder.GetLeftEx();
843
- height = this.ChartBorder.GetWidthEx();
844
- }
845
-
846
- for (var i in showData)
847
- {
848
- var item = showData[i];
849
- var rt = this.GetBGCoordinate(item, kLineMap);
850
- if (!rt) continue;
851
-
852
- if (Array.isArray(item.Color))
853
- {
854
- var gradient;
855
- if (isHScreen) gradient = this.Canvas.createLinearGradient(bottom, rt.Left, top, rt.Left);
856
- else gradient = this.Canvas.createLinearGradient(rt.Left, top, rt.Left, bottom);
857
- var offset = 1 / item.Color.length;
858
- for (var i in item.Color)
859
- {
860
- gradient.addColorStop(i * offset, item.Color[i]);
861
- }
862
- this.Canvas.fillStyle = gradient;
863
- }
864
- else
865
- {
866
- this.Canvas.fillStyle = item.Color;
867
- }
868
-
869
- if (isHScreen) this.Canvas.fillRect(ToFixedRect(bottom), ToFixedRect(rt.Left), ToFixedRect(height), ToFixedRect(rt.Width));
870
- else this.Canvas.fillRect(ToFixedRect(rt.Left), ToFixedRect(top), ToFixedRect(rt.Width), ToFixedRect(height));
871
- }
872
- }
873
-
874
- this.GetShowData = function (first, end)
875
- {
876
- var aryData = [];
877
- for (var i in this.Data) {
878
- var item = this.Data[i];
879
- var showItem = {};
880
- if (item.Start.Date >= first.Date && item.Start.Date <= end.Date) showItem.Start = item.Start;
881
- if (item.End.Date >= first.Date && item.End.Date <= end.Date) showItem.End = item.End;
882
- if (showItem.Start || showItem.End)
883
- {
884
- showItem.Color = item.Color;
885
- aryData.push(showItem);
886
- }
887
- }
888
-
889
- return aryData;
890
- }
891
-
892
- this.BuildKLineMap = function ()
893
- {
894
- var isHScreen = (this.ChartSubFrame.IsHScreen === true);
895
- var dataWidth = this.ChartSubFrame.DataWidth;
896
- var distanceWidth = this.ChartSubFrame.DistanceWidth;
897
- var xOffset = this.ChartBorder.GetLeft() + distanceWidth / 2.0 + g_JSChartResource.FrameLeftMargin;
898
- if (isHScreen) xOffset = this.ChartBorder.GetTop() + distanceWidth / 2.0 + g_JSChartResource.FrameLeftMargin;
899
- var chartright = this.ChartBorder.GetRight();
900
- if (isHScreen) chartright = this.ChartBorder.GetBottom();
901
-
902
- var mapKLine = { Data: new Map() }; //Key: date / date time, Value:索引
903
- for (var i = this.KData.DataOffset, j = 0; i < this.KData.Data.length && j < this.XPointCount; ++i, ++j, xOffset += (dataWidth + distanceWidth))
904
- {
905
- var kItem = this.KData.Data[i];
906
- var left = xOffset;
907
- var right = xOffset + dataWidth;
908
- if (right > chartright) break;
909
- var x = left + (right - left) / 2;
910
-
911
- if (j == 0) mapKLine.XLeft = left;
912
- mapKLine.XRight = right;
913
-
914
- var value = { Index: i, ShowIndex: j, X: x, Right: right, Left: left, Date: kItem.Date };
915
- if (ChartData.IsMinutePeriod(this.Period, true))
916
- {
917
- var key = `Date:${kItem.Date} Time:${kItem.Time}`;
918
- value.Time = kItem.Time;
919
- }
920
- else
921
- {
922
- var key = `Date:${kItem.Date}`;
923
- }
924
-
925
- mapKLine.Data.set(key, value);
926
- }
927
-
928
- return mapKLine;
929
- }
930
-
931
- this.GetBGCoordinate = function (item, kLineMap)
932
- {
933
- var xLeft = null, xRight = null;
934
- if (item.Start)
935
- {
936
- if (ChartData.IsMinutePeriod(this.Period, true))
937
- var key = `Date:${item.Start.Date} Time:${item.Start.Time}`;
938
- else
939
- var key = `Date:${item.Start.Date}`;
940
-
941
- if (kLineMap.Data.has(key))
942
- {
943
- var findItem = kLineMap.Data.get(key);
944
- xLeft = findItem.Left;
945
- }
946
- else
947
- {
948
- for (var kItem of kLineMap.Data)
949
- {
950
- var value = kItem[1];
951
- if (value.Date > item.Start.Date)
952
- {
953
- xLeft = value.Left;
954
- break;
955
- }
956
- }
957
- }
958
- }
959
- else
960
- {
961
- xLeft = kLineMap.XLeft;
962
- }
963
-
964
- if (item.End)
965
- {
966
- if (ChartData.IsMinutePeriod(this.Period, true))
967
- var key = `Date:${item.End.Date} Time:${item.End.Time}`;
968
- else
969
- var key = `Date:${item.End.Date}`;
970
-
971
- if (kLineMap.Data.has(key))
972
- {
973
- var findItem = kLineMap.Data.get(key);
974
- xRight = findItem.Right;
975
- }
976
- else
977
- {
978
- var previousX = null;
979
- for (var kItem of kLineMap.Data)
980
- {
981
- var value = kItem[1];
982
- if (value.Date > item.End.Date)
983
- {
984
- xRight = previousX;
985
- break;
986
- }
987
- previousX = value.Right;
988
- }
989
- }
990
- }
991
- else
992
- {
993
- xRight = kLineMap.XRight;
994
- }
995
-
996
- if (xLeft == null || xRight == null) return null;
997
-
998
- return { Left: xLeft, Right: xRight, Width: xRight - xLeft };
999
- }
1000
- }
1001
-
1002
-
1003
- //弹幕
1004
- function BarragePaint()
1005
- {
1006
- this.newMethod = IExtendChartPainting; //派生
1007
- this.newMethod();
1008
- delete this.newMethod;
1009
-
1010
- this.ClassName = 'BarragePaint';
1011
- this.IsAnimation = true;
1012
- this.IsEraseBG = true;
1013
- this.HQChart;
1014
-
1015
- this.Font = g_JSChartResource.Barrage.Font;
1016
- this.TextColor = g_JSChartResource.Barrage.Color;
1017
- this.FontHeight = g_JSChartResource.Barrage.Height;
1018
-
1019
- this.BarrageList = new BarrageList(); //字幕列表
1020
- this.IsMoveStep = false;
1021
-
1022
-
1023
- this.SetOption = function (option) //设置参数接口
1024
- {
1025
- if (option)
1026
- {
1027
- if (option.Step > 0) this.BarrageList.Step = option.Step;
1028
- if (option.MinLineHeight) this.Barrage.MinLineHeight = option.MinLineHeight;
1029
- }
1030
- }
1031
-
1032
- this.DrawHScreen = function ()
1033
- {
1034
- var height = this.ChartBorder.GetWidth();
1035
- var left = this.ChartBorder.GetTop();
1036
- var right = this.ChartBorder.GetBottom();
1037
- var top = this.ChartBorder.GetRightEx();
1038
- var wdith = this.ChartBorder.GetChartWidth();
1039
-
1040
- if (height != this.BarrageList.Height)
1041
- this.BarrageList.CacluatePlayLine(height);
1042
-
1043
- this.Canvas.textBaseline = "middle";
1044
- this.Canvas.textAlign = "left";
1045
-
1046
- var play = this.BarrageList.GetPlayList({ Canves: this.Canvas, Right: right, Left: left, Font: this.Font, IsMoveStep: this.IsMoveStep, HQChart: this.HQChart });
1047
- this.IsMoveStep = false;
1048
- if (!play) return;
1049
-
1050
- this.Canvas.save();
1051
- this.Canvas.translate(this.ChartBorder.GetChartHeight(), 0);
1052
- this.Canvas.rotate(90 * Math.PI / 180);
1053
-
1054
- for (var i = 0; i < play.length; ++i)
1055
- {
1056
- var item = play[i];
1057
- if (item.Color) this.Canvas.fillStyle = item.Color;
1058
- else this.Canvas.fillStyle = this.TextColor;
1059
- if (item.Font) this.Canvas.font = item.Font.Name;
1060
- else this.Canvas.font = this.Font;
1061
-
1062
- var fontHeight = this.FontHeight;
1063
- if (item.Font && item.Font.Height > 0) fontHeight = item.Font.Height;
1064
- var yOffset = item.Y + parseInt((item.Height - fontHeight) / 2);
1065
-
1066
- this.Canvas.fillText(item.Text, right - item.X, top + yOffset);
1067
- }
1068
-
1069
- this.Canvas.restore();
1070
- }
1071
-
1072
- this.Draw = function ()
1073
- {
1074
- if (this.ChartFrame.IsHScreen)
1075
- {
1076
- this.DrawHScreen();
1077
- return;
1078
- }
1079
-
1080
- var left = this.ChartBorder.GetLeft();
1081
- var right = this.ChartBorder.GetRight();
1082
- var top = this.ChartBorder.GetTopEx();
1083
- var height = this.ChartBorder.GetHeight();
1084
-
1085
- if (height != this.BarrageList.Height)
1086
- this.BarrageList.CacluatePlayLine(height);
1087
-
1088
- this.Canvas.textBaseline = "middle";
1089
- this.Canvas.textAlign = "left";
1090
-
1091
- var play = this.BarrageList.GetPlayList({ Canves: this.Canvas, Right: right, Left: left, Font: this.Font, IsMoveStep: this.IsMoveStep, HQChart: this.HQChart });
1092
- this.IsMoveStep = false;
1093
- if (!play) return;
1094
-
1095
- for (var i = 0; i < play.length; ++i)
1096
- {
1097
- var item = play[i];
1098
- if (item.Color) this.Canvas.fillStyle = item.Color;
1099
- else this.Canvas.fillStyle = this.TextColor;
1100
- if (item.Font) this.Canvas.font = item.Font.Name;
1101
- else this.Canvas.font = this.Font;
1102
-
1103
- var fontHeight = this.FontHeight;
1104
- if (item.Font && item.Font.Height > 0) fontHeight = item.Font.Height;
1105
- var yOffset = item.Y + parseInt((item.Height - fontHeight) / 2);
1106
-
1107
- this.Canvas.fillText(item.Text, right - item.X, top + yOffset);
1108
- }
1109
- }
1110
- }
1111
-
1112
- //导出统一使用JSCommon命名空间名
1113
- export
1114
- {
1115
- IExtendChartPainting,
1116
- KLineTooltipPaint,
1117
- BarragePaint,
1118
- MinuteTooltipPaint,
1119
- BackgroundPaint,
1120
- }
1121
- /*
1122
- module.exports =
1123
- {
1124
- JSCommonExtendChartPaint:
1125
- {
1126
- IExtendChartPainting: IExtendChartPainting,
1127
- KLineTooltipPaint: KLineTooltipPaint,
1128
- BarragePaint: BarragePaint,
1129
- MinuteTooltipPaint: MinuteTooltipPaint,
1130
- BackgroundPaint: BackgroundPaint,
1131
- },
1132
-
1133
- //单个类导出
1134
- JSCommonExtendChartPaint_IExtendChartPainting: IExtendChartPainting,
1135
- JSCommonExtendChartPaint_KLineTooltipPaint: KLineTooltipPaint,
1136
- JSCommonExtendChartPaint_BarragePaint: BarragePaint,
1137
- JSCommonExtendChartPaint_MinuteTooltipPaint: MinuteTooltipPaint,
1138
- JSCommonExtendChartPaint_BackgroundPaint: BackgroundPaint,
1139
- };
1140
- */