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.
@@ -813,12 +813,27 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
813
813
  var item=option.LatestPointFlash;
814
814
  if (item.Enable)
815
815
  {
816
- this.CreateExtraCanvasElement(JSChart.LatestPointFlashKey, { ZIndex:6 });
816
+ var zIndex=6;
817
+ if (IFrameSplitOperator.IsNumber(item.ZIndex)) zIndex=item.ZIndex;
818
+ this.CreateExtraCanvasElement(JSChart.LatestPointFlashKey, { ZIndex:zIndex });
817
819
  chart.CreateExtendChart("LatestPointFlashPaint", item);
818
820
  chart.StartLatestPointFlash();
819
821
  }
820
822
  }
821
823
 
824
+ if (option.KLineCountDown)
825
+ {
826
+ var item=option.KLineCountDown;
827
+ if (item.Enable)
828
+ {
829
+ var zIndex=4;
830
+ if (IFrameSplitOperator.IsNumber(item.ZIndex)) zIndex=item.ZIndex;
831
+ this.CreateExtraCanvasElement(JSChart.KLineCountDownKey, { ZIndex:zIndex });
832
+ chart.CreateExtendChart("KLineCountDownPaint", item);
833
+ chart.StartCountDown();
834
+ }
835
+ }
836
+
822
837
  return chart;
823
838
  }
824
839
 
@@ -1877,6 +1892,9 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
1877
1892
  if (option.FloatTooltip && option.FloatTooltip.Enable)
1878
1893
  chart.InitalFloatTooltip(option.FloatTooltip);
1879
1894
 
1895
+ if (option.SmallFloatTooltip && option.SmallFloatTooltip.Enable)
1896
+ chart.InitalSmallFloatTooltip(option.SmallFloatTooltip);
1897
+
1880
1898
  if (option.SelectRectDialog && option.SelectRectDialog.Enable)
1881
1899
  chart.InitalSelectRectDialog(option.SelectRectDialog);
1882
1900
 
@@ -2389,6 +2407,7 @@ JSChart.CorssCursorCanvasKey="hqchart_corsscursor";
2389
2407
  JSChart.TooltipCursorCanvasKey="hqchart_tooltip";
2390
2408
  JSChart.RectDragCanvasKey="hqchart_drag_rect";
2391
2409
  JSChart.LatestPointFlashKey="hqchart_point_flash"; //最新数据点闪烁
2410
+ JSChart.KLineCountDownKey="hqchart_kline_countdown"; //倒计时
2392
2411
 
2393
2412
  //初始化
2394
2413
  JSChart.Init=function(divElement,bScreen,bCacheCanvas)
@@ -2835,6 +2854,8 @@ var JSCHART_EVENT_ID=
2835
2854
  ON_REPORT_SHOW_TOOLTIP:175, //报价列表 提示信息\
2836
2855
 
2837
2856
  ON_FORMAT_TVLONGPOSITION_LABEL:176,
2857
+
2858
+ ON_FORMAT_COUNTDOWN_TEXT:177, //倒计时
2838
2859
  }
2839
2860
 
2840
2861
  var JSCHART_OPERATOR_ID=
@@ -3302,7 +3323,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3302
3323
  this.DisplayLatestOption={ Timer:null, Enable: false, DelayTime:60*1000*3, LastPoint:null };
3303
3324
  this.DrawDynamicInfoOption={ Timer:null, Enable:false , DelayTime:10 };
3304
3325
 
3305
- this.LatestPointFlashOption={ Timer:null, DelayTime:100 };
3326
+ this.LatestPointFlashOption={ Timer:null, DelayTime:100 }; //最后一个数据闪烁
3327
+ this.CountDownOption={ Timer:null, DelayTime:300 }; //倒计时
3306
3328
 
3307
3329
  this.CustomChartDrag; //自定义图形的拖拽操作 { Type:, Data: }
3308
3330
 
@@ -3320,6 +3342,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3320
3342
  this.FloatTooltip; //浮动tooltip信息
3321
3343
  this.DialogSearchIndex; //指标搜索
3322
3344
  this.DialogModifyIndexParam; //指标参数修改
3345
+ this.SmallFloatTooltipGroup; //小浮框tooltip信息集合
3323
3346
 
3324
3347
 
3325
3348
  this.RestoreFocusTimer=null; //恢复焦点定时器
@@ -3404,6 +3427,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3404
3427
 
3405
3428
  this.GlobalOption.LatestPoint=null;
3406
3429
  this.GlobalOption.TradeStatus=null;
3430
+ this.GlobalOption.CountDown=null;
3407
3431
  }
3408
3432
 
3409
3433
  this.RestoreFocus=function(delay)
@@ -3476,6 +3500,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3476
3500
  this.FloatTooltip.Create();
3477
3501
  }
3478
3502
 
3503
+
3504
+ this.InitalSmallFloatTooltip=function(option)
3505
+ {
3506
+ if (this.SmallFloatTooltipGroup) return;
3507
+
3508
+ this.SmallFloatTooltipGroup=new JSSmallFloatTooltipGroup();
3509
+ this.SmallFloatTooltipGroup.Inital(this, option);
3510
+ this.SmallFloatTooltipGroup.Create();
3511
+ }
3512
+
3513
+
3479
3514
  this.InitalModifyDrawDialog=function()
3480
3515
  {
3481
3516
  if ( this.DialogModifyDraw) return;
@@ -3653,6 +3688,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3653
3688
  this.FloatTooltip.Hide();
3654
3689
  }
3655
3690
 
3691
+ this.HideSmallFloatTooltip=function()
3692
+ {
3693
+ if (!this.SmallFloatTooltipGroup) return;
3694
+
3695
+ this.SmallFloatTooltipGroup.Hide();
3696
+ }
3697
+
3656
3698
  this.DestroyTooltipDialog=function()
3657
3699
  {
3658
3700
  if (!this.DialogTooltip) return;
@@ -3669,6 +3711,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3669
3711
  this.FloatTooltip=null;
3670
3712
  }
3671
3713
 
3714
+ this.DestroySmallFloatTooltip=function()
3715
+ {
3716
+ if (!this.SmallFloatTooltipGroup) return;
3717
+
3718
+ this.SmallFloatTooltipGroup.Destroy();
3719
+ this.SmallFloatTooltipGroup=null;
3720
+ }
3721
+
3672
3722
  this.DestroySearchIndexDialog=function()
3673
3723
  {
3674
3724
  if (!this.DialogSearchIndex) return;
@@ -3722,6 +3772,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3722
3772
  {
3723
3773
  this.HideFloatTooltip();
3724
3774
  this.CloseTooltipDialog();
3775
+ this.HideSmallFloatTooltip();
3725
3776
 
3726
3777
  if (this.DialogDrawTool) this.DialogDrawTool.Close();
3727
3778
  this.CloseModifyDrawDialog();
@@ -3811,6 +3862,30 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3811
3862
  chart.FlashCount=flashCount;
3812
3863
  }
3813
3864
 
3865
+ this.StartCountDown=function()
3866
+ {
3867
+ this.CountDownOption.Timer=setInterval(()=>
3868
+ {
3869
+ this.DrawCountDown();
3870
+ }, this.CountDownOption.DelayTime);
3871
+ }
3872
+
3873
+ this.DrawCountDown=function()
3874
+ {
3875
+ var finder=this.GetExtendChartByClassName("KLineCountDownPaint");
3876
+ if (finder && finder.Chart)
3877
+ finder.Chart.Draw();
3878
+ }
3879
+
3880
+ this.StopCountDown=function()
3881
+ {
3882
+ if (this.CountDownOption.Timer)
3883
+ {
3884
+ clearInterval(this.CountDownOption.Timer);
3885
+ this.CountDownOption.Timer=null;
3886
+ }
3887
+ }
3888
+
3814
3889
  this.ChartDestroy=function() //销毁
3815
3890
  {
3816
3891
  this.IsDestroy=true;
@@ -3818,6 +3893,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3818
3893
 
3819
3894
  this.DestroyTooltipDialog();
3820
3895
  this.DestroyFloatTooltip();
3896
+ this.DestroySmallFloatTooltip();
3821
3897
 
3822
3898
  this.DestroySearchIndexDialog();
3823
3899
  this.DestroyDialogModifyIndexParam();
@@ -3832,6 +3908,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3832
3908
  if (this.DestroyPopMinuteChart) this.DestroyPopMinuteChart();
3833
3909
 
3834
3910
  this.StopLatestPointFlash();
3911
+ this.StopCountDown();
3835
3912
 
3836
3913
  document.oncontextmenu=null;
3837
3914
  this.RemoveAllEventListener();
@@ -6295,12 +6372,20 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6295
6372
  canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);
6296
6373
  }
6297
6374
 
6375
+ this.ClearCorssCursorCanvas=function()
6376
+ {
6377
+ if (!this.CorssCursorCanvas) return;
6378
+
6379
+ this.CorssCursorCanvas.clearRect(0,0,this.CorssCursorElement.width,this.CorssCursorElement.height);
6380
+ }
6381
+
6298
6382
  this.Draw=function()
6299
6383
  {
6300
6384
  if (this.ChartCorssCursor) this.ChartCorssCursor.Status=0;
6301
6385
  if (this.UIElement.width<=0 || this.UIElement.height<=0) return;
6302
6386
 
6303
6387
  this.StopDrawDynamicInfo();
6388
+ this.ClearCorssCursorCanvas();
6304
6389
 
6305
6390
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_BEFORE_DRAW);
6306
6391
  if (event && event.Callback)
@@ -6474,7 +6559,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6474
6559
  if (this.CorssCursorCanvas) //独立的十字光标层
6475
6560
  {
6476
6561
  this.ChartCorssCursor.Canvas=this.CorssCursorCanvas;
6477
- this.ChartCorssCursor.Canvas.clearRect(0,0,this.CorssCursorElement.width,this.CorssCursorElement.height)
6478
6562
  bRestoreCanvas=true;
6479
6563
  }
6480
6564
 
@@ -7274,6 +7358,50 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7274
7358
  return null;
7275
7359
  }
7276
7360
 
7361
+ this.GetCorssCursorTooltipData=function(option)
7362
+ {
7363
+ if (!this.ChartCorssCursor) return null;
7364
+ if (this.ChartCorssCursor.Status===0) return null;
7365
+ if (!this.ChartCorssCursor.IsShowCorss) return null;
7366
+
7367
+ var kItem=this.ChartCorssCursor.StringFormatX.KItem;
7368
+ if (!kItem) return null;
7369
+
7370
+ //X轴取十字光标坐标
7371
+ var toolTip={ AryData:[], X:this.ChartCorssCursor.StringFormatX.Point.X };
7372
+
7373
+ for(var i=0;i<this.ChartPaint.length;++i)
7374
+ {
7375
+ var item=this.ChartPaint[i];
7376
+ if (!item.GetCorssCursorTooltipData) continue;
7377
+
7378
+ item.GetCorssCursorTooltipData(kItem, toolTip);
7379
+ }
7380
+
7381
+ if (IFrameSplitOperator.IsNonEmptyArray(this.Frame.SubFrame))
7382
+ {
7383
+ for(var i=0;i<this.Frame.SubFrame.length;++i)
7384
+ {
7385
+ var subFrame=this.Frame.SubFrame[i];
7386
+ for(var j=0;j<subFrame.OverlayIndex.length;++j)
7387
+ {
7388
+ var overlayItem=subFrame.OverlayIndex[j];
7389
+ for(var k=0;k<overlayItem.ChartPaint.length;++k)
7390
+ {
7391
+ var item=overlayItem.ChartPaint[k];
7392
+ if (!item.GetCorssCursorTooltipData) continue;
7393
+
7394
+ item.GetCorssCursorTooltipData(kItem, toolTip);
7395
+ }
7396
+ }
7397
+ }
7398
+ }
7399
+
7400
+ if (!IFrameSplitOperator.IsNonEmptyArray(toolTip.AryData)) return null;
7401
+
7402
+ return toolTip;
7403
+ }
7404
+
7277
7405
  this.PtInExtendChartButtons=function(x,y)
7278
7406
  {
7279
7407
  for(var i=0;i<this.ExtendChartPaint.length; ++i)
@@ -7587,6 +7715,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7587
7715
  }
7588
7716
  }
7589
7717
 
7718
+ var corssTooltipData=this.GetCorssCursorTooltipData(null);
7719
+ if (corssTooltipData) this.DrawSmallFloatTooltip(corssTooltipData);
7720
+ else this.HideSmallFloatTooltip();
7721
+
7590
7722
  this.SetCursor(mouseStatus);
7591
7723
  }
7592
7724
 
@@ -8311,6 +8443,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8311
8443
 
8312
8444
  this.ShowTooltipByKeyDown=function()
8313
8445
  {
8446
+ var corssTooltipData=this.GetCorssCursorTooltipData(null);
8447
+ if (corssTooltipData) this.DrawSmallFloatTooltip(corssTooltipData);
8448
+ else this.HideSmallFloatTooltip();
8449
+
8314
8450
  if (!this.KLineTooltipConfig.Enable || !this.KLineTooltipConfig.EnableKeyDown)
8315
8451
  {
8316
8452
  this.HideFloatTooltip();
@@ -8329,7 +8465,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8329
8465
  var kItem=kData.Data[dataIndex];
8330
8466
  if (!kItem) return;
8331
8467
 
8332
- var data=this.Frame.Data;
8333
8468
  var toolTip=new TooltipData();
8334
8469
  toolTip.Data=kItem;
8335
8470
  toolTip.ChartPaint=this.ChartPaint[0];
@@ -8697,6 +8832,29 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8697
8832
  if (this.Tooltip.style.display!="none") this.Tooltip.style.display = "none";
8698
8833
 
8699
8834
  this.HideFloatTooltip();
8835
+ this.HideSmallFloatTooltip();
8836
+ }
8837
+
8838
+ this.DrawSmallFloatTooltip=function(toolTip)
8839
+ {
8840
+ if (!this.SmallFloatTooltipGroup) return;
8841
+
8842
+ this.UpdateSmallFloatTooltip(toolTip)
8843
+ }
8844
+
8845
+ this.UpdateSmallFloatTooltip=function(toolTip)
8846
+ {
8847
+ if (!this.SmallFloatTooltipGroup) return;
8848
+
8849
+ var sendData=
8850
+ {
8851
+ Tooltip:toolTip,
8852
+ Symbol:this.Symbol,
8853
+ Name:this.Name,
8854
+ DataType:1,
8855
+ };
8856
+
8857
+ this.SmallFloatTooltipGroup.Update(sendData);
8700
8858
  }
8701
8859
 
8702
8860
  this.UpdateSelectRect=function(start,end)
@@ -47494,6 +47652,69 @@ function ChartStackedBar()
47494
47652
 
47495
47653
  }
47496
47654
 
47655
+ //绘制随光标移动的浮动文字。
47656
+ //用法:DRAWFLAGTEXT(COND,PRICE,TEXT),光标处当COND条件满足时,在PRICE位置用半透明窗口显示文字TEXT,随光标移动而移动。将\\n插入TEXT内容中可实现文字换行。
47657
+ //例如:DRAWFLAGTEXT(CLOSE/OPEN>1.08,LOW,'大阳线')表示当光标移动到涨幅大于8%的地方,在最低价位置显示'大阳线'字样的浮动窗口。
47658
+ function ChartDrawFlagText()
47659
+ {
47660
+ this.newMethod=IChartPainting; //派生
47661
+ this.newMethod();
47662
+ delete this.newMethod;
47663
+
47664
+ this.ClassName="ChartDrawFlagText";
47665
+
47666
+ this.MapCache=null; //key=date/date-time value={ Date:, Time:, Data:[ ] }
47667
+ this.AryData=[];
47668
+
47669
+ this.GetKValue=ChartData.GetKValue;
47670
+ this.BuildCacheData=function()
47671
+ {
47672
+ var mapData=new Map();
47673
+ this.MapCache=mapData;
47674
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
47675
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryData)) return;
47676
+
47677
+ for(var i=0;i<this.Data.Data.length;++i)
47678
+ {
47679
+ var item=this.AryData[i];
47680
+ if (!item) continue;
47681
+
47682
+ var kItem=this.Data.Data[i];
47683
+ item.Date=kItem.Date;
47684
+ item.Time=kItem.Time;
47685
+
47686
+ var key=this.BuildKey(kItem);
47687
+ mapData.set(key, item);
47688
+ }
47689
+ }
47690
+
47691
+ this.Draw=function()
47692
+ {
47693
+
47694
+ }
47695
+
47696
+ this.GetCorssCursorTooltipData=function(kItem, tooltip)
47697
+ {
47698
+ if (!kItem) return null;
47699
+ if (!this.MapCache) return null;
47700
+
47701
+ var key=this.BuildKey(kItem);
47702
+ if (!this.MapCache.has(key)) return null;
47703
+
47704
+ var item=this.MapCache.get(key);
47705
+ if (item.YValue>this.ChartFrame.HorizontalMax || item.YValue<this.ChartFrame.HorizontalMin) return null;
47706
+
47707
+ var y=this.ChartFrame.GetYFromData(item.YValue,false);
47708
+ tooltip.AryData.push({ Data:item, Y:y, ChartPaint:this, Type:1 });
47709
+ return item;
47710
+ }
47711
+
47712
+ this.GetMaxMin=function()
47713
+ {
47714
+ return {Min:null, Max:null};
47715
+ }
47716
+ }
47717
+
47497
47718
  //锁 支持横屏
47498
47719
  function ChartLock()
47499
47720
  {
@@ -47922,7 +48143,8 @@ function ExtendChartPaintFactory()
47922
48143
  ["DragMovePaint", { Create:function() { return new DragMovePaint(); } }],
47923
48144
  ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}],
47924
48145
  ["FrameButtomToolbarPaint", {Create:function() { return new FrameButtomToolbarPaint(); }}],
47925
- ["LatestPointFlashPaint", {Create:function() { return new LatestPointFlashPaint(); }}]
48146
+ ["LatestPointFlashPaint", {Create:function() { return new LatestPointFlashPaint(); }}],
48147
+ ["KLineCountDownPaint", { Create:function(){ return new KLineCountDownPaint(); }}]
47926
48148
  ]
47927
48149
  );
47928
48150
 
@@ -52664,6 +52886,238 @@ function LatestPointFlashPaint()
52664
52886
  }
52665
52887
  }
52666
52888
 
52889
+
52890
+ //K线倒计时
52891
+ function KLineCountDownPaint()
52892
+ {
52893
+ this.newMethod=IExtendChartPainting; //派生
52894
+ this.newMethod();
52895
+ delete this.newMethod;
52896
+
52897
+ this.ClassName='KLineCountDownPaint';
52898
+ this.HQChart;
52899
+ this.CanvasEx;
52900
+ this.Frequency=500; //闪烁频率ms
52901
+ this.Font=g_JSChartResource.KLineCountDownPaint.Font;
52902
+ this.PriceColor=g_JSChartResource.KLineCountDownPaint.PriceColor;
52903
+ this.TimeColor=g_JSChartResource.KLineCountDownPaint.TimeColor;
52904
+
52905
+ this.TextMargin=CloneData(g_JSChartResource.KLineCountDownPaint.TextMargin);
52906
+ this.LabelMargin=CloneData(g_JSChartResource.KLineCountDownPaint.LabelMargin);
52907
+ this.LineConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Line); //{ IsShow:true, Width:1, Dash:[3,4] };
52908
+
52909
+ this.UnchangeConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Unchange);
52910
+ this.UpConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Up);
52911
+ this.DownConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Down);
52912
+
52913
+ //临时使用
52914
+ this.MainFrame;
52915
+ this.LastItem;
52916
+
52917
+ this.SetOption=function(option)
52918
+ {
52919
+ if (this.HQChart)
52920
+ {
52921
+ var extraElement=this.HQChart.GetExtraCanvas(JSChart.KLineCountDownKey);
52922
+ if (extraElement && extraElement.Canvas) this.CanvasEx=extraElement.Canvas; //绑定独立的画布
52923
+ }
52924
+
52925
+ if (option)
52926
+ {
52927
+ if (IFrameSplitOperator.IsNumber(option.Frequency)) this.Frequency=option.Frequency;
52928
+ if (option.TextMargin) CopyMarginConfig(option.TextMargin, this.TextMargin);
52929
+ if (option.LabelMargin) CopyMarginConfig(option.LabelMargin, this.LabelMargin);
52930
+ if (option.UnchangeColor) this.UnchangeColor=option.UnchangeColor;
52931
+ if (option.UpColor) this.UpColor=option.UpColor;
52932
+ if (option.DownColor) this.DownColor=option.DownColor;
52933
+
52934
+ if (option.Line)
52935
+ {
52936
+ var item=option.Line;
52937
+ if (IFrameSplitOperator.IsBool(item.IsShow)) this.LineConfig.IsShow=item.IsShow;
52938
+ if (IFrameSplitOperator.IsNumber(item.Width)) this.LineConfig.Width=item.Width;
52939
+ if (item.Dash) this.LineConfig.Dash=item.Dash;
52940
+ }
52941
+ }
52942
+ }
52943
+
52944
+ this.ReloadResource=function(resource)
52945
+ {
52946
+ this.Font=g_JSChartResource.KLineCountDownPaint.Font;
52947
+ this.PriceColor=g_JSChartResource.KLineCountDownPaint.PriceColor;
52948
+ this.TimeColor=g_JSChartResource.KLineCountDownPaint.TimeColor;
52949
+
52950
+ this.TextMargin=CloneData(g_JSChartResource.KLineCountDownPaint.TextMargin);
52951
+ this.LabelMargin=CloneData(g_JSChartResource.KLineCountDownPaint.LabelMargin);
52952
+ this.LineConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Line); //{ IsShow:true, Width:1, Dash:[3,4] };
52953
+
52954
+ this.UnchangeConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Unchange);
52955
+ this.UpConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Up);
52956
+ this.DownConfig=CloneData(g_JSChartResource.KLineCountDownPaint.Down);
52957
+ }
52958
+
52959
+ this.Draw=function()
52960
+ {
52961
+ this.MainFrame=null;
52962
+ this.LastItem=null;
52963
+
52964
+ if (!this.HQChart) return;
52965
+ if (!this.CanvasEx) return;
52966
+ this.HQChart.ClearCanvas(this.CanvasEx);
52967
+ var kData=this.HQChart.GetKData();
52968
+ if (!kData || !IFrameSplitOperator.IsNonEmptyArray(kData.Data)) return;
52969
+
52970
+ var lastItem=kData.Data[kData.Data.length-1];
52971
+ if (!lastItem || !IFrameSplitOperator.IsNumber(lastItem.Close)) return;
52972
+ var frame=this.ChartFrame.SubFrame[0].Frame;
52973
+ if (!frame) return;
52974
+ var price=lastItem.Close;
52975
+ if (price>frame.HorizontalMax || price<frame.HorizontalMin) return;
52976
+
52977
+ if (frame.IsHScreen) return;
52978
+
52979
+ this.MainFrame=frame;
52980
+ this.LastItem=lastItem;
52981
+
52982
+ this.CanvasEx.save();
52983
+ this.DrawDownPaint();
52984
+ this.CanvasEx.restore();
52985
+
52986
+ this.MainFrame=null;
52987
+ this.LastItem=null;
52988
+ //if (!this.HQChart.GlobalOption || !this.HQChart.GlobalOption.CountDown) return;
52989
+ }
52990
+
52991
+ this.DrawDownPaint=function()
52992
+ {
52993
+ if (!this.MainFrame || !this.LastItem || !IFrameSplitOperator.IsNumber(this.LastItem.Close)) return;
52994
+
52995
+ var decNum=GetfloatPrecision(this.HQChart.Symbol); //小数位数
52996
+ var yPrice=this.MainFrame.GetYFromData(this.LastItem.Close,false);
52997
+ var strPrice=this.LastItem.Close.toFixed(decNum);
52998
+
52999
+ var config=this.GetColorConfig(this.LastItem);
53000
+ var out={ BGColor:config.BGColor, Font:this.Font, AryText:[ ], YPrice:yPrice };
53001
+
53002
+ var item={ Text:strPrice, Color:config.PriceColor };
53003
+ out.AryText.push(item);
53004
+
53005
+ var item={ Text:"--:--", Color:config.TimeColor};
53006
+ out.AryText.push(item);
53007
+
53008
+ var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_COUNTDOWN_TEXT);
53009
+ if (event && event.Callback)
53010
+ {
53011
+ var sendData={ LastItem:this.LastItem, Frame:this.MainFrame, Out:out, Period:this.HQChart.Period, Symbol:this.HQChart.Symbol };
53012
+ event.Callback(event, sendData, this);
53013
+ }
53014
+
53015
+ if (!this.CalculateLableSize(out)) return;
53016
+
53017
+ this.DrawLable(out);
53018
+ }
53019
+
53020
+ this.CalculateLableSize=function(out)
53021
+ {
53022
+ if (!out || !IFrameSplitOperator.IsNonEmptyArray(out.AryText)) return false;
53023
+
53024
+ this.CanvasEx.font=this.Font;
53025
+ this.FontHeight=this.CanvasEx.measureText("O").width; //行高
53026
+
53027
+ var lableWidth=0, lableHeight=0
53028
+ for(var i=0; i<out.AryText.length; ++i)
53029
+ {
53030
+ var item=out.AryText[i];
53031
+ if (!item || !item.Text) continue;
53032
+ item.TextWidth=this.CanvasEx.measureText(item.Text).width;
53033
+ item.TextWidth+=this.TextMargin.Left+this.TextMargin.Right;
53034
+
53035
+ if (lableWidth<item.TextWidth) lableWidth=item.TextWidth;
53036
+ lableHeight+=this.FontHeight+this.TextMargin.Top+this.TextMargin.Bottom;
53037
+ }
53038
+
53039
+ out.Width=lableWidth+this.LabelMargin.Left+this.LabelMargin.Right;
53040
+ out.Height=lableHeight+this.LabelMargin.Top+this.LabelMargin.Bottom;
53041
+
53042
+ return true;
53043
+ }
53044
+
53045
+ this.FixedRect=function(rt)
53046
+ {
53047
+ rt.Left=ToFixedRect(rt.Left);
53048
+ rt.Top=ToFixedRect(rt.Top);
53049
+ rt.Width=ToFixedRect(rt.Width);
53050
+ rt.Height=ToFixedRect(rt.Height);
53051
+
53052
+ rt.Right=rt.Left+rt.Width;
53053
+ rt.Bottom=rt.Top+rt.Height;
53054
+ }
53055
+
53056
+ this.DrawLable=function(out)
53057
+ {
53058
+ if (!out || !IFrameSplitOperator.IsNonEmptyArray(out.AryText)) return;
53059
+
53060
+ var border=this.MainFrame.GetBorder();
53061
+ var chartBorder=this.MainFrame.ChartBorder;
53062
+ var lineHeight=this.FontHeight+this.TextMargin.Top+this.TextMargin.Bottom;
53063
+ if (chartBorder.Right>10 ) //外部刻度
53064
+ {
53065
+ var rtBG={ Left:border.Right, Top:out.YPrice-lineHeight/2, Width:out.Width, Height:out.Height };
53066
+ rtBG.Right=rtBG.Left+rtBG.Width;
53067
+ if (rtBG.Right>border.ChartWidth)
53068
+ {
53069
+ rtBG.Right=border.ChartWidth-1;
53070
+ rtBG.Left=rtBG.Right-rtBG.Width;
53071
+ }
53072
+
53073
+ this.FixedRect(rtBG);
53074
+ this.CanvasEx.fillStyle=out.BGColor;
53075
+ this.CanvasEx.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
53076
+ }
53077
+
53078
+ this.Canvas.textAlign = "left";
53079
+ this.Canvas.textBaseline = "bottom";
53080
+ var yText=rtBG.Top+lineHeight+this.LabelMargin.Top;
53081
+ var xText=rtBG.Left+this.TextMargin.Left+this.LabelMargin.Left;
53082
+ for(var i=0;i<out.AryText.length;++i)
53083
+ {
53084
+ var item=out.AryText[i];
53085
+ var yOffset=this.TextMargin.YOffset;
53086
+
53087
+ this.CanvasEx.fillStyle=item.Color;
53088
+ this.CanvasEx.fillText(item.Text, xText, yText+yOffset-this.TextMargin.Bottom);
53089
+
53090
+ yText+=lineHeight;
53091
+ }
53092
+
53093
+ //线段
53094
+ var config=this.LineConfig;
53095
+ if (config.IsShow)
53096
+ {
53097
+ this.CanvasEx.strokeStyle=out.BGColor;
53098
+ this.CanvasEx.lineWidth=config.Width;
53099
+ if (IFrameSplitOperator.IsNonEmptyArray(config.Dash)) this.CanvasEx.setLineDash(config.Dash);
53100
+ this.CanvasEx.beginPath();
53101
+ var xLeft=border.LeftEx;
53102
+ var xRight=rtBG.Left;
53103
+ this.CanvasEx.moveTo(xLeft,ToFixedPoint(out.YPrice));
53104
+ this.CanvasEx.lineTo(xRight,ToFixedPoint(out.YPrice));
53105
+ this.CanvasEx.stroke();
53106
+ }
53107
+ }
53108
+
53109
+ this.GetColorConfig=function(kItem, symbol)
53110
+ {
53111
+ var config=this.UnchangeConfig;
53112
+ if (!kItem) return config;
53113
+
53114
+ if (kItem.Close>kItem.YClose) config=this.UpConfig;
53115
+ else if (kItem.Close<kItem.YClose) config=this.DownConfig;
53116
+
53117
+ return config;
53118
+ }
53119
+ }
53120
+
52667
53121
  //拖拽效果图
52668
53122
  var JSCHART_DRAGCHART_TYPE_ID=
52669
53123
  {
@@ -54347,6 +54801,8 @@ IFrameSplitOperator.FormatDateTimeStringV2=function(datetime, format, languageID
54347
54801
 
54348
54802
  case "HH:MM:SS":
54349
54803
  return `${IFrameSplitOperator.NumberToString(datetime.getHours())}:${IFrameSplitOperator.NumberToString(datetime.getMinutes())}:${IFrameSplitOperator.NumberToString(datetime.getSeconds())}`;
54804
+ case "MM:SS":
54805
+ return `${IFrameSplitOperator.NumberToString(datetime.getMinutes())}:${IFrameSplitOperator.NumberToString(datetime.getSeconds())}`;
54350
54806
  case "HH:MM":
54351
54807
  return `${IFrameSplitOperator.NumberToString(datetime.getHours())}:${IFrameSplitOperator.NumberToString(datetime.getMinutes())}`;
54352
54808
  case "HH:MM:SS.fff":
@@ -57436,7 +57892,7 @@ function ChartCorssCursor()
57436
57892
 
57437
57893
  //内部使用
57438
57894
  this.Close=null; //收盘价格
57439
- this.Status=0; //当前状态 0=隐藏 1=显示
57895
+ this.Status=0; //当前状态 0=隐藏 1=显示底部 2=十字线
57440
57896
 
57441
57897
  this.ReloadResource=function(resource)
57442
57898
  {
@@ -77007,6 +77463,15 @@ function JSChartResource()
77007
77463
  ValueColor:"rgb(0,0,0)", //数值
77008
77464
  };
77009
77465
 
77466
+ this.SmallFloatTooltipV2=
77467
+ {
77468
+ BGColor:'rgb(250,250,250)', //背景色
77469
+ BorderColor:'rgb(20,20,20)', //边框颜色
77470
+
77471
+ TextColor:"rgb(0,0,0)", //数值名称
77472
+ ValueColor:"rgb(0,0,0)", //数值
77473
+ };
77474
+
77010
77475
  //区间统计
77011
77476
  this.DialogSelectRect=
77012
77477
  {
@@ -77447,6 +77912,18 @@ function JSChartResource()
77447
77912
  SplitLine:{ Color:'rgb(73,133,231)', Width:1*GetDevicePixelRatio(), Dash:[5*GetDevicePixelRatio(),5*GetDevicePixelRatio()] }
77448
77913
  }
77449
77914
 
77915
+ this.KLineCountDownPaint=
77916
+ {
77917
+ Font:`${14*GetDevicePixelRatio()}px 微软雅黑`,
77918
+ TextMargin:{ Left:0, Right:0, Bottom:2, Top:2, YOffset:0 },
77919
+ LabelMargin:{ Left:5, Right:5, Bottom:4, Top:2 },
77920
+ Line:{ IsShow:true, Width:1, Dash:[5*GetDevicePixelRatio(), 5*GetDevicePixelRatio()] },
77921
+
77922
+ Unchange:{ BGColor:"rgb(0,0,0)", PriceColor:"rgb(250,250,250)", TimeColor:"rgb(190,190,190)" },
77923
+ Up:{ BGColor:"rgb(238,21,21)", PriceColor:"rgb(250,250,250)", TimeColor:"rgb(190,190,190)" },
77924
+ Down:{ BGColor:"rgb(25,158,0)", PriceColor:"rgb(250,250,250)", TimeColor:"rgb(190,190,190)" },
77925
+ }
77926
+
77450
77927
 
77451
77928
  //成交明细
77452
77929
  this.DealList=
@@ -78779,6 +79256,73 @@ function JSChartResource()
78779
79256
  if (style.ChartScatterPlotV2) this.SetChartScatterPlotV2(style.ChartScatterPlotV2);
78780
79257
 
78781
79258
  if (style.ChartDrawTVLongPosition) this.SetChartDrawTVLongPosition(style.ChartDrawTVLongPosition);
79259
+ if (style.KLineCountDownPaint) this.SetKLineCountDownPaint(style.KLineCountDownPaint);
79260
+
79261
+ if (style.SmallFloatTooltipV2) this.SetSmallFloatTooltipV2(style.SmallFloatTooltipV2);
79262
+ }
79263
+
79264
+ this.SetSmallFloatTooltipV2=function(style)
79265
+ {
79266
+ var dest=this.SmallFloatTooltipV2;
79267
+
79268
+ if (style.BGColor) dest.BGColor=style.BGColor;
79269
+ if (style.BorderColor) dest.BorderColor=style.BorderColor;
79270
+
79271
+ if (style.TextColor) dest.TextColor=style.TextColor;
79272
+ if (style.ValueColor) dest.ValueColor=style.ValueColor;
79273
+ }
79274
+
79275
+ this.SetKLineCountDownPaint=function(style)
79276
+ {
79277
+ var dest=this.KLineCountDownPaint;
79278
+ if (style.Font) dest.Font=style.Font;
79279
+
79280
+ if (style.TextMargin)
79281
+ {
79282
+ var item=style.TextMargin;
79283
+ CopyMarginConfig(dest.TextMargin, item);
79284
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) dest.TextMargin.YOffset=item.YOffset;
79285
+ }
79286
+
79287
+ if (style.LabelMargin) CopyMarginConfig(dest.LabelMargin, style.LabelMargin);
79288
+
79289
+ if (style.Line)
79290
+ {
79291
+ var item=style.Line;
79292
+ if (IFrameSplitOperator.IsNumber(item.Width)) dest.Line.Width=item.Width;
79293
+ if (IFrameSplitOperator.IsBool(item.IsShow)) dest.Line.Width=item.Width;
79294
+ if (item.Dash) dest.Line.Dash=item.Dash;
79295
+ }
79296
+
79297
+ if (style.Unchange)
79298
+ {
79299
+ var item=style.Unchange;
79300
+ var subDest=dest.Unchange;
79301
+
79302
+ if (item.BGColor) subDest.BGColor=item.BGColor;
79303
+ if (item.PriceColor) subDest.PriceColor=item.PriceColor;
79304
+ if (item.TimeColor) subDest.TimeColor=item.TimeColor;
79305
+ }
79306
+
79307
+ if (style.Up)
79308
+ {
79309
+ var item=style.Up;
79310
+ var subDest=dest.Up;
79311
+
79312
+ if (item.BGColor) subDest.BGColor=item.BGColor;
79313
+ if (item.PriceColor) subDest.PriceColor=item.PriceColor;
79314
+ if (item.TimeColor) subDest.TimeColor=item.TimeColor;
79315
+ }
79316
+
79317
+ if (style.Down)
79318
+ {
79319
+ var item=style.Down;
79320
+ var subDest=dest.Down;
79321
+
79322
+ if (item.BGColor) subDest.BGColor=item.BGColor;
79323
+ if (item.PriceColor) subDest.PriceColor=item.PriceColor;
79324
+ if (item.TimeColor) subDest.TimeColor=item.TimeColor;
79325
+ }
78782
79326
  }
78783
79327
 
78784
79328