hqchart 1.1.13909 → 1.1.13915

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.
@@ -495,6 +495,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
495
495
 
496
496
  if (IFrameSplitOperator.IsNumber(item.PriceFormatType)) chart.ChartCorssCursor.StringFormatY.PriceFormatType=item.PriceFormatType;
497
497
  if (IFrameSplitOperator.IsNumber(item.DataFormatType)) chart.ChartCorssCursor.StringFormatY.DataFormatType=item.DataFormatType;
498
+ if (IFrameSplitOperator.IsBool(item.EnableKeyboard)) chart.ChartCorssCursor.EnableKeyboard=item.EnableKeyboard;
498
499
 
499
500
  }
500
501
 
@@ -972,6 +973,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
972
973
 
973
974
  if (IFrameSplitOperator.IsNumber(item.HPenType)) chart.ChartCorssCursor.HPenType=item.HPenType;
974
975
  if (IFrameSplitOperator.IsNumber(item.VPenType)) chart.ChartCorssCursor.VPenType=item.VPenType;
976
+ if (IFrameSplitOperator.IsBool(item.EnableKeyboard)) chart.ChartCorssCursor.EnableKeyboard=item.EnableKeyboard;
975
977
  }
976
978
 
977
979
  if (option.MinuteInfo) chart.CreateMinuteInfo(option.MinuteInfo);
@@ -1718,6 +1720,9 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
1718
1720
  if (option.EnableDrawToolDialogV2===true) chart.InitalDrawToolDialog();
1719
1721
  if (option.EnableModifyDrawDialogV2===true) chart.InitalModifyDrawDialog();
1720
1722
 
1723
+ //K线tooltip
1724
+ if (option.EnableTooltipDialog===true) chart.InitalTooltipDialog();
1725
+
1721
1726
  //注册事件
1722
1727
  if (option.EventCallback)
1723
1728
  {
@@ -3019,6 +3024,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3019
3024
  this.DialogDrawTool; //画图工具
3020
3025
  this.DialogModifyDraw; //画图修改
3021
3026
 
3027
+ this.DialogTooltip; //tooltip信息
3028
+
3022
3029
 
3023
3030
  this.ClearStockCache=function()
3024
3031
  {
@@ -3042,6 +3049,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3042
3049
  this.DialogDrawTool.Create();
3043
3050
  }
3044
3051
 
3052
+ this.InitalTooltipDialog=function()
3053
+ {
3054
+ if (this.DialogTooltip) return;
3055
+
3056
+ this.DialogTooltip=new JSDialogTooltip();
3057
+ this.DialogTooltip.Inital(this);
3058
+ this.DialogTooltip.Create();
3059
+ }
3060
+
3045
3061
  this.InitalModifyDrawDialog=function()
3046
3062
  {
3047
3063
  if ( this.DialogModifyDraw) return;
@@ -3098,6 +3114,22 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3098
3114
  this.DialogModifyDraw.Close();
3099
3115
  }
3100
3116
 
3117
+ this.IsShowTooltipDialog=function()
3118
+ {
3119
+ if (!this.DialogTooltip) return false;
3120
+
3121
+ return this.DialogTooltip.IsShow();
3122
+ }
3123
+
3124
+ this.CloseTooltipDialog=function()
3125
+ {
3126
+ if (!this.DialogTooltip) return;
3127
+
3128
+ this.DialogTooltip.Close();
3129
+ }
3130
+
3131
+
3132
+
3101
3133
  //obj={ Element:, Canvas: }
3102
3134
  this.SetCorssCursorElement=function(obj)
3103
3135
  {
@@ -5424,6 +5456,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5424
5456
 
5425
5457
  this.DrawDrawPictureXYCoordinate(); //绘制画图工具 X,Y轴刻度信息
5426
5458
 
5459
+ var bDrawDialogTooltip=false;
5427
5460
  var ptPosition=null; //鼠标位置 null 无效 -1 在外面 >=0 对应的指标窗口中ID
5428
5461
  if (this.LastPoint.X!=null || this.LastPoint.Y!=null)
5429
5462
  {
@@ -5467,6 +5500,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5467
5500
  {
5468
5501
  this.ChartCorssCursor.Canvas=this.Canvas;
5469
5502
  }
5503
+
5504
+ bDrawDialogTooltip=true;
5470
5505
  }
5471
5506
 
5472
5507
  ptPosition=this.Frame.PtInFrame(this.LastPoint.X, this.LastPoint.Y);
@@ -5547,6 +5582,9 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5547
5582
  var frame=this.LastMouseStatus.MouseOnToolbar.Frame;
5548
5583
  if (frame && frame.DrawToolbarTooltip) frame.DrawToolbarTooltip(this.LastMouseStatus.MouseOnToolbar);
5549
5584
  }
5585
+
5586
+
5587
+ if (bDrawDialogTooltip) this.DrawTooltipDialog();
5550
5588
 
5551
5589
  //发送图形状态给外部
5552
5590
  if (this.mapEvent.has(JSCHART_EVENT_ID.CHART_STATUS))
@@ -5872,7 +5910,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5872
5910
  }
5873
5911
 
5874
5912
  this.DrawDrawPictureXYCoordinate();
5875
-
5913
+ var bDrawDialogTooltip=false;
5876
5914
  if (this.ChartCorssCursor)
5877
5915
  {
5878
5916
  this.ChartCorssCursor.LastPoint=this.LastPoint;
@@ -5916,6 +5954,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5916
5954
  {
5917
5955
  this.ChartCorssCursor.Canvas=this.Canvas;
5918
5956
  }
5957
+
5958
+ bDrawDialogTooltip=true;
5919
5959
  }
5920
5960
 
5921
5961
  var ptPosition=null; //鼠标位置 null 无效 -1 在外面 >=0 对应的指标窗口中ID
@@ -6010,6 +6050,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6010
6050
 
6011
6051
  this.OffscreenToShowCanvas();
6012
6052
 
6053
+ if (bDrawDialogTooltip) this.DrawTooltipDialog();
6054
+
6013
6055
  ++this.TouchDrawCount;
6014
6056
  }
6015
6057
 
@@ -6438,6 +6480,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6438
6480
  }
6439
6481
 
6440
6482
  var keyID = e.keyCode ? e.keyCode :e.which;
6483
+
6484
+ var draw=false;
6485
+ if (this.ChartCorssCursor && this.ChartCorssCursor.OnKeyDown) //十字光标 隐藏显示
6486
+ {
6487
+ var sendData={ e:e, KeyID:keyID, Draw:false, PreventDefault:false };
6488
+ this.ChartCorssCursor.OnKeyDown(sendData);
6489
+ draw=sendData.Draw;
6490
+ }
6491
+
6441
6492
  switch(keyID)
6442
6493
  {
6443
6494
  case 37: //left
@@ -6580,6 +6631,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6580
6631
  return;
6581
6632
  }
6582
6633
 
6634
+ if (draw) this.DrawDynamicInfo();
6635
+
6583
6636
  //不让滚动条滚动
6584
6637
  if(e.preventDefault) e.preventDefault();
6585
6638
  else e.returnValue = false;
@@ -6887,6 +6940,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6887
6940
  this.ShowTooltip(this.LastPoint.X/pixelTatio,this.LastPoint.Y/pixelTatio,toolTip);
6888
6941
  }
6889
6942
 
6943
+ this.DrawTooltipDialog=function()
6944
+ {
6945
+
6946
+ }
6947
+
6890
6948
  this.ShowTooltip=function(x,y,toolTip)
6891
6949
  {
6892
6950
  if (!this.IsShowTooltip) return;
@@ -7996,6 +8054,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7996
8054
  else if (option.Draw==true) this.Draw(); //是否立即重绘
7997
8055
 
7998
8056
  if (this.PopMinuteChart) this.PopMinuteChart.ReloadResource(option);
8057
+ if (this.DialogTooltip) this.DialogTooltip.ReloadResource(option);
7999
8058
  }
8000
8059
 
8001
8060
  this.ReloadBorder=function(option) //根据页面缩放调整对应边框的尺长
@@ -9985,6 +10044,19 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9985
10044
  item.Status=OVERLAY_STATUS_ID.STATUS_NONE_ID;
9986
10045
  }
9987
10046
  }
10047
+
10048
+ //十字光标状态变动
10049
+ this.OnChangeCorssCursorStatus=function(data, obj)
10050
+ {
10051
+ if (data.Type==1)
10052
+ {
10053
+ if (!data.IsShowCorss) //十字光标隐藏
10054
+ {
10055
+ this.HideTooltip();
10056
+ this.CloseTooltipDialog();
10057
+ }
10058
+ }
10059
+ }
9988
10060
  }
9989
10061
 
9990
10062
  function GetDevicePixelRatio()
@@ -32966,7 +33038,8 @@ function ChartVolStick()
32966
33038
  this.ClassName='ChartVolStick';
32967
33039
 
32968
33040
  this.BarWidth; //固定宽度 目前只支持宽度为1
32969
- this.BarType; //柱子状态 1=实心 0=空心 2=涨实跌空 如果设置了这个属性, 属性KLineDrawType无效
33041
+ this.BarType; //柱子状态 1=实心 0=空心 2=涨实跌空 如果设置了这个属性, 属性KLineDrawType无效
33042
+ this.BarColorType=0; //0=柱子颜色跟K线走 1=正upcolor 负downcolor
32970
33043
  this.PtInChart=this.PtInBar;
32971
33044
  this.DrawSelectedStatus=this.DrawLinePoint;
32972
33045
 
@@ -33013,7 +33086,7 @@ function ChartVolStick()
33013
33086
  if (right>chartright) break;
33014
33087
 
33015
33088
  var y=this.ChartFrame.GetYFromData(value);
33016
- var barColor=this.GetBarColor(kItem);
33089
+ var barColor=this.GetBarColor(kItem,value);
33017
33090
  var bUp=barColor.IsUp;
33018
33091
 
33019
33092
 
@@ -33061,7 +33134,7 @@ function ChartVolStick()
33061
33134
  if (x>chartright) break;
33062
33135
 
33063
33136
  if (isMinute) barColor=this.GetMinuteBarColor(kItem,preKItem); //分时图颜色单独计算
33064
- else barColor=this.GetBarColor(kItem);
33137
+ else barColor=this.GetBarColor(kItem, value);
33065
33138
 
33066
33139
  this.Canvas.strokeStyle=barColor.Color;
33067
33140
 
@@ -33106,7 +33179,7 @@ function ChartVolStick()
33106
33179
  if (right>chartBottom) break;
33107
33180
 
33108
33181
  var y=this.ChartFrame.GetYFromData(value);
33109
- var barColor=this.GetBarColor(kItem);
33182
+ var barColor=this.GetBarColor(kItem, value);
33110
33183
  var bUp=barColor.IsUp;
33111
33184
 
33112
33185
  var height=ToFixedRect(y-yBottom); //高度调整为整数
@@ -33152,7 +33225,7 @@ function ChartVolStick()
33152
33225
  if (x>chartBottom) break;
33153
33226
 
33154
33227
  if (isMinute) barColor=this.GetMinuteBarColor(kItem,preKItem); //分时图颜色单独计算
33155
- else barColor=this.GetBarColor(kItem);
33228
+ else barColor=this.GetBarColor(kItem,value);
33156
33229
 
33157
33230
  var bUp=barColor.IsUp;
33158
33231
  this.Canvas.strokeStyle=barColor.Color;
@@ -33192,8 +33265,14 @@ function ChartVolStick()
33192
33265
  return range;
33193
33266
  }
33194
33267
 
33195
- this.GetBarColor=function(kItem)
33268
+ this.GetBarColor=function(kItem, value)
33196
33269
  {
33270
+ if (this.BarColorType===1) //更具正负决定柱子颜色
33271
+ {
33272
+ if (value>=0) return { Color:this.UpColor, IsUp:true }; //颜色, 是否是上涨
33273
+ else return { Color:this.DownColor, IsUp:false };
33274
+ }
33275
+
33197
33276
  if (kItem.Close>=kItem.Open) return { Color:this.UpColor, IsUp:true }; //颜色, 是否是上涨
33198
33277
  else return { Color:this.DownColor, IsUp:false };
33199
33278
  }
@@ -42187,7 +42266,7 @@ function KLineTooltipPaint()
42187
42266
  }
42188
42267
 
42189
42268
  if (this.HQChart.CurrentChartDrawPicture) return false; //画图工具操作的时候 不显示
42190
-
42269
+
42191
42270
  return true;
42192
42271
  }
42193
42272
 
@@ -43019,6 +43098,8 @@ function MinuteLeftTooltipPaint()
43019
43098
  var pt=this.HQChart.LastPoint;
43020
43099
  if (!pt) return false;
43021
43100
 
43101
+ if (this.HQChart.ChartCorssCursor && !this.HQChart.ChartCorssCursor.IsShowCorss) return false;
43102
+
43022
43103
  return this.HQChart.IsMouseOnClient(pt.X, pt.Y);
43023
43104
  }
43024
43105
 
@@ -50669,6 +50750,9 @@ function ChartCorssCursor()
50669
50750
  this.IsShowClose=false; //Y轴始终显示收盘价
50670
50751
  this.ClientPos=-1;
50671
50752
  this.CallAcutionXOperator;
50753
+
50754
+ this.EnableKeyboard=false; //是否支持键盘隐藏显示
50755
+ this.OnChangeStatusCallback; //状态切换以后回调
50672
50756
 
50673
50757
 
50674
50758
  this.RightButton=
@@ -51847,6 +51931,29 @@ function ChartCorssCursor()
51847
51931
 
51848
51932
  this.Status=1;
51849
51933
  }
51934
+
51935
+ //data={ e:e, PreventDefault:false, KeyID, Draw:是否需要重绘 }
51936
+ this.OnKeyDown=function(data)
51937
+ {
51938
+ if (!this.EnableKeyboard) return;
51939
+
51940
+ var keyID=data.KeyID;
51941
+ if (keyID==27) //ESC 隐藏十字线
51942
+ {
51943
+ if (!this.IsShowCorss) return;
51944
+ this.IsShowCorss=false;
51945
+ data.Draw=true;
51946
+ if (this.OnChangeStatusCallback) this.OnChangeStatusCallback({ Type:1, IsShowCorss:this.IsShowCorss }, this);
51947
+ }
51948
+ else if (keyID==37 || keyID==39) //left, right 显示十字线
51949
+ {
51950
+ if (this.IsShowCorss) return;
51951
+ this.IsShowCorss=true;
51952
+ data.Draw=true;
51953
+ if (this.OnChangeStatusCallback) this.OnChangeStatusCallback({ Type:1, IsShowCorss:this.IsShowCorss }, this);
51954
+ }
51955
+ }
51956
+
51850
51957
  }
51851
51958
 
51852
51959
 
@@ -68897,6 +69004,18 @@ function JSChartResource()
68897
69004
  LineHeight:25 //单行高度
68898
69005
  };
68899
69006
 
69007
+ this.DialogTooltip=
69008
+ {
69009
+ BGColor:'rgb(250,250,250)', //背景色
69010
+ BorderColor:'rgb(20,20,20)', //边框颜色
69011
+ TitleColor:'rgb(0,0,0)', //标题颜色
69012
+ VolColor:"rgb(255, 185, 15)", //标题成交量
69013
+ AmountColor:"rgb(79, 79, 79)", //成交金额
69014
+ DateTimeColor:'rgb(60,60,60)',
69015
+ TurnoverRateColor:'rgb(43,54,69)', //换手率
69016
+ PositionColor:"rgb(43,54,69)" //持仓
69017
+ }
69018
+
68900
69019
  //弹幕
68901
69020
  this.Barrage= {
68902
69021
  Font:16*GetDevicePixelRatio() +'px 微软雅黑', //字体
@@ -69879,6 +69998,21 @@ function JSChartResource()
69879
69998
  if (item.AmountColor) this.PCTooltipPaint.AmountColor=item.AmountColor;
69880
69999
  }
69881
70000
 
70001
+ if (style.DialogTooltip)
70002
+ {
70003
+ var item=style.DialogTooltip;
70004
+ if (item.BGColor) this.DialogTooltip.BGColor=item.BGColor;
70005
+ if (item.BorderColor) this.DialogTooltip.BorderColor=item.BorderColor;
70006
+ if (item.TitleColor) this.DialogTooltip.TitleColor=item.TitleColor;
70007
+ if (item.DateTimeColor) this.DialogTooltip.DateTimeColor=item.DateTimeColor;
70008
+
70009
+ if (item.VolColor) this.DialogTooltip.VolColor=item.VolColor;
70010
+ if (item.AmountColor) this.DialogTooltip.AmountColor=item.AmountColor;
70011
+ if (item.TurnoverRateColor) this.DialogTooltip.TurnoverRateColor=item.TurnoverRateColor;
70012
+ if (item.PositionColor) this.DialogTooltip.PositionColor=item.PositionColor;
70013
+
70014
+ }
70015
+
69882
70016
  if (style.MinuteInfo)
69883
70017
  {
69884
70018
  var item=style.MinuteInfo;
@@ -70820,7 +70954,26 @@ function JSChartLocalization()
70820
70954
  ['DivTooltip-Amount', {CN:'金额:', EN:'Amount:', TC:'金額'}],
70821
70955
  ['DivTooltip-Exchange', {CN:'换手:', EN:'Exchange:', TC:'換手'}],
70822
70956
  ['DivTooltip-Position', {CN:'持仓:', EN:'Position:', TC:'持倉'}],
70823
- ['DivTooltip-Price', {CN:'价格:', EN:'Open:', TC:'價格'}],
70957
+ ['DivTooltip-Price', {CN:'价格:', EN:'Price:', TC:'價格'}],
70958
+
70959
+ ['DialogTooltip-Date', {CN:'日期', EN:'Date', TC:'日期'}],
70960
+ ['DialogTooltip-Time', {CN:'时间', EN:'Time', TC:'時間'}],
70961
+ ['DialogTooltip-Open', {CN:'开盘价', EN:'Open', TC:'開盤價'}],
70962
+ ['DialogTooltip-High', {CN:'最高价', EN:'High', TC:'最高價'}],
70963
+ ['DialogTooltip-Low', {CN:'最低价', EN:'Low', TC:'最低價'}],
70964
+ ['DialogTooltip-Close', {CN:'收盘价', EN:'Close', TC:'收盤價'}],
70965
+ ['DialogTooltip-Increase', {CN:'涨幅', EN:'Increase', TC:'漲幅'}],
70966
+ ['DialogTooltip-Risefall', {CN:'涨跌', EN:'Risefall', TC:'漲跌'}],
70967
+ ['DialogTooltip-Vol', {CN:'成交量', EN:'Volume', TC:'數量'}],
70968
+ ['DialogTooltip-Amount', {CN:'成交额', EN:'Amount', TC:'金額'}],
70969
+ ['DialogTooltip-Exchange', {CN:'换手率', EN:'Exchange', TC:'換手'}],
70970
+ ['DialogTooltip-Position', {CN:'持仓量', EN:'Position', TC:'持倉'}],
70971
+ ['DialogTooltip-Price', {CN:'价格', EN:'Price', TC:'價格'}],
70972
+ ['DialogTooltip-Amplitude', {CN:'振幅', EN:'amplitude', TC:'價格'}],
70973
+ ['DialogTooltip-AC-Price', {CN:'匹配价', EN:'Price', TC:'匹配價'}],
70974
+ ['DialogTooltip-AC-AvPrice', {CN:'匹配均价', EN:'AVPrice', TC:'匹配均價'}],
70975
+ ['DialogTooltip-AC-Increase', {CN:'竞价涨幅', EN:'Increase', TC:'競價漲幅'}],
70976
+ ['DialogTooltip-AC-Vol', {CN:'匹配量', EN:'Vol', TC:'匹配量'}],
70824
70977
 
70825
70978
  //走势图PC tooltip
70826
70979
  ['PCTooltip-Date', {CN:'日期', EN:'Date', TC:"日期"}],
@@ -72572,6 +72725,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72572
72725
  this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;
72573
72726
  this.ChartCorssCursor.StringFormatY.ExtendChartPaint=this.ExtendChartPaint;
72574
72727
  this.ChartCorssCursor.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
72728
+ this.ChartCorssCursor.OnChangeStatusCallback=(data, obj)=>{ this.OnChangeCorssCursorStatus(data,obj); }
72575
72729
 
72576
72730
  //创建等待提示
72577
72731
  this.ChartSplashPaint = new ChartSplashPaint();
@@ -79106,6 +79260,42 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
79106
79260
 
79107
79261
  this.Draw();
79108
79262
  }
79263
+
79264
+ this.DrawTooltipDialog=function()
79265
+ {
79266
+ if (!this.DialogTooltip) return;
79267
+
79268
+ this.UpdateTooltipDialog();
79269
+ }
79270
+
79271
+ this.UpdateTooltipDialog=function()
79272
+ {
79273
+ if (!this.DialogTooltip) return false;
79274
+ if (!this.ChartCorssCursor) return false;
79275
+
79276
+ var kItem=null;
79277
+ if (this.ChartCorssCursor.ClientPos>=0)
79278
+ {
79279
+ var hisData=this.ChartOperator_Temp_GetHistroyData();;
79280
+ if (!hisData) return false; //数据还没有到达
79281
+
79282
+ var dataIndex=hisData.DataOffset+this.ChartCorssCursor.CursorIndex;
79283
+ var kItem=hisData.Data[dataIndex];
79284
+ }
79285
+
79286
+ var sendData=
79287
+ {
79288
+ ClientPos:this.ChartCorssCursor.ClientPos, //位置
79289
+ IsShowCorss:this.ChartCorssCursor.IsShowCorss, //是否显示十字线
79290
+ KItem:kItem,
79291
+ Symbol:this.Symbol, Name:this.Name,
79292
+ };
79293
+
79294
+
79295
+ this.DialogTooltip.Update(sendData);
79296
+
79297
+ return true;
79298
+ }
79109
79299
  }
79110
79300
 
79111
79301
  //API 返回数据 转化为array[]
@@ -80786,6 +80976,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
80786
80976
  }
80787
80977
 
80788
80978
  var keyID = e.keyCode ? e.keyCode :e.which;
80979
+
80980
+ var draw=false;
80981
+ if (this.ChartCorssCursor && this.ChartCorssCursor.OnKeyDown) //十字光标 隐藏显示
80982
+ {
80983
+ var sendData={ e:e, KeyID:keyID, Draw:false, PreventDefault:false };
80984
+ this.ChartCorssCursor.OnKeyDown(sendData);
80985
+ draw=sendData.Draw;
80986
+ }
80987
+
80789
80988
  switch(keyID)
80790
80989
  {
80791
80990
  case 37: //left
@@ -80891,10 +81090,20 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
80891
81090
  this.ChartOperator(option);
80892
81091
  }
80893
81092
  break;
81093
+ case 27:
81094
+ if (this.CurrentChartDrawPicture)
81095
+ {
81096
+ var drawPicture=this.CurrentChartDrawPicture;
81097
+ if (drawPicture.Status!=20) //画布移动的时候不能取消
81098
+ this.CurrentChartDrawPicture=null;
81099
+ }
81100
+ break;
80894
81101
  default:
80895
81102
  return;
80896
81103
  }
80897
81104
 
81105
+ if (draw) this.DrawDynamicInfo();
81106
+
80898
81107
  //不让滚动条滚动
80899
81108
  if(e.preventDefault) e.preventDefault();
80900
81109
  else e.returnValue = false;
@@ -84841,6 +85050,55 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84841
85050
 
84842
85051
  return null;
84843
85052
  }
85053
+
85054
+ this.DrawTooltipDialog=function()
85055
+ {
85056
+ if (!this.DialogTooltip) return;
85057
+
85058
+ this.UpdateTooltipDialog();
85059
+ }
85060
+
85061
+ this.UpdateTooltipDialog=function()
85062
+ {
85063
+ if (!this.DialogTooltip) return false;
85064
+ if (!this.ChartCorssCursor) return false;
85065
+
85066
+ var minuteItem=null; //{ Type:0=连续交易 1=集合竞价, Data:数据 }
85067
+ if (this.ChartCorssCursor.ClientPos>=0)
85068
+ {
85069
+ var titlePaint=this.TitlePaint[0];
85070
+ if (titlePaint && titlePaint.PointInfo)
85071
+ {
85072
+ var pointInfo=titlePaint.PointInfo;
85073
+ if ((pointInfo.ClientPos==2 || pointInfo.ClientPos==3 || (pointInfo.ClientPos>=200&& pointInfo.ClientPos<=299) || (pointInfo.ClientPos>=300&& pointInfo.ClientPos<=399)))
85074
+ {
85075
+ var auctionData=titlePaint.GetCurrentAuctionData();
85076
+ if (!auctionData) return;
85077
+ minuteItem={ Type:1, Data:auctionData };
85078
+ }
85079
+ else
85080
+ {
85081
+ var minuteData=titlePaint.GetCurrentKLineData();
85082
+ if (!minuteData) return;
85083
+ minuteItem={ Type:0, Data:minuteData };
85084
+ }
85085
+ }
85086
+
85087
+ }
85088
+
85089
+ var sendData=
85090
+ {
85091
+ ClientPos:this.ChartCorssCursor.ClientPos, //位置
85092
+ IsShowCorss:this.ChartCorssCursor.IsShowCorss, //是否显示十字线
85093
+ MinItem:minuteItem,
85094
+ Symbol:this.Symbol, Name:this.Name,
85095
+ };
85096
+
85097
+
85098
+ this.DialogTooltip.Update(sendData);
85099
+
85100
+ return true;
85101
+ }
84844
85102
  }
