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.
@@ -4728,6 +4728,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4728
4728
  }
4729
4729
 
4730
4730
  if (IFrameSplitOperator.IsBool(item.EnablePrediction)) klineChart.PredictionConfig.Enable=item.EnablePrediction;
4731
+ if (IFrameSplitOperator.IsBool(item.EnableDaySummary)) klineChart.DaySummary.Enable=item.EnableDaySummary;
4731
4732
  }
4732
4733
 
4733
4734
  if(option.KLineTitle)
@@ -7065,6 +7066,7 @@ var JSCHART_MENU_ID=
7065
7066
 
7066
7067
  CMD_FULLSCREEN_SUMMARY_ID:56, //当前屏区间统计
7067
7068
  CMD_CORSS_DBCLICK_ID:57, //双击显示隐藏十字光标
7069
+ CMD_ENABLE_KLINE_DAY_SUMMARY_ID:58, //K线底部显示走完剩余时间
7068
7070
 
7069
7071
 
7070
7072
 
@@ -15038,6 +15040,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
15038
15040
  case JSCHART_MENU_ID.CMD_FULLSCREEN_SUMMARY_ID:
15039
15041
  this.FullScreenSummary();
15040
15042
  break;
15043
+ case JSCHART_MENU_ID.CMD_ENABLE_KLINE_DAY_SUMMARY_ID:
15044
+ if (IFrameSplitOperator.IsBool(srcParam))
15045
+ {
15046
+ this.ChartPaint[0].DaySummary.Enable=srcParam;
15047
+ this.Draw();
15048
+ }
15049
+ break;
15041
15050
  }
15042
15051
  }
15043
15052
 
@@ -15747,6 +15756,20 @@ function IsRectOverlap(rt, rt2)
15747
15756
  return false;
15748
15757
  }
15749
15758
 
15759
+ //获取文字高度和宽度
15760
+ function GetTextSize(canvas, text, option)
15761
+ {
15762
+ var data=canvas.measureText(text);
15763
+ var height=Math.abs(Math.abs(data.fontBoundingBoxAscent)+Math.abs(data.fontBoundingBoxDescent));
15764
+ var textBaseline=canvas.textBaseline;
15765
+
15766
+ if (textBaseline=="top") height=data.fontBoundingBoxDescent;
15767
+ else if (textBaseline=="bottom") height=data.fontBoundingBoxAscent;
15768
+
15769
+ var result={ Width:data.width, Height:height};
15770
+ return result;
15771
+ }
15772
+
15750
15773
  Number.prototype.toFixed2=Number.prototype.toFixed; //备份下老的
15751
15774
  Number.prototype.toFixed = function( precision )
15752
15775
  {
@@ -30705,6 +30728,31 @@ function ChartKLine()
30705
30728
  //面积图和收盘价线 断开点
30706
30729
  this.AryBreakPoint;
30707
30730
 
30731
+ //天数统计
30732
+ this.DaySummary={ MapDate:new Map(), Enable:false };
30733
+ this.DaySummaryConfig=
30734
+ {
30735
+ Font: g_JSChartResource.DaySummaryKLine.Font,
30736
+ TextColor: g_JSChartResource.DaySummaryKLine.TextColor
30737
+ }
30738
+
30739
+ this.AddToDaySummary=function(kItem)
30740
+ {
30741
+ if (!this.DaySummary.Enable) return false;
30742
+
30743
+ if (!kItem) return false;
30744
+ if (!IFrameSplitOperator.IsPlusNumber(kItem.Date)) return false;
30745
+
30746
+ if (this.DaySummary.MapDate.has(kItem.Date)) return false;
30747
+
30748
+ this.DaySummary.MapDate.set(kItem.Date, { Date:kItem.Date });
30749
+ }
30750
+
30751
+ this.ClearDaySummary=function()
30752
+ {
30753
+ this.DaySummary.MapDate.clear();
30754
+ }
30755
+
30708
30756
  this.BuildDateTimeKey=function(item)
30709
30757
  {
30710
30758
  if (!item) return null;
@@ -30762,6 +30810,13 @@ function ChartKLine()
30762
30810
  UnchangeColor:g_JSChartResource.PredictionKLine.Bar.UnchangeColor,
30763
30811
  DrawType:g_JSChartResource.PredictionKLine.Bar.DrawType
30764
30812
  };
30813
+
30814
+
30815
+ this.DaySummaryConfig=
30816
+ {
30817
+ Font: g_JSChartResource.DaySummaryKLine.Font,
30818
+ TextColor: g_JSChartResource.DaySummaryKLine.TextColor
30819
+ }
30765
30820
 
30766
30821
  }
