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.
@@ -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
 
@@ -57335,11 +57502,24 @@ IFrameSplitOperator.FormatDateTimeStringV2=function(datetime, format, languageID
57335
57502
  {
57336
57503
  case "YYYY-MM-DD":
57337
57504
  return `${datetime.getFullYear()}-${IFrameSplitOperator.NumberToString(datetime.getMonth()+1)}-${IFrameSplitOperator.NumberToString(datetime.getDate())}`;
57338
-
57505
+ case 'MM-DD':
57506
+ return `${IFrameSplitOperator.NumberToString(datetime.getMonth()+1)}-${IFrameSplitOperator.NumberToString(datetime.getDate())}`;
57507
+ case "MM/DD":
57508
+ return `${IFrameSplitOperator.NumberToString(datetime.getMonth()+1)}/${IFrameSplitOperator.NumberToString(datetime.getDate())}`;
57509
+ case "YYYY-MM":
57510
+ return `${datetime.getFullYear()}-${IFrameSplitOperator.NumberToString(datetime.getMonth()+1)}`;
57511
+ case "YYYY/MM/DD":
57512
+ return `${datetime.getFullYear()}/${IFrameSplitOperator.NumberToString(datetime.getMonth()+1)}/${IFrameSplitOperator.NumberToString(datetime.getDate())}`;
57513
+ case "DD/MM/YYYY":
57514
+ return `${IFrameSplitOperator.NumberToString(datetime.getDate())}/${IFrameSplitOperator.NumberToString(datetime.getMonth()+1)}/${datetime.getFullYear()}`;
57515
+
57516
+
57339
57517
  case "HH:MM:SS":
57340
57518
  return `${IFrameSplitOperator.NumberToString(datetime.getHours())}:${IFrameSplitOperator.NumberToString(datetime.getMinutes())}:${IFrameSplitOperator.NumberToString(datetime.getSeconds())}`;
57341
57519
  case "HH:MM":
57342
57520
  return `${IFrameSplitOperator.NumberToString(datetime.getHours())}:${IFrameSplitOperator.NumberToString(datetime.getMinutes())}`;
57521
+ case "HH:MM:SS.fff":
57522
+ return `${IFrameSplitOperator.NumberToString(datetime.getHours())}:${IFrameSplitOperator.NumberToString(datetime.getMinutes())}:${IFrameSplitOperator.NumberToString(datetime.getSeconds())}.${IFrameSplitOperator.MillisecondToString(datetime.getMilliseconds())}`;
57343
57523
  default:
57344
57524
  return null;
57345
57525
  }
@@ -83886,7 +84066,12 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
83886
84066
  }
83887
84067
  }
83888
84068
 
83889
- if (bRegisterKeydown) this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
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
+
83890
84075
  if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
83891
84076
 
83892
84077
  this.InitalPopMinuteChart(option);
@@ -85666,7 +85851,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85666
85851
 
85667
85852
  this.RecvRealtimeData=function(data)
85668
85853
  {
85669
- if (this.IsOnTouch==true) return; //正在操作中不更新数据
85854
+ if (this.IsOnTouch==true) return; //正在操作手势不更新数据
85855
+ if (this.IsPressKeyboard==true) return; //正在操作键盘不更新数据
85670
85856
 
85671
85857
  if (data.Ver==3.0)
85672
85858
  {
@@ -86006,6 +86192,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
86006
86192
  this.RecvMinuteRealtimeDataV2=function(data) //新版本的
86007
86193
  {
86008
86194
  if (this.IsOnTouch==true) return; //正在操作中不更新数据
86195
+ if (this.IsPressKeyboard==true) return; //正在操作键盘不更新数据
86196
+
86009
86197
  if (this.EnableVerifyRecvData && data.symbol!=this.Symbol)
86010
86198
  {
86011
86199
  JSConsole.Chart.Warn(`[KLineChartContainer::RecvMinuteRealtimeDataV2] recv data symbol not match. HQChart[${this.Symbol}] , Recv[${data.symbol}]`);
@@ -99672,7 +99860,11 @@ function DepthChartContainer(uielement)
99672
99860
  }
99673
99861
  }
99674
99862
 
99675
- if (bRegisterKeydown) this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
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
+ }
99676
99868
  if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
99677
99869
  }
99678
99870
 
@@ -141804,6 +141996,8 @@ function ChartReport()
141804
141996
  for(var i=0;i<this.Column.length;++i)
141805
141997
  {
141806
141998
  var item=this.Column[i];
141999
+ this.Canvas.font=this.ItemFont;
142000
+
141807
142001
  if (item.Type==REPORT_COLUMN_ID.SYMBOL_NAME_ID)
141808
142002
  {
141809
142003
  this.Canvas.font=this.ItemNameFont;
@@ -142291,6 +142485,7 @@ function ChartReport()
142291
142485
  }
142292
142486
 
142293
142487
  this.DrawFullRowBGColor(symbol, eventDrawBG, i, rtRowBG, { Selected:selectedSymbol } );
142488
+ this.DrawFlashFullRowBGColor(symbol, rtRowBG);
142294
142489
 
142295
142490
  if (bFillRow)
142296
142491
  {
@@ -142340,6 +142535,27 @@ function ChartReport()
142340
142535
  }
142341
142536
  }
142342
142537
 
142538
+ this.DrawFlashFullRowBGColor=function(symbol, rtBG)
142539
+ {
142540
+ var data= { Symbol:symbol, FlashBG:null };
142541
+ if (this.GetFlashBGDataCallback) data.FlashBG=this.GetFlashBGDataCallback(symbol, Date.now());
142542
+ if (!data.FlashBG) return;
142543
+
142544
+ var id=-1;
142545
+ if (!data.FlashBG.Data.has(id)) return;
142546
+
142547
+ var flashItem=data.FlashBG.Data.get(id);
142548
+ if (flashItem && flashItem.Count)
142549
+ {
142550
+ this.Canvas.fillStyle=flashItem.Color;
142551
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
142552
+ }
142553
+
142554
+ --flashItem.Count;
142555
+
142556
+ if (this.GlobalOption) ++this.GlobalOption.FlashBGCount;
142557
+ }
142558
+
142343
142559
  this.DrawSelectedRow=function()
142344
142560
  {
142345
142561
  if (this.SelectedStyle===2 && IFrameSplitOperator.IsNonEmptyArray(this.AryFullSelectedRow))
@@ -143979,6 +144195,8 @@ function ChartReport()
143979
144195
  {
143980
144196
  drawInfo.Botton={ Rect:rtBG, Type:1 };
143981
144197
  }
144198
+
144199
+ this.Canvas.font=this.ItemFont;
143982
144200
  }
143983
144201
 
143984
144202
  this.DrawProgressBar=function(drawInfo, left, top, width)
@@ -153252,7 +153470,11 @@ function JSDialogDrawTool()
153252
153470
  this.Destroy=function()
153253
153471
  {
153254
153472
  this.AryDivChart=[];
153255
- if (this.DivDialog) document.body.removeChild(this.DivDialog);
153473
+ if (this.DivDialog)
153474
+ {
153475
+ if (document && document.body && document.body.removeChild)
153476
+ document.body.removeChild(this.DivDialog);
153477
+ }
153256
153478
  this.DivDialog=null;
153257
153479
  }
153258
153480
 
@@ -154384,7 +154606,11 @@ function JSPopMinuteChart()
154384
154606
 
154385
154607
  this.Destroy=function()
154386
154608
  {
154387
- if (this.DivDialog) document.body.removeChild(this.DivDialog);
154609
+ if (this.DivDialog)
154610
+ {
154611
+ if (document && document.body && document.body.removeChild)
154612
+ document.body.removeChild(this.DivDialog);
154613
+ }
154388
154614
  this.DivDialog=null;
154389
154615
  this.TitleBox=null;
154390
154616
  this.Minute.JSChart=null;
@@ -155189,7 +155415,12 @@ function JSTooltipKLineChart()
155189
155415
 
155190
155416
  this.Destroy=function()
155191
155417
  {
155192
- if (this.DivDialog) document.body.removeChild(this.DivDialog);
155418
+ if (this.DivDialog)
155419
+ {
155420
+ if (document && document.body && document.body.removeChild)
155421
+ document.body.removeChild(this.DivDialog);
155422
+ }
155423
+
155193
155424
  this.DivDialog=null;
155194
155425
  this.TitleBox=null;
155195
155426
  if (!this.KLine.JSChart) this.KLine.JSChart.ChartDestory();
@@ -155421,7 +155652,11 @@ function JSPopKeyboard()
155421
155652
 
155422
155653
  this.Destroy=function()
155423
155654
  {
155424
- if (this.DivDialog) document.body.removeChild(this.DivDialog);
155655
+ if (this.DivDialog)
155656
+ {
155657
+ if (document && document.body && document.body.removeChild)
155658
+ document.body.removeChild(this.DivDialog);
155659
+ }
155425
155660
 
155426
155661
  this.DivDialog=null;
155427
155662
  this.TitleBox=null;
@@ -155862,7 +156097,7 @@ function JSDialogTooltip()
155862
156097
 
155863
156098
  if (this.DivDialog)
155864
156099
  {
155865
- document.body.removeChild(this.DivDialog);
156100
+ if (document && document.body && document.body.removeChild) document.body.removeChild(this.DivDialog);
155866
156101
  this.DivDialog=null;
155867
156102
  }
155868
156103
  }
@@ -158105,7 +158340,7 @@ function JSDialogSelectRect()
158105
158340
 
158106
158341
  if (this.DivDialog)
158107
158342
  {
158108
- document.body.removeChild(this.DivDialog);
158343
+ if (document && document.body && document.body.removeChild) document.body.removeChild(this.DivDialog);
158109
158344
  this.DivDialog=null;
158110
158345
  }
158111
158346
  }
@@ -158978,7 +159213,7 @@ function JSDialogSearchIndex()
158978
159213
 
158979
159214
  if (this.DivDialog)
158980
159215
  {
158981
- document.body.removeChild(this.DivDialog);
159216
+ if (document && document.body && document.body.removeChild) document.body.removeChild(this.DivDialog);
158982
159217
  this.DivDialog=null;
158983
159218
  }
158984
159219
  }
@@ -160333,7 +160568,7 @@ function HQChartScriptWorker()
160333
160568
 
160334
160569
 
160335
160570
 
160336
- var HQCHART_VERSION="1.1.14810";
160571
+ var HQCHART_VERSION="1.1.14816";
160337
160572
 
160338
160573
  function PrintHQChartVersion()
160339
160574
  {