hqchart 1.1.15011 → 1.1.15026

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.
@@ -4909,12 +4909,27 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4909
4909
  var item=option.LatestPointFlash;
4910
4910
  if (item.Enable)
4911
4911
  {
4912
- this.CreateExtraCanvasElement(JSChart.LatestPointFlashKey, { ZIndex:6 });
4912
+ var zIndex=6;
4913
+ if (IFrameSplitOperator.IsNumber(item.ZIndex)) zIndex=item.ZIndex;
4914
+ this.CreateExtraCanvasElement(JSChart.LatestPointFlashKey, { ZIndex:zIndex });
4913
4915
  chart.CreateExtendChart("LatestPointFlashPaint", item);
4914
4916
  chart.StartLatestPointFlash();
4915
4917
  }
4916
4918
  }
4917
4919
 
4920
+ if (option.KLineCountDown)
4921
+ {
4922
+ var item=option.KLineCountDown;
4923
+ if (item.Enable)
4924
+ {
4925
+ var zIndex=4;
4926
+ if (IFrameSplitOperator.IsNumber(item.ZIndex)) zIndex=item.ZIndex;
4927
+ this.CreateExtraCanvasElement(JSChart.KLineCountDownKey, { ZIndex:zIndex });
4928
+ chart.CreateExtendChart("KLineCountDownPaint", item);
4929
+ chart.StartCountDown();
4930
+ }
4931
+ }
4932
+
4918
4933
  return chart;
4919
4934
  }
4920
4935
 
@@ -5973,6 +5988,9 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5973
5988
  if (option.FloatTooltip && option.FloatTooltip.Enable)
5974
5989
  chart.InitalFloatTooltip(option.FloatTooltip);
5975
5990
 
5991
+ if (option.SmallFloatTooltip && option.SmallFloatTooltip.Enable)
5992
+ chart.InitalSmallFloatTooltip(option.SmallFloatTooltip);
5993
+
5976
5994
  if (option.SelectRectDialog && option.SelectRectDialog.Enable)
5977
5995
  chart.InitalSelectRectDialog(option.SelectRectDialog);
5978
5996
 
@@ -6485,6 +6503,7 @@ JSChart.CorssCursorCanvasKey="hqchart_corsscursor";
6485
6503
  JSChart.TooltipCursorCanvasKey="hqchart_tooltip";
6486
6504
  JSChart.RectDragCanvasKey="hqchart_drag_rect";
6487
6505
  JSChart.LatestPointFlashKey="hqchart_point_flash"; //最新数据点闪烁
6506
+ JSChart.KLineCountDownKey="hqchart_kline_countdown"; //倒计时
6488
6507
 
6489
6508
  //初始化
6490
6509
  JSChart.Init=function(divElement,bScreen,bCacheCanvas)
@@ -6931,6 +6950,8 @@ var JSCHART_EVENT_ID=
6931
6950
  ON_REPORT_SHOW_TOOLTIP:175, //报价列表 提示信息\
6932
6951
 
6933
6952
  ON_FORMAT_TVLONGPOSITION_LABEL:176,
6953
+
6954
+ ON_FORMAT_COUNTDOWN_TEXT:177, //倒计时
6934
6955
  }
6935
6956
 
6936
6957
  var JSCHART_OPERATOR_ID=
@@ -7398,7 +7419,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7398
7419
  this.DisplayLatestOption={ Timer:null, Enable: false, DelayTime:60*1000*3, LastPoint:null };
7399
7420
  this.DrawDynamicInfoOption={ Timer:null, Enable:false , DelayTime:10 };
7400
7421
 
7401
- this.LatestPointFlashOption={ Timer:null, DelayTime:100 };
7422
+ this.LatestPointFlashOption={ Timer:null, DelayTime:100 }; //最后一个数据闪烁
7423
+ this.CountDownOption={ Timer:null, DelayTime:300 }; //倒计时
7402
7424
 
7403
7425
  this.CustomChartDrag; //自定义图形的拖拽操作 { Type:, Data: }
7404
7426
 
@@ -7416,6 +7438,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7416
7438
  this.FloatTooltip; //浮动tooltip信息
7417
7439
  this.DialogSearchIndex; //指标搜索
7418
7440
  this.DialogModifyIndexParam; //指标参数修改
7441
+ this.SmallFloatTooltipGroup; //小浮框tooltip信息集合
7419
7442
 
7420
7443
 
7421
7444
  this.RestoreFocusTimer=null; //恢复焦点定时器
@@ -7500,6 +7523,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7500
7523
 
7501
7524
  this.GlobalOption.LatestPoint=null;
7502
7525
  this.GlobalOption.TradeStatus=null;
7526
+ this.GlobalOption.CountDown=null;
7503
7527
  }
7504
7528
 
7505
7529
  this.RestoreFocus=function(delay)
@@ -7572,6 +7596,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7572
7596
  this.FloatTooltip.Create();
7573
7597
  }
7574
7598
 
7599
+
7600
+ this.InitalSmallFloatTooltip=function(option)
7601
+ {
7602
+ if (this.SmallFloatTooltipGroup) return;
7603
+
7604
+ this.SmallFloatTooltipGroup=new JSSmallFloatTooltipGroup();
7605
+ this.SmallFloatTooltipGroup.Inital(this, option);
7606
+ this.SmallFloatTooltipGroup.Create();
7607
+ }
7608
+
7609
+
7575
7610
  this.InitalModifyDrawDialog=function()
7576
7611
  {
7577
7612
  if ( this.DialogModifyDraw) return;
@@ -7749,6 +7784,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7749
7784
  this.FloatTooltip.Hide();
7750
7785
  }
7751
7786
 
7787
+ this.HideSmallFloatTooltip=function()
7788
+ {
7789
+ if (!this.SmallFloatTooltipGroup) return;
7790
+
7791
+ this.SmallFloatTooltipGroup.Hide();
7792
+ }
7793
+
7752
7794
  this.DestroyTooltipDialog=function()
7753
7795
  {
7754
7796
  if (!this.DialogTooltip) return;
@@ -7765,6 +7807,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7765
7807
  this.FloatTooltip=null;
7766
7808
  }
7767
7809
 
7810
+ this.DestroySmallFloatTooltip=function()
7811
+ {
7812
+ if (!this.SmallFloatTooltipGroup) return;
7813
+
7814
+ this.SmallFloatTooltipGroup.Destroy();
7815
+ this.SmallFloatTooltipGroup=null;
7816
+ }
7817
+
7768
7818
  this.DestroySearchIndexDialog=function()
7769
7819
  {
7770
7820
  if (!this.DialogSearchIndex) return;
@@ -7818,6 +7868,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7818
7868
  {
7819
7869
  this.HideFloatTooltip();
7820
7870
  this.CloseTooltipDialog();
7871
+ this.HideSmallFloatTooltip();
7821
7872
 
7822
7873
  if (this.DialogDrawTool) this.DialogDrawTool.Close();
7823
7874
  this.CloseModifyDrawDialog();
@@ -7907,6 +7958,30 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7907
7958
  chart.FlashCount=flashCount;
7908
7959
  }
7909
7960
 
7961
+ this.StartCountDown=function()
7962
+ {
7963
+ this.CountDownOption.Timer=setInterval(()=>
7964
+ {
7965
+ this.DrawCountDown();
7966
+ }, this.CountDownOption.DelayTime);
7967
+ }
7968
+
7969
+ this.DrawCountDown=function()
7970
+ {
7971
+ var finder=this.GetExtendChartByClassName("KLineCountDownPaint");
7972
+ if (finder && finder.Chart)
7973
+ finder.Chart.Draw();
7974
+ }
7975
+
7976
+ this.StopCountDown=function()
7977
+ {
7978
+ if (this.CountDownOption.Timer)
7979
+ {
7980
+ clearInterval(this.CountDownOption.Timer);
7981
+ this.CountDownOption.Timer=null;
7982
+ }
7983
+ }
7984
+
7910
7985
  this.ChartDestroy=function() //销毁
7911
7986
  {
7912
7987
  this.IsDestroy=true;
@@ -7914,6 +7989,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7914
7989
 
7915
7990
  this.DestroyTooltipDialog();
7916
7991
  this.DestroyFloatTooltip();
7992
+ this.DestroySmallFloatTooltip();
7917
7993
 
7918
7994
  this.DestroySearchIndexDialog();
7919
7995
  this.DestroyDialogModifyIndexParam();
@@ -7928,6 +8004,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7928
8004
  if (this.DestroyPopMinuteChart) this.DestroyPopMinuteChart();
7929
8005
 
7930
8006
  this.StopLatestPointFlash();
8007
+ this.StopCountDown();
7931
8008
 
7932
8009
  document.oncontextmenu=null;
7933
8010
  this.RemoveAllEventListener();
@@ -10391,12 +10468,20 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10391
10468
  canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);
10392
10469
  }
10393
10470
 
10471
+ this.ClearCorssCursorCanvas=function()
10472
+ {
10473
+ if (!this.CorssCursorCanvas) return;
10474
+
10475
+ this.CorssCursorCanvas.clearRect(0,0,this.CorssCursorElement.width,this.CorssCursorElement.height);
10476
+ }
10477
+
10394
10478
  this.Draw=function()
10395
10479
  {
10396
10480
  if (this.ChartCorssCursor) this.ChartCorssCursor.Status=0;
10397
10481
  if (this.UIElement.width<=0 || this.UIElement.height<=0) return;
10398
10482
 
10399
10483
  this.StopDrawDynamicInfo();
10484
+ this.ClearCorssCursorCanvas();
10400
10485
 
10401
10486
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_BEFORE_DRAW);
10402
10487
  if (event && event.Callback)
@@ -10570,7 +10655,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10570
10655
  if (this.CorssCursorCanvas) //独立的十字光标层
10571
10656
  {
10572
10657
  this.ChartCorssCursor.Canvas=this.CorssCursorCanvas;
10573
- this.ChartCorssCursor.Canvas.clearRect(0,0,this.CorssCursorElement.width,this.CorssCursorElement.height)
10574
10658
  bRestoreCanvas=true;
10575
10659
  }
10576
10660
 
@@ -11370,6 +11454,50 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11370
11454
  return null;
11371
11455
  }
11372
11456
 
11457
+ this.GetCorssCursorTooltipData=function(option)
11458
+ {
11459
+ if (!this.ChartCorssCursor) return null;
11460
+ if (this.ChartCorssCursor.Status===0) return null;
11461
+ if (!this.ChartCorssCursor.IsShowCorss) return null;
11462
+
11463
+ var kItem=this.ChartCorssCursor.StringFormatX.KItem;
11464
+ if (!kItem) return null;
11465
+
11466
+ //X轴取十字光标坐标
11467
+ var toolTip={ AryData:[], X:this.ChartCorssCursor.StringFormatX.Point.X };
11468
+
11469
+ for(var i=0;i<this.ChartPaint.length;++i)
11470
+ {
11471
+ var item=this.ChartPaint[i];
11472
+ if (!item.GetCorssCursorTooltipData) continue;
11473
+
11474
+ item.GetCorssCursorTooltipData(kItem, toolTip);
11475
+ }
11476
+
11477
+ if (IFrameSplitOperator.IsNonEmptyArray(this.Frame.SubFrame))
11478
+ {
11479
+ for(var i=0;i<this.Frame.SubFrame.length;++i)
11480
+ {
11481
+ var subFrame=this.Frame.SubFrame[i];
11482
+ for(var j=0;j<subFrame.OverlayIndex.length;++j)
11483
+ {
11484
+ var overlayItem=subFrame.OverlayIndex[j];
11485
+ for(var k=0;k<overlayItem.ChartPaint.length;++k)
11486
+ {
11487
+ var item=overlayItem.ChartPaint[k];
11488
+ if (!item.GetCorssCursorTooltipData) continue;
11489
+
11490
+ item.GetCorssCursorTooltipData(kItem, toolTip);
11491
+ }
11492
+ }
11493
+ }
11494
+ }
11495
+
11496
+ if (!IFrameSplitOperator.IsNonEmptyArray(toolTip.AryData)) return null;
11497
+
11498
+ return toolTip;
11499
+ }
11500
+
11373
11501
  this.PtInExtendChartButtons=function(x,y)
