hqchart 1.1.14827 → 1.1.14831

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.
@@ -5433,6 +5433,17 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5433
5433
  chart.CreateOverlayWindowsIndex(obj);
5434
5434
  }
5435
5435
  }
5436
+
5437
+ if (option.LatestPointFlash)
5438
+ {
5439
+ var item=option.LatestPointFlash;
5440
+ if (item.Enable)
5441
+ {
5442
+ this.CreateExtraCanvasElement(JSChart.LatestPointFlashKey, { ZIndex:6 });
5443
+ chart.CreateExtendChart("LatestPointFlashPaint", item);
5444
+ chart.StartLatestPointFlash();
5445
+ }
5446
+ }
5436
5447
 
5437
5448
  return chart;
5438
5449
  }
@@ -6493,6 +6504,7 @@ JSChart.EnableCanvasWillReadFrequently=false; //https://html.spec.whatwg.org/m
6493
6504
  JSChart.CorssCursorCanvasKey="hqchart_corsscursor";
6494
6505
  JSChart.TooltipCursorCanvasKey="hqchart_tooltip";
6495
6506
  JSChart.RectDragCanvasKey="hqchart_drag_rect";
6507
+ JSChart.LatestPointFlashKey="hqchart_point_flash"; //最新数据点闪烁
6496
6508
 
6497
6509
  //初始化
6498
6510
  JSChart.Init=function(divElement,bScreen,bCacheCanvas)
@@ -7373,6 +7385,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7373
7385
  MapIndexChartCache:new Map(), //key 指标GUID
7374
7386
 
7375
7387
  TradeStatus:null, //当前交易状态 { Date, Time:数据最后更新的时间, Status: }
7388
+
7389
+ LatestPoint:null, //最新的点位置 { X:, Y: }
7376
7390
  };
7377
7391
 
7378
7392
  this.VerticalDrag; //通过X轴左右拖动数据(手势才有)
@@ -7386,6 +7400,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7386
7400
  this.DisplayLatestOption={ Timer:null, Enable: false, DelayTime:60*1000*3, LastPoint:null };
7387
7401
  this.DrawDynamicInfoOption={ Timer:null, Enable:false , DelayTime:10 };
7388
7402
 
7403
+ this.LatestPointFlashOption={ Timer:null, DelayTime:100 };
7404
+
7389
7405
  this.CustomChartDrag; //自定义图形的拖拽操作 { Type:, Data: }
7390
7406
 
7391
7407
  this.StockCache={ Data:null }; //扩展数据缓存数据
@@ -7455,13 +7471,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7455
7471
 
7456
7472
  if (bRegisterKeydown)
7457
7473
  {
7458
- this.AddEventListener(this.UIElement,"keydown", this.OnKeyDown, true);
7459
- this.AddEventListener(this.UIElement,"keyup", this.OnKeyUp, true);
7474
+ this.AddEventListener(this.UIElement,"keydown", (e)=>{ this.OnKeyDown(e); }, true);
7475
+ this.AddEventListener(this.UIElement,"keyup", (e)=>{ this.OnKeyUp(e); }, true);
7460
7476
  }
7461
7477
 
7462
7478
  if (bRegisterWheel)
7463
7479
  {
7464
- this.AddEventListener(this.UIElement,"wheel", this.OnWheel, true);
7480
+ this.AddEventListener(this.UIElement,"wheel", (e)=>{ this.OnWheel(e); }, true);
7465
7481
  }
7466
7482
 
7467
7483
  JSConsole.Chart.Log(`[JSChartContainer::AddDefaultEventListener] [keydown,keyup]=${bRegisterKeydown}, [wheel]=${bRegisterWheel}`);
@@ -7480,6 +7496,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7480
7496
  this.MapEventListenerCache.clear();
7481
7497
  }
7482
7498
 
7499
+ this.ClearGlobalOption=function()
7500
+ {
7501
+ if (!this.GlobalOption) return;
7502
+
7503
+ this.GlobalOption.LatestPoint=null;
7504
+ this.GlobalOption.TradeStatus=null;
7505
+ }
7506
+
7483
7507
  this.RestoreFocus=function(delay)
7484
7508
  {
7485
7509
  var value=1000;
@@ -7851,6 +7875,40 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7851
7875
  }
7852
7876
  }
7853
7877
 
7878
+ this.StartLatestPointFlash=function()
7879
+ {
7880
+ this.LatestPointFlashOption.Timer=setInterval(()=>
7881
+ {
7882
+ this.DrawLatestPoint();
7883
+ }, this.LatestPointFlashOption.DelayTime);
7884
+ }
7885
+
7886
+ this.StopLatestPointFlash=function()
7887
+ {
7888
+ if (this.LatestPointFlashOption.Timer)
7889
+ {
7890
+ clearInterval(this.LatestPointFlashOption.Timer);
7891
+ this.LatestPointFlashOption.Timer=null;
7892
+ }
7893
+ }
7894
+
7895
+ this.DrawLatestPoint=function()
7896
+ {
7897
+ var finder=this.GetExtendChartByClassName("LatestPointFlashPaint");
7898
+ if (finder && finder.Chart)
7899
+ finder.Chart.Draw();
7900
+ }
7901
+
7902
+ this.SetLatestPointFlash=function(flashCount, option)
7903
+ {
7904
+ if (!IFrameSplitOperator.IsNumber(flashCount)) return;
7905
+ var finder=this.GetExtendChartByClassName("LatestPointFlashPaint");
7906
+ if (!finder || !finder.Chart) return false;
7907
+
7908
+ var chart=finder.Chart;
7909
+ chart.FlashCount=flashCount;
7910
+ }
7911
+
7854
7912
  this.ChartDestroy=function() //销毁
7855
7913
  {
7856
7914
  this.IsDestroy=true;
@@ -7869,6 +7927,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7869
7927
 
7870
7928
  this.DestroyPopMenu();
7871
7929
 
7930
+ this.StopLatestPointFlash();
7931
+
7872
7932
  document.oncontextmenu=null;
7873
7933
  this.RemoveAllEventListener();
7874
7934
  }
@@ -43962,6 +44022,12 @@ function ChartMinutePriceLine()
43962
44022
  this.DrawAfterClose(); //收盘集合竞价
43963
44023
  this.DrawMultiDayAfterClose();
43964
44024
 
44025
+ if (this.Identify=="Minute-Line" && this.ChartFrame.GlobalOption)
44026
+ {
44027
+ var globalOption=this.ChartFrame.GlobalOption;
44028
+ globalOption.LatestPoint={ X:this.LastPoint.X, Y:this.LastPoint.Y };
44029
+ }
44030
+
43965
44031
  if (this.GetEventCallback)
43966
44032
  {
43967
44033
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAW_MINUTE_LAST_POINT);
@@ -51293,7 +51359,8 @@ function ExtendChartPaintFactory()
51293
51359
  ["RectDragPaint", { Create:function() { return new RectDragPaint(); } }],
51294
51360
  ["DragMovePaint", { Create:function() { return new DragMovePaint(); } }],
51295
51361
  ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}],
51296
- ["FrameButtomToolbarPaint", {Create:function() { return new FrameButtomToolbarPaint(); }}]
51362
+ ["FrameButtomToolbarPaint", {Create:function() { return new FrameButtomToolbarPaint(); }}],
51363
+ ["LatestPointFlashPaint", {Create:function() { return new LatestPointFlashPaint(); }}]
51297
51364
  ]
51298
51365
  );
51299
51366
 
@@ -55919,6 +55986,101 @@ function MinuteBackgroundPaint()
55919
55986
  }
55920
55987
  }
55921
55988
 
55989
+ //最新数据点闪动
55990
+ function LatestPointFlashPaint()
55991
+ {
55992
+ this.newMethod=IExtendChartPainting; //派生
55993
+ this.newMethod();
55994
+ delete this.newMethod;
55995
+
55996
+ this.ClassName='LatestPointFlashPaint';
55997
+ this.HQChart;
55998
+
55999
+ this.Status=0;
56000
+ this.UpdateTime=new Date();
56001
+ this.FlashCount=0; //闪烁次数
56002
+ this.Frequency=500; //闪烁频率ms
56003
+
56004
+ this.PointColor=g_JSChartResource.LatestPointFlash.PointColor;
56005
+ this.PointRadius=g_JSChartResource.LatestPointFlash.PointRadius;
56006
+ this.BGColor=g_JSChartResource.LatestPointFlash.BGColor;
56007
+ this.BGRadius=g_JSChartResource.LatestPointFlash.BGRadius;
56008
+ this.DrawPriority=IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_25;
56009
+ this.FlashCanvas;
56010
+
56011
+ this.SetOption=function(option)
56012
+ {
56013
+ if (this.HQChart)
56014
+ {
56015
+ var extraElement=this.HQChart.GetExtraCanvas(JSChart.LatestPointFlashKey);
56016
+ if (extraElement && extraElement.Canvas) this.FlashCanvas=extraElement.Canvas; //绑定独立的画布
56017
+ }
56018
+
56019
+ if (option)
56020
+ {
56021
+ if (IFrameSplitOperator.IsNumber(option.Frequency)) this.Frequency=option.Frequency;
56022
+ }
56023
+ }
56024
+
56025
+ this.ReloadResource=function(resource)
56026
+ {
56027
+ this.PointColor=g_JSChartResource.LatestPointFlash.PointColor;
56028
+ this.PointRadius=g_JSChartResource.LatestPointFlash.PointRadius;
56029
+ this.BGColor=g_JSChartResource.LatestPointFlash.BGColor;
56030
+ this.BGRadius=g_JSChartResource.LatestPointFlash.BGRadius;
56031
+ }
56032
+
56033
+ this.Draw=function()
56034
+ {
56035
+ if (!this.FlashCanvas) return;
56036
+ if (!this.HQChart) return;
56037
+ this.HQChart.ClearCanvas(this.FlashCanvas);
56038
+
56039
+ if (this.FlashCount<=0) return;
56040
+ if (this.IsStatusChange())
56041
+ {
56042
+ this.Status=(this.Status+1)%2;
56043
+ --this.FlashCount;
56044
+ }
56045
+
56046
+ if (this.Status==0) return;
56047
+ if (!this.HQChart.GlobalOption || !this.HQChart.GlobalOption.LatestPoint) return;
56048
+ var point=this.HQChart.GlobalOption.LatestPoint;
56049
+ if (!IFrameSplitOperator.IsNumber(point.X) || !IFrameSplitOperator.IsNumber(point.Y)) return;
56050
+
56051
+ this.FlashCanvas.fillStyle=this.BGColor;
56052
+ this.FlashCanvas.beginPath();
56053
+ this.FlashCanvas.arc(point.X,point.Y,this.BGRadius,0,360,false);
56054
+ this.FlashCanvas.fill();
56055
+ this.FlashCanvas.closePath();
56056
+
56057
+ //画实心圆
56058
+ this.FlashCanvas.fillStyle=this.PointColor;
56059
+ this.FlashCanvas.beginPath();
56060
+ this.FlashCanvas.arc(point.X,point.Y,this.PointRadius,0,360,false);
56061
+ this.FlashCanvas.fill();
56062
+ this.FlashCanvas.closePath();
56063
+ }
56064
+
56065
+ this.IsStatusChange=function()
56066
+ {
56067
+ if (!this.UpdateTime)
56068
+ {
56069
+ this.UpdateTime=new Date();
56070
+ return true;
56071
+ }
56072
+
56073
+
56074
+ var now=new Date();
56075
+ var diffValue=now.getTime()-this.UpdateTime.getTime();
56076
+ if (diffValue<=this.Frequency)
56077
+ return false;
56078
+
56079
+ this.UpdateTime=now;
56080
+ return true;
56081
+ }
56082
+ }
56083
+
55922
56084
  //拖拽效果图
