hqchart 1.1.14811 → 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.
@@ -4499,6 +4499,12 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4499
4499
  if (option.DrawTool.StorageKey && chart.ChartDrawStorage) chart.ChartDrawStorage.Load(option.DrawTool.StorageKey);
4500
4500
  }
4501
4501
 
4502
+ if (option.KeyboardMove)
4503
+ {
4504
+ var item=option.KeyboardMove;
4505
+ if (IFrameSplitOperator.IsPlusNumber(item.Delay)) chart.KeyboardMove.Delay=item.Delay;
4506
+ }
4507
+
4502
4508
  if (IFrameSplitOperator.IsNumber(option.StepPixel)) chart.StepPixel=option.StepPixel;
4503
4509
  if (option.ZoomStepPixel>0) chart.ZoomStepPixel=option.ZoomStepPixel;
4504
4510
  if (option.IsApiPeriod==true) chart.IsApiPeriod=option.IsApiPeriod;
@@ -7276,7 +7282,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7276
7282
  this.DisableMouse=false; //禁止鼠标事件
7277
7283
  this.LanguageID=JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;
7278
7284
  this.PressTime=500;
7279
- this.IsPress=false; //是否长按
7285
+ this.IsPress=false; //是否长按
7286
+ this.IsPressKeyboard=false; //是否键盘按键
7280
7287
 
7281
7288
  this.NetworkFilter; //网络请求回调 function(data, callback);
7282
7289
  this.LastMouseStatus={ MouseOnToolbar:null }; // MouseOnToolbar={ Rect:{}, Title: }
@@ -7360,6 +7367,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7360
7367
  this.AryHotKey=[]; //热键 { KeyID:87, SecondKeyID:1, CMD:JSCHART_MENU_ID.CMD_FULLSCREEN_SUMMARY_ID, Args:null, Description:"Alt+W 全屏区间统计" },
7361
7368
 
7362
7369
  this.FastSlideConfig={ MinDistance:500, MinSpeed:3, MaxTime:250, Enable:false }; //快速滑动配置 MinDistance=最小的距离 MinSpeed=最小速度 MaxTime=最大间隔时间(ms)
7370
+ this.KeyboardMove={ Timer:null, Delay:100 , Enable:false, Event:null }; //键盘左右移动
7363
7371
 
7364
7372
  this.RestoreFocus=function(delay)
7365
7373
  {
@@ -11529,6 +11537,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11529
11537
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
11530
11538
 
11531
11539
  var keyID = e.keyCode ? e.keyCode :e.which;
11540
+ this.IsPressKeyboard=true;
11532
11541
 
11533
11542
  //回调事件
11534
11543
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);
@@ -11563,6 +11572,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11563
11572
  switch(keyID)
11564
11573
  {
11565
11574
  case 37: //left
11575
+ if (this.KeyboardMove.Enable) break;
11566
11576
  if ((e.ctrlKey||e.shiftKey) && this.OnCustomKeyDown)
11567
11577
  {
11568
11578
  if (this.OnCustomKeyDown(keyID, e))
@@ -11602,6 +11612,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11602
11612
  }
11603
11613
  break;
11604
11614
  case 39: //right
11615
+ if (this.KeyboardMove.Enable) break;
11605
11616
  if ((e.ctrlKey|| e.shiftKey) && this.OnCustomKeyDown)
11606
11617
  {
11607
11618
  if (this.OnCustomKeyDown(keyID, e))
@@ -11736,11 +11747,167 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11736
11747
 
11737
11748
  if (draw) this.DrawDynamicInfo();
11738
11749
 
11750
+ if (keyID==37 || keyID==39)
11751
+ this.StartKeyboardMoveTimer(e);
11752
+
11739
11753
  //不让滚动条滚动
11740
11754
  if(e.preventDefault) e.preventDefault();
11741
11755
  else e.returnValue = false;
11742
11756
  }
11743
11757
 
11758
+
11759
+ this.ClearKeyboardMoveTimer=function()
11760
+ {
11761
+ if (!this.KeyboardMove) return;
11762
+
11763
+ this.KeyboardMove.Event=null;
11764
+
11765
+ if (this.KeyboardMove.Timer)
11766
+ {
11767
+ clearTimeout(this.KeyboardMove.Timer);
11768
+ this.KeyboardMove.Timer=null;
11769
+ JSConsole.Chart.Log(`[JSChartContainer::ClearKeyboardMoveTimer] Stop` );
11770
+ }
11771
+
11772
+ this.KeyboardMove.Enable=false;
11773
+ }
11774
+
11775
+ this.StartKeyboardMoveTimer=function(e)
11776
+ {
11777
+ if (!this.KeyboardMove) return;
11778
+ if (this.KeyboardMove.Enable) return; //已启动
11779
+
11780
+ this.KeyboardMove.Event=e;
11781
+ this.KeyboardMove.Enable=true;
11782
+
11783
+ JSConsole.Chart.Log(`[JSChartContainer::StartKeyboardMoveTimer] Start` );
11784
+
11785
+ this.AutoKeyboardMove();
11786
+ }
11787
+
11788
+ this.AutoKeyboardMove=function()
11789
+ {
11790
+ if (!this.KeyboardMove) return false;
11791
+ if (!this.KeyboardMove.Enable) return false;
11792
+ if (!this.KeyboardMove.Event) return false;
11793
+
11794
+ this.KeyboardMove.Timer=setTimeout(()=>
11795
+ {
11796
+ this.OnKeyboardMoveTimerProc();
11797
+ },this.KeyboardMove.Delay);
11798
+ }
11799
+
11800
+
11801
+ this.OnKeyboardMoveTimerProc=function()
11802
+ {
11803
+ if (!this.KeyboardMove) return false;
11804
+ if (!this.KeyboardMove.Enable) return false;
11805
+ if (!this.KeyboardMove.Event) return false;
11806
+
11807
+ var e=this.KeyboardMove.Event;
11808
+ var keyID = e.keyCode ? e.keyCode :e.which;
11809
+ var bStop=false;
11810
+ switch(keyID)
11811
+ {
11812
+ case 37: //left
11813
+ if ((e.ctrlKey||e.shiftKey) && this.OnCustomKeyDown)
11814
+ {
11815
+ if (this.OnCustomKeyDown(keyID, e))
11816
+ break;
11817
+ }
11818
+
11819
+ //K线 如果超出K线数据了 调整到最后一个数据
11820
+ if (this.FixCursorIndexValid && this.FixCursorIndexValid())
11821
+ {
11822
+ this.UpdatePointByCursorIndex();
11823
+ this.DrawDynamicInfo();
11824
+ this.ShowTooltipByKeyDown();
11825
+ break;
11826
+ }
11827
+
11828
+ if (this.CursorIndex<=0.99999)
11829
+ {
11830
+ if (!this.DataMoveLeft())
11831
+ { //左移数据到头了 触发下载新数据
11832
+ if (this.DragDownloadData) this.DragDownloadData();
11833
+ break;
11834
+ }
11835
+ this.UpdataDataoffset();
11836
+ this.UpdatePointByCursorIndex();
11837
+ this.UpdateFrameMaxMin();
11838
+ this.ResetFrameXSplit();
11839
+ this.Draw();
11840
+ this.ShowTooltipByKeyDown();
11841
+ this.OnKLinePageChange("keydown");
11842
+ }
11843
+ else
11844
+ {
11845
+ --this.CursorIndex;
11846
+ this.UpdatePointByCursorIndex();
11847
+ this.DrawDynamicInfo();
11848
+ this.ShowTooltipByKeyDown();
11849
+ }
11850
+ break;
11851
+
11852
+ case 39: //right
11853
+ if ((e.ctrlKey|| e.shiftKey) && this.OnCustomKeyDown)
11854
+ {
11855
+ if (this.OnCustomKeyDown(keyID, e))
11856
+ break;
11857
+ }
11858
+
11859
+ //K线 如果超出K线数据了 调整到最后一个数据
11860
+ if (this.FixCursorIndexValid && this.FixCursorIndexValid())
11861
+ {
11862
+ this.UpdatePointByCursorIndex();
11863
+ this.DrawDynamicInfo();
11864
+ this.ShowTooltipByKeyDown();
11865
+ break;
11866
+ }
11867
+
11868
+ var xPointcount=0;
11869
+ if (this.Frame.XPointCount) xPointcount=this.Frame.XPointCount;
11870
+ else xPointcount=this.Frame.SubFrame[0].Frame.XPointCount;
11871
+ if (this.CursorIndex+1>=xPointcount)
11872
+ {
11873
+ if (!this.DataMoveRight()) break;
11874
+ this.UpdataDataoffset();
11875
+ this.UpdatePointByCursorIndex();
11876
+ this.UpdateFrameMaxMin();
11877
+ this.ResetFrameXSplit();
11878
+ this.Draw();
11879
+ this.ShowTooltipByKeyDown();
11880
+ this.OnKLinePageChange("keydown");
11881
+ }
11882
+ else
11883
+ {
11884
+ //判断是否在最后一个数据上
11885
+ var data=null;
11886
+ if (this.Frame.Data) data=this.Frame.Data;
11887
+ else data=this.Frame.SubFrame[0].Frame.Data;
11888
+ if (!data) break;
11889
+ if (this.CursorIndex+data.DataOffset+1>=data.Data.length) break;
11890
+
11891
+ ++this.CursorIndex;
11892
+ this.UpdatePointByCursorIndex();
11893
+ this.DrawDynamicInfo();
11894
+ this.ShowTooltipByKeyDown();
11895
+ }
11896
+ break;
11897
+ }
11898
+
11899
+
11900
+ if (!bStop) this.AutoKeyboardMove();
11901
+ return true;
11902
+ }
11903
+
11904
+
11905
+ this.OnKeyUp=function(e)
11906
+ {
11907
+ this.IsPressKeyboard=false;
11908
+ this.ClearKeyboardMoveTimer();
11909
+ }
11910
+
11744
11911
  this.OnDoubleClick=function(x,y,e)
11745
11912
  {
11746
11913
 
@@ -57291,11 +57458,24 @@ IFrameSplitOperator.FormatDateTimeStringV2=function(datetime, format, languageID
57291
57458
  {
57292
57459
  case "YYYY-MM-DD":
57293
57460
  return `${datetime.getFullYear()}-${IFrameSplitOperator.NumberToString(datetime.getMonth()+1)}-${IFrameSplitOperator.NumberToString(datetime.getDate())}`;
57294
-
57461
+ case 'MM-DD':
57462
+ return `${IFrameSplitOperator.NumberToString(datetime.getMonth()+1)}-${IFrameSplitOperator.NumberToString(datetime.getDate())}`;
57463
+ case "MM/DD":
57464
+ return `${IFrameSplitOperator.NumberToString(datetime.getMonth()+1)}/${IFrameSplitOperator.NumberToString(datetime.getDate())}`;
57465
+ case "YYYY-MM":
57466
+ return `${datetime.getFullYear()}-${IFrameSplitOperator.NumberToString(datetime.getMonth()+1)}`;
57467
+ case "YYYY/MM/DD":
57468
+ return `${datetime.getFullYear()}/${IFrameSplitOperator.NumberToString(datetime.getMonth()+1)}/${IFrameSplitOperator.NumberToString(datetime.getDate())}`;
57469
+ case "DD/MM/YYYY":
57470
+ return `${IFrameSplitOperator.NumberToString(datetime.getDate())}/${IFrameSplitOperator.NumberToString(datetime.getMonth()+1)}/${datetime.getFullYear()}`;
57471
+
57472
+
57295
57473
  case "HH:MM:SS":
57296
57474
  return `${IFrameSplitOperator.NumberToString(datetime.getHours())}:${IFrameSplitOperator.NumberToString(datetime.getMinutes())}:${IFrameSplitOperator.NumberToString(datetime.getSeconds())}`;
57297
57475
  case "HH:MM":
57298
57476
  return `${IFrameSplitOperator.NumberToString(datetime.getHours())}:${IFrameSplitOperator.NumberToString(datetime.getMinutes())}`;
57477
+ case "HH:MM:SS.fff":
57478
+ return `${IFrameSplitOperator.NumberToString(datetime.getHours())}:${IFrameSplitOperator.NumberToString(datetime.getMinutes())}:${IFrameSplitOperator.NumberToString(datetime.getSeconds())}.${IFrameSplitOperator.MillisecondToString(datetime.getMilliseconds())}`;
57299
57479
  default:
57300
57480
  return null;
57301
57481
  }
@@ -83842,7 +84022,12 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
83842
84022
  }
83843
84023
  }
83844
84024
 
83845
- if (bRegisterKeydown) this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
84025
+ if (bRegisterKeydown)
84026
+ {
84027
+ this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
84028
+ this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
84029
+ }
84030
+
83846
84031
  if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
83847
84032
 
83848
84033
  this.InitalPopMinuteChart(option);
@@ -85622,7 +85807,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85622
85807
 
85623
85808
  this.RecvRealtimeData=function(data)
85624
85809
  {
85625
- if (this.IsOnTouch==true) return; //正在操作中不更新数据
85810
+ if (this.IsOnTouch==true) return; //正在操作手势不更新数据
85811
+ if (this.IsPressKeyboard==true) return; //正在操作键盘不更新数据
85626
85812
 
85627
85813
  if (data.Ver==3.0)
85628
85814
  {
@@ -85962,6 +86148,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85962
86148
  this.RecvMinuteRealtimeDataV2=function(data) //新版本的
85963
86149
  {
85964
86150
  if (this.IsOnTouch==true) return; //正在操作中不更新数据
86151
+ if (this.IsPressKeyboard==true) return; //正在操作键盘不更新数据
86152
+
85965
86153
  if (this.EnableVerifyRecvData && data.symbol!=this.Symbol)
85966
86154
  {
85967
86155
  JSConsole.Chart.Warn(`[KLineChartContainer::RecvMinuteRealtimeDataV2] recv data symbol not match. HQChart[${this.Symbol}] , Recv[${data.symbol}]`);
@@ -99628,7 +99816,11 @@ function DepthChartContainer(uielement)
99628
99816
  }
99629
99817
  }
99630
99818
 
99631
- if (bRegisterKeydown) this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
99819
+ if (bRegisterKeydown)
99820
+ {
99821
+ this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
99822
+ this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
99823
+ }
99632
99824
  if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
99633
99825
  }
99634
99826
 
@@ -141760,6 +141952,8 @@ function ChartReport()
141760
141952
  for(var i=0;i<this.Column.length;++i)
141761
141953
  {
141762
141954
  var item=this.Column[i];
141955
+ this.Canvas.font=this.ItemFont;
141956
+
141763
141957
  if (item.Type==REPORT_COLUMN_ID.SYMBOL_NAME_ID)
141764
141958
  {
141765
141959
  this.Canvas.font=this.ItemNameFont;
@@ -142247,6 +142441,7 @@ function ChartReport()
142247
142441
  }
142248
142442
 
142249
142443
  this.DrawFullRowBGColor(symbol, eventDrawBG, i, rtRowBG, { Selected:selectedSymbol } );
142444
+ this.DrawFlashFullRowBGColor(symbol, rtRowBG);
142250
142445
 
142251
142446
  if (bFillRow)
142252
142447
  {
@@ -142296,6 +142491,27 @@ function ChartReport()
142296
142491
  }
142297
142492
  }
142298
142493
 
142494
+ this.DrawFlashFullRowBGColor=function(symbol, rtBG)
142495
+ {
142496
+ var data= { Symbol:symbol, FlashBG:null };
142497
+ if (this.GetFlashBGDataCallback) data.FlashBG=this.GetFlashBGDataCallback(symbol, Date.now());
142498
+ if (!data.FlashBG) return;
142499
+
142500
+ var id=-1;
142501
+ if (!data.FlashBG.Data.has(id)) return;
142502
+
142503
+ var flashItem=data.FlashBG.Data.get(id);
142504
+ if (flashItem && flashItem.Count)
142505
+ {
142506
+ this.Canvas.fillStyle=flashItem.Color;
142507
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
142508
+ }
142509
+
142510
+ --flashItem.Count;
142511
+
142512
+ if (this.GlobalOption) ++this.GlobalOption.FlashBGCount;
142513
+ }
142514
+
142299
142515
  this.DrawSelectedRow=function()
142300
142516
  {
142301
142517
  if (this.SelectedStyle===2 && IFrameSplitOperator.IsNonEmptyArray(this.AryFullSelectedRow))
@@ -143935,6 +144151,8 @@ function ChartReport()
143935
144151
  {
143936
144152
  drawInfo.Botton={ Rect:rtBG, Type:1 };
143937
144153
  }
144154
+
144155
+ this.Canvas.font=this.ItemFont;
143938
144156
  }
143939
144157
 
143940
144158
  this.DrawProgressBar=function(drawInfo, left, top, width)
@@ -149339,7 +149557,7 @@ function ScrollBarBGChart()
149339
149557
 
149340
149558
 
149341
149559
 
149342
- var HQCHART_VERSION="1.1.14810";
149560
+ var HQCHART_VERSION="1.1.14816";
149343
149561
 
149344
149562
  function PrintHQChartVersion()
149345
149563
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14810";
8
+ var HQCHART_VERSION="1.1.14816";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {