hqchart 1.1.14660 → 1.1.14663

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.
@@ -4684,6 +4684,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4684
4684
  }
4685
4685
 
4686
4686
  if (IFrameSplitOperator.IsBool(item.EnablePrediction)) klineChart.PredictionConfig.Enable=item.EnablePrediction;
4687
+ if (IFrameSplitOperator.IsBool(item.EnableDaySummary)) klineChart.DaySummary.Enable=item.EnableDaySummary;
4687
4688
  }
4688
4689
 
4689
4690
  if(option.KLineTitle)
@@ -7021,6 +7022,7 @@ var JSCHART_MENU_ID=
7021
7022
 
7022
7023
  CMD_FULLSCREEN_SUMMARY_ID:56, //当前屏区间统计
7023
7024
  CMD_CORSS_DBCLICK_ID:57, //双击显示隐藏十字光标
7025
+ CMD_ENABLE_KLINE_DAY_SUMMARY_ID:58, //K线底部显示走完剩余时间
7024
7026
 
7025
7027
 
7026
7028
 
@@ -14994,6 +14996,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
14994
14996
  case JSCHART_MENU_ID.CMD_FULLSCREEN_SUMMARY_ID:
14995
14997
  this.FullScreenSummary();
14996
14998
  break;
14999
+ case JSCHART_MENU_ID.CMD_ENABLE_KLINE_DAY_SUMMARY_ID:
15000
+ if (IFrameSplitOperator.IsBool(srcParam))
15001
+ {
15002
+ this.ChartPaint[0].DaySummary.Enable=srcParam;
15003
+ this.Draw();
15004
+ }
15005
+ break;
14997
15006
  }
14998
15007
  }
14999
15008
 
@@ -15703,6 +15712,20 @@ function IsRectOverlap(rt, rt2)
15703
15712
  return false;
15704
15713
  }
15705
15714
 
15715
+ //获取文字高度和宽度
15716
+ function GetTextSize(canvas, text, option)
15717
+ {
15718
+ var data=canvas.measureText(text);
15719
+ var height=Math.abs(Math.abs(data.fontBoundingBoxAscent)+Math.abs(data.fontBoundingBoxDescent));
15720
+ var textBaseline=canvas.textBaseline;
15721
+
15722
+ if (textBaseline=="top") height=data.fontBoundingBoxDescent;
15723
+ else if (textBaseline=="bottom") height=data.fontBoundingBoxAscent;
15724
+
15725
+ var result={ Width:data.width, Height:height};
15726
+ return result;
15727
+ }
15728
+
15706
15729
  Number.prototype.toFixed2=Number.prototype.toFixed; //备份下老的
15707
15730
  Number.prototype.toFixed = function( precision )
15708
15731
  {
@@ -30661,6 +30684,31 @@ function ChartKLine()
30661
30684
  //面积图和收盘价线 断开点
30662
30685
  this.AryBreakPoint;
30663
30686
 
30687
+ //天数统计
30688
+ this.DaySummary={ MapDate:new Map(), Enable:false };
30689
+ this.DaySummaryConfig=
30690
+ {
30691
+ Font: g_JSChartResource.DaySummaryKLine.Font,
30692
+ TextColor: g_JSChartResource.DaySummaryKLine.TextColor
30693
+ }
30694
+
30695
+ this.AddToDaySummary=function(kItem)
30696
+ {
30697
+ if (!this.DaySummary.Enable) return false;
30698
+
30699
+ if (!kItem) return false;
30700
+ if (!IFrameSplitOperator.IsPlusNumber(kItem.Date)) return false;
30701
+
30702
+ if (this.DaySummary.MapDate.has(kItem.Date)) return false;
30703
+
30704
+ this.DaySummary.MapDate.set(kItem.Date, { Date:kItem.Date });
30705
+ }
30706
+
30707
+ this.ClearDaySummary=function()
30708
+ {
30709
+ this.DaySummary.MapDate.clear();
30710
+ }
30711
+
30664
30712
  this.BuildDateTimeKey=function(item)
30665
30713
  {
30666
30714
  if (!item) return null;
@@ -30718,6 +30766,13 @@ function ChartKLine()
30718
30766
  UnchangeColor:g_JSChartResource.PredictionKLine.Bar.UnchangeColor,
30719
30767
  DrawType:g_JSChartResource.PredictionKLine.Bar.DrawType
30720
30768
  };
30769
+
30770
+
30771
+ this.DaySummaryConfig=
30772
+ {
30773
+ Font: g_JSChartResource.DaySummaryKLine.Font,
30774
+ TextColor: g_JSChartResource.DaySummaryKLine.TextColor
30775
+ }
30721
30776
 
30722
30777
  }
30723
30778
 
@@ -31350,6 +31405,8 @@ function ChartKLine()
31350
31405
  this.ShowRange.End=i;
31351
31406
  if (!data || data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
31352
31407
 
31408
+ this.AddToDaySummary(data);
31409
+
31353
31410
  var left=xOffset;
31354
31411
  var right=xOffset+dataWidth;
31355
31412
  if (right>chartright) break;
@@ -33235,6 +33292,7 @@ function ChartKLine()
33235
33292
  if (this.IsShowIndexTitleOnly()) return;
33236
33293
  if (this.IsHideScriptIndex()) return;
33237
33294
 
33295
+ this.ClearDaySummary();
33238
33296
  this.IsShowOrderText=false;
33239
33297
  this.TooltipRect=[];
33240
33298
  this.InfoTooltipRect=[];
@@ -33373,6 +33431,8 @@ function ChartKLine()
33373
33431
  this.FFKChart.DrawMaxMinPrice();
33374
33432
  }
33375
33433
  }
33434
+
33435
+ this.DrawDaySummary();
33376
33436
  }
33377
33437
 
33378
33438
  this.OnFormatHighLowTitle=function(ptMax, ptMin)
@@ -33443,8 +33503,33 @@ function ChartKLine()
33443
33503
  else text=text+rightArrow;
33444
33504
  if (ptTop.Y>(top-2))
33445
33505
  {
33506
+ var textSize=GetTextSize(this.Canvas,text);
33507
+ var textWidth=textSize.Width;
33508
+ var textHeight=textSize.Height;
33509
+ if (this.ChartFrame.CoordinateType==1) //反转坐标
33510
+ {
33511
+ var rtText={ Width:textWidth, Height:textHeight, Top:ptTop.Y };
33512
+ rtText.Bottom=rtText.Top+rtText.Height;
33513
+ }
33514
+ else
33515
+ {
33516
+ var rtText={ Width:textWidth, Height:textHeight, Bottom:ptTop.Y };
33517
+ rtText.Top=rtText.Bottom-rtText.Height;
33518
+ }
33519
+
33520
+ if (ptTop.Align=="left")
33521
+ {
33522
+ rtText.Left=left;
33523
+ rtText.Right=rtText.Left+rtText.Width;
33524
+ }
33525
+ else
33526
+ {
33527
+ rtText.Right=left;
33528
+ rtText.Left=rtText.Right-rtText.Width;
33529
+ }
33530
+
33446
33531
  this.Canvas.fillText(text,left,ptTop.Y);
33447
- this.ChartFrame.ChartKLine.Max={X:left, Y:ptTop.Y, Text: { BaseLine:'bottom'}};
33532
+ this.ChartFrame.ChartKLine.Max={X:left, Y:ptTop.Y, Text: { BaseLine:'bottom'}, Rect:rtText };
33448
33533
  }
33449
33534
 
33450
33535
  var ptBottom=ptMin;
@@ -33473,8 +33558,33 @@ function ChartKLine()
33473
33558
  else text=text+rightArrow;
33474
33559
  if (ptBottom.Y<(bottom+1))
33475
33560
  {
33561
+ var textSize=GetTextSize(this.Canvas,text);
33562
+ var textWidth=textSize.Width;
33563
+ var textHeight=textSize.Height;
33564
+ if (this.ChartFrame.CoordinateType==1) //反转坐标
33565
+ {
33566
+ var rtText={ Width:textWidth, Height:textHeight, Bottom:ptBottom.Y };
33567
+ rtText.Top=rtText.Bottom-rtText.Height;
33568
+ }
33569
+ else
33570
+ {
33571
+ var rtText={ Width:textWidth, Height:textHeight, Top:ptBottom.Y };
33572
+ rtText.Bottom=rtText.Top+rtText.Height;
33573
+ }
33574
+
33575
+ if (ptBottom.Align=="left")
33576
+ {
33577
+ rtText.Left=left;
33578
+ rtText.Right=rtText.Left+rtText.Width;
33579
+ }
33580
+ else
33581
+ {
33582
+ rtText.Right=left;
33583
+ rtText.Left=rtText.Right-rtText.Width;
33584
+ }
33585
+
33476
33586
  this.Canvas.fillText(text,left,ptBottom.Y);
33477
- this.ChartFrame.ChartKLine.Min={X:left, Y:ptBottom.Y, Text:{ BaseLine:'top'}};
33587
+ this.ChartFrame.ChartKLine.Min={X:left, Y:ptBottom.Y, Text:{ BaseLine:'top'}, Rect:rtText };
33478
33588
  }
33479
33589
  }
33480
33590
 
@@ -35561,7 +35671,99 @@ function ChartKLine()
35561
35671
  }
35562
35672
  }
35563
35673
  }
35564
-
35674
+
35675
+ this.GetDaySummaryText=function()
35676
+ {
35677
+ var count=this.DaySummary.MapDate.size;
35678
+ if (count<=0) return null;
35679
+ if (!this.HQChart) return null;
35680
+
35681
+ var text;
35682
+ if (ChartData.IsMinutePeriod(this.Data.Period,true))
35683
+ {
35684
+ text=`${count}${g_JSChartLocalization.GetText('天',this.HQChart.LanguageID)}`;
35685
+ return text;
35686
+ }
35687
+
35688
+ if (ChartData.IsDayPeriod(this.Data.Period,true))
35689
+ {
35690
+ switch(this.Data.Period)
35691
+ {
35692
+ case 0:
35693
+ text=`${count}${g_JSChartLocalization.GetText('天',this.HQChart.LanguageID)}`;
35694
+ break;
35695
+ case 1:
35696
+ text=`${count}${g_JSChartLocalization.GetText('周',this.HQChart.LanguageID)}`;
35697
+ break;
35698
+ case 2:
35699
+ text=`${count}${g_JSChartLocalization.GetText('月',this.HQChart.LanguageID)}`;
35700
+ break;
35701
+ case 4:
35702
+ text=`${count}${g_JSChartLocalization.GetText('年',this.HQChart.LanguageID)}`;
35703
+ break;
35704
+ default:
35705
+ return null;
35706
+ }
35707
+
35708
+ return text;
35709
+ }
35710
+
35711
+ return null;
35712
+ }
35713
+
35714
+ this.DrawDaySummary=function()
35715
+ {
35716
+ if (!this.DaySummary.Enable) return;
35717
+ if (this.ChartFrame.IsHScreen===true) return;
35718
+
35719
+ var text=this.GetDaySummaryText();
35720
+ if (!text) return;
35721
+
35722
+ this.Canvas.font=this.DaySummaryConfig.Font;
35723
+
35724
+ this.Canvas.textAlign = 'left';
35725
+ this.Canvas.textBaseline = 'bottom';
35726
+
35727
+ var border=this.ChartBorder.GetBorder();
35728
+ var xText=border.Left+1;
35729
+ var yText=border.Bottom;
35730
+
35731
+ var textSize=GetTextSize(this.Canvas,text);
35732
+ var textWidth=textSize.Width;
35733
+ var textHeight=textSize.Height;
35734
+
35735
+ var rtText={ Left:xText, Bottom:yText, Width:textWidth, Height:textHeight };
35736
+ rtText.Right=rtText.Left+rtText.Width;
35737
+ rtText.Top=rtText.Bottom-rtText.Height;
35738
+
35739
+ if (this.ChartFrame.ChartKLine.Max && this.ChartFrame.ChartKLine.Max.Rect)
35740
+ {
35741
+ var rtMax=this.ChartFrame.ChartKLine.Max.Rect;
35742
+ if (IsRectOverlap(rtText,rtMax))
35743
+ {
35744
+ rtText.Left=rtMax.Right+2;
35745
+ rtText.Right=rtText.Left+rtText.Width;
35746
+ }
35747
+ }
35748
+
35749
+ if (this.ChartFrame.ChartKLine.Min && this.ChartFrame.ChartKLine.Min.Rect)
35750
+ {
35751
+ var rtMin=this.ChartFrame.ChartKLine.Min.Rect;
35752
+ if (IsRectOverlap(rtText,rtMin))
35753
+ {
35754
+ rtText.Left=rtMin.Right+2;
35755
+ rtText.Right=rtText.Left+rtText.Width;
35756
+ }
35757
+ }
35758
+
35759
+ //this.Canvas.fillStyle="rgb(100,0,100)";
35760
+ //this.Canvas.fillRect(rtText.Left,rtText.Top,rtText.Width,rtText.Height);
35761
+
35762
+ this.Canvas.fillStyle=this.DaySummaryConfig.TextColor;
35763
+ this.Canvas.fillText(text,rtText.Left,rtText.Bottom);
35764
+
35765
+ this.ClearDaySummary();
35766
+ }
35565
35767
  }
35566
35768
 
35567
35769
  function ChartColorKline()
@@ -77645,6 +77847,12 @@ function JSChartResource()
77645
77847
  Text:{ Color:"rgb(105,105,105)", Font:`${12*GetDevicePixelRatio()}px 微软雅黑`}
77646
77848
  };
77647
77849
 
77850
+ this.DaySummaryKLine=
77851
+ {
77852
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
77853
+ TextColor:"rgb(105,105,105)"
77854
+ }
77855
+
77648
77856
  //订单流配置
77649
77857
  this.OrderFlow=
77650
77858
  {
@@ -79096,6 +79304,14 @@ function JSChartResource()
79096
79304
  }
79097
79305
  }
79098
79306
 
79307
+ if (style.DaySummaryKLine)
79308
+ {
79309
+ var item=style.DaySummaryKLine;
79310
+ var dest=this.DaySummaryKLine;
79311
+ if (item.Font) dest.Font=item.Font;
79312
+ if (item.TextColor) dest.TextColor=item.TextColor;
79313
+ }
79314
+
79099
79315
  if (style.Index)
79100
79316
  {
79101
79317
  if (style.Index.LineColor) this.Index.LineColor = style.Index.LineColor;
@@ -80643,7 +80859,14 @@ function JSChartLocalization()
80643
80859
 
80644
80860
  //日盘|夜盘
80645
80861
  ["日盘",{CN:'日盘', EN:'Day', TC:'日盤'}],
80646
- ["夜盘",{CN:'夜盘', EN:'Night', TC:'夜盤'} ]
80862
+ ["夜盘",{CN:'夜盘', EN:'Night', TC:'夜盤'} ],
80863
+
80864
+
80865
+ ["天", {CN:'天', EN:'Day', TC:'天'} ],
80866
+ ["周", {CN:'周', EN:'Week', TC:'周'} ],
80867
+ ["月", {CN:'月', EN:'Month', TC:'月'} ],
80868
+ ["年", {CN:'年', EN:'Year', TC:'年'} ],
80869
+
80647
80870
  ]);
80648
80871
 
80649
80872
  this.GetText=function(key,language)
@@ -82828,6 +83051,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
82828
83051
  kline.Name="Main-KLine";
82829
83052
  kline.DrawType=this.KLineDrawType;
82830
83053
  kline.Identify="Main-KLine";
83054
+ kline.HQChart=this;
82831
83055
  kline.GetEventCallback=(id)=>{ return this.GetEventCallback(id); };
82832
83056
 
82833
83057
  this.ChartPaint[0]=kline;
@@ -87387,6 +87611,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87387
87611
  var klineType=klineChart.DrawType;
87388
87612
  var bThinAKBar=klineChart.IsThinAKBar;
87389
87613
  var priceGap=klineChart.PriceGap; //缺口配置信息
87614
+ var bDaySummary=klineChart.DaySummary.Enable;
87390
87615
  var infoPosition=klineChart.InfoPosition;
87391
87616
  var coordinateType=null, yCoordinateType=null; //坐标类型
87392
87617
  var mainFrame=null;
@@ -87634,6 +87859,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87634
87859
 
87635
87860
  { Name:"双击弹分时图", Data:{ ID:JSCHART_MENU_ID.CMD_ENABLE_POP_MINUTE_CHART_ID, Args:[!bPopMinuteChart]}, Checked:bPopMinuteChart},
87636
87861
 
87862
+ { Name:"显示走完剩余时间", Data:{ ID:JSCHART_MENU_ID.CMD_ENABLE_KLINE_DAY_SUMMARY_ID, Args:[!bDaySummary]}, Checked:bDaySummary},
87863
+
87637
87864
  { Name:JSPopMenu.SEPARATOR_LINE_NAME },
87638
87865
  {
87639
87866
  Name:"鼠标形状",
@@ -131484,6 +131711,13 @@ function GetBlackStyle()
131484
131711
  Text:{ Color:"rgb(219,220,220)", Font:`${12*GetDevicePixelRatio()}px 微软雅黑` }
131485
131712
  },
131486
131713
 
131714
+ DaySummaryKLine:
131715
+ {
131716
+ //Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
131717
+ TextColor:"rgb(255,165,0)"
131718
+ },
131719
+
131720
+
131487
131721
  //指标锁
131488
131722
  IndexLock:
131489
131723
  {
@@ -146826,7 +147060,7 @@ function ScrollBarBGChart()
146826
147060
 
146827
147061
 
146828
147062
 
146829
- var HQCHART_VERSION="1.1.14659";
147063
+ var HQCHART_VERSION="1.1.14662";
146830
147064
 
146831
147065
  function PrintHQChartVersion()
146832
147066
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14659";
8
+ var HQCHART_VERSION="1.1.14662";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {