hqchart 1.1.13909 → 1.1.13911

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.
@@ -4464,6 +4464,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4464
4464
 
4465
4465
  if (IFrameSplitOperator.IsNumber(item.PriceFormatType)) chart.ChartCorssCursor.StringFormatY.PriceFormatType=item.PriceFormatType;
4466
4466
  if (IFrameSplitOperator.IsNumber(item.DataFormatType)) chart.ChartCorssCursor.StringFormatY.DataFormatType=item.DataFormatType;
4467
+ if (IFrameSplitOperator.IsBool(item.EnableKeyboard)) chart.ChartCorssCursor.EnableKeyboard=item.EnableKeyboard;
4467
4468
 
4468
4469
  }
4469
4470
 
@@ -5687,6 +5688,9 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5687
5688
  if (option.EnableDrawToolDialogV2===true) chart.InitalDrawToolDialog();
5688
5689
  if (option.EnableModifyDrawDialogV2===true) chart.InitalModifyDrawDialog();
5689
5690
 
5691
+ //K线tooltip
5692
+ if (option.EnableTooltipDialog===true) chart.InitalTooltipDialog();
5693
+
5690
5694
  //注册事件
5691
5695
  if (option.EventCallback)
5692
5696
  {
@@ -6988,6 +6992,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6988
6992
  this.DialogDrawTool; //画图工具
6989
6993
  this.DialogModifyDraw; //画图修改
6990
6994
 
6995
+ this.DialogTooltip; //tooltip信息
6996
+
6991
6997
 
6992
6998
  this.ClearStockCache=function()
6993
6999
  {
@@ -7011,6 +7017,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7011
7017
  this.DialogDrawTool.Create();
7012
7018
  }
7013
7019
 
7020
+ this.InitalTooltipDialog=function()
7021
+ {
7022
+ if (this.DialogTooltip) return;
7023
+
7024
+ this.DialogTooltip=new JSDialogTooltip();
7025
+ this.DialogTooltip.Inital(this);
7026
+ this.DialogTooltip.Create();
7027
+ }
7028
+
7014
7029
  this.InitalModifyDrawDialog=function()
7015
7030
  {
7016
7031
  if ( this.DialogModifyDraw) return;
@@ -7067,6 +7082,22 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7067
7082
  this.DialogModifyDraw.Close();
7068
7083
  }
7069
7084
 
7085
+ this.IsShowTooltipDialog=function()
7086
+ {
7087
+ if (!this.DialogTooltip) return false;
7088
+
7089
+ return this.DialogTooltip.IsShow();
7090
+ }
7091
+
7092
+ this.CloseTooltipDialog=function()
7093
+ {
7094
+ if (!this.DialogTooltip) return;
7095
+
7096
+ this.DialogTooltip.Close();
7097
+ }
7098
+
7099
+
7100
+
7070
7101
  //obj={ Element:, Canvas: }
7071
7102
  this.SetCorssCursorElement=function(obj)
7072
7103
  {
@@ -9436,6 +9467,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9436
9467
  {
9437
9468
  this.ChartCorssCursor.Canvas=this.Canvas;
9438
9469
  }
9470
+
9471
+ this.DrawTooltipDialog();
9439
9472
  }
9440
9473
 
9441
9474
  ptPosition=this.Frame.PtInFrame(this.LastPoint.X, this.LastPoint.Y);
@@ -9885,6 +9918,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9885
9918
  {
9886
9919
  this.ChartCorssCursor.Canvas=this.Canvas;
9887
9920
  }
9921
+
9922
+ this.DrawTooltipDialog();
9888
9923
  }
9889
9924
 
9890
9925
  var ptPosition=null; //鼠标位置 null 无效 -1 在外面 >=0 对应的指标窗口中ID
@@ -10407,6 +10442,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10407
10442
  }
10408
10443
 
10409
10444
  var keyID = e.keyCode ? e.keyCode :e.which;
10445
+
10446
+ var draw=false;
10447
+ if (this.ChartCorssCursor && this.ChartCorssCursor.OnKeyDown) //十字光标 隐藏显示
10448
+ {
10449
+ var sendData={ e:e, KeyID:keyID, Draw:false, PreventDefault:false };
10450
+ this.ChartCorssCursor.OnKeyDown(sendData);
10451
+ draw=sendData.Draw;
10452
+ }
10453
+
10410
10454
  switch(keyID)
10411
10455
  {
10412
10456
  case 37: //left
@@ -10549,6 +10593,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10549
10593
  return;
10550
10594
  }
10551
10595
 