84845
85103
 
84846
85104
  //盘前数据
@@ -1609,7 +1609,84 @@ input[type="color"] {
1609
1609
  }
1610
1610
 
1611
1611
 
1612
+ /*
1613
+ Copyright (c) 2018 jones
1614
+
1615
+ http://www.apache.org/licenses/LICENSE-2.0
1612
1616
 
1617
+ 开源项目 https://github.com/jones2000/HQChart
1618
+
1619
+ jones_2000@163.com
1613
1620
 
1621
+ 内置tooltip对话框
1622
+ */
1614
1623
 
1615
1624
 
1625
+ .UMyChart_Tooltip_Dialog_Div
1626
+ {
1627
+ font-family: "微软雅黑";
1628
+ /*display: flex;*/
1629
+ border: 1px solid;
1630
+ width:fit-content;
1631
+ border-color: rgb(204,204,204);
1632
+ visibility:hidden;
1633
+ position: absolute;
1634
+ background-color: rgba(20,20,20,1);
1635
+ left:1px;
1636
+ top:1px;
1637
+
1638
+ }
1639
+
1640
+ .UMyChart_Tooltip_Title_Div
1641
+ {
1642
+ padding-left: 2px;
1643
+ height:20px;
1644
+ border-bottom: 1px solid;
1645
+
1646
+ display: flex;
1647
+ cursor: default;
1648
+ user-select: none;
1649
+ background-color:rgb(200, 66, 69)
1650
+ }
1651
+
1652
+ .UMyChart_Tooltip_Name_Div
1653
+ {
1654
+ margin-left: 5px;
1655
+ color:rgb(250,250,250)
1656
+ }
1657
+
1658
+ .UMyChart_Tooltip_Close_Div
1659
+ {
1660
+ margin-left: auto;
1661
+ padding-right: 4px;
1662
+ cursor:pointer;
1663
+ color:rgb(180,180,180)
1664
+ }
1665
+
1666
+ .UMyChart_Tooltip_Table
1667
+ {
1668
+ border-spacing: 2px;
1669
+ user-select: none;
1670
+ font-size:12px;
1671
+ }
1672
+
1673
+ .UMyChart_Tooltip_Title_Td
1674
+ {
1675
+ min-width: 40px;
1676
+ }
1677
+
1678
+ .UMyChart_Tooltip_Text_Td
1679
+ {
1680
+ min-width:100px;
1681
+ }
1682
+
1683
+ .UMyChart_Tooltip_Title_Span
1684
+ {
1685
+ float: right;
1686
+ }
1687
+
1688
+ .UMyChart_Tooltip_Text_Span
1689
+ {
1690
+ float: right;
1691
+ margin-right: 5px;
1692
+ }
@@ -392,7 +392,19 @@ function GetBlackStyle()
392
392
  VolColor:"rgb(161,154,3)", //标题成交量
393
393
  AmountColor:"rgb(161,154,3)", //成交金额
394
394
  },
395
-
395
+
396
+ DialogTooltip:
397
+ {
398
+ BGColor:'rgb(20,20,20)', //背景色
399
+ BorderColor:'rgb(170,170,170)', //边框颜色
400
+ TitleColor:'rgb(210,210,210)', //标题颜色
401
+ VolColor:"rgb(255, 185, 15)", //标题成交量
402
+ AmountColor:"rgb(210,210,210)", //成交金额
403
+ DateTimeColor:'rgb(210,210,210)',
404
+ TurnoverRateColor:'rgb(43,54,69)', //换手率
405
+ PositionColor:"rgb(43,54,69)" //持仓
406
+ },
407
+
396
408
  //走势图 信息地雷
397
409
  MinuteInfo:
398
410
  {
@@ -468,7 +468,7 @@ HQData.RequestMinuteRealtimeData=function(data,callback)
468
468
 
469
469
  //生成随机测试数据
470
470
  var price=kItem[5];
471
- var value=Math.ceil(Math.random()*10)/10000*price;
471
+ var value=Math.ceil(Math.random()*10)/5000*price;
472
472
  var bUp=Math.ceil(Math.random()*10)>=5;
473
473
 
474
474
  if (bUp) price+=value;