hqchart 1.1.14045 → 1.1.14056

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.
@@ -45,8 +45,9 @@ function JSDialogTooltip()
45
45
 
46
46
  this.KItemCache=null;
47
47
  this.KItemCacheID=null;
48
- this.LastValueCache=null; //最后的鼠标位置对应的数值
49
- this.LastValueCacheID=null;
48
+ this.LastValueCache=null; //最后的鼠标位置对应的数值
49
+ this.LastValueCacheID=null; //鼠标信息
50
+ this.DataID=null; //当前显示的数据时间{ Symbol:, Date:, Time: }
50
51
 
51
52
  this.Inital=function(hqchart, option)
52
53
  {
@@ -86,6 +87,22 @@ function JSDialogTooltip()
86
87
  }
87
88
  }
88
89
 
90
+ //data={ Symbol, Date, Time}
91
+ this.IsEqualDataID=function(data)
92
+ {
93
+ if (!this.DataID) return false;
94
+ if (!data) return false;
95
+
96
+ if (this.DataID.Symbol!=data.Symbol) return false;
97
+ if (this.DataID.Date!=data.Date) return false;
98
+ if (IFrameSplitOperator.IsNumber(this.DataID.Time))
99
+ {
100
+ if (this.DataID.Time!=data.Time) return false;
101
+ }
102
+
103
+ return true;
104
+ }
105
+
89
106
  this.Create=function()
90
107
  {
91
108
  var divDom=document.createElement("div");
@@ -201,9 +218,72 @@ function JSDialogTooltip()
201
218
  this.UpdateStyle();
202
219
  }
203
220
 
221
+ //更新实时数据
222
+ this.UpdateKLineData=function(data)
223
+ {
224
+ if (!data.KItem|| !data.IsShowCorss) return;
225
+
226
+ this.LanguageID=this.HQChart.LanguageID;
227
+
228
+ if (this.HQChart.ClassName=='KLineChartContainer')
229
+ {
230
+ var strKItem=JSON.stringify(data.KItem);
231
+ var bUpdata=false;
232
+ if (this.KItemCacheID!=strKItem) //数据变动的才更新
233
+ {
234
+ this.KItemCache= JSON.parse(strKItem);
235
+ this.KItemCacheID=strKItem;
236
+ bUpdata=true;
237
+ }
238
+
239
+ if (bUpdata)
240
+ {
241
+ this.UpdateTableDOM();
242
+ }
243
+ else
244
+ {
245
+ //JSConsole.Chart.Log(`[JSDialogTooltip::Update] save as KItemCache and KItem`);
246
+ }
247
+ }
248
+ }
249
+
250
+ //更新实时分时数据
251
+ this.UpdateMinuteData=function(data)
252
+ {
253
+ if (!data.MinItem || !data.IsShowCorss) return;
254
+
255
+ var strKItem=JSON.stringify(data.MinItem);
256
+ var bUpdata=false;
257
+ if (this.KItemCacheID!=strKItem) //数据变动的才更新
258
+ {
259
+ this.KItemCache= JSON.parse(strKItem);
260
+ this.KItemCacheID=strKItem;
261
+ bUpdata=true;
262
+ }
263
+
264
+ if (bUpdata)
265
+ {
266
+ this.UpdateTableDOM();
267
+ }
268
+ }
269
+
204
270
  this.Update=function(data)
205
271
  {
206
272
  if (!this.DivDialog || !this.TitleBox) return;
273
+
274
+ //实时数据更新
275
+ if (data.DataType==1)
276
+ {
277
+ this.UpdateKLineData(data);
278
+ return;
279
+ }
280
+ else if (data.DataType==2)
281
+ {
282
+ this.UpdateMinuteData(data);
283
+ return;
284
+ }
285
+
286
+
207
287
  if ((!data.KItem && !data.MinItem) || !data.IsShowCorss || data.ClientPos<0) return;
208
288
 
209
289
  this.LanguageID=this.HQChart.LanguageID;
@@ -228,6 +308,7 @@ function JSDialogTooltip()
228
308
 
229
309
  if (bUpdata)
230
310
  {
311
+ this.UpdateDataID(data);
231
312
  this.UpdateTableDOM();
232
313
  }
233
314
  else
@@ -255,6 +336,7 @@ function JSDialogTooltip()
255
336
 
256
337
  if (bUpdata)
257
338
  {
339
+ this.UpdateDataID(data);
258
340
  this.UpdateTableDOM();
259
341
  }
260
342
  }
@@ -302,6 +384,31 @@ function JSDialogTooltip()
302
384
  }
303
385
  }
304
386
 
387
+ this.UpdateDataID=function(data)
388
+ {
389
+ if (this.HQChart.ClassName=='KLineChartContainer')
390
+ {
391
+ var kItem=data.KItem;
392
+ this.DataID={ Symbol:data.Symbol, Date:kItem.Date, Time:null };
393
+ if (IFrameSplitOperator.IsNumber(kItem.Time)) this.DataID.Time=kItem.Time;
394
+ }
395
+ else if (this.HQChart.ClassName=='MinuteChartContainer')
396
+ {
397
+ var minItem=data.MinItem;
398
+ if (minItem.Type==0) //连续交易
399
+ {
400
+ var item=minItem.Data;
401
+ if (item) this.DataID={ Symbol:data.Symbol, Date:item.Date, Time:item.Time };
402
+ }
403
+ else if (minItem.Type==1) //集合竞价
404
+ {
405
+ var item=minItem.Data.Data;
406
+ if (item) this.DataID={ Symbol:data.Symbol, Date:item.Date, Time:item.Time };
407
+ }
408
+
409
+ }
410
+ }
411
+
305
412
  this.Close=function(e)
306
413
  {
307
414
  if (!this.DivDialog) return;
@@ -447,7 +554,7 @@ function JSDialogTooltip()
447
554
  aryText.push(this.ForamtFClose(data.FClose, defaultfloatPrecision, 'DialogTooltip-FClose'));
448
555
  }
449
556
 
450
- var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_DIALOG_TOOLTIP_TEXT);
557
+ var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_DIALOG_TOOLTIP);
451
558
  if (event && event.Callback)
452
559
  {
453
560
  var sendData={ AryText:aryText, Data:data, Symbol:this.HQChart.Symbol, HQChart:this.HQChart, IsKLine:true };
@@ -455,7 +562,7 @@ function JSDialogTooltip()
455
562
  }
456
563
 
457
564
  return aryText;
458
- },
565
+ }
459
566
 
460
567
  this.GetFormatMinuteTooltipText=function(data)
461
568
  {
@@ -515,7 +622,7 @@ function JSDialogTooltip()
515
622
 
516
623
  }
517
624
 
518
- var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_DIALOG_TOOLTIP_TEXT);
625
+ var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_DIALOG_TOOLTIP);
519
626
  if (event && event.Callback)
520
627
  {
521
628
  var sendData={ AryText:aryText, Data:data, Symbol:this.HQChart.Symbol, HQChart:this.HQChart, IsMinute:true };
@@ -829,4 +936,829 @@ function JSDialogTooltip()
829
936
  }
830
937
 
831
938
 
939
+ }
940
+
941
+ //浮动K线提示信息
942
+ function JSFloatTooltip()
943
+ {
944
+ this.DivDialog=null;
945
+ this.Style=0; //0=一行一个, 1=2行一个
946
+
947
+ this.HQChart=null;
948
+ this.MaxRowCount=25;
949
+
950
+ this.UpColor=g_JSChartResource.UpTextColor;
951
+ this.DownColor=g_JSChartResource.DownTextColor;
952
+ this.UnchangeColor=g_JSChartResource.UnchagneTextColor;
953
+
954
+ this.BGColor=g_JSChartResource.FloatTooltip.BGColor;
955
+ this.BorderColor=g_JSChartResource.FloatTooltip.BorderColor;
956
+
957
+ this.TextColor=g_JSChartResource.FloatTooltip.TextColor;
958
+ this.ValueColor=g_JSChartResource.FloatTooltip.ValueColor;
959
+
960
+ this.VolColor=g_JSChartResource.FloatTooltip.VolColor;
961
+ this.AmountColor=g_JSChartResource.FloatTooltip.AmountColor;
962
+ this.TurnoverRateColor=g_JSChartResource.FloatTooltip.TurnoverRateColor;
963
+ this.PositionColor=g_JSChartResource.FloatTooltip.PositionColor;
964
+ this.DateTimeColor=g_JSChartResource.FloatTooltip.DateTimeColor;
965
+ this.LanguageID=JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;
966
+
967
+ this.ValueAlign=
968
+ {
969
+ Left:"UMyChart_Tooltip_Float_Text2_Span", //左对齐
970
+ MarginLeft:'UMyChart_Tooltip_Float_Text3_Span',
971
+ Right:"UMyChart_Tooltip_Float_Text_Span"
972
+ }
973
+
974
+ this.AryData=[]; //输出文字信息
975
+ this.AryText=[]; //表格tr
976
+
977
+ this.KItemCache=null; //{ Symbol:, Item:, Name }
978
+ this.KItemCacheID=null;
979
+
980
+ this.Inital=function(hqchart, option)
981
+ {
982
+ this.HQChart=hqchart;
983
+ if (option)
984
+ {
985
+ if (IFrameSplitOperator.IsNumber(option.Style)) this.Style=option.Style;
986
+ }
987
+ }
988
+
989
+ this.Destroy=function()
990
+ {
991
+ this.AryData=[];
992
+ this.AryText=[];
993
+ this.KItemCache=null;
994
+ this.KItemCacheID=null;
995
+
996
+ if (this.DivDialog)
997
+ {
998
+ document.body.removeChild(this.DivDialog);
999
+ this.DivDialog=null;
1000
+ }
1001
+ }
1002
+
1003
+ this.Show=function(x, y)
1004
+ {
1005
+ if (!this.DivDialog) return;
1006
+ if (!this.HQChart) return;
1007
+
1008
+ var rtClient=this.HQChart.UIElement.getBoundingClientRect();
1009
+ var left=x+rtClient.left,top=y+rtClient.top;
1010
+ var right=left+this.DivDialog.offsetWidth;
1011
+ var bottom=top+this.DivDialog.offsetHeight;
1012
+
1013
+ if ((right+5)>=window.innerWidth) left=left-this.DivDialog.offsetWidth;
1014
+ if ((bottom+5)>=window.innerHeight) top=0;
1015
+
1016
+ this.DivDialog.style.top = top + "px";
1017
+ this.DivDialog.style.left = left + "px";
1018
+
1019
+ if (this.DivDialog.style.visibility!='visible')
1020
+ this.DivDialog.style.visibility='visible';
1021
+ }
1022
+
1023
+ this.Hide=function()
1024
+ {
1025
+ if (!this.DivDialog) return;
1026
+
1027
+ this.KItemCache=null;
1028
+ this.KItemCacheID=null;
1029
+
1030
+ if (this.DivDialog.style.visibility!='hidden') this.DivDialog.style.visibility='hidden';
1031
+ }
1032
+
1033
+ this.Create=function()
1034
+ {
1035
+ var divDom=document.createElement("div");
1036
+ divDom.className='UMyChart_Tooltip_Float_Div';
1037
+
1038
+ var table=document.createElement("table");
1039
+ table.className="UMyChart_Tooltip_Float_Table";
1040
+ divDom.appendChild(table);
1041
+
1042
+ var tbody=document.createElement("tbody");
1043
+ tbody.className="UMyChart_Tooltip_Float_Tbody";
1044
+ table.appendChild(tbody);
1045
+
1046
+ this.AryData=[];
1047
+
1048
+ for(var i=0;i<this.MaxRowCount;++i)
1049
+ {
1050
+ var rowItem={ Tr:null, TitleSpan:null, TextSpan:null, TitleTd:null, TextTd:null };
1051
+
1052
+ var trDom=document.createElement("tr");
1053
+ trDom.className='UMyChart_Tooltip_Float_Group_Tr';
1054
+ tbody.appendChild(trDom);
1055
+ rowItem.Tr=trDom;
1056
+
1057
+ var tdDom=document.createElement("td");
1058
+ tdDom.className="UMyChart_Tooltip_Float_Title_Td"; //标题
1059
+ trDom.appendChild(tdDom);
1060
+ rowItem.TitleTd=tdDom;
1061
+
1062
+ var spanDom=document.createElement("span");
1063
+ spanDom.className='UMyChart_Tooltip_Float_Title_Span';
1064
+ spanDom.innerText='标题';
1065
+ tdDom.appendChild(spanDom);
1066
+ rowItem.TitleSpan=spanDom;
1067
+
1068
+ var tdDom=document.createElement("td");
1069
+ tdDom.className="UMyChart_Tooltip_Float_Text_Td"; //数值
1070
+ trDom.appendChild(tdDom);
1071
+ rowItem.TextTd=tdDom;
1072
+
1073
+ var spanDom=document.createElement("span");
1074
+ spanDom.className='UMyChart_Tooltip_Float_Text_Span';
1075
+ spanDom.innerText='数值';
1076
+ tdDom.appendChild(spanDom);
1077
+ rowItem.TextSpan=spanDom;
1078
+
1079
+ this.AryData.push(rowItem);
1080
+ }
1081
+
1082
+ document.body.appendChild(divDom);
1083
+
1084
+ this.DivDialog=divDom;
1085
+
1086
+ this.UpdateStyle();
1087
+ }
1088
+
1089
+ this.IsShow=function()
1090
+ {
1091
+ if (!this.DivDialog) return false;
1092
+
1093
+ return this.DivDialog.style.visibility==='visible';
1094
+ }
1095
+
1096
+ //data={ Symbol, Date, Time} 是否是同一条K线
1097
+ this.IsEqualHQID=function(data)
1098
+ {
1099
+ if (!this.KItemCache) return false;
1100
+ if (!data) return false;
1101
+ if (!this.KItemCache.Item) return false;
1102
+
1103
+ var kItem=this.KItemCache.Item;
1104
+ if (this.KItemCache.Symbol!=data.Symbol) return false;
1105
+ if (kItem.Date!=data.Date) return false;
1106
+ if (IFrameSplitOperator.IsNumber(kItem.Time))
1107
+ {
1108
+ if (kItem.Time!=data.Time) return false;
1109
+ }
1110
+
1111
+ return true;
1112
+ }
1113
+
1114
+ this.UpdateStyle=function()
1115
+ {
1116
+ if (!this.DivDialog) return;
1117
+
1118
+ if (this.BGColor) this.DivDialog.style['background-color']=this.BGColor;
1119
+ if (this.BorderColor) this.DivDialog.style['border-color']=this.BorderColor;
1120
+
1121
+ //this.UpdateTableDOM();
1122
+ }
1123
+
1124
+ //更新数据
1125
+ this.Update=function(data)
1126
+ {
1127
+ if (!this.DivDialog) return;
1128
+ this.LanguageID=this.HQChart.LanguageID;
1129
+
1130
+ if (data.DataType==1)
1131
+ {
1132
+ var tooltipData=data.Tooltip;
1133
+ if (!tooltipData) return;
1134
+
1135
+ if (tooltipData.Type==0) //K线信息
1136
+ {
1137
+ this.UpdateKLineToolitp(data);
1138
+ }
1139
+ else if (tooltipData.Type==1) //信息地雷
1140
+ {
1141
+ this.UpdateKLineInfoTooltip(data);
1142
+ }
1143
+ }
1144
+ else if (data.DataType==2) //更新实时行情数据
1145
+ {
1146
+ this.UpdateRealtimeHQTooltip(data);
1147
+ }
1148
+ }
1149
+
1150
+ this.UpdateRealtimeHQTooltip=function(data)
1151
+ {
1152
+ if (!this.KItemCache) return;
1153
+
1154
+ var kItem={ Symbol:data.Symbol, Name:this.KItemCache.Name, Item:data.Data, IsOverlay:this.KItemCache.IsOverlay };
1155
+ var strKItem=JSON.stringify(kItem);
1156
+
1157
+ var bUpdata=false;
1158
+ if (this.KItemCacheID!=strKItem) //数据变动的才更新
1159
+ {
1160
+ this.KItemCache= kItem;
1161
+ this.KItemCacheID=strKItem;
1162
+ this.AryText=this.GetFormatKLineTooltipText(this.KItemCache);
1163
+ bUpdata=true;
1164
+ }
1165
+
1166
+ if (bUpdata)
1167
+ {
1168
+ this.UpdateTableDOM();
1169
+ }
1170
+ }
1171
+
1172
+ //K线提示信息
1173
+ this.UpdateKLineToolitp=function(data)
1174
+ {
1175
+ var tooltipData=data.Tooltip;
1176
+ var symbol=data.Symbol;
1177
+ var name=data.Name;
1178
+ var bOverlay=false; //是否是叠加指标
1179
+ if (tooltipData.ChartPaint.Name=="Overlay-KLine")
1180
+ {
1181
+ symbol=tooltipData.ChartPaint.Symbol;
1182
+ name=tooltipData.ChartPaint.Title;
1183
+ bOverlay=true;
1184
+ }
1185
+
1186
+ var kItem={ Symbol:symbol, Name:name, Item:CloneData(tooltipData.Data), IsOverlay:bOverlay };
1187
+ var strKItem=JSON.stringify(kItem);
1188
+ var bUpdata=false;
1189
+ if (this.KItemCacheID!=strKItem) //数据变动的才更新
1190
+ {
1191
+ this.KItemCache= kItem;
1192
+ this.KItemCacheID=strKItem;
1193
+ this.AryText=this.GetFormatKLineTooltipText(this.KItemCache);
1194
+ bUpdata=true;
1195
+ }
1196
+
1197
+ if (bUpdata)
1198
+ {
1199
+ this.UpdateTableDOM();
1200
+ }
1201
+
1202
+ if (data.Point)
1203
+ {
1204
+ var x=data.Point.X;
1205
+ var y=data.Point.Y+data.Point.YMove;
1206
+ this.Show(x, y);
1207
+ }
1208
+ }
1209
+
1210
+ this.UpdateTableDOM=function()
1211
+ {
1212
+ var index=0;
1213
+ for(index=0;index<this.AryText.length && index<this.MaxRowCount;++index)
1214
+ {
1215
+ var outItem=this.AryText[index];
1216
+ var item=this.AryData[index];
1217
+
1218
+ item.TitleSpan.innerText=outItem.Title;
1219
+ item.TitleSpan.style.color=this.TextColor;
1220
+ item.TextSpan.innerText=outItem.Text;
1221
+ item.TextSpan.style.color=outItem.Color;
1222
+
1223
+ if (outItem.ClassName)
1224
+ {
1225
+ item.TextSpan.className=outItem.ClassName;
1226
+ }
1227
+ else
1228
+ {
1229
+ if (item.TextSpan.className!=this.ValueAlign.Right) item.TextSpan.className=this.ValueAlign.Right;
1230
+ }
1231
+
1232
+ item.Tr.style.display="";
1233
+ if (item.Tr2) item.Tr2.style.display="";
1234
+ }
1235
+
1236
+ for( ; index<this.MaxRowCount; ++index)
1237
+ {
1238
+ var item=this.AryData[index];
1239
+ item.Tr.style.display="none";
1240
+ if (item.Tr2) item.Tr2.style.display="none";
1241
+ }
1242
+ }
1243
+
1244
+
1245
+ this.GetFormatKLineTooltipText=function(kItem)
1246
+ {
1247
+ var data=kItem.Item;
1248
+ var symbol=kItem.Symbol;
1249
+ var upperSymbol=symbol.toUpperCase();
1250
+ var defaultfloatPrecision=GetfloatPrecision(symbol);//价格小数位数
1251
+
1252
+ //日期
1253
+ var dateItem=this.ForamtDate(data.Date,"YYYY/MM/DD/W",'FloatTooltip-Date' );
1254
+
1255
+ //时间
1256
+ var timeItem=null;
1257
+ if (IFrameSplitOperator.IsNumber(data.Time)) timeItem=this.FormatTime(data.Time, this.HQChart.Period, null, 'FloatTooltip-Time');
1258
+
1259
+ var overlayItem=null;
1260
+ if (kItem.IsOverlay)
1261
+ overlayItem={ Title:"", Text:kItem.Name, Color:this.TextColor, ClassName:this.ValueAlign.Left };
1262
+
1263
+
1264
+ var yClose=data.YClose; //昨收价|昨结算价
1265
+ var aryText=
1266
+ [
1267
+ this.ForamtPrice(data.Open,yClose, defaultfloatPrecision,'FloatTooltip-Open'),
1268
+ this.ForamtPrice(data.High,yClose, defaultfloatPrecision,'FloatTooltip-High'),
1269
+ this.ForamtPrice(data.Low,yClose, defaultfloatPrecision,'FloatTooltip-Low'),
1270
+ this.ForamtPrice(data.Close,yClose, defaultfloatPrecision,'FloatTooltip-Close'),
1271
+ this.ForamtPrice(data.YClose,data.YClose, defaultfloatPrecision,'FloatTooltip-YClose'),
1272
+ this.FormatVol(data.Vol,'FloatTooltip-Vol' ),
1273
+ this.FormatAmount(data.Amount,'FloatTooltip-Amount' ),
1274
+ this.FormatIncrease(data.Close,yClose,defaultfloatPrecision,'FloatTooltip-Increase'),
1275
+ this.FormatAmplitude(data.High,data.Low,yClose,defaultfloatPrecision,'FloatTooltip-Amplitude'),
1276
+ ];
1277
+
1278
+ if (timeItem) aryText.unshift(timeItem);
1279
+ aryText.unshift(dateItem);
1280
+ if (overlayItem) aryText.unshift(overlayItem);
1281
+
1282
+ //换手率
1283
+ if (MARKET_SUFFIX_NAME.IsSHSZStockA(upperSymbol) && data.FlowCapital>0)
1284
+ {
1285
+ aryText.push(this.FormatExchange(data.Vol,data.FlowCapital,'FloatTooltip-Exchange' ));
1286
+ }
1287
+
1288
+ //持仓量 结算价
1289
+ if (MARKET_SUFFIX_NAME.IsFutures(upperSymbol))
1290
+ {
1291
+ aryText.push(this.FormatPosition(data.Position,'FloatTooltip-Position'));
1292
+ aryText.push(this.ForamtFClose(data.FClose, defaultfloatPrecision, 'FloatTooltip-FClose'));
1293
+ aryText.push(this.ForamtFClose(data.YFClose, defaultfloatPrecision, 'FloatTooltip-YSettlePrice'));
1294
+
1295
+ }
1296
+
1297
+ var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_KLINE_FLOAT_TOOLTIP);
1298
+ if (event && event.Callback)
1299
+ {
1300
+ var sendData={ AryText:aryText, Data:kItem, HQChart:this.HQChart };
1301
+ event.Callback(event, sendData, this);
1302
+ }
1303
+
1304
+ return aryText;
1305
+ }
1306
+
1307
+
1308
+ //信息地雷
1309
+ this.UpdateKLineInfoTooltip=function(data)
1310
+ {
1311
+ var tooltipData=data.Tooltip;
1312
+ var symbol=data.Symbol;
1313
+ var defaultfloatPrecision=GetfloatPrecision(symbol);//价格小数位数
1314
+
1315
+ var aryData=tooltipData.Data.Data;
1316
+ var aryText=[]; //输出内容
1317
+ for(var i=0;i<aryData.length;++i)
1318
+ {
1319
+ var item=aryData[i];
1320
+ var infoType=item.InfoType;
1321
+ switch(infoType)
1322
+ {
1323
+ case KLINE_INFO_TYPE.BLOCKTRADING:
1324
+ this.FormatBlockTradingText(item, defaultfloatPrecision, aryText);
1325
+ break;
1326
+ case KLINE_INFO_TYPE.TRADEDETAIL:
1327
+ this.FormatTradeDetailText(item,defaultfloatPrecision,aryText);
1328
+ break;
1329
+ case KLINE_INFO_TYPE.RESEARCH:
1330
+ this.FormatResearchText(item, aryText);
1331
+ break;
1332
+ case KLINE_INFO_TYPE.PFORECAST:
1333
+ this.FormatPerformanceForecastText(item,aryText);
1334
+ break;
1335
+ default:
1336
+ this.FormatDefaultKLineInfoText(item, aryText);
1337
+ break;
1338
+ }
1339
+ }
1340
+
1341
+ this.AryText=aryText;
1342
+
1343
+ this.UpdateTableDOM();
1344
+
1345
+ if (data.Point)
1346
+ {
1347
+ var x=data.Point.X;
1348
+ var y=data.Point.Y+data.Point.YMove;
1349
+ this.Show(x, y);
1350
+ }
1351
+ }
1352
+
1353
+
1354
+ /////////////////////////////////////////////////////////////////////////////////////////////
1355
+ // 公告数据格式化
1356
+
1357
+ this.FormatDefaultKLineInfoText=function(item, aryOut)
1358
+ {
1359
+ var title;
1360
+ var strDate=IFrameSplitOperator.FormatDateString(item.Date,"YYYY-MM-DD");
1361
+ if (IFrameSplitOperator.IsNumber(item.Time))
1362
+ {
1363
+ var strTime=IFrameSplitOperator.FormatTimeString(item.Time);
1364
+ title=`${strDate} ${strTime}`;
1365
+ }
1366
+ else
1367
+ {
1368
+ title=strDate;
1369
+ }
1370
+
1371
+ var item=
1372
+ {
1373
+ Title:title, //日期
1374
+ Text:item.Title, //标题
1375
+ Color:this.ValueColor,
1376
+ ClassName:this.ValueAlign.MarginLeft
1377
+ };
1378
+
1379
+ aryOut.push(item);
1380
+ }
1381
+
1382
+ //大宗交易
1383
+ this.FormatBlockTradingText=function(data, floatPrecision, aryOut)
1384
+ {
1385
+ var item={ Title:"", Text:"大宗交易", Color:this.TextColor, ClassName:this.ValueAlign.Left };
1386
+ aryOut.push(item);
1387
+
1388
+ var item={ Title:"日期",Text:IFrameSplitOperator.FormatDateString(data.Date,"YYYY-MM-DD"), Color:this.ValueColor };
1389
+ aryOut.push(item);
1390
+
1391
+ var extendata = data.ExtendData;
1392
+ var item={ Title:"成交价:", Text:extendata.Price.toFixed(floatPrecision), Color:this.ValueColor };
1393
+ aryOut.push(item);
1394
+
1395
+ var item={ Title:"收盘价:", Text:extendata.ClosePrice.toFixed(floatPrecision), Color:this.ValueColor };
1396
+ aryOut.push(item);
1397
+
1398
+ var item={ Title:"溢折价率:", Text:extendata.Premium.toFixed(2), Color:this.GetColor(extendata.Premium,0) };
1399
+ aryOut.push(item);
1400
+
1401
+ var item={ Title:"成交量:", Text:IFrameSplitOperator.FormatValueStringV2(extendata.Vol,0,2,this.LanguageID), Color:this.VolColor };
1402
+ aryOut.push(item);
1403
+ }
1404
+
1405
+ //龙虎榜
1406
+ this.FormatTradeDetailText=function(data, floatPrecision, aryOut)
1407
+ {
1408
+ if (!data.ExtendData) return;
1409
+ var extendata = data.ExtendData;
1410
+ if (!IFrameSplitOperator.IsNonEmptyArray(extendata.Detail)) return;
1411
+
1412
+ var item={ Title:"日期",Text:IFrameSplitOperator.FormatDateString(data.Date,"YYYY-MM-DD"), Color:this.ValueColor, ClassName:this.ValueAlign.MarginLeft };
1413
+ aryOut.push(item);
1414
+
1415
+ for(var i=0;i<extendata.Detail.length;++i)
1416
+ {
1417
+ var resItem=extendata.Detail[i];
1418
+ if (i==0)
1419
+ var item={ Title:"上榜原因:",Text:resItem.TypeExplain, Color:this.ValueColor, ClassName:this.ValueAlign.MarginLeft };
1420
+ else
1421
+ var item={ Title:"",Text:resItem.TypeExplain, Color:this.ValueColor, ClassName:this.ValueAlign.MarginLeft };
1422
+
1423
+ aryOut.push(item);
1424
+ }
1425
+
1426
+ if (extendata.FWeek)
1427
+ {
1428
+ var value=extendata.FWeek.Week1;
1429
+ if (IFrameSplitOperator.IsNumber(value))
1430
+ {
1431
+ var item={ Title:"一周后涨幅:",Text:`${value.toFixed(2)}%`, Color:this.GetColor(value,0), ClassName:this.ValueAlign.MarginLeft };
1432
+ aryOut.push(item);
1433
+ }
1434
+
1435
+ var value=extendata.FWeek.Week4;
1436
+ if (IFrameSplitOperator.IsNumber(value))
1437
+ {
1438
+ var item={ Title:"四周后涨幅:",Text:`${value.toFixed(2)}%`, Color:this.GetColor(value,0), ClassName:this.ValueAlign.MarginLeft };
1439
+ aryOut.push(item);
1440
+ }
1441
+ }
1442
+ }
1443
+
1444
+ //调研
1445
+ this.FormatResearchText=function(data,aryOut)
1446
+ {
1447
+ if (!data.ExtendData) return;
1448
+ var extendata = data.ExtendData;
1449
+
1450
+ var item={ Title:"日期",Text:IFrameSplitOperator.FormatDateString(data.Date,"YYYY-MM-DD"), Color:this.ValueColor, ClassName:this.ValueAlign.MarginLeft };
1451
+ aryOut.push(item);
1452
+
1453
+ if (IFrameSplitOperator.IsNonEmptyArray(extendata.Level))
1454
+ {
1455
+ var strLevel="";
1456
+ for(var i=0;i<extendata.Level.length;++i)
1457
+ {
1458
+ var value=extendata.Level[i];
1459
+ if (strLevel.length>0) strLevel+=",";
1460
+ if(value==0) strLevel+="证券代表";
1461
+ else if(value==1) strLevel+="董秘";
1462
+ else if(value==2) strLevel+="总经理";
1463
+ else if(value==3) strLevel+="董事长";
1464
+ }
1465
+
1466
+ var item={ Title:"接待人员:",Text:strLevel, Color:this.ValueColor, ClassName:this.ValueAlign.MarginLeft };
1467
+ aryOut.push(item);
1468
+ }
1469
+ else
1470
+ {
1471
+ var item={ Title:"接待人员",Text:"----", Color:this.ValueColor, ClassName:this.ValueAlign.MarginLeft };
1472
+ aryOut.push(item);
1473
+ }
1474
+
1475
+ if (extendata.Type)
1476
+ {
1477
+ var item={ Title:"", Text:extendata.Type, Color:this.ValueColor, ClassName:this.ValueAlign.MarginLeft };
1478
+ aryOut.push(item);
1479
+ }
1480
+
1481
+ }
1482
+
1483
+ //业绩预告
1484
+ this.FormatPerformanceForecastText=function(data,aryOut)
1485
+ {
1486
+ if (!data.ExtendData) return;
1487
+ var extendata = data.ExtendData;
1488
+ var reportDate=extendata.ReportDate;
1489
+ if (!reportDate) return;
1490
+
1491
+ var year=parseInt(reportDate/10000); //年份
1492
+ var day=reportDate%10000; //日期
1493
+ var reportType="----";
1494
+ if(day == 1231) reportType = '年报';
1495
+ else if(day == 331) reportType ='一季度报';
1496
+ else if(day == 630) reportType = "半年度报";
1497
+ else if(day == 930) reportType = "三季度报";
1498
+
1499
+ var item={ Title:"业绩预告:",Text:data.Title, Color:this.ValueColor, ClassName:this.ValueAlign.MarginLeft };
1500
+ aryOut.push(item);
1501
+
1502
+ var item={ Title:"年份:",Text:`${year}`, Color:this.ValueColor, ClassName:this.ValueAlign.MarginLeft };
1503
+ aryOut.push(item);
1504
+
1505
+ var item={ Title:"类型:",Text:reportType, Color:this.ValueColor, ClassName:this.ValueAlign.MarginLeft };
1506
+ aryOut.push(item);
1507
+ }
1508
+
1509
+
1510
+ /////////////////////////////////////////////////////////////////////////////////////////////
1511
+ //数据格式化
1512
+ this.ForamtPrice=function(price, yClose, defaultfloatPrecision, TitleID)
1513
+ {
1514
+ var item=
1515
+ {
1516
+ Title:g_JSChartLocalization.GetText(TitleID, this.LanguageID),
1517
+ Text:"--.--",
1518
+ Color:this.ValueColor
1519
+ };
1520
+
1521
+ if (!IFrameSplitOperator.IsNumber(price)) return item;
1522
+
1523
+ item.Text=price.toFixed(defaultfloatPrecision);
1524
+ item.Color=this.GetColor(price, yClose);
1525
+
1526
+ return item;
1527
+ }
1528
+
1529
+ this.ForamtValue=function(value, defaultfloatPrecision, TitleID)
1530
+ {
1531
+ var item=
1532
+ {
1533
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
1534
+ Text:'--',
1535
+ Color:this.ValueColor
1536
+ };
1537
+
1538
+ if (!IFrameSplitOperator.IsNumber(value)) return item;
1539
+
1540
+ item.Text=IFrameSplitOperator.FormatValueStringV2(value,defaultfloatPrecision,2,this.LanguageID);
1541
+ return item;
1542
+ }
1543
+
1544
+ this.FormatVol=function(vol, TitleID)
1545
+ {
1546
+ var item=
1547
+ {
1548
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
1549
+ Text:'--',
1550
+ Color:this.VolColor
1551
+ };
1552
+
1553
+ if (!IFrameSplitOperator.IsNumber(vol)) return item;
1554
+
1555
+ item.Text=IFrameSplitOperator.FormatValueStringV2(vol,0,2,this.LanguageID);
1556
+
1557
+ return item;
1558
+ }
1559
+
1560
+ this.FormatAmount=function(amount, TitleID)
1561
+ {
1562
+ var item=
1563
+ {
1564
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
1565
+ Text:'--',
1566
+ Color:this.AmountColor
1567
+ };
1568
+
1569
+ if (!IFrameSplitOperator.IsNumber(amount)) return item;
1570
+
1571
+ item.Text=IFrameSplitOperator.FormatValueString(amount,2,this.LanguageID);
1572
+
1573
+ return item;
1574
+ }
1575
+
1576
+ this.FormatIncrease=function(price, yClose, defaultfloatPrecision, TitleID)
1577
+ {
1578
+ //涨幅
1579
+ var item=
1580
+ {
1581
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
1582
+ Text:"--.--",
1583
+ Color:this.ValueColor
1584
+ };
1585
+
1586
+ if (!IFrameSplitOperator.IsNumber(price) || !IFrameSplitOperator.IsNumber(yClose)) return item;
1587
+
1588
+ var diffValue=price-yClose;
1589
+ var value=(price-yClose)/yClose;
1590
+
1591
+ item.Text=`${(value*100).toFixed(2)}%`;
1592
+ item.Color=this.GetColor(value,0);
1593
+
1594
+ return item;
1595
+ }
1596
+
1597
+ this.FormatRisefall=function(price, yClose, defaultfloatPrecision, TitleID)
1598
+ {
1599
+ //涨跌
1600
+ var item=
1601
+ {
1602
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
1603
+ Text:"--.--",
1604
+ Color:this.ValueColor
1605
+ };
1606
+
1607
+ if (!IFrameSplitOperator.IsNumber(price) || !IFrameSplitOperator.IsNumber(yClose)) return item;
1608
+
1609
+ var value=price-yClose;
1610
+ item.Text=`${value.toFixed(defaultfloatPrecision)}`;
1611
+ item.Color=this.GetColor(value,0);
1612
+
1613
+ return item;
1614
+ }
1615
+
1616
+ this.FormatAmplitude=function(high, low, yClose, defaultfloatPrecision, TitleID)
1617
+ {
1618
+ //振幅
1619
+ var item=
1620
+ {
1621
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
1622
+ Text:"--.--",
1623
+ Color:this.ValueColor
1624
+ };
1625
+
1626
+
1627
+ if (!IFrameSplitOperator.IsNumber(high) || !IFrameSplitOperator.IsNumber(low) || !IFrameSplitOperator.IsNumber(yClose)) return item;
1628
+
1629
+ var diffValue=high-low;
1630
+ var value=(diffValue)/yClose;
1631
+ item.Text=`${(value*100).toFixed(2)}%`;
1632
+ item.Color=this.GetColor(value,0);
1633
+
1634
+ return item;
1635
+ }
1636
+
1637
+ this.ForamtDate=function(date, format, TitleID)
1638
+ {
1639
+ //日期
1640
+ var item=
1641
+ {
1642
+ Title:g_JSChartLocalization.GetText('DialogTooltip-Date',this.LanguageID),
1643
+ Text:"----/--/--",
1644
+ Color:this.DateTimeColor
1645
+ }
1646
+
1647
+ if (!IFrameSplitOperator.IsNumber(date)) return item;
1648
+
1649
+ item.Text=IFrameSplitOperator.FormatDateString(date,format);
1650
+
1651
+ return item;
1652
+ }
1653
+
1654
+ this.FormatTime=function(time, period, format, TitleID)
1655
+ {
1656
+ //时间
1657
+ var item=
1658
+ {
1659
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
1660
+ Text:'--:--',
1661
+ Color:this.DateTimeColor
1662
+ };
1663
+
1664
+ if (!IFrameSplitOperator.IsNumber(time)) return item;
1665
+ if (!format)
1666
+ {
1667
+ format="HH:MM";
1668
+ if (ChartData.IsMinutePeriod(period,true)) format='HH:MM'; // 分钟周期
1669
+ else if (ChartData.IsSecondPeriod(period)) format='HH:MM:SS';
1670
+ else if (ChartData.IsMilliSecondPeriod(period)) format='HH:MM:SS.fff';
1671
+ }
1672
+
1673
+ item.Text=IFrameSplitOperator.FormatTimeString(time,format);
1674
+
1675
+ return item;
1676
+ }
1677
+
1678
+ //换手率 成交量/流通股本
1679
+ this.FormatExchange=function(vol, flowCapital, TitleID)
1680
+ {
1681
+ //换手率
1682
+ var item=
1683
+ {
1684
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
1685
+ Text:'--.--',
1686
+ Color:this.DateTimeColor
1687
+ };
1688
+
1689
+ if (!IFrameSplitOperator.IsNumber(vol) || !IFrameSplitOperator.IsNumber(flowCapital) || flowCapital==0) return item;
1690
+
1691
+ var value=vol/flowCapital*100;
1692
+ item.Text=value.toFixed(2)+'%';
1693
+
1694
+ return item;
1695
+ }
1696
+
1697
+
1698
+ //持仓
1699
+ this.FormatPosition=function(position, TitleID)
1700
+ {
1701
+ //持仓
1702
+ var item=
1703
+ {
1704
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
1705
+ Text:'--.--',
1706
+ Color:this.PositionColor
1707
+ };
1708
+
1709
+ if (!IFrameSplitOperator.IsNumber(position)) return item;
1710
+
1711
+ item.Text=position.toFixed(0);
1712
+
1713
+ return item;
1714
+ }
1715
+
1716
+ //结算价
1717
+ this.ForamtFClose=function(value, defaultfloatPrecision, TitleID)
1718
+ {
1719
+ var item=
1720
+ {
1721
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
1722
+ Text:'--.--',
1723
+ Color:this.DateTimeColor
1724
+ };
1725
+
1726
+ if (!IFrameSplitOperator.IsNumber(value)) return item;
1727
+
1728
+ item.Text=value.toFixed(defaultfloatPrecision);
1729
+
1730
+ return item;
1731
+ }
1732
+
1733
+ this.GetColor=function(price,yClose)
1734
+ {
1735
+ if(price>yClose) return this.UpColor;
1736
+ else if (price<yClose) return this.DownColor;
1737
+ else return this.UnchangeColor;
1738
+ }
1739
+
1740
+
1741
+ //配色修改
1742
+ this.ReloadResource=function(option)
1743
+ {
1744
+ this.UpColor=g_JSChartResource.UpTextColor;
1745
+ this.DownColor=g_JSChartResource.DownTextColor;
1746
+ this.UnchangeColor=g_JSChartResource.UnchagneTextColor;
1747
+
1748
+ this.BGColor=g_JSChartResource.FloatTooltip.BGColor;
1749
+ this.BorderColor=g_JSChartResource.FloatTooltip.BorderColor;
1750
+
1751
+ this.TextColor=g_JSChartResource.FloatTooltip.TextColor;
1752
+ this.ValueColor=g_JSChartResource.FloatTooltip.ValueColor;
1753
+
1754
+ this.VolColor=g_JSChartResource.FloatTooltip.VolColor;
1755
+ this.AmountColor=g_JSChartResource.FloatTooltip.AmountColor;
1756
+ this.TurnoverRateColor=g_JSChartResource.FloatTooltip.TurnoverRateColor;
1757
+ this.PositionColor=g_JSChartResource.FloatTooltip.PositionColor;
1758
+ this.DateTimeColor=g_JSChartResource.FloatTooltip.DateTimeColor;
1759
+
1760
+ if (!this.DivDialog) return;
1761
+
1762
+ this.UpdateStyle();
1763
+ }
832
1764
  }