30767
30822
 
@@ -31394,6 +31449,8 @@ function ChartKLine()
31394
31449
  this.ShowRange.End=i;
31395
31450
  if (!data || data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
31396
31451
 
31452
+ this.AddToDaySummary(data);
31453
+
31397
31454
  var left=xOffset;
31398
31455
  var right=xOffset+dataWidth;
31399
31456
  if (right>chartright) break;
@@ -33279,6 +33336,7 @@ function ChartKLine()
33279
33336
  if (this.IsShowIndexTitleOnly()) return;
33280
33337
  if (this.IsHideScriptIndex()) return;
33281
33338
 
33339
+ this.ClearDaySummary();
33282
33340
  this.IsShowOrderText=false;
33283
33341
  this.TooltipRect=[];
33284
33342
  this.InfoTooltipRect=[];
@@ -33417,6 +33475,8 @@ function ChartKLine()
33417
33475
  this.FFKChart.DrawMaxMinPrice();
33418
33476
  }
33419
33477
  }
33478
+
33479
+ this.DrawDaySummary();
33420
33480
  }
33421
33481
 
33422
33482
  this.OnFormatHighLowTitle=function(ptMax, ptMin)
@@ -33487,8 +33547,33 @@ function ChartKLine()
33487
33547
  else text=text+rightArrow;
33488
33548
  if (ptTop.Y>(top-2))
33489
33549
  {
33550
+ var textSize=GetTextSize(this.Canvas,text);
33551
+ var textWidth=textSize.Width;
33552
+ var textHeight=textSize.Height;
33553
+ if (this.ChartFrame.CoordinateType==1) //反转坐标
33554
+ {
33555
+ var rtText={ Width:textWidth, Height:textHeight, Top:ptTop.Y };
33556
+ rtText.Bottom=rtText.Top+rtText.Height;
33557
+ }
33558
+ else
33559
+ {
33560
+ var rtText={ Width:textWidth, Height:textHeight, Bottom:ptTop.Y };
33561
+ rtText.Top=rtText.Bottom-rtText.Height;
33562
+ }
33563
+
33564
+ if (ptTop.Align=="left")
33565
+ {
33566
+ rtText.Left=left;
33567
+ rtText.Right=rtText.Left+rtText.Width;
33568
+ }
33569
+ else
33570
+ {
33571
+ rtText.Right=left;
33572
+ rtText.Left=rtText.Right-rtText.Width;
33573
+ }
33574
+
33490
33575
  this.Canvas.fillText(text,left,ptTop.Y);
33491
- this.ChartFrame.ChartKLine.Max={X:left, Y:ptTop.Y, Text: { BaseLine:'bottom'}};
33576
+ this.ChartFrame.ChartKLine.Max={X:left, Y:ptTop.Y, Text: { BaseLine:'bottom'}, Rect:rtText };
33492
33577
  }
33493
33578
 
33494
33579
  var ptBottom=ptMin;
@@ -33517,8 +33602,33 @@ function ChartKLine()
33517
33602
  else text=text+rightArrow;
33518
33603
  if (ptBottom.Y<(bottom+1))
33519
33604
  {
33605
+ var textSize=GetTextSize(this.Canvas,text);
33606
+ var textWidth=textSize.Width;
33607
+ var textHeight=textSize.Height;
33608
+ if (this.ChartFrame.CoordinateType==1) //反转坐标
33609
+ {
33610
+ var rtText={ Width:textWidth, Height:textHeight, Bottom:ptBottom.Y };
33611
+ rtText.Top=rtText.Bottom-rtText.Height;
33612
+ }
33613
+ else
33614
+ {
33615
+ var rtText={ Width:textWidth, Height:textHeight, Top:ptBottom.Y };
33616
+ rtText.Bottom=rtText.Top+rtText.Height;
33617
+ }
33618
+
33619
+ if (ptBottom.Align=="left")
33620
+ {
33621
+ rtText.Left=left;
33622
+ rtText.Right=rtText.Left+rtText.Width;
33623
+ }
33624
+ else
33625
+ {
33626
+ rtText.Right=left;
33627
+ rtText.Left=rtText.Right-rtText.Width;
33628
+ }
33629
+
33520
33630
  this.Canvas.fillText(text,left,ptBottom.Y);
33521
- this.ChartFrame.ChartKLine.Min={X:left, Y:ptBottom.Y, Text:{ BaseLine:'top'}};
33631
+ this.ChartFrame.ChartKLine.Min={X:left, Y:ptBottom.Y, Text:{ BaseLine:'top'}, Rect:rtText };
33522
33632
  }