11374
11502
  {
11375
11503
  for(var i=0;i<this.ExtendChartPaint.length; ++i)
@@ -11683,6 +11811,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11683
11811
  }
11684
11812
  }
11685
11813
 
11814
+ var corssTooltipData=this.GetCorssCursorTooltipData(null);
11815
+ if (corssTooltipData) this.DrawSmallFloatTooltip(corssTooltipData);
11816
+ else this.HideSmallFloatTooltip();
11817
+
11686
11818
  this.SetCursor(mouseStatus);
11687
11819
  }
11688
11820
 
@@ -12407,6 +12539,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12407
12539
 
12408
12540
  this.ShowTooltipByKeyDown=function()
12409
12541
  {
12542
+ var corssTooltipData=this.GetCorssCursorTooltipData(null);
12543
+ if (corssTooltipData) this.DrawSmallFloatTooltip(corssTooltipData);
12544
+ else this.HideSmallFloatTooltip();
12545
+
12410
12546
  if (!this.KLineTooltipConfig.Enable || !this.KLineTooltipConfig.EnableKeyDown)
12411
12547
  {
12412
12548
  this.HideFloatTooltip();
@@ -12425,7 +12561,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12425
12561
  var kItem=kData.Data[dataIndex];
12426
12562
  if (!kItem) return;
12427
12563
 
12428
- var data=this.Frame.Data;
12429
12564
  var toolTip=new TooltipData();
12430
12565
  toolTip.Data=kItem;
12431
12566
  toolTip.ChartPaint=this.ChartPaint[0];
@@ -12793,6 +12928,29 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12793
12928
  if (this.Tooltip.style.display!="none") this.Tooltip.style.display = "none";
12794
12929
 
12795
12930
  this.HideFloatTooltip();
12931
+ this.HideSmallFloatTooltip();
12932
+ }
12933
+
12934
+ this.DrawSmallFloatTooltip=function(toolTip)
12935
+ {
12936
+ if (!this.SmallFloatTooltipGroup) return;
12937
+
12938
+ this.UpdateSmallFloatTooltip(toolTip)
12939
+ }
12940
+
12941
+ this.UpdateSmallFloatTooltip=function(toolTip)
12942
+ {
12943
+ if (!this.SmallFloatTooltipGroup) return;
12944
+
12945
+ var sendData=
12946
+ {
12947
+ Tooltip:toolTip,
12948
+ Symbol:this.Symbol,
12949
+ Name:this.Name,
12950
+ DataType:1,
12951
+ };
12952
+
12953
+ this.SmallFloatTooltipGroup.Update(sendData);
12796
12954
  }
12797
12955
 
12798
12956
  this.UpdateSelectRect=function(start,end)
@@ -51590,6 +51748,69 @@ function ChartStackedBar()
51590
51748
 
51591
51749
  }
51592
51750
 
51751
+ //绘制随光标移动的浮动文字。
51752
+ //用法:DRAWFLAGTEXT(COND,PRICE,TEXT),光标处当COND条件满足时,在PRICE位置用半透明窗口显示文字TEXT,随光标移动而移动。将\\n插入TEXT内容中可实现文字换行。
51753
+ //例如:DRAWFLAGTEXT(CLOSE/OPEN>1.08,LOW,'大阳线')表示当光标移动到涨幅大于8%的地方,在最低价位置显示'大阳线'字样的浮动窗口。
51754
+ function ChartDrawFlagText()
51755
+ {
51756
+ this.newMethod=IChartPainting; //派生
51757
+ this.newMethod();
51758
+ delete this.newMethod;
51759
+
51760
+ this.ClassName="ChartDrawFlagText";
51761
+
51762
+ this.MapCache=null; //key=date/date-time value={ Date:, Time:, Data:[ ] }
51763
+ this.AryData=[];
51764
+
51765
+ this.GetKValue=ChartData.GetKValue;
51766
+ this.BuildCacheData=function()
51767
+ {
51768
+ var mapData=new Map();
51769
+ this.MapCache=mapData;
51770
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
51771
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryData)) return;
51772
+
51773
+ for(var i=0;i<this.Data.Data.length;++i)
51774
+ {
51775
+ var item=this.AryData[i];
51776
+ if (!item) continue;
51777
+
51778
+ var kItem=this.Data.Data[i];
51779
+ item.Date=kItem.Date;
51780
+ item.Time=kItem.Time;
51781
+
51782
+ var key=this.BuildKey(kItem);
51783
+ mapData.set(key, item);
51784
+ }
51785
+ }
51786
+
51787
+ this.Draw=function()
51788
+ {
51789
+
51790
+ }
51791
+
51792
+ this.GetCorssCursorTooltipData=function(kItem, tooltip)
51793
+ {
51794
+ if (!kItem) return null;
51795
+ if (!this.MapCache) return null;
51796
+
51797
+ var key=this.BuildKey(kItem);
51798
+ if (!this.MapCache.has(key)) return null;
51799
+
51800
+ var item=this.MapCache.get(key);
51801
+ if (item.YValue>this.ChartFrame.HorizontalMax || item.YValue<this.ChartFrame.HorizontalMin) return null;
51802
+
51803
+ var y=this.ChartFrame.GetYFromData(item.YValue,false);
51804
+ tooltip.AryData.push({ Data:item, Y:y, ChartPaint:this, Type:1 });
51805
+ return item;
51806
+ }
51807
+
51808
+ this.GetMaxMin=function()
51809
+ {
51810
+ return {Min:null, Max:null};
51811
+ }
51812
+ }
51813
+
51593
51814
  //锁 支持横屏
51594
51815
  function ChartLock()
51595
51816
  {
@@ -52018,7 +52239,8 @@ function ExtendChartPaintFactory()
52018
52239
  ["DragMovePaint", { Create:function() { return new DragMovePaint(); } }],
52019
52240
  ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}],
52020
52241
  ["FrameButtomToolbarPaint", {Create:function() { return new FrameButtomToolbarPaint(); }}],
52021
- ["LatestPointFlashPaint", {Create:function() { return new LatestPointFlashPaint(); }}]
52242
+ ["LatestPointFlashPaint", {Create:function() { return new LatestPointFlashPaint(); }}],
52243
+ ["KLineCountDownPaint", { Create:function(){ return new KLineCountDownPaint(); }}]
52022
52244
  ]
52023
52245
  );
52024
52246
 
@@ -56760,6 +56982,238 @@ function LatestPointFlashPaint()
56760
56982
  }
56761
56983
  }
56762
56984
 
56985
+
56986
+ //K线倒计时
56987
+ function KLineCountDownPaint()
56988
+ {
56989
+ this.newMethod=IExtendChartPainting; //派生
56990
+ this.newMethod();
56991
+ delete this.newMethod;
56992
+
56993
+ this.ClassName='KLineCountDownPaint';
56994
+ this.HQChart;
56995
+ this.CanvasEx;
56996
+ this.Frequency=500; //闪烁频率ms
56997
+ this.Font=g_JSChartResource.KLineCountDownPaint.Font;
56998
+ this.PriceColor=g_JSChartResource.KLineCountDownPaint.PriceColor;
56999
+ this.TimeColor=g_JSChartResource.KLineCountDownPaint.TimeColor;
57000
+
57001
+ this.TextMargin=CloneData(g_JSChartResource.KLineCountDownPaint.TextMargin);
57002
+ this.LabelMargin=CloneData(g_JSChartResource.KLineCountDownPaint.LabelMargin);
57003
+ this.LineConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Line); //{ IsShow:true, Width:1, Dash:[3,4] };
57004
+
57005
+ this.UnchangeConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Unchange);
57006
+ this.UpConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Up);
57007
+ this.DownConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Down);
57008
+
57009
+ //临时使用
57010
+ this.MainFrame;
57011
+ this.LastItem;
57012
+
57013
+ this.SetOption=function(option)
57014
+ {
57015
+ if (this.HQChart)
57016
+ {
57017
+ var extraElement=this.HQChart.GetExtraCanvas(JSChart.KLineCountDownKey);
57018
+ if (extraElement && extraElement.Canvas) this.CanvasEx=extraElement.Canvas; //绑定独立的画布
57019
+ }
57020
+
57021
+ if (option)
57022
+ {
57023
+ if (IFrameSplitOperator.IsNumber(option.Frequency)) this.Frequency=option.Frequency;
57024
+ if (option.TextMargin) CopyMarginConfig(option.TextMargin, this.TextMargin);
57025
+ if (option.LabelMargin) CopyMarginConfig(option.LabelMargin, this.LabelMargin);
57026
+ if (option.UnchangeColor) this.UnchangeColor=option.UnchangeColor;
57027
+ if (option.UpColor) this.UpColor=option.UpColor;
57028
+ if (option.DownColor) this.DownColor=option.DownColor;
57029
+
57030
+ if (option.Line)
57031
+ {
57032
+ var item=option.Line;
57033
+ if (IFrameSplitOperator.IsBool(item.IsShow)) this.LineConfig.IsShow=item.IsShow;
57034
+ if (IFrameSplitOperator.IsNumber(item.Width)) this.LineConfig.Width=item.Width;
57035
+ if (item.Dash) this.LineConfig.Dash=item.Dash;
57036
+ }
57037
+ }
57038
+ }
57039
+
57040
+ this.ReloadResource=function(resource)
57041
+ {
57042
+ this.Font=g_JSChartResource.KLineCountDownPaint.Font;
57043
+ this.PriceColor=g_JSChartResource.KLineCountDownPaint.PriceColor;
57044
+ this.TimeColor=g_JSChartResource.KLineCountDownPaint.TimeColor;
57045
+
57046
+ this.TextMargin=CloneData(g_JSChartResource.KLineCountDownPaint.TextMargin);
57047
+ this.LabelMargin=CloneData(g_JSChartResource.KLineCountDownPaint.LabelMargin);
57048
+ this.LineConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Line); //{ IsShow:true, Width:1, Dash:[3,4] };
57049
+
57050
+ this.UnchangeConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Unchange);
57051
+ this.UpConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Up);
57052
+ this.DownConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Down);
57053
+ }
57054
+
57055
+ this.Draw=function()
57056
+ {
57057
+ this.MainFrame=null;
57058
+ this.LastItem=null;
57059
+
57060
+ if (!this.HQChart) return;
57061
+ if (!this.CanvasEx) return;
57062
+ this.HQChart.ClearCanvas(this.CanvasEx);
57063
+ var kData=this.HQChart.GetKData();
57064
+ if (!kData || !IFrameSplitOperator.IsNonEmptyArray(kData.Data)) return;
57065
+
57066
+ var lastItem=kData.Data[kData.Data.length-1];
57067
+ if (!lastItem || !IFrameSplitOperator.IsNumber(lastItem.Close)) return;
57068
+ var frame=this.ChartFrame.SubFrame[0].Frame;
57069
+ if (!frame) return;
57070
+ var price=lastItem.Close;
57071
+ if (price>frame.HorizontalMax || price<frame.HorizontalMin) return;
57072
+
57073
+ if (frame.IsHScreen) return;
57074
+
57075
+ this.MainFrame=frame;
57076
+ this.LastItem=lastItem;
57077
+
57078
+ this.CanvasEx.save();
57079
+ this.DrawDownPaint();
57080
+ this.CanvasEx.restore();
57081
+
57082
+ this.MainFrame=null;
57083
+ this.LastItem=null;
57084
+ //if (!this.HQChart.GlobalOption || !this.HQChart.GlobalOption.CountDown) return;
57085
+ }
57086
+
57087
+ this.DrawDownPaint=function()
57088
+ {
57089
+ if (!this.MainFrame || !this.LastItem || !IFrameSplitOperator.IsNumber(this.LastItem.Close)) return;
57090
+
57091
+ var decNum=GetfloatPrecision(this.HQChart.Symbol); //小数位数
57092
+ var yPrice=this.MainFrame.GetYFromData(this.LastItem.Close,false);
57093
+ var strPrice=this.LastItem.Close.toFixed(decNum);
57094
+
57095
+ var config=this.GetColorConfig(this.LastItem);
57096
+ var out={ BGColor:config.BGColor, Font:this.Font, AryText:[ ], YPrice:yPrice };
57097
+
57098
+ var item={ Text:strPrice, Color:config.PriceColor };
57099
+ out.AryText.push(item);
57100
+
57101
+ var item={ Text:"--:--", Color:config.TimeColor};
57102
+ out.AryText.push(item);
57103
+
57104
+ var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_COUNTDOWN_TEXT);
57105
+ if (event && event.Callback)
57106
+ {
57107
+ var sendData={ LastItem:this.LastItem, Frame:this.MainFrame, Out:out, Period:this.HQChart.Period, Symbol:this.HQChart.Symbol };
57108
+ event.Callback(event, sendData, this);
57109
+ }
57110
+
57111
+ if (!this.CalculateLableSize(out)) return;
57112
+
57113
+ this.DrawLable(out);
57114
+ }
57115
+
57116
+ this.CalculateLableSize=function(out)
57117
+ {
57118
+ if (!out || !IFrameSplitOperator.IsNonEmptyArray(out.AryText)) return false;
57119
+
57120
+ this.CanvasEx.font=this.Font;
57121
+ this.FontHeight=this.CanvasEx.measureText("O").width; //行高
57122
+
57123
+ var lableWidth=0, lableHeight=0
57124
+ for(var i=0; i<out.AryText.length; ++i)
57125
+ {
57126
+ var item=out.AryText[i];
57127
+ if (!item || !item.Text) continue;
57128
+ item.TextWidth=this.CanvasEx.measureText(item.Text).width;
57129
+ item.TextWidth+=this.TextMargin.Left+this.TextMargin.Right;
57130
+
57131
+ if (lableWidth<item.TextWidth) lableWidth=item.TextWidth;
57132
+ lableHeight+=this.FontHeight+this.TextMargin.Top+this.TextMargin.Bottom;
57133
+ }
57134
+
57135
+ out.Width=lableWidth+this.LabelMargin.Left+this.LabelMargin.Right;
57136
+ out.Height=lableHeight+this.LabelMargin.Top+this.LabelMargin.Bottom;
57137
+
57138
+ return true;
57139
+ }
57140
+
57141
+ this.FixedRect=function(rt)
57142
+ {
57143
+ rt.Left=ToFixedRect(rt.Left);
57144
+ rt.Top=ToFixedRect(rt.Top);
57145
+ rt.Width=ToFixedRect(rt.Width);
57146
+ rt.Height=ToFixedRect(rt.Height);
57147
+
57148
+ rt.Right=rt.Left+rt.Width;
57149
+ rt.Bottom=rt.Top+rt.Height;
57150
+ }
57151
+
57152
+ this.DrawLable=function(out)
57153
+ {
57154
+ if (!out || !IFrameSplitOperator.IsNonEmptyArray(out.AryText)) return;
57155
+
57156
+ var border=this.MainFrame.GetBorder();
57157
+ var chartBorder=this.MainFrame.ChartBorder;
57158
+ var lineHeight=this.FontHeight+this.TextMargin.Top+this.TextMargin.Bottom;
57159
+ if (chartBorder.Right>10 ) //外部刻度
57160
+ {
57161
+ var rtBG={ Left:border.Right, Top:out.YPrice-lineHeight/2, Width:out.Width, Height:out.Height };
57162
+ rtBG.Right=rtBG.Left+rtBG.Width;
57163
+ if (rtBG.Right>border.ChartWidth)
57164
+ {
57165
+ rtBG.Right=border.ChartWidth-1;
57166
+ rtBG.Left=rtBG.Right-rtBG.Width;
57167
+ }
57168
+
57169
+ this.FixedRect(rtBG);
57170
+ this.CanvasEx.fillStyle=out.BGColor;
57171
+ this.CanvasEx.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
57172
+ }
57173
+
57174
+ this.Canvas.textAlign = "left";
57175
+ this.Canvas.textBaseline = "bottom";
57176
+ var yText=rtBG.Top+lineHeight+this.LabelMargin.Top;
57177
+ var xText=rtBG.Left+this.TextMargin.Left+this.LabelMargin.Left;
57178
+ for(var i=0;i<out.AryText.length;++i)
57179
+ {
57180
+ var item=out.AryText[i];
57181
+ var yOffset=this.TextMargin.YOffset;
57182
+
57183
+ this.CanvasEx.fillStyle=item.Color;
57184
+ this.CanvasEx.fillText(item.Text, xText, yText+yOffset-this.TextMargin.Bottom);
57185
+
57186
+ yText+=lineHeight;
57187
+ }
57188
+
57189
+ //线段
57190
+ var config=this.LineConfig;
57191
+ if (config.IsShow)
57192
+ {
57193
+ this.CanvasEx.strokeStyle=out.BGColor;
57194
+ this.CanvasEx.lineWidth=config.Width;
57195
+ if (IFrameSplitOperator.IsNonEmptyArray(config.Dash)) this.CanvasEx.setLineDash(config.Dash);
57196
+ this.CanvasEx.beginPath();
57197
+ var xLeft=border.LeftEx;
57198
+ var xRight=rtBG.Left;
57199
+ this.CanvasEx.moveTo(xLeft,ToFixedPoint(out.YPrice));
57200
+ this.CanvasEx.lineTo(xRight,ToFixedPoint(out.YPrice));
57201
+ this.CanvasEx.stroke();
57202
+ }
57203
+ }
57204
+
57205
+ this.GetColorConfig=function(kItem, symbol)
57206
+ {
57207
+ var config=this.UnchangeConfig;
57208
+ if (!kItem) return config;
57209
+
57210
+ if (kItem.Close>kItem.YClose) config=this.UpConfig;
57211
+ else if (kItem.Close<kItem.YClose) config=this.DownConfig;
57212
+
57213
+ return config;
57214
+ }
57215
+ }
57216
+
56763
57217
  //拖拽效果图
56764
57218
  var JSCHART_DRAGCHART_TYPE_ID=
56765
57219
  {
@@ -58443,6 +58897,8 @@ IFrameSplitOperator.FormatDateTimeStringV2=function(datetime, format, languageID
58443
58897
 
58444
58898
  case "HH:MM:SS":
58445
58899
  return `${IFrameSplitOperator.NumberToString(datetime.getHours())}:${IFrameSplitOperator.NumberToString(datetime.getMinutes())}:${IFrameSplitOperator.NumberToString(datetime.getSeconds())}`;
58900
+ case "MM:SS":
58901
+ return `${IFrameSplitOperator.NumberToString(datetime.getMinutes())}:${IFrameSplitOperator.NumberToString(datetime.getSeconds())}`;
58446
58902
  case "HH:MM":
58447
58903
  return `${IFrameSplitOperator.NumberToString(datetime.getHours())}:${IFrameSplitOperator.NumberToString(datetime.getMinutes())}`;
58448
58904
  case "HH:MM:SS.fff":
@@ -61532,7 +61988,7 @@ function ChartCorssCursor()
61532
61988
 
61533
61989
  //内部使用
61534
61990
  this.Close=null; //收盘价格
61535
- this.Status=0; //当前状态 0=隐藏 1=显示
61991
+ this.Status=0; //当前状态 0=隐藏 1=显示底部 2=十字线
61536
61992
 
61537
61993
  this.ReloadResource=function(resource)
61538
61994
  {
@@ -81103,6 +81559,15 @@ function JSChartResource()
81103
81559
  ValueColor:"rgb(0,0,0)", //数值
81104
81560
  };
81105
81561
 
81562
+ this.SmallFloatTooltipV2=
81563
+ {
81564
+ BGColor:'rgb(250,250,250)', //背景色
81565
+ BorderColor:'rgb(20,20,20)', //边框颜色
81566
+
81567
+ TextColor:"rgb(0,0,0)", //数值名称
81568
+ ValueColor:"rgb(0,0,0)", //数值
81569
+ };
81570
+
81106
81571
  //区间统计
81107
81572
  this.DialogSelectRect=
81108
81573
  {
@@ -81543,6 +82008,18 @@ function JSChartResource()
81543
82008
  SplitLine:{ Color:'rgb(73,133,231)', Width:1*GetDevicePixelRatio(), Dash:[5*GetDevicePixelRatio(),5*GetDevicePixelRatio()] }
81544
82009
  }
81545
82010
 
82011
+ this.KLineCountDownPaint=
82012
+ {
82013
+ Font:`${14*GetDevicePixelRatio()}px 微软雅黑`,
82014
+ TextMargin:{ Left:0, Right:0, Bottom:2, Top:2, YOffset:0 },
82015
+ LabelMargin:{ Left:5, Right:5, Bottom:4, Top:2 },
82016
+ Line:{ IsShow:true, Width:1, Dash:[5*GetDevicePixelRatio(), 5*GetDevicePixelRatio()] },
82017
+
82018
+ Unchange:{ BGColor:"rgb(0,0,0)", PriceColor:"rgb(250,250,250)", TimeColor:"rgb(190,190,190)" },
82019
+ Up:{ BGColor:"rgb(238,21,21)", PriceColor:"rgb(250,250,250)", TimeColor:"rgb(190,190,190)" },
82020
+ Down:{ BGColor:"rgb(25,158,0)", PriceColor:"rgb(250,250,250)", TimeColor:"rgb(190,190,190)" },
82021
+ }
82022
+
81546
82023
 
81547
82024
  //成交明细
81548
82025
  this.DealList=
@@ -82875,6 +83352,73 @@ function JSChartResource()
82875
83352
  if (style.ChartScatterPlotV2) this.SetChartScatterPlotV2(style.ChartScatterPlotV2);
82876
83353
 
82877
83354
  if (style.ChartDrawTVLongPosition) this.SetChartDrawTVLongPosition(style.ChartDrawTVLongPosition);
83355
+ if (style.KLineCountDownPaint) this.SetKLineCountDownPaint(style.KLineCountDownPaint);
83356
+
83357
+ if (style.SmallFloatTooltipV2) this.SetSmallFloatTooltipV2(style.SmallFloatTooltipV2);
83358
+ }
83359
+
83360
+ this.SetSmallFloatTooltipV2=function(style)
83361
+ {
83362
+ var dest=this.SmallFloatTooltipV2;
83363
+
83364
+ if (style.BGColor) dest.BGColor=style.BGColor;
83365
+ if (style.BorderColor) dest.BorderColor=style.BorderColor;
83366
+
83367
+ if (style.TextColor) dest.TextColor=style.TextColor;
83368
+ if (style.ValueColor) dest.ValueColor=style.ValueColor;
83369
+ }
83370
+
83371
+ this.SetKLineCountDownPaint=function(style)
83372
+ {
83373
+ var dest=this.KLineCountDownPaint;
83374
+ if (style.Font) dest.Font=style.Font;
83375
+
83376
+ if (style.TextMargin)
83377
+ {
83378
+ var item=style.TextMargin;
83379
+ CopyMarginConfig(dest.TextMargin, item);
83380
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) dest.TextMargin.YOffset=item.YOffset;
83381
+ }
83382
+
83383
+ if (style.LabelMargin) CopyMarginConfig(dest.LabelMargin, style.LabelMargin);
83384
+
83385
+ if (style.Line)
83386
+ {
83387
+ var item=style.Line;
83388
+ if (IFrameSplitOperator.IsNumber(item.Width)) dest.Line.Width=item.Width;
83389
+ if (IFrameSplitOperator.IsBool(item.IsShow)) dest.Line.Width=item.Width;
83390
+ if (item.Dash) dest.Line.Dash=item.Dash;
83391
+ }
83392
+
83393
+ if (style.Unchange)
83394
+ {
83395
+ var item=style.Unchange;
83396
+ var subDest=dest.Unchange;
83397
+
83398
+ if (item.BGColor) subDest.BGColor=item.BGColor;
83399
+ if (item.PriceColor) subDest.PriceColor=item.PriceColor;
83400
+ if (item.TimeColor) subDest.TimeColor=item.TimeColor;
83401
+ }
83402
+
83403
+ if (style.Up)
83404
+ {
83405
+ var item=style.Up;
83406
+ var subDest=dest.Up;
83407
+
83408
+ if (item.BGColor) subDest.BGColor=item.BGColor;
83409
+ if (item.PriceColor) subDest.PriceColor=item.PriceColor;
83410
+ if (item.TimeColor) subDest.TimeColor=item.TimeColor;
83411
+ }
83412
+
83413
+ if (style.Down)
83414
+ {
83415
+ var item=style.Down;
83416
+ var subDest=dest.Down;
83417
+
83418
+ if (item.BGColor) subDest.BGColor=item.BGColor;
83419
+ if (item.PriceColor) subDest.PriceColor=item.PriceColor;
83420
+ if (item.TimeColor) subDest.TimeColor=item.TimeColor;
83421
+ }
82878
83422
  }
82879
83423
 
82880
83424
 
@@ -117984,6 +118528,55 @@ function JSDraw(errorHandler,symbolData)
117984
118528
  this.ErrorHandler=errorHandler;
117985
118529
  this.SymbolData=symbolData;
117986
118530
 
118531
+ //绘制随光标移动的浮动文字。
118532
+ //用法: DRAWFLAGTEXT(COND,PRICE,TEXT),光标处当COND条件满足时,在PRICE位置用半透明窗口显示文字TEXT,随光标移动而移动。将\\n插入TEXT内容中可实现文字换行。
118533
+ //例如:DRAWFLAGTEXT(CLOSE/OPEN>1.08,LOW,'大阳线')表示当光标移动到涨幅大于8%的地方,在最低价位置显示'大阳线'字样的浮动窗口。
118534
+ this.DRAWFLAGTEXT=function(condition,price,text)
118535
+ {
118536
+ var drawData=[];
118537
+ var result={ DrawData:drawData, DrawType:'DRAWFLAGTEXT' };
118538
+ if (!text) return result;
118539
+
118540
+ if (Array.isArray(condition))
118541
+ {
118542
+ if (condition.length<=0) return result;
118543
+
118544
+ var bSinglePrice=IFrameSplitOperator.IsNumber(price);
118545
+ for(var i=0; i<condition.length; ++i)
118546
+ {
118547
+ drawData[i]=null;
118548
+
118549
+ if (isNaN(condition[i]) || !condition[i]) continue;
118550
+
118551
+ if (bSinglePrice)
118552
+ {
118553
+ drawData[i]={ YValue:price, Text:text };
118554
+ }
118555
+ else
118556
+ {
118557
+ if (IFrameSplitOperator.IsNumber(price[i])) drawData[i]={ YValue:price[i], Text:text };
118558
+ }
118559
+ }
118560
+ }
118561
+ else if (IFrameSplitOperator.IsPlusNumber(condition))
118562
+ {
118563
+ var bSinglePrice=IFrameSplitOperator.IsNumber(price);
118564
+ for(var i=0;i<this.SymbolData.Data.Data.length;++i)
118565
+ {
118566
+ if (bSinglePrice)
118567
+ {
118568
+ drawData[i]={ YValue:price, Text:text };
118569
+ }
118570
+ else
118571
+ {
118572
+ if (IFrameSplitOperator.IsNumber(price[i])) drawData[i]={ YValue:price[i], Text:text };
118573
+ }
118574
+ }
118575
+ }
118576
+
118577
+ return result;
118578
+ }
118579
+
117987
118580
  this.DRAWTEXT=function(condition,price,text)
117988
118581
  {
117989
118582
  let drawData=[];
@@ -120364,6 +120957,7 @@ JSDraw.prototype.IsDrawFunction=function(name)
120364
120957
  "VERTLINE","HORLINE","TIPICON",
120365
120958
  "BUY","SELL","SELLSHORT","BUYSHORT",
120366
120959
  "DRAWLASTBARICON","DRAWLASTBARNUMBER", "DRAWLASTBARTEXT","DRAWTABLE","DRAWPIE","DRAWRADAR","DRAWDOUGHNUT",
120960
+ "DRAWFLAGTEXT"
120367
120961
  ]);
120368
120962
  if (setFunctionName.has(name)) return true;
120369
120963
 
@@ -126929,6 +127523,10 @@ function JSExecute(ast,option)
126929
127523
  node.Draw=this.Draw.DRAWTEXT_FIX(args[0],args[1],args[2],args[3],args[4]);
126930
127524
  node.Out=[];
126931
127525
  break;
127526
+ case "DRAWFLAGTEXT":
127527
+ node.Draw=this.Draw.DRAWFLAGTEXT(args[0],args[1],args[2]);
127528
+ node.Out=[];
127529
+ break;
126932
127530
  case 'SUPERDRAWTEXT':
126933
127531
  node.Draw=this.Draw.SUPERDRAWTEXT(args[0],args[1],args[2],args[3],args[4]);
126934
127532
  node.Out=[];
@@ -129754,6 +130352,22 @@ function ScriptIndex(name,script,args,option)
129754
130352
  hqChart.ChartPaint.push(chartText);
129755
130353
  }
129756
130354
 
130355
+ this.CreateDrawFlagText=function(hqChart,windowIndex,varItem,id)
130356
+ {
130357
+ var chart=new ChartDrawFlagText();
130358
+ chart.Canvas=hqChart.Canvas;
130359
+ chart.Name=varItem.Name;
130360
+ chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
130361
+ chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;
130362
+ if (chart.ReloadResource) chart.ReloadResource();
130363
+
130364
+ chart.Data=hqChart.GetKData();
130365
+ if (varItem.Draw.DrawData) chart.AryData=varItem.Draw.DrawData;
130366
+ chart.BuildCacheData();
130367
+
130368
+ hqChart.ChartPaint.push(chart);
130369
+ }
130370
+
129757
130371
  //COLORSTICK
129758
130372
  this.CreateMACD=function(hqChart,windowIndex,varItem,id)
129759
130373
  {
@@ -131220,6 +131834,9 @@ function ScriptIndex(name,script,args,option)
131220
131834
  case 'DRAWTEXT':
131221
131835
  this.CreateDrawTextV2(hqChart,windowIndex,item,i);
131222
131836
  break;
131837
+ case "DRAWFLAGTEXT":
131838
+ this.CreateDrawFlagText(hqChart,windowIndex,item,i);
131839
+ break;
131223
131840
  case 'SUPERDRAWTEXT':
131224
131841
  this.CreateText(hqChart,windowIndex,item,i);
131225
131842
  break;
@@ -131641,6 +132258,8 @@ function OverlayScriptIndex(name,script,args,option)
131641
132258
  case 'DRAWTEXT':
131642
132259
  this.CreateDrawTextV2(hqChart,windowIndex,item,i);
131643
132260
  break;
132261
+ case "DRAWFLAGTEXT":
132262
+ this.CreateDrawFlagText(hqChart,windowIndex,item,i);
131644
132263
  case 'SUPERDRAWTEXT':
131645
132264
  this.CreateText(hqChart,windowIndex,item,i);
131646
132265
  break;
@@ -132005,6 +132624,25 @@ function OverlayScriptIndex(name,script,args,option)
132005
132624
  frame.ChartPaint.push(chartText);
132006
132625
  }
132007
132626
 
132627
+ this.CreateDrawFlagText=function(hqChart,windowIndex,varItem,id)
132628
+ {
132629
+ var overlayIndex=this.OverlayIndex;
132630
+ var frame=overlayIndex.Frame;
132631
+ var chart=new ChartDrawFlagText();
132632
+ chart.Canvas=hqChart.Canvas;
132633
+ chart.Name=varItem.Name;
132634
+ chart.ChartBorder=frame.Frame.ChartBorder;
132635
+ chart.ChartFrame=frame.Frame;
132636
+ chart.Identify=overlayIndex.Identify;
132637
+ if (chart.ReloadResource) chart.ReloadResource();
132638
+
132639
+ chart.Data=hqChart.GetKData();
132640
+ if (varItem.Draw.DrawData) chart.AryData=varItem.Draw.DrawData;
132641
+ chart.BuildCacheData();
132642
+
132643
+ frame.ChartPaint.push(chart);
132644
+ }
132645
+
132008
132646
  //创建文本
132009
132647
  this.CreateText=function(hqChart,windowIndex,varItem,id, drawName)
132010
132648
  {
@@ -135870,6 +136508,15 @@ function GetBlackStyle()
135870
136508
  ValueColor:"rgb(210,210,210)", //数值
135871
136509
  },
135872
136510
 
136511
+ SmallFloatTooltipV2:
136512
+ {
136513
+ BGColor:'rgb(20,20,20)', //背景色
136514
+ BorderColor:'rgb(170,170,170)', //边框颜色
136515
+
136516
+ TextColor:"rgb(210,210,210)", //数值名称
136517
+ ValueColor:"rgb(210,210,210)", //数值
136518
+ },
136519
+
135873
136520
  DialogSelectRect:
135874
136521
  {
135875
136522
  BGColor:'rgb(20,20,20)', //背景色
@@ -136078,6 +136725,13 @@ function GetBlackStyle()
136078
136725
  BGColor:[null, "rgb(42,46,57)"],
136079
136726
  SplitLine:{ Color:'rgb(73,133,231)', Width:1*GetDevicePixelRatio(), Dash:[5*GetDevicePixelRatio(),5*GetDevicePixelRatio()] }
136080
136727
  },
136728
+
136729
+ KLineCountDownPaint:
136730
+ {
136731
+ Unchange:{ BGColor:"rgb(190, 190 ,190)", PriceColor:"rgb(0,0,0)", TimeColor:"rgb(50,50,50)" },
136732
+ Up:{ BGColor:"rgb(238,21,21)", PriceColor:"rgb(250,250,250)", TimeColor:"rgb(190,190,190)" },
136733
+ Down:{ BGColor:"rgb(25,158,0)", PriceColor:"rgb(250,250,250)", TimeColor:"rgb(190,190,190)" },
136734
+ },
136081
136735
 
136082
136736
  //成交明细
136083
136737
  DealList:
@@ -152519,7 +153173,7 @@ function ScrollBarBGChart()
152519
153173
 
152520
153174
 
152521
153175
 
152522
- var HQCHART_VERSION="1.1.15010";
153176
+ var HQCHART_VERSION="1.1.15025";
152523
153177
 
152524
153178
  function PrintHQChartVersion()
152525
153179
  {