10596
+ if (draw) this.DrawDynamicInfo();
10597
+
10552
10598
  //不让滚动条滚动
10553
10599
  if(e.preventDefault) e.preventDefault();
10554
10600
  else e.returnValue = false;
@@ -10856,6 +10902,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10856
10902
  this.ShowTooltip(this.LastPoint.X/pixelTatio,this.LastPoint.Y/pixelTatio,toolTip);
10857
10903
  }
10858
10904
 
10905
+ this.DrawTooltipDialog=function()
10906
+ {
10907
+
10908
+ }
10909
+
10859
10910
  this.ShowTooltip=function(x,y,toolTip)
10860
10911
  {
10861
10912
  if (!this.IsShowTooltip) return;
@@ -11965,6 +12016,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11965
12016
  else if (option.Draw==true) this.Draw(); //是否立即重绘
11966
12017
 
11967
12018
  if (this.PopMinuteChart) this.PopMinuteChart.ReloadResource(option);
12019
+ if (this.DialogTooltip) this.DialogTooltip.ReloadResource(option);
11968
12020
  }
11969
12021
 
11970
12022
  this.ReloadBorder=function(option) //根据页面缩放调整对应边框的尺长
@@ -13954,6 +14006,19 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
13954
14006
  item.Status=OVERLAY_STATUS_ID.STATUS_NONE_ID;
13955
14007
  }
13956
14008
  }
14009
+
14010
+ //十字光标状态变动
14011
+ this.OnChangeCorssCursorStatus=function(data, obj)
14012
+ {
14013
+ if (data.Type==1)
14014
+ {
14015
+ if (!data.IsShowCorss) //十字光标隐藏
14016
+ {
14017
+ this.HideTooltip();
14018
+ this.CloseTooltipDialog();
14019
+ }
14020
+ }
14021
+ }
13957
14022
  }
13958
14023
 
13959
14024
  function GetDevicePixelRatio()
@@ -54638,6 +54703,9 @@ function ChartCorssCursor()
54638
54703
  this.IsShowClose=false; //Y轴始终显示收盘价
54639
54704
  this.ClientPos=-1;
54640
54705
  this.CallAcutionXOperator;
54706
+
54707
+ this.EnableKeyboard=false; //是否支持键盘隐藏显示
54708
+ this.OnChangeStatusCallback; //状态切换以后回调
54641
54709
 
54642
54710
 
54643
54711
  this.RightButton=
@@ -55816,6 +55884,29 @@ function ChartCorssCursor()
55816
55884
 
55817
55885
  this.Status=1;
55818
55886
  }
55887
+
55888
+ //data={ e:e, PreventDefault:false, KeyID, Draw:是否需要重绘 }
55889
+ this.OnKeyDown=function(data)
55890
+ {
55891
+ if (!this.EnableKeyboard) return;
55892
+
55893
+ var keyID=data.KeyID;
55894
+ if (keyID==27) //ESC 隐藏十字线
55895
+ {
55896
+ if (!this.IsShowCorss) return;
55897
+ this.IsShowCorss=false;
55898
+ data.Draw=true;
55899
+ if (this.OnChangeStatusCallback) this.OnChangeStatusCallback({ Type:1, IsShowCorss:this.IsShowCorss }, this);
55900
+ }
55901
+ else if (keyID==37 || keyID==39) //left, right 显示十字线
55902
+ {
55903
+ if (this.IsShowCorss) return;
55904
+ this.IsShowCorss=true;
55905
+ data.Draw=true;
55906
+ if (this.OnChangeStatusCallback) this.OnChangeStatusCallback({ Type:1, IsShowCorss:this.IsShowCorss }, this);
55907
+ }
55908
+ }
55909
+
55819
55910
  }
55820
55911
 
55821
55912
 
@@ -72866,6 +72957,18 @@ function JSChartResource()
72866
72957
  LineHeight:25 //单行高度
72867
72958
  };
72868
72959
 
72960
+ this.DialogTooltip=
72961
+ {
72962
+ BGColor:'rgb(250,250,250)', //背景色
72963
+ BorderColor:'rgb(20,20,20)', //边框颜色
72964
+ TitleColor:'rgb(0,0,0)', //标题颜色
72965
+ VolColor:"rgb(255, 185, 15)", //标题成交量
72966
+ AmountColor:"rgb(79, 79, 79)", //成交金额
72967
+ DateTimeColor:'rgb(60,60,60)',
72968
+ TurnoverRateColor:'rgb(43,54,69)', //换手率
72969
+ PositionColor:"rgb(43,54,69)" //持仓
72970
+ }
72971
+
72869
72972
  //弹幕
72870
72973
  this.Barrage= {
72871
72974
  Font:16*GetDevicePixelRatio() +'px 微软雅黑', //字体
@@ -73848,6 +73951,21 @@ function JSChartResource()
73848
73951
  if (item.AmountColor) this.PCTooltipPaint.AmountColor=item.AmountColor;
73849
73952
  }
73850
73953
 
73954
+ if (style.DialogTooltip)
73955
+ {
73956
+ var item=style.DialogTooltip;
73957
+ if (item.BGColor) this.DialogTooltip.BGColor=item.BGColor;
73958
+ if (item.BorderColor) this.DialogTooltip.BorderColor=item.BorderColor;
73959
+ if (item.TitleColor) this.DialogTooltip.TitleColor=item.TitleColor;
73960
+ if (item.DateTimeColor) this.DialogTooltip.DateTimeColor=item.DateTimeColor;
73961
+
73962
+ if (item.VolColor) this.DialogTooltip.VolColor=item.VolColor;
73963
+ if (item.AmountColor) this.DialogTooltip.AmountColor=item.AmountColor;
73964
+ if (item.TurnoverRateColor) this.DialogTooltip.TurnoverRateColor=item.TurnoverRateColor;
73965
+ if (item.PositionColor) this.DialogTooltip.PositionColor=item.PositionColor;
73966
+
73967
+ }
73968
+
73851
73969
  if (style.MinuteInfo)
73852
73970
  {
73853
73971
  var item=style.MinuteInfo;
@@ -74791,6 +74909,20 @@ function JSChartLocalization()
74791
74909
  ['DivTooltip-Position', {CN:'持仓:', EN:'Position:', TC:'持倉'}],
74792
74910
  ['DivTooltip-Price', {CN:'价格:', EN:'Open:', TC:'價格'}],
74793
74911
 
74912
+ ['DialogTooltip-Date', {CN:'日期', EN:'Date', TC:'日期'}],
74913
+ ['DialogTooltip-Time', {CN:'时间', EN:'Time', TC:'時間'}],
74914
+ ['DialogTooltip-Open', {CN:'开盘价', EN:'Open', TC:'開盤價'}],
74915
+ ['DialogTooltip-High', {CN:'最高价', EN:'High', TC:'最高價'}],
74916
+ ['DialogTooltip-Low', {CN:'最低价', EN:'Low', TC:'最低價'}],
74917
+ ['DialogTooltip-Close', {CN:'收盘价', EN:'Close', TC:'收盤價'}],
74918
+ ['DialogTooltip-Increase', {CN:'涨幅', EN:'Increase', TC:'漲幅'}],
74919
+ ['DialogTooltip-Vol', {CN:'成交量', EN:'Volume', TC:'數量'}],
74920
+ ['DialogTooltip-Amount', {CN:'成交额', EN:'Amount', TC:'金額'}],
74921
+ ['DialogTooltip-Exchange', {CN:'换手率', EN:'Exchange', TC:'換手'}],
74922
+ ['DialogTooltip-Position', {CN:'持仓量', EN:'Position', TC:'持倉'}],
74923
+ ['DialogTooltip-Price', {CN:'价格', EN:'Open', TC:'價格'}],
74924
+ ['DialogTooltip-Amplitude', {CN:'振幅', EN:'amplitude', TC:'價格'}],
74925
+
74794
74926
  //走势图PC tooltip
74795
74927
  ['PCTooltip-Date', {CN:'日期', EN:'Date', TC:"日期"}],
74796
74928
  ['PCTooltip-Time', {CN:'时间', EN:'Time', TC:"時間"}],
@@ -76541,6 +76673,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
76541
76673
  this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;
76542
76674
  this.ChartCorssCursor.StringFormatY.ExtendChartPaint=this.ExtendChartPaint;
76543
76675
  this.ChartCorssCursor.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
76676
+ this.ChartCorssCursor.OnChangeStatusCallback=(data, obj)=>{ this.OnChangeCorssCursorStatus(data,obj); }
76544
76677
 
76545
76678
  //创建等待提示
76546
76679
  this.ChartSplashPaint = new ChartSplashPaint();
@@ -83075,6 +83208,42 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
83075
83208
 
83076
83209
  this.Draw();
83077
83210
  }
83211
+
83212
+ this.DrawTooltipDialog=function()
83213
+ {
83214
+ if (!this.DialogTooltip) return;
83215
+
83216
+ this.UpdateTooltipDialog();
83217
+ }
83218
+
83219
+ this.UpdateTooltipDialog=function()
83220
+ {
83221
+ if (!this.DialogTooltip) return false;
83222
+ if (!this.ChartCorssCursor) return false;
83223
+
83224
+ var kItem=null;
83225
+ if (this.ChartCorssCursor.ClientPos>=0)
83226
+ {
83227
+ var hisData=this.ChartOperator_Temp_GetHistroyData();;
83228
+ if (!hisData) return false; //数据还没有到达
83229
+
83230
+ var dataIndex=hisData.DataOffset+this.ChartCorssCursor.CursorIndex;
83231
+ var kItem=hisData.Data[dataIndex];
83232
+ }
83233
+
83234
+ var sendData=
83235
+ {
83236
+ ClientPos:this.ChartCorssCursor.ClientPos, //位置
83237
+ IsShowCorss:this.ChartCorssCursor.IsShowCorss, //是否显示十字线
83238
+ KItem:kItem,
83239
+ Symbol:this.Symbol, Name:this.Name,
83240
+ };
83241
+
83242
+
83243
+ this.DialogTooltip.Update(sendData);
83244
+
83245
+ return true;
83246
+ }
83078
83247
  }
83079
83248
 
83080
83249
  //API 返回数据 转化为array[]
@@ -84755,6 +84924,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84755
84924
  }
84756
84925
 
84757
84926
  var keyID = e.keyCode ? e.keyCode :e.which;
84927
+
84758
84928
  switch(keyID)
84759
84929
  {
84760
84930
  case 37: //left
@@ -125109,7 +125279,19 @@ function GetBlackStyle()
125109
125279
  VolColor:"rgb(161,154,3)", //标题成交量
125110
125280
  AmountColor:"rgb(161,154,3)", //成交金额
125111
125281
  },
125112
-
125282
+
125283
+ DialogTooltip:
125284
+ {
125285
+ BGColor:'rgb(20,20,20)', //背景色
125286
+ BorderColor:'rgb(170,170,170)', //边框颜色
125287
+ TitleColor:'rgb(210,210,210)', //标题颜色
125288
+ VolColor:"rgb(255, 185, 15)", //标题成交量
125289
+ AmountColor:"rgb(210,210,210)", //成交金额
125290
+ DateTimeColor:'rgb(210,210,210)',
125291
+ TurnoverRateColor:'rgb(43,54,69)', //换手率
125292
+ PositionColor:"rgb(43,54,69)" //持仓
125293
+ },
125294
+
125113
125295
  //走势图 信息地雷
125114
125296
  MinuteInfo:
125115
125297
  {
@@ -142942,7 +143124,428 @@ JSPopKeyboard.GetOption=function()
142942
143124
 
142943
143125
 
142944
143126
 
142945
- ///////////////////////////////////////////////////////////////////////////////////
143127
+ /*
143128
+ Copyright (c) 2018 jones
143129
+
143130
+ http://www.apache.org/licenses/LICENSE-2.0
143131
+
143132
+ 开源项目 https://github.com/jones2000/HQChart
143133
+
143134
+ jones_2000@163.com
143135
+
143136
+ 内置K线提示信息
143137
+ */
143138
+
143139
+
143140
+ function JSDialogTooltip()
143141
+ {
143142
+ this.DivDialog=null;
143143
+ this.DragTitle=null;
143144
+ this.TitleBox=null; //{ DivTitle, DivName, DivName }
143145
+
143146
+ this.HQChart=null;
143147
+
143148
+ this.UpColor=g_JSChartResource.UpTextColor;
143149
+ this.DownColor=g_JSChartResource.DownTextColor;
143150
+ this.UnchangeColor=g_JSChartResource.UnchagneTextColor;
143151
+
143152
+ this.TitleColor=g_JSChartResource.DialogTooltip.TitleColor;
143153
+ this.TitleBGColor=g_JSChartResource.DialogTooltip.TitleBGColor;
143154
+ this.BGColor=g_JSChartResource.DialogTooltip.BGColor;
143155
+ this.BorderColor=g_JSChartResource.DialogTooltip.BorderColor;
143156
+
143157
+ this.VolColor=g_JSChartResource.DialogTooltip.VolColor;
143158
+ this.AmountColor=g_JSChartResource.DialogTooltip.AmountColor;
143159
+ this.TurnoverRateColor=g_JSChartResource.DialogTooltip.TurnoverRateColor;
143160
+ this.PositionColor=g_JSChartResource.DialogTooltip.PositionColor;
143161
+ this.DateTimeColor=g_JSChartResource.DialogTooltip.DateTimeColor;
143162
+ this.LanguageID=JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;
143163
+ this.MaxRowCount=10;
143164
+
143165
+ this.AryData=[];
143166
+ this.AryText=[];
143167
+
143168
+ this.KItemCache=null;
143169
+ this.KItemCacheID=null;
143170
+
143171
+ this.Inital=function(hqchart)
143172
+ {
143173
+ this.HQChart=hqchart;
143174
+ }
143175
+
143176
+ this.Destroy=function()
143177
+ {
143178
+ this.AryData=[];
143179
+ this.AryText=[];
143180
+ this.KItemCache=null;
143181
+ this.KItemCacheID=null;
143182
+
143183
+ if (this.DivDialog)
143184
+ {
143185
+ document.body.removeChild(this.DivDialog);
143186
+ this.DivDialog=null;
143187
+ }
143188
+ }
143189
+
143190
+ this.OnClickColseButton=function(e)
143191
+ {
143192
+ this.Close(e);
143193
+
143194
+ if (this.HQChart && this.HQChart.ChartCorssCursor)
143195
+ {
143196
+ var chart=this.HQChart.ChartCorssCursor;
143197
+ if (!chart.IsShowCorss) return;
143198
+
143199
+ chart.IsShowCorss=false;
143200
+ this.HQChart.Draw();
143201
+ this.HQChart.SetFocus();
143202
+ }
143203
+ }
143204
+
143205
+ this.Create=function()
143206
+ {
143207
+ var divDom=document.createElement("div");
143208
+ divDom.className='UMyChart_Tooltip_Dialog_Div';
143209
+
143210
+ var divTitle=document.createElement("div");
143211
+ divTitle.className='UMyChart_Tooltip_Title_Div';
143212
+ divTitle.onmousedown=(e)=>{ this.OnMouseDownTitle(e);}
143213
+
143214
+ var divName=document.createElement("div");
143215
+ divName.className='UMyChart_Tooltip_Name_Div';
143216
+ divName.innerText="----";
143217
+ divTitle.appendChild(divName);
143218
+
143219
+ var divClose=document.createElement("div");
143220
+ divClose.className='UMyChart_Tooltip_Close_Div';
143221
+ divClose.innerText="x";
143222
+ divClose.onmousedown=(e)=>{ this.OnClickColseButton(e); }
143223
+ divTitle.appendChild(divClose);
143224
+
143225
+ divDom.appendChild(divTitle);
143226
+
143227
+ var table=document.createElement("table");
143228
+ table.className="UMyChart_Tooltip_Table";
143229
+ divDom.appendChild(table);
143230
+
143231
+ var tbody=document.createElement("tbody");
143232
+ tbody.className="UMyChart_Tooltip_Tbody";
143233
+ table.appendChild(tbody);
143234
+
143235
+ this.AryData=[];
143236
+ for(var i=0;i<this.MaxRowCount;++i)
143237
+ {
143238
+ var rowItem={ Tr:null, TitleSpan:null, TextSpan:null };
143239
+
143240
+ var trDom=document.createElement("tr");
143241
+ trDom.className='UMyChart_Tooltip_Group_Tr';
143242
+ tbody.appendChild(trDom);
143243
+ rowItem.Tr=trDom;
143244
+
143245
+ var tdDom=document.createElement("td");
143246
+ tdDom.className="UMyChart_Tooltip_Title_Td"; //标题
143247
+ trDom.appendChild(tdDom);
143248
+
143249
+ var spanDom=document.createElement("span");
143250
+ spanDom.className='UMyChart_Tooltip_Title_Span';
143251
+ spanDom.innerText='标题';
143252
+ tdDom.appendChild(spanDom);
143253
+ rowItem.TitleSpan=spanDom;
143254
+
143255
+ var tdDom=document.createElement("td");
143256
+ tdDom.className="UMyChart_Tooltip_Text_Td"; //数值
143257
+ trDom.appendChild(tdDom);
143258
+
143259
+ var spanDom=document.createElement("span");
143260
+ spanDom.className='UMyChart_Tooltip_Text_Span';
143261
+ spanDom.innerText='数值';
143262
+ tdDom.appendChild(spanDom);
143263
+ rowItem.TextSpan=spanDom;
143264
+
143265
+ this.AryData.push(rowItem);
143266
+ }
143267
+
143268
+
143269
+ document.body.appendChild(divDom);
143270
+
143271
+ this.DivName=divName;
143272
+ this.DivDialog=divDom;
143273
+ this.TitleBox={ DivTitle:divTitle, DivName:divName, DivColor:divClose };
143274
+
143275
+ this.UpdateStyle();
143276
+ }
143277
+
143278
+ this.Update=function(data)
143279
+ {
143280
+ if (!this.DivDialog || !this.TitleBox) return;
143281
+ if (!data.KItem || !data.IsShowCorss || data.ClientPos<0) return;
143282
+
143283
+ this.LanguageID=this.HQChart.LanguageID;
143284
+ this.TitleBox.DivName.innerText=data.Name;
143285
+
143286
+ var strKItem=JSON.stringify(data.KItem);
143287
+ if (this.KItemCacheID!=strKItem) //数据变动的才更新
143288
+ {
143289
+ this.KItemCache= JSON.parse(strKItem);
143290
+ this.KItemCacheID=strKItem;
143291
+ this.UpdateTableDOM();
143292
+ }
143293
+ else
143294
+ {
143295
+ //JSConsole.Chart.Log(`[JSDialogTooltip::Update] save as KItemCache and KItem`);
143296
+ }
143297
+
143298
+ if (!this.IsShow()) this.Show();
143299
+ }
143300
+
143301
+ this.UpdateTableDOM=function()
143302
+ {
143303
+ if (!this.KItemCache) return;
143304
+
143305
+ this.AryText=this.GetFormatKlineTooltipText(this.KItemCache);
143306
+
143307
+ var index=0;
143308
+ for(index=0;index<this.AryText.length && index<this.MaxRowCount;++index)
143309
+ {
143310
+ var outItem=this.AryText[index];
143311
+ var item=this.AryData[index];
143312
+
143313
+ item.TitleSpan.innerText=outItem.Title;
143314
+ item.TitleSpan.style.color=this.TitleColor;
143315
+ item.TextSpan.innerText=outItem.Text;
143316
+ item.TextSpan.style.color=outItem.Color;
143317
+ item.Tr.style.display="";
143318
+ }
143319
+
143320
+ for( ; index<this.MaxRowCount; ++index)
143321
+ {
143322
+ var item=this.AryData[index];
143323
+ item.Tr.style.display="none";
143324
+ }
143325
+ }
143326
+
143327
+ this.Close=function(e)
143328
+ {
143329
+ if (!this.DivDialog) return;
143330
+
143331
+ this.DivDialog.style.visibility='hidden';
143332
+ }
143333
+
143334
+ this.OnMouseDownTitle=function(e)
143335
+ {
143336
+ if (!this.DivDialog) return;
143337
+
143338
+ var dragData={ X:e.clientX, Y:e.clientY };
143339
+ dragData.YOffset=e.clientX - this.DivDialog.offsetLeft;
143340
+ dragData.XOffset=e.clientY - this.DivDialog.offsetTop;
143341
+ this.DragTitle=dragData;
143342
+
143343
+ document.onmousemove=(e)=>{ this.DocOnMouseMoveTitle(e); }
143344
+ document.onmouseup=(e)=>{ this.DocOnMouseUpTitle(e); }
143345
+ }
143346
+
143347
+ this.DocOnMouseMoveTitle=function(e)
143348
+ {
143349
+ if (!this.DragTitle) return;
143350
+
143351
+ var left = e.clientX - this.DragTitle.YOffset;
143352
+ var top = e.clientY - this.DragTitle.XOffset;
143353
+
143354
+ var right=left+this.DivDialog.offsetWidth;
143355
+ var bottom=top+ this.DivDialog.offsetHeight;
143356
+
143357
+ if ((right+5)>=window.innerWidth) left=window.innerWidth-this.DivDialog.offsetWidth-5;
143358
+ if ((bottom+5)>=window.innerHeight) top=window.innerHeight-this.DivDialog.offsetHeight-5;
143359
+
143360
+ this.DivDialog.style.left = left + 'px';
143361
+ this.DivDialog.style.top = top + 'px';
143362
+
143363
+ if(e.preventDefault) e.preventDefault();
143364
+ }
143365
+
143366
+ this.DocOnMouseUpTitle=function(e)
143367
+ {
143368
+ this.DragTitle=null;
143369
+ this.onmousemove = null;
143370
+ this.onmouseup = null;
143371
+ }
143372
+
143373
+ this.Show=function()
143374
+ {
143375
+ if (!this.DivDialog) return;
143376
+ if (!this.HQChart) return;
143377
+
143378
+ if (!this.DivDialog.style.top || !this.DivDialog.style.left) //上一次显示的位置
143379
+ {
143380
+ var top=this.HQChart.Frame.ChartBorder.GetTop();
143381
+ var left=this.HQChart.Frame.ChartBorder.GetLeft();
143382
+ var rtClient=this.HQChart.UIElement.getBoundingClientRect();
143383
+
143384
+ var x=left+rtClient.left+5;
143385
+ var y=top+rtClient.top+10;
143386
+ this.DivDialog.style.top = y + "px";
143387
+ this.DivDialog.style.left = x + "px";
143388
+ }
143389
+
143390
+ this.DivDialog.style.visibility='visible';
143391
+ }
143392
+
143393
+ this.IsShow=function()
143394
+ {
143395
+ if (!this.DivDialog) return false;
143396
+
143397
+ return this.DivDialog.style.visibility==='visible';
143398
+ }
143399
+
143400
+
143401
+ this.GetFormatKlineTooltipText=function(data)
143402
+ {
143403
+ var defaultfloatPrecision=GetfloatPrecision(this.HQChart.Symbol);//价格小数位数
143404
+
143405
+ //日期
143406
+ var dateItem=
143407
+ {
143408
+ Title:g_JSChartLocalization.GetText('DialogTooltip-Date',this.LanguageID),
143409
+ Text:IFrameSplitOperator.FormatDateString(data.Date,"YYYY/MM/DD/W"),
143410
+ Color:this.DateTimeColor
143411
+ }
143412
+
143413
+ //时间
143414
+ var timeItem=null;
143415
+ var timeFormat=null;
143416
+ if (ChartData.IsMinutePeriod(this.HQChart.Period,true)) timeFormat='HH:MM'; // 分钟周期
143417
+ else if (ChartData.IsSecondPeriod(this.HQChart.Period)) timeFormat='HH:MM:SS';
143418
+ else if (ChartData.IsMilliSecondPeriod(this.HQChart.Period)) timeFormat='HH:MM:SS.fff';
143419
+
143420
+ if (timeFormat)
143421
+ {
143422
+ timeItem=
143423
+ {
143424
+ Title:g_JSChartLocalization.GetText('DialogTooltip-Time',this.LanguageID),
143425
+ Text:IFrameSplitOperator.FormatTimeString(data.Time,timeFormat),
143426
+ Color:this.DateTimeColor
143427
+ }
143428
+ }
143429
+
143430
+ //涨幅
143431
+ var increaseItem=
143432
+ {
143433
+ Title:g_JSChartLocalization.GetText('DialogTooltip-Increase',this.LanguageID),
143434
+ Text:"--.--",
143435
+ Color:this.TitleColor
143436
+ };
143437
+ if (IFrameSplitOperator.IsNumber(data.YClose) && IFrameSplitOperator.IsNumber(data.Close))
143438
+ {
143439
+ var value=(data.Close-data.YClose)/data.YClose;
143440
+ increaseItem.Text=`${(value*100).toFixed(2)}%`;
143441
+ increaseItem.Color=this.GetColor(value,0);
143442
+ }
143443
+
143444
+ //涨幅
143445
+ var amplitudeItem=
143446
+ {
143447
+ Title:g_JSChartLocalization.GetText('DialogTooltip-Amplitude',this.LanguageID),
143448
+ Text:"--.--",
143449
+ Color:this.TitleColor
143450
+ }
143451
+ if (IFrameSplitOperator.IsNumber(data.YClose) && IFrameSplitOperator.IsNumber(data.High) && IFrameSplitOperator.IsNumber(data.Low))
143452
+ {
143453
+ var value=(data.High-data.Low)/data.YClose;
143454
+ amplitudeItem.Text=`${(value*100).toFixed(2)}%`;
143455
+ amplitudeItem.Color=this.GetColor(value,0);
143456
+ }
143457
+
143458
+ var aryText=
143459
+ [
143460
+ {
143461
+ Title:g_JSChartLocalization.GetText('DialogTooltip-Open',this.LanguageID),
143462
+ Text:IFrameSplitOperator.IsNumber(data.Open)? data.Open.toFixed(defaultfloatPrecision):'--',
143463
+ Color:this.GetPriceColor(data.Open,data.YClose),
143464
+ },
143465
+ {
143466
+ Title:g_JSChartLocalization.GetText('DialogTooltip-High',this.LanguageID),
143467
+ Text:IFrameSplitOperator.IsNumber(data.High)? data.High.toFixed(defaultfloatPrecision):'--',
143468
+ Color:this.GetPriceColor(data.High,data.YClose)
143469
+ },
143470
+ {
143471
+ Title:g_JSChartLocalization.GetText('DialogTooltip-Low',this.LanguageID),
143472
+ Text:IFrameSplitOperator.IsNumber(data.Low)? data.Low.toFixed(defaultfloatPrecision):'--',
143473
+ Color:this.GetPriceColor(data.Low,data.YClose)
143474
+ },
143475
+ {
143476
+ Title:g_JSChartLocalization.GetText('DialogTooltip-Close',this.LanguageID),
143477
+ Text:IFrameSplitOperator.IsNumber(data.Close)? data.Close.toFixed(defaultfloatPrecision):'--',
143478
+ Color:this.GetPriceColor(data.Close,data.YClose)
143479
+ },
143480
+ {
143481
+ Title:g_JSChartLocalization.GetText('DialogTooltip-Vol',this.LanguageID),
143482
+ Text:IFrameSplitOperator.IsNumber(data.Vol)? IFrameSplitOperator.FormatValueString(data.Vol,2,this.LanguageID):'--',
143483
+ Color:this.VolColor
143484
+ },
143485
+ {
143486
+ Title:g_JSChartLocalization.GetText('DialogTooltip-Amount',this.LanguageID),
143487
+ Text:IFrameSplitOperator.IsNumber(data.Amount)? IFrameSplitOperator.FormatValueString(data.Amount,2,this.LanguageID):'--',
143488
+ Color:this.AmountColor
143489
+ },
143490
+ increaseItem,
143491
+ amplitudeItem
143492
+ ];
143493
+
143494
+ if (timeItem) aryText.unshift(timeItem);
143495
+ aryText.unshift(dateItem);
143496
+
143497
+ return aryText;
143498
+ },
143499
+
143500
+ this.GetColor=function(price,yClose)
143501
+ {
143502
+ if(price>yClose) return this.UpColor;
143503
+ else if (price<yClose) return this.DownColor;
143504
+ else return this.UnchangeColor;
143505
+ }
143506
+
143507
+ this.GetPriceColor=function(price, yClose)
143508
+ {
143509
+ var color=this.GetColor(price, yClose);
143510
+ return color;
143511
+ }
143512
+
143513
+ //配色修改
143514
+ this.ReloadResource=function(option)
143515
+ {
143516
+ this.UpColor=g_JSChartResource.UpTextColor;
143517
+ this.DownColor=g_JSChartResource.DownTextColor;
143518
+ this.UnchangeColor=g_JSChartResource.UnchagneTextColor;
143519
+
143520
+ this.TitleColor=g_JSChartResource.DialogTooltip.TitleColor;
143521
+ this.TitleBGColor=g_JSChartResource.DialogTooltip.TitleBGColor;
143522
+ this.BGColor=g_JSChartResource.DialogTooltip.BGColor;
143523
+ this.BorderColor=g_JSChartResource.DialogTooltip.BorderColor;
143524
+
143525
+ this.VolColor=g_JSChartResource.DialogTooltip.VolColor;
143526
+ this.AmountColor=g_JSChartResource.DialogTooltip.AmountColor;
143527
+ this.TurnoverRateColor=g_JSChartResource.DialogTooltip.TurnoverRateColor;
143528
+ this.PositionColor=g_JSChartResource.DialogTooltip.PositionColor;
143529
+ this.DateTimeColor=g_JSChartResource.DialogTooltip.DateTimeColor;
143530
+
143531
+ if (!this.DivDialog) return;
143532
+
143533
+ this.UpdateStyle();
143534
+ }
143535
+
143536
+ this.UpdateStyle=function()
143537
+ {
143538
+ if (!this.DivDialog) return;
143539
+
143540
+ if (this.BGColor) this.DivDialog.style['background-color']=this.BGColor;
143541
+ if (this.BorderColor) this.DivDialog.style['border-color']=this.BorderColor;
143542
+
143543
+ if (this.TitleBGColor) this.TitleBox.DivTitle.style['background-color']=this.TitleBGColor;
143544
+
143545
+ this.UpdateTableDOM();
143546
+ }
143547
+
143548
+ }///////////////////////////////////////////////////////////////////////////////////
142946
143549
  // 工作线程计算指标示例
142947
143550
  //
142948
143551
  //
@@ -143063,7 +143666,7 @@ function HQChartScriptWorker()
143063
143666
 
143064
143667
 
143065
143668
 
143066
- var HQCHART_VERSION="1.1.13907";
143669
+ var HQCHART_VERSION="1.1.13910";
143067
143670
 
143068
143671
  function PrintHQChartVersion()
143069
143672
  {