hqchart 1.1.13905 → 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.
@@ -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
 
@@ -1718,6 +1719,9 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
1718
1719
  if (option.EnableDrawToolDialogV2===true) chart.InitalDrawToolDialog();
1719
1720
  if (option.EnableModifyDrawDialogV2===true) chart.InitalModifyDrawDialog();
1720
1721
 
1722
+ //K线tooltip
1723
+ if (option.EnableTooltipDialog===true) chart.InitalTooltipDialog();
1724
+
1721
1725
  //注册事件
1722
1726
  if (option.EventCallback)
1723
1727
  {
@@ -3019,6 +3023,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3019
3023
  this.DialogDrawTool; //画图工具
3020
3024
  this.DialogModifyDraw; //画图修改
3021
3025
 
3026
+ this.DialogTooltip; //tooltip信息
3027
+
3022
3028
 
3023
3029
  this.ClearStockCache=function()
3024
3030
  {
@@ -3042,6 +3048,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3042
3048
  this.DialogDrawTool.Create();
3043
3049
  }
3044
3050
 
3051
+ this.InitalTooltipDialog=function()
3052
+ {
3053
+ if (this.DialogTooltip) return;
3054
+
3055
+ this.DialogTooltip=new JSDialogTooltip();
3056
+ this.DialogTooltip.Inital(this);
3057
+ this.DialogTooltip.Create();
3058
+ }
3059
+
3045
3060
  this.InitalModifyDrawDialog=function()
3046
3061
  {
3047
3062
  if ( this.DialogModifyDraw) return;
@@ -3098,6 +3113,22 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3098
3113
  this.DialogModifyDraw.Close();
3099
3114
  }
3100
3115
 
3116
+ this.IsShowTooltipDialog=function()
3117
+ {
3118
+ if (!this.DialogTooltip) return false;
3119
+
3120
+ return this.DialogTooltip.IsShow();
3121
+ }
3122
+
3123
+ this.CloseTooltipDialog=function()
3124
+ {
3125
+ if (!this.DialogTooltip) return;
3126
+
3127
+ this.DialogTooltip.Close();
3128
+ }
3129
+
3130
+
3131
+
3101
3132
  //obj={ Element:, Canvas: }
3102
3133
  this.SetCorssCursorElement=function(obj)
3103
3134
  {
@@ -5467,6 +5498,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5467
5498
  {
5468
5499
  this.ChartCorssCursor.Canvas=this.Canvas;
5469
5500
  }
5501
+
5502
+ this.DrawTooltipDialog();
5470
5503
  }
5471
5504
 
5472
5505
  ptPosition=this.Frame.PtInFrame(this.LastPoint.X, this.LastPoint.Y);
@@ -5916,6 +5949,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5916
5949
  {
5917
5950
  this.ChartCorssCursor.Canvas=this.Canvas;
5918
5951
  }
5952
+
5953
+ this.DrawTooltipDialog();
5919
5954
  }
5920
5955
 
5921
5956
  var ptPosition=null; //鼠标位置 null 无效 -1 在外面 >=0 对应的指标窗口中ID
@@ -6438,6 +6473,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6438
6473
  }
6439
6474
 
6440
6475
  var keyID = e.keyCode ? e.keyCode :e.which;
6476
+
6477
+ var draw=false;
6478
+ if (this.ChartCorssCursor && this.ChartCorssCursor.OnKeyDown) //十字光标 隐藏显示
6479
+ {
6480
+ var sendData={ e:e, KeyID:keyID, Draw:false, PreventDefault:false };
6481
+ this.ChartCorssCursor.OnKeyDown(sendData);
6482
+ draw=sendData.Draw;
6483
+ }
6484
+
6441
6485
  switch(keyID)
6442
6486
  {
6443
6487
  case 37: //left
@@ -6580,6 +6624,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6580
6624
  return;
6581
6625
  }
6582
6626
 
6627
+ if (draw) this.DrawDynamicInfo();
6628
+
6583
6629
  //不让滚动条滚动
6584
6630
  if(e.preventDefault) e.preventDefault();
6585
6631
  else e.returnValue = false;
@@ -6887,6 +6933,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6887
6933
  this.ShowTooltip(this.LastPoint.X/pixelTatio,this.LastPoint.Y/pixelTatio,toolTip);
6888
6934
  }
6889
6935
 
6936
+ this.DrawTooltipDialog=function()
6937
+ {
6938
+
6939
+ }
6940
+
6890
6941
  this.ShowTooltip=function(x,y,toolTip)
6891
6942
  {
6892
6943
  if (!this.IsShowTooltip) return;
@@ -7996,6 +8047,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7996
8047
  else if (option.Draw==true) this.Draw(); //是否立即重绘
7997
8048
 
7998
8049
  if (this.PopMinuteChart) this.PopMinuteChart.ReloadResource(option);
8050
+ if (this.DialogTooltip) this.DialogTooltip.ReloadResource(option);
7999
8051
  }
8000
8052
 
8001
8053
  this.ReloadBorder=function(option) //根据页面缩放调整对应边框的尺长
@@ -9985,6 +10037,19 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9985
10037
  item.Status=OVERLAY_STATUS_ID.STATUS_NONE_ID;
9986
10038
  }
9987
10039
  }
10040
+
10041
+ //十字光标状态变动
10042
+ this.OnChangeCorssCursorStatus=function(data, obj)
10043
+ {
10044
+ if (data.Type==1)
10045
+ {
10046
+ if (!data.IsShowCorss) //十字光标隐藏
10047
+ {
10048
+ this.HideTooltip();
10049
+ this.CloseTooltipDialog();
10050
+ }
10051
+ }
10052
+ }
9988
10053
  }
9989
10054
 
9990
10055
  function GetDevicePixelRatio()
@@ -13495,6 +13560,20 @@ function MinuteFrame()
13495
13560
 
13496
13561
  this.NightDayConfig=CloneData(g_JSChartResource.Minute.NightDay);
13497
13562
 
13563
+
13564
+ this.MinuteFrame_ReloadResource=this.ReloadResource;
13565
+
13566
+
13567
+ this.ReloadResource=function(resource)
13568
+ {
13569
+ this.MinuteFrame_ReloadResource(resource);
13570
+
13571
+ //集合竞价配色修改
13572
+ this.BeforeBGColor=g_JSChartResource.Minute.Before.BGColor;
13573
+ this.AfterBGColor=g_JSChartResource.Minute.After.BGColor;
13574
+ this.MultiDayBorderPen=g_JSChartResource.MultiDayBorderPen;
13575
+ }
13576
+
13498
13577
  this.DrawFrame=function()
13499
13578
  {
13500
13579
  if (!this.IsMinSize)
@@ -42983,6 +43062,22 @@ function MinuteLeftTooltipPaint()
42983
43062
  if (IFrameSplitOperator.IsNumber(option.FixedWidth)) this.FixedWidth=option.FixedWidth;
42984
43063
  }
42985
43064
 
43065
+ this.ReloadResource=function(resource)
43066
+ {
43067
+ this.BorderColor=g_JSChartResource.PCTooltipPaint.BorderColor; //边框颜色
43068
+ this.BGColor=g_JSChartResource.PCTooltipPaint.BGColor; //背景色
43069
+ this.TitleColor=g_JSChartResource.PCTooltipPaint.TitleColor; //标题颜色
43070
+ this.DateTimeColor=g_JSChartResource.PCTooltipPaint.DateTimeColor; //日期时间颜色
43071
+ this.VolColor=g_JSChartResource.PCTooltipPaint.VolColor; //标题成交量
43072
+ this.AmountColor=g_JSChartResource.PCTooltipPaint.AmountColor; //成交金额
43073
+
43074
+ this.UpColor=g_JSChartResource.UpTextColor;
43075
+ this.DownColor=g_JSChartResource.DownTextColor;
43076
+ this.UnchagneColor=g_JSChartResource.UnchagneTextColor;
43077
+
43078
+ this.Font=g_JSChartResource.PCTooltipPaint.TitleFont;
43079
+ }
43080
+
42986
43081
  this.IsEnableDraw=function()
42987
43082
  {
42988
43083
  if (!this.HQChart || !this.HQChart.TitlePaint || !this.HQChart.TitlePaint[0]) return false;
@@ -50639,6 +50734,9 @@ function ChartCorssCursor()
50639
50734
  this.IsShowClose=false; //Y轴始终显示收盘价
50640
50735
  this.ClientPos=-1;
50641
50736
  this.CallAcutionXOperator;
50737
+
50738
+ this.EnableKeyboard=false; //是否支持键盘隐藏显示
50739
+ this.OnChangeStatusCallback; //状态切换以后回调
50642
50740
 
50643
50741
 
50644
50742
  this.RightButton=
@@ -51817,6 +51915,29 @@ function ChartCorssCursor()
51817
51915
 
51818
51916
  this.Status=1;
51819
51917
  }
51918
+
51919
+ //data={ e:e, PreventDefault:false, KeyID, Draw:是否需要重绘 }
51920
+ this.OnKeyDown=function(data)
51921
+ {
51922
+ if (!this.EnableKeyboard) return;
51923
+
51924
+ var keyID=data.KeyID;
51925
+ if (keyID==27) //ESC 隐藏十字线
51926
+ {
51927
+ if (!this.IsShowCorss) return;
51928
+ this.IsShowCorss=false;
51929
+ data.Draw=true;
51930
+ if (this.OnChangeStatusCallback) this.OnChangeStatusCallback({ Type:1, IsShowCorss:this.IsShowCorss }, this);
51931
+ }
51932
+ else if (keyID==37 || keyID==39) //left, right 显示十字线
51933
+ {
51934
+ if (this.IsShowCorss) return;
51935
+ this.IsShowCorss=true;
51936
+ data.Draw=true;
51937
+ if (this.OnChangeStatusCallback) this.OnChangeStatusCallback({ Type:1, IsShowCorss:this.IsShowCorss }, this);
51938
+ }
51939
+ }
51940
+
51820
51941
  }
51821
51942
 
51822
51943
 
@@ -68867,6 +68988,18 @@ function JSChartResource()
68867
68988
  LineHeight:25 //单行高度
68868
68989
  };
68869
68990
 
68991
+ this.DialogTooltip=
68992
+ {
68993
+ BGColor:'rgb(250,250,250)', //背景色
68994
+ BorderColor:'rgb(20,20,20)', //边框颜色
68995
+ TitleColor:'rgb(0,0,0)', //标题颜色
68996
+ VolColor:"rgb(255, 185, 15)", //标题成交量
68997
+ AmountColor:"rgb(79, 79, 79)", //成交金额
68998
+ DateTimeColor:'rgb(60,60,60)',
68999
+ TurnoverRateColor:'rgb(43,54,69)', //换手率
69000
+ PositionColor:"rgb(43,54,69)" //持仓
69001
+ }
69002
+
68870
69003
  //弹幕
68871
69004
  this.Barrage= {
68872
69005
  Font:16*GetDevicePixelRatio() +'px 微软雅黑', //字体
@@ -69849,6 +69982,21 @@ function JSChartResource()
69849
69982
  if (item.AmountColor) this.PCTooltipPaint.AmountColor=item.AmountColor;
69850
69983
  }
69851
69984
 
69985
+ if (style.DialogTooltip)
69986
+ {
69987
+ var item=style.DialogTooltip;
69988
+ if (item.BGColor) this.DialogTooltip.BGColor=item.BGColor;
69989
+ if (item.BorderColor) this.DialogTooltip.BorderColor=item.BorderColor;
69990
+ if (item.TitleColor) this.DialogTooltip.TitleColor=item.TitleColor;
69991
+ if (item.DateTimeColor) this.DialogTooltip.DateTimeColor=item.DateTimeColor;
69992
+
69993
+ if (item.VolColor) this.DialogTooltip.VolColor=item.VolColor;
69994
+ if (item.AmountColor) this.DialogTooltip.AmountColor=item.AmountColor;
69995
+ if (item.TurnoverRateColor) this.DialogTooltip.TurnoverRateColor=item.TurnoverRateColor;
69996
+ if (item.PositionColor) this.DialogTooltip.PositionColor=item.PositionColor;
69997
+
69998
+ }
69999
+
69852
70000
  if (style.MinuteInfo)
69853
70001
  {
69854
70002
  var item=style.MinuteInfo;
@@ -70792,6 +70940,20 @@ function JSChartLocalization()
70792
70940
  ['DivTooltip-Position', {CN:'持仓:', EN:'Position:', TC:'持倉'}],
70793
70941
  ['DivTooltip-Price', {CN:'价格:', EN:'Open:', TC:'價格'}],
70794
70942
 
70943
+ ['DialogTooltip-Date', {CN:'日期', EN:'Date', TC:'日期'}],
70944
+ ['DialogTooltip-Time', {CN:'时间', EN:'Time', TC:'時間'}],
70945
+ ['DialogTooltip-Open', {CN:'开盘价', EN:'Open', TC:'開盤價'}],
70946
+ ['DialogTooltip-High', {CN:'最高价', EN:'High', TC:'最高價'}],
70947
+ ['DialogTooltip-Low', {CN:'最低价', EN:'Low', TC:'最低價'}],
70948
+ ['DialogTooltip-Close', {CN:'收盘价', EN:'Close', TC:'收盤價'}],
70949
+ ['DialogTooltip-Increase', {CN:'涨幅', EN:'Increase', TC:'漲幅'}],
70950
+ ['DialogTooltip-Vol', {CN:'成交量', EN:'Volume', TC:'數量'}],
70951
+ ['DialogTooltip-Amount', {CN:'成交额', EN:'Amount', TC:'金額'}],
70952
+ ['DialogTooltip-Exchange', {CN:'换手率', EN:'Exchange', TC:'換手'}],
70953
+ ['DialogTooltip-Position', {CN:'持仓量', EN:'Position', TC:'持倉'}],
70954
+ ['DialogTooltip-Price', {CN:'价格', EN:'Open', TC:'價格'}],
70955
+ ['DialogTooltip-Amplitude', {CN:'振幅', EN:'amplitude', TC:'價格'}],
70956
+
70795
70957
  //走势图PC tooltip
70796
70958
  ['PCTooltip-Date', {CN:'日期', EN:'Date', TC:"日期"}],
70797
70959
  ['PCTooltip-Time', {CN:'时间', EN:'Time', TC:"時間"}],
@@ -72542,6 +72704,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72542
72704
  this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;
72543
72705
  this.ChartCorssCursor.StringFormatY.ExtendChartPaint=this.ExtendChartPaint;
72544
72706
  this.ChartCorssCursor.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
72707
+ this.ChartCorssCursor.OnChangeStatusCallback=(data, obj)=>{ this.OnChangeCorssCursorStatus(data,obj); }
72545
72708
 
72546
72709
  //创建等待提示
72547
72710
  this.ChartSplashPaint = new ChartSplashPaint();
@@ -79076,6 +79239,42 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
79076
79239
 
79077
79240
  this.Draw();
79078
79241
  }
79242
+
79243
+ this.DrawTooltipDialog=function()
79244
+ {
79245
+ if (!this.DialogTooltip) return;
79246
+
79247
+ this.UpdateTooltipDialog();
79248
+ }
79249
+
79250
+ this.UpdateTooltipDialog=function()
79251
+ {
79252
+ if (!this.DialogTooltip) return false;
79253
+ if (!this.ChartCorssCursor) return false;
79254
+
79255
+ var kItem=null;
79256
+ if (this.ChartCorssCursor.ClientPos>=0)
79257
+ {
79258
+ var hisData=this.ChartOperator_Temp_GetHistroyData();;
79259
+ if (!hisData) return false; //数据还没有到达
79260
+
79261
+ var dataIndex=hisData.DataOffset+this.ChartCorssCursor.CursorIndex;
79262
+ var kItem=hisData.Data[dataIndex];
79263
+ }
79264
+
79265
+ var sendData=
79266
+ {
79267
+ ClientPos:this.ChartCorssCursor.ClientPos, //位置
79268
+ IsShowCorss:this.ChartCorssCursor.IsShowCorss, //是否显示十字线
79269
+ KItem:kItem,
79270
+ Symbol:this.Symbol, Name:this.Name,
79271
+ };
79272
+
79273
+
79274
+ this.DialogTooltip.Update(sendData);
79275
+
79276
+ return true;
79277
+ }
79079
79278
  }
79080
79279
 
79081
79280
  //API 返回数据 转化为array[]
@@ -80756,6 +80955,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
80756
80955
  }
80757
80956
 
80758
80957
  var keyID = e.keyCode ? e.keyCode :e.which;
80958
+
80759
80959
  switch(keyID)
80760
80960
  {
80761
80961
  case 37: //left
@@ -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
1616
+
1617
+ 开源项目 https://github.com/jones2000/HQChart
1618
+
1619
+ jones_2000@163.com
1620
+
1621
+ 内置tooltip对话框
1622
+ */
1623
+
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
+ }
1612
1651
 
1652
+ .UMyChart_Tooltip_Name_Div
1653
+ {
1654
+ margin-left: 5px;
1655
+ color:rgb(250,250,250)
1656
+ }
1613
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
+ }
1614
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
+ width: 40px;
1676
+ }
1677
+
1678
+ .UMyChart_Tooltip_Text_Td
1679
+ {
1680
+ width:100px;
1681
+ }
1615
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
  {