hqchart 1.1.14814 → 1.1.14817
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
|
|
|
@@ -83899,7 +84066,12 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
83899
84066
|
}
|
|
83900
84067
|
}
|
|
83901
84068
|
|
|
83902
|
-
if (bRegisterKeydown)
|
|
84069
|
+
if (bRegisterKeydown)
|
|
84070
|
+
{
|
|
84071
|
+
this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
|
|
84072
|
+
this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
|
|
84073
|
+
}
|
|
84074
|
+
|
|
83903
84075
|
if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
|
|
83904
84076
|
|
|
83905
84077
|
this.InitalPopMinuteChart(option);
|
|
@@ -85679,7 +85851,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
85679
85851
|
|
|
85680
85852
|
this.RecvRealtimeData=function(data)
|
|
85681
85853
|
{
|
|
85682
|
-
if (this.IsOnTouch==true) return;
|
|
85854
|
+
if (this.IsOnTouch==true) return; //正在操作手势不更新数据
|
|
85855
|
+
if (this.IsPressKeyboard==true) return; //正在操作键盘不更新数据
|
|
85683
85856
|
|
|
85684
85857
|
if (data.Ver==3.0)
|
|
85685
85858
|
{
|
|
@@ -86019,6 +86192,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
86019
86192
|
this.RecvMinuteRealtimeDataV2=function(data) //新版本的
|
|
86020
86193
|
{
|
|
86021
86194
|
if (this.IsOnTouch==true) return; //正在操作中不更新数据
|
|
86195
|
+
if (this.IsPressKeyboard==true) return; //正在操作键盘不更新数据
|
|
86196
|
+
|
|
86022
86197
|
if (this.EnableVerifyRecvData && data.symbol!=this.Symbol)
|
|
86023
86198
|
{
|
|
86024
86199
|
JSConsole.Chart.Warn(`[KLineChartContainer::RecvMinuteRealtimeDataV2] recv data symbol not match. HQChart[${this.Symbol}] , Recv[${data.symbol}]`);
|
|
@@ -99685,7 +99860,11 @@ function DepthChartContainer(uielement)
|
|
|
99685
99860
|
}
|
|
99686
99861
|
}
|
|
99687
99862
|
|
|
99688
|
-
if (bRegisterKeydown)
|
|
99863
|
+
if (bRegisterKeydown)
|
|
99864
|
+
{
|
|
99865
|
+
this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
|
|
99866
|
+
this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
|
|
99867
|
+
}
|
|
99689
99868
|
if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
|
|
99690
99869
|
}
|
|
99691
99870
|
|
|
@@ -160389,7 +160568,7 @@ function HQChartScriptWorker()
|
|
|
160389
160568
|
|
|
160390
160569
|
|
|
160391
160570
|
|
|
160392
|
-
var HQCHART_VERSION="1.1.
|
|
160571
|
+
var HQCHART_VERSION="1.1.14816";
|
|
160393
160572
|
|
|
160394
160573
|
function PrintHQChartVersion()
|
|
160395
160574
|
{
|