55923
56085
  var JSCHART_DRAGCHART_TYPE_ID=
55924
56086
  {
@@ -79093,6 +79255,15 @@ function JSChartResource()
79093
79255
 
79094
79256
  CorssPoint:{ Center:{ Radius:5*GetDevicePixelRatio(), Color:"rgb(50,171,205)"}, Border:{ Color:'rgb(255,255,255)', Width:1*GetDevicePixelRatio() } }
79095
79257
  };
79258
+
79259
+ this.LatestPointFlash=
79260
+ {
79261
+ PointColor:"rgb(50,171,205)",
79262
+ PointRadius:3*GetDevicePixelRatio(),
79263
+
79264
+ BGColor:"rgba(50,171,205,0.7)",
79265
+ BGRadius:6*GetDevicePixelRatio(),
79266
+ }
79096
79267
 
79097
79268
  //指标锁
79098
79269
  this.IndexLock=
@@ -80637,6 +80808,17 @@ function JSChartResource()
80637
80808
  if (subItem.Color) subDest.Color=subItem.Color;
80638
80809
  }
80639
80810
  }
80811
+
80812
+ if (style.LatestPointFlash)
80813
+ {
80814
+ var item=style.LatestPointFlash;
80815
+ var dest=this.LatestPointFlash;
80816
+ if (item.PointColor) dest.PointColor=item.PointColor;
80817
+ if (IFrameSplitOperator.IsNumber(item.PointRadius)) dest.PointRadius=item.PointRadius;
80818
+
80819
+ if (item.BGColor) dest.BGColor=item.BGColor;
80820
+ if (IFrameSplitOperator.IsNumber(item.BGRadius)) dest.BGRadius=item.BGRadius;
80821
+ }
80640
80822
 
80641
80823
  if (style.KLine) this.KLine = style.KLine;
80642
80824
  if (style.VirtualKLine)
@@ -94805,6 +94987,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
94805
94987
  this.ChangeSymbol=function(symbol,option)
94806
94988
  {
94807
94989
  this.StopDisplayLatest();
94990
+ this.ClearGlobalOption();
94808
94991
  this.CancelAutoUpdate();
94809
94992
  this.AutoUpdateEvent(false, "MinuteChartContainer::ChangeSymbol");
94810
94993
  this.Symbol=symbol;
@@ -94947,6 +95130,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
94947
95130
  if (count<0) return;
94948
95131
 
94949
95132
  this.StopDisplayLatest();
95133
+ this.ClearGlobalOption();
94950
95134
  this.CancelAutoUpdate();
94951
95135
  this.AutoUpdateEvent(false, "MinuteChartContainer::ChangeDayCount");
94952
95136
  this.DayCount=count;
@@ -95894,6 +96078,13 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
95894
96078
  this.DataStatus.LatestDate=data.stock[0].date; //保存下最后一天的日期
95895
96079
  this.RecvBuySellData(data.stock[0].BuySellData);
95896
96080
  }
96081
+
96082
+ if (data.LatestPointFlash) //最新数据闪烁
96083
+ {
96084
+ var item=data.LatestPointFlash;
96085
+ if (IFrameSplitOperator.IsNumber(item.FlashCount))
96086
+ this.SetLatestPointFlash(item.FlashCount)
96087
+ }
95897
96088
 
95898
96089
  this.DataStatus.LatestDay=true;
95899
96090
 
@@ -160606,7 +160797,7 @@ function HQChartScriptWorker()
160606
160797
 
160607
160798
 
160608
160799
 
160609
- var HQCHART_VERSION="1.1.14826";
160800
+ var HQCHART_VERSION="1.1.14830";
160610
160801
 
160611
160802
  function PrintHQChartVersion()
160612
160803
  {