33523
33633
  }
33524
33634
 
@@ -35605,7 +35715,99 @@ function ChartKLine()
35605
35715
  }
35606
35716
  }
35607
35717
  }
35608
-
35718
+
35719
+ this.GetDaySummaryText=function()
35720
+ {
35721
+ var count=this.DaySummary.MapDate.size;
35722
+ if (count<=0) return null;
35723
+ if (!this.HQChart) return null;
35724
+
35725
+ var text;
35726
+ if (ChartData.IsMinutePeriod(this.Data.Period,true))
35727
+ {
35728
+ text=`${count}${g_JSChartLocalization.GetText('天',this.HQChart.LanguageID)}`;
35729
+ return text;
35730
+ }
35731
+
35732
+ if (ChartData.IsDayPeriod(this.Data.Period,true))
35733
+ {
35734
+ switch(this.Data.Period)
35735
+ {
35736
+ case 0:
35737
+ text=`${count}${g_JSChartLocalization.GetText('天',this.HQChart.LanguageID)}`;
35738
+ break;
35739
+ case 1:
35740
+ text=`${count}${g_JSChartLocalization.GetText('周',this.HQChart.LanguageID)}`;
35741
+ break;
35742
+ case 2:
35743
+ text=`${count}${g_JSChartLocalization.GetText('月',this.HQChart.LanguageID)}`;
35744
+ break;
35745
+ case 4:
35746
+ text=`${count}${g_JSChartLocalization.GetText('年',this.HQChart.LanguageID)}`;
35747
+ break;
35748
+ default:
35749
+ return null;
35750
+ }
35751
+
35752
+ return text;
35753
+ }
35754
+
35755
+ return null;
35756
+ }
35757
+
35758
+ this.DrawDaySummary=function()
35759
+ {
35760
+ if (!this.DaySummary.Enable) return;
35761
+ if (this.ChartFrame.IsHScreen===true) return;
35762
+
35763
+ var text=this.GetDaySummaryText();
35764
+ if (!text) return;
35765
+
35766
+ this.Canvas.font=this.DaySummaryConfig.Font;
35767
+
35768
+ this.Canvas.textAlign = 'left';
35769
+ this.Canvas.textBaseline = 'bottom';
35770
+
35771
+ var border=this.ChartBorder.GetBorder();
35772
+ var xText=border.Left+1;
35773
+ var yText=border.Bottom;
35774
+
35775
+ var textSize=GetTextSize(this.Canvas,text);
35776
+ var textWidth=textSize.Width;
35777
+ var textHeight=textSize.Height;
35778
+
35779
+ var rtText={ Left:xText, Bottom:yText, Width:textWidth, Height:textHeight };
35780
+ rtText.Right=rtText.Left+rtText.Width;
35781
+ rtText.Top=rtText.Bottom-rtText.Height;
35782
+
35783
+ if (this.ChartFrame.ChartKLine.Max && this.ChartFrame.ChartKLine.Max.Rect)
35784
+ {
35785
+ var rtMax=this.ChartFrame.ChartKLine.Max.Rect;
35786
+ if (IsRectOverlap(rtText,rtMax))
35787
+ {
35788
+ rtText.Left=rtMax.Right+2;
35789
+ rtText.Right=rtText.Left+rtText.Width;
35790
+ }
35791
+ }
35792
+
35793
+ if (this.ChartFrame.ChartKLine.Min && this.ChartFrame.ChartKLine.Min.Rect)
35794
+ {
35795
+ var rtMin=this.ChartFrame.ChartKLine.Min.Rect;
35796
+ if (IsRectOverlap(rtText,rtMin))
35797
+ {
35798
+ rtText.Left=rtMin.Right+2;
35799
+ rtText.Right=rtText.Left+rtText.Width;
35800
+ }
35801
+ }
35802
+
35803
+ //this.Canvas.fillStyle="rgb(100,0,100)";
35804
+ //this.Canvas.fillRect(rtText.Left,rtText.Top,rtText.Width,rtText.Height);
35805
+
35806
+ this.Canvas.fillStyle=this.DaySummaryConfig.TextColor;
35807
+ this.Canvas.fillText(text,rtText.Left,rtText.Bottom);
35808
+
35809
+ this.ClearDaySummary();
35810
+ }
35609
35811
  }
35610
35812
 
35611
35813
  function ChartColorKline()
@@ -77689,6 +77891,12 @@ function JSChartResource()
77689
77891
  Text:{ Color:"rgb(105,105,105)", Font:`${12*GetDevicePixelRatio()}px 微软雅黑`}
77690
77892
  };
77691
77893
 
77894
+ this.DaySummaryKLine=
77895
+ {
77896
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
77897
+ TextColor:"rgb(105,105,105)"
77898
+ }
77899
+
77692
77900
  //订单流配置
77693
77901
  this.OrderFlow=
77694
77902
  {
@@ -79140,6 +79348,14 @@ function JSChartResource()
79140
79348
  }
79141
79349
  }
79142
79350
 
79351
+ if (style.DaySummaryKLine)
79352
+ {
79353
+ var item=style.DaySummaryKLine;
79354
+ var dest=this.DaySummaryKLine;
79355
+ if (item.Font) dest.Font=item.Font;
79356
+ if (item.TextColor) dest.TextColor=item.TextColor;
79357
+ }
79358
+
79143
79359
  if (style.Index)
79144
79360
  {
79145
79361
  if (style.Index.LineColor) this.Index.LineColor = style.Index.LineColor;
@@ -80687,7 +80903,14 @@ function JSChartLocalization()
80687
80903
 
80688
80904
  //日盘|夜盘
80689
80905
  ["日盘",{CN:'日盘', EN:'Day', TC:'日盤'}],
80690
- ["夜盘",{CN:'夜盘', EN:'Night', TC:'夜盤'} ]
80906
+ ["夜盘",{CN:'夜盘', EN:'Night', TC:'夜盤'} ],
80907
+
80908
+
80909
+ ["天", {CN:'天', EN:'Day', TC:'天'} ],
80910
+ ["周", {CN:'周', EN:'Week', TC:'周'} ],
80911
+ ["月", {CN:'月', EN:'Month', TC:'月'} ],
80912
+ ["年", {CN:'年', EN:'Year', TC:'年'} ],
80913
+
80691
80914
  ]);
80692
80915
 
80693
80916
  this.GetText=function(key,language)
@@ -82872,6 +83095,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
82872
83095
  kline.Name="Main-KLine";
82873
83096
  kline.DrawType=this.KLineDrawType;
82874
83097
  kline.Identify="Main-KLine";
83098
+ kline.HQChart=this;
82875
83099
  kline.GetEventCallback=(id)=>{ return this.GetEventCallback(id); };
82876
83100
 
82877
83101
  this.ChartPaint[0]=kline;
@@ -87431,6 +87655,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87431
87655
  var klineType=klineChart.DrawType;
87432
87656
  var bThinAKBar=klineChart.IsThinAKBar;
87433
87657
  var priceGap=klineChart.PriceGap; //缺口配置信息
87658
+ var bDaySummary=klineChart.DaySummary.Enable;
87434
87659
  var infoPosition=klineChart.InfoPosition;
87435
87660
  var coordinateType=null, yCoordinateType=null; //坐标类型
87436
87661
  var mainFrame=null;
@@ -87678,6 +87903,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87678
87903
 
87679
87904
  { Name:"双击弹分时图", Data:{ ID:JSCHART_MENU_ID.CMD_ENABLE_POP_MINUTE_CHART_ID, Args:[!bPopMinuteChart]}, Checked:bPopMinuteChart},
87680
87905
 
87906
+ { Name:"显示走完剩余时间", Data:{ ID:JSCHART_MENU_ID.CMD_ENABLE_KLINE_DAY_SUMMARY_ID, Args:[!bDaySummary]}, Checked:bDaySummary},
87907
+
87681
87908
  { Name:JSPopMenu.SEPARATOR_LINE_NAME },
87682
87909
  {
87683
87910
  Name:"鼠标形状",
@@ -131528,6 +131755,13 @@ function GetBlackStyle()
131528
131755
  Text:{ Color:"rgb(219,220,220)", Font:`${12*GetDevicePixelRatio()}px 微软雅黑` }
131529
131756
  },
131530
131757
 
131758
+ DaySummaryKLine:
131759
+ {
131760
+ //Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
131761
+ TextColor:"rgb(255,165,0)"
131762
+ },
131763
+
131764
+
131531
131765
  //指标锁
131532
131766
  IndexLock:
131533
131767
  {
@@ -146557,6 +146791,89 @@ function ChartTReport()
146557
146791
  return null;
146558
146792
  }
146559
146793
 
146794
+ //获取一行位置 option={ Symbol:, RowIndex:}
146795
+ this.GetRowRect=function(option)
146796
+ {
146797
+ if (!this.Data) return null;
146798
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return null;
146799
+
146800
+ var symbol=null;
146801
+ var rowIndex=null;
146802
+ if (option)
146803
+ {
146804
+ if (option.Symbol) symbol=option.Symbol;
146805
+ if (IFrameSplitOperator.IsNumber(option.RowIndex)) rowIndex=option.RowIndex;
146806
+ }
146807
+ var top=this.RectClient.Top+this.HeaderHeight;
146808
+ var left=this.RectClient.Left;
146809
+ var right=this.RectClient.Right;
146810
+
146811
+ var textTop=top+this.FixedRowHeight*this.FixedRowCount;
146812
+ for(var i=this.Data.YOffset, j=0; i<this.Data.Data.length && j<this.RowCount ;++i, ++j, textTop+=this.RowHeight)
146813
+ {
146814
+ var exePrice=this.Data.Data[i];
146815
+ var rtRow={ Left:left, Top:textTop, Right:right, Bottom: textTop+this.RowHeight };
146816
+ rtRow.Height=rtRow.Bottom-rtRow.Top;
146817
+ rtRow.Width=rtRow.Right-rtRow.Left;
146818
+
146819
+ var data={ RectRow:rtRow, DataIndex:i, Index:j, ExePrice:exePrice };
146820
+ var item=this.GetExePriceDataCallback(exePrice);
146821
+ if (!item) continue;
146822
+
146823
+ var bLeftFind=false, bRightFind=false;
146824
+ if (symbol)
146825
+ {
146826
+ if (item.LeftData && item.LeftData.Symbol && item.LeftData.Symbol==symbol) bLeftFind=true;
146827
+ if (item.RightData && item.RightData.Symbol && item.RightData.Symbol==symbol) bRightFind=true;
146828
+ }
146829
+ else if (IFrameSplitOperator.IsNumber(rowIndex))
146830
+ {
146831
+ if (rowIndex==i)
146832
+ {
146833
+ bLeftFind=true;
146834
+ bRightFind=true;
146835
+ }
146836
+ }
146837
+
146838
+ if (bLeftFind || bRightFind)
146839
+ {
146840
+ data.Item=item;
146841
+ data.AryLeftRect=[];
146842
+ data.AryRightRect=[];
146843
+ data.ElementRect=this.UIElement.getBoundingClientRect();
146844
+ data.PixelRatio=GetDevicePixelRatio();
146845
+
146846
+ var rtCenterItem=this.GetCenterItemRect();
146847
+ var rtCenter={Left:rtCenterItem.Left, Right:rtCenterItem.Right, Top:rtRow.Top, Height:rtRow.Height, Bottom:rtRow.Bottom };
146848
+
146849
+ var xLeft=rtCenterItem.Left; //左边
146850
+ var xRight=rtCenterItem.Right; //右边
146851
+
146852
+ var reportleft=this.RectClient.Left;
146853
+ var reportRight=this.RectClient.Right;
146854
+ for(var k=this.Data.XOffset;k<this.Column.length;++k)
146855
+ {
146856
+ var colItem=this.Column[k];
146857
+ var itemWidth=colItem.Width+this.ItemExtraWidth;
146858
+ xLeft-=itemWidth;
146859
+ if (xLeft<reportleft) break;
146860
+
146861
+ var rtItem={ Left:xLeft, Right:xLeft+itemWidth, Top:rtRow.Top, Height:rtRow.Height, Bottom:rtRow.Bottom, Width:itemWidth };
146862
+ data.AryLeftRect.push({ Rect:rtItem, ColumnIndex:k, Column:colItem })
146863
+
146864
+ rtItem={ Left:xRight, Right:xRight+itemWidth, Top:rtRow.Top, Height:rtRow.Height, Bottom:rtRow.Bottom, Width:itemWidth };
146865
+ data.AryRightRect.push({ Rect:rtItem, ColumnIndex:k, Column:colItem });
146866
+
146867
+ xRight+=itemWidth;
146868
+ }
146869
+
146870
+ return data;
146871
+ }
146872
+ }
146873
+
146874
+ return null;
146875
+ }
146876
+
146560
146877
  this.PtInBody=function(x,y)
146561
146878
  {
146562
146879
  if (!this.Data) return null;
@@ -157558,7 +157875,7 @@ function HQChartScriptWorker()
157558
157875
 
157559
157876
 
157560
157877
 
157561
- var HQCHART_VERSION="1.1.14659";
157878
+ var HQCHART_VERSION="1.1.14662";
157562
157879
 
157563
157880
  function PrintHQChartVersion()
157564
157881
  {