hqchart 1.1.14814 → 1.1.14820

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.
@@ -4543,6 +4543,12 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4543
4543
  if (option.DrawTool.StorageKey && chart.ChartDrawStorage) chart.ChartDrawStorage.Load(option.DrawTool.StorageKey);
4544
4544
  }
4545
4545
 
4546
+ if (option.KeyboardMove)
4547
+ {
4548
+ var item=option.KeyboardMove;
4549
+ if (IFrameSplitOperator.IsPlusNumber(item.Delay)) chart.KeyboardMove.Delay=item.Delay;
4550
+ }
4551
+
4546
4552
  if (IFrameSplitOperator.IsNumber(option.StepPixel)) chart.StepPixel=option.StepPixel;
4547
4553
  if (option.ZoomStepPixel>0) chart.ZoomStepPixel=option.ZoomStepPixel;
4548
4554
  if (option.IsApiPeriod==true) chart.IsApiPeriod=option.IsApiPeriod;
@@ -7320,7 +7326,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7320
7326
  this.DisableMouse=false; //禁止鼠标事件
7321
7327
  this.LanguageID=JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;
7322
7328
  this.PressTime=500;
7323
- this.IsPress=false; //是否长按
7329
+ this.IsPress=false; //是否长按
7330
+ this.IsPressKeyboard=false; //是否键盘按键
7324
7331
 
7325
7332
  this.NetworkFilter; //网络请求回调 function(data, callback);
7326
7333
  this.LastMouseStatus={ MouseOnToolbar:null }; // MouseOnToolbar={ Rect:{}, Title: }
@@ -7404,6 +7411,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7404
7411
  this.AryHotKey=[]; //热键 { KeyID:87, SecondKeyID:1, CMD:JSCHART_MENU_ID.CMD_FULLSCREEN_SUMMARY_ID, Args:null, Description:"Alt+W 全屏区间统计" },
7405
7412
 
7406
7413
  this.FastSlideConfig={ MinDistance:500, MinSpeed:3, MaxTime:250, Enable:false }; //快速滑动配置 MinDistance=最小的距离 MinSpeed=最小速度 MaxTime=最大间隔时间(ms)
7414
+ this.KeyboardMove={ Timer:null, Delay:100 , Enable:false, Event:null }; //键盘左右移动
7407
7415
 
7408
7416
  this.RestoreFocus=function(delay)
7409
7417
  {
@@ -11573,6 +11581,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11573
11581
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
11574
11582
 
11575
11583
  var keyID = e.keyCode ? e.keyCode :e.which;
11584
+ this.IsPressKeyboard=true;
11576
11585
 
11577
11586
  //回调事件
11578
11587
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);
@@ -11607,6 +11616,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11607
11616
  switch(keyID)
11608
11617
  {
11609
11618
  case 37: //left
11619
+ if (this.KeyboardMove.Enable) break;
11610
11620
  if ((e.ctrlKey||e.shiftKey) && this.OnCustomKeyDown)
11611
11621
  {
11612
11622
  if (this.OnCustomKeyDown(keyID, e))
@@ -11646,6 +11656,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11646
11656
  }
11647
11657
  break;
11648
11658
  case 39: //right
11659
+ if (this.KeyboardMove.Enable) break;
11649
11660
  if ((e.ctrlKey|| e.shiftKey) && this.OnCustomKeyDown)
11650
11661
  {
11651
11662
  if (this.OnCustomKeyDown(keyID, e))
@@ -11780,11 +11791,167 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11780
11791
 
11781
11792
  if (draw) this.DrawDynamicInfo();
11782
11793
 
11794
+ if (keyID==37 || keyID==39)
11795
+ this.StartKeyboardMoveTimer(e);
11796
+
11783
11797
  //不让滚动条滚动
11784
11798
  if(e.preventDefault) e.preventDefault();
11785
11799
  else e.returnValue = false;
11786
11800
  }
11787
11801
 
11802
+
11803
+ this.ClearKeyboardMoveTimer=function()
11804
+ {
11805
+ if (!this.KeyboardMove) return;
11806
+
11807
+ this.KeyboardMove.Event=null;
11808
+
11809
+ if (this.KeyboardMove.Timer)
11810
+ {
11811
+ clearTimeout(this.KeyboardMove.Timer);
11812
+ this.KeyboardMove.Timer=null;
11813
+ JSConsole.Chart.Log(`[JSChartContainer::ClearKeyboardMoveTimer] Stop` );
11814
+ }
11815
+
11816
+ this.KeyboardMove.Enable=false;
11817
+ }
11818
+
11819
+ this.StartKeyboardMoveTimer=function(e)
11820
+ {
11821
+ if (!this.KeyboardMove) return;
11822
+ if (this.KeyboardMove.Enable) return; //已启动
11823
+
11824
+ this.KeyboardMove.Event=e;
11825
+ this.KeyboardMove.Enable=true;
11826
+
11827
+ JSConsole.Chart.Log(`[JSChartContainer::StartKeyboardMoveTimer] Start` );
11828
+
11829
+ this.AutoKeyboardMove();
11830
+ }
11831
+
11832
+ this.AutoKeyboardMove=function()
11833
+ {
11834
+ if (!this.KeyboardMove) return false;
11835
+ if (!this.KeyboardMove.Enable) return false;
11836
+ if (!this.KeyboardMove.Event) return false;
11837
+
11838
+ this.KeyboardMove.Timer=setTimeout(()=>
11839
+ {
11840
+ this.OnKeyboardMoveTimerProc();
11841
+ },this.KeyboardMove.Delay);
11842
+ }
11843
+
11844
+
11845
+ this.OnKeyboardMoveTimerProc=function()
11846
+ {
11847
+ if (!this.KeyboardMove) return false;
11848
+ if (!this.KeyboardMove.Enable) return false;
11849
+ if (!this.KeyboardMove.Event) return false;
11850
+
11851
+ var e=this.KeyboardMove.Event;
11852
+ var keyID = e.keyCode ? e.keyCode :e.which;
11853
+ var bStop=false;
11854
+ switch(keyID)
11855
+ {
11856
+ case 37: //left
11857
+ if ((e.ctrlKey||e.shiftKey) && this.OnCustomKeyDown)
11858
+ {
11859
+ if (this.OnCustomKeyDown(keyID, e))
11860
+ break;
11861
+ }
11862
+
11863
+ //K线 如果超出K线数据了 调整到最后一个数据
11864
+ if (this.FixCursorIndexValid && this.FixCursorIndexValid())
11865
+ {
11866
+ this.UpdatePointByCursorIndex();
11867
+ this.DrawDynamicInfo();
11868
+ this.ShowTooltipByKeyDown();
11869
+ break;
11870
+ }
11871
+
11872
+ if (this.CursorIndex<=0.99999)
11873
+ {
11874
+ if (!this.DataMoveLeft())
11875
+ { //左移数据到头了 触发下载新数据
11876
+ if (this.DragDownloadData) this.DragDownloadData();
11877
+ break;
11878
+ }
11879
+ this.UpdataDataoffset();
11880
+ this.UpdatePointByCursorIndex();
11881
+ this.UpdateFrameMaxMin();
11882
+ this.ResetFrameXSplit();
11883
+ this.Draw();
11884
+ this.ShowTooltipByKeyDown();
11885
+ this.OnKLinePageChange("keydown");
11886
+ }
11887
+ else
11888
+ {
11889
+ --this.CursorIndex;
11890
+ this.UpdatePointByCursorIndex();
11891
+ this.DrawDynamicInfo();
11892
+ this.ShowTooltipByKeyDown();
11893
+ }
11894
+ break;
11895
+
11896
+ case 39: //right
11897
+ if ((e.ctrlKey|| e.shiftKey) && this.OnCustomKeyDown)
11898
+ {
11899
+ if (this.OnCustomKeyDown(keyID, e))
11900
+ break;
11901
+ }
11902
+
11903
+ //K线 如果超出K线数据了 调整到最后一个数据
11904
+ if (this.FixCursorIndexValid && this.FixCursorIndexValid())
11905
+ {
11906
+ this.UpdatePointByCursorIndex();
11907
+ this.DrawDynamicInfo();
11908
+ this.ShowTooltipByKeyDown();
11909
+ break;
11910
+ }
11911
+
11912
+ var xPointcount=0;
11913
+ if (this.Frame.XPointCount) xPointcount=this.Frame.XPointCount;
11914
+ else xPointcount=this.Frame.SubFrame[0].Frame.XPointCount;
11915
+ if (this.CursorIndex+1>=xPointcount)
11916
+ {
11917
+ if (!this.DataMoveRight()) break;
11918
+ this.UpdataDataoffset();
11919
+ this.UpdatePointByCursorIndex();
11920
+ this.UpdateFrameMaxMin();
11921
+ this.ResetFrameXSplit();
11922
+ this.Draw();
11923
+ this.ShowTooltipByKeyDown();
11924
+ this.OnKLinePageChange("keydown");
11925
+ }
11926
+ else
11927
+ {
11928
+ //判断是否在最后一个数据上
11929
+ var data=null;
11930
+ if (this.Frame.Data) data=this.Frame.Data;
11931
+ else data=this.Frame.SubFrame[0].Frame.Data;
11932
+ if (!data) break;
11933
+ if (this.CursorIndex+data.DataOffset+1>=data.Data.length) break;
11934
+
11935
+ ++this.CursorIndex;
11936
+ this.UpdatePointByCursorIndex();
11937
+ this.DrawDynamicInfo();
11938
+ this.ShowTooltipByKeyDown();
11939
+ }
11940
+ break;
11941
+ }
11942
+
11943
+
11944
+ if (!bStop) this.AutoKeyboardMove();
11945
+ return true;
11946
+ }
11947
+
11948
+
11949
+ this.OnKeyUp=function(e)
11950
+ {
11951
+ this.IsPressKeyboard=false;
11952
+ this.ClearKeyboardMoveTimer();
11953
+ }
11954
+
11788
11955
  this.OnDoubleClick=function(x,y,e)
11789
11956
  {
11790
11957
 
@@ -15961,6 +16128,12 @@ function OnKeyDown(e) //键盘事件
15961
16128
  this.JSChartContainer.OnKeyDown(e);
15962
16129
  }
15963
16130
 
16131
+ function OnKeyUp(e) //键盘事件
16132
+ {
16133
+ if(this.JSChartContainer && this.JSChartContainer.OnKeyUp)
16134
+ this.JSChartContainer.OnKeyUp(e);
16135
+ }
16136
+
15964
16137
  function OnWheel(e) //上下滚动事件
15965
16138
  {
15966
16139
  if(this.JSChartContainer && this.JSChartContainer.OnWheel)
@@ -83899,7 +84072,12 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
83899
84072
  }
83900
84073
  }
83901
84074
 
83902
- if (bRegisterKeydown) this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
84075
+ if (bRegisterKeydown)
84076
+ {
84077
+ this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
84078
+ this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
84079
+ }
84080
+
83903
84081
  if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
83904
84082
 
83905
84083
  this.InitalPopMinuteChart(option);
@@ -85679,7 +85857,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85679
85857
 
85680
85858
  this.RecvRealtimeData=function(data)
85681
85859
  {
85682
- if (this.IsOnTouch==true) return; //正在操作中不更新数据
85860
+ if (this.IsOnTouch==true) return; //正在操作手势不更新数据
85861
+ if (this.IsPressKeyboard==true) return; //正在操作键盘不更新数据
85683
85862
 
85684
85863
  if (data.Ver==3.0)
85685
85864
  {
@@ -86019,6 +86198,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
86019
86198
  this.RecvMinuteRealtimeDataV2=function(data) //新版本的
86020
86199
  {
86021
86200
  if (this.IsOnTouch==true) return; //正在操作中不更新数据
86201
+ if (this.IsPressKeyboard==true) return; //正在操作键盘不更新数据
86202
+
86022
86203
  if (this.EnableVerifyRecvData && data.symbol!=this.Symbol)
86023
86204
  {
86024
86205
  JSConsole.Chart.Warn(`[KLineChartContainer::RecvMinuteRealtimeDataV2] recv data symbol not match. HQChart[${this.Symbol}] , Recv[${data.symbol}]`);
@@ -93798,7 +93979,11 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
93798
93979
  }
93799
93980
  }
93800
93981
 
93801
- if (bRegisterKeydown) this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e);} , true); //键盘消息
93982
+ if (bRegisterKeydown)
93983
+ {
93984
+ this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e);} , true); //键盘消息
93985
+ this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
93986
+ }
93802
93987
  if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
93803
93988
  }
93804
93989
 
@@ -95695,7 +95880,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
95695
95880
  return;
95696
95881
  }
95697
95882
 
95698
- if (this.IsOnTouch==true) //正在操作中不更新数据
95883
+ if (this.IsOnTouch==true || this.IsPressKeyboard==true) //正在操作中不更新数据
95699
95884
  {
95700
95885
  if (this.SourceData && IFrameSplitOperator.IsNonEmptyArray(this.SourceData.Data))
95701
95886
  {
@@ -99329,6 +99514,7 @@ function KLineChartHScreenContainer(uielement)
99329
99514
  }
99330
99515
 
99331
99516
  this.UIElement.addEventListener("keydown", OnKeyDown, true); //键盘消息
99517
+ this.UIElement.addEventListener("keyup", OnKeyUp, true);
99332
99518
  }
99333
99519
 
99334
99520
  //创建子窗口
@@ -99517,6 +99703,7 @@ function MinuteChartHScreenContainer(uielement)
99517
99703
  this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;
99518
99704
 
99519
99705
  this.UIElement.addEventListener("keydown", OnKeyDown, true); //键盘消息
99706
+ this.UIElement.addEventListener("keyup", OnKeyUp, true);
99520
99707
  }
99521
99708
 
99522
99709
  //创建子窗口
@@ -99685,7 +99872,11 @@ function DepthChartContainer(uielement)
99685
99872
  }
99686
99873
  }
99687
99874
 
99688
- if (bRegisterKeydown) this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
99875
+ if (bRegisterKeydown)
99876
+ {
99877
+ this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
99878
+ this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
99879
+ }
99689
99880
  if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
99690
99881
  }
99691
99882
 
@@ -153738,7 +153929,7 @@ function JSDialogModifyDraw()
153738
153929
  this.ColorButton=null;
153739
153930
  if (this.DivDialog)
153740
153931
  {
153741
- document.body.remove(this.DivDialog);
153932
+ document.body.removeChild(this.DivDialog);
153742
153933
  this.DivDialog=null;
153743
153934
  }
153744
153935
  }
@@ -159869,7 +160060,7 @@ function JSDialogModifyIndexParam()
159869
160060
 
159870
160061
  if (this.DivDialog)
159871
160062
  {
159872
- document.body.removeChild(this.DivDialog);
160063
+ if (document && document.body && document.body.removeChild) document.body.removeChild(this.DivDialog);
159873
160064
  this.DivDialog=null;
159874
160065
  }
159875
160066
  }
@@ -160389,7 +160580,7 @@ function HQChartScriptWorker()
160389
160580
 
160390
160581
 
160391
160582
 
160392
- var HQCHART_VERSION="1.1.14813";
160583
+ var HQCHART_VERSION="1.1.14819";
160393
160584
 
160394
160585
  function PrintHQChartVersion()
160395
160586
  {