hqchart 1.1.14653 → 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()
@@ -51508,6 +51710,7 @@ function StockChip()
51508
51710
  this.DefaultButton=CloneData(g_JSChartResource.StockChip.DefaultButton); //默认筹码分布图
51509
51711
  this.LongButton=CloneData(g_JSChartResource.StockChip.LongButton); //远期筹码分布图
51510
51712
  this.RecentButton=CloneData(g_JSChartResource.StockChip.RecentButton); //近期筹码分布图
51713
+ this.CloseButton=CloneData(g_JSChartResource.StockChip.CloseButton); //关闭按钮
51511
51714
  this.ButtonTooltip=CloneData(g_JSChartResource.Buttons.Tooltip);
51512
51715
 
51513
51716
  this.DAY_COLOR=
@@ -51537,6 +51740,7 @@ function StockChip()
51537
51740
  this.DefaultButton=CloneData(g_JSChartResource.StockChip.DefaultButton); //默认筹码分布图
51538
51741
  this.LongButton=CloneData(g_JSChartResource.StockChip.LongButton); //远期筹码分布图
51539
51742
  this.RecentButton=CloneData(g_JSChartResource.StockChip.RecentButton); //近期筹码分布图
51743
+ this.CloseButton=CloneData(g_JSChartResource.StockChip.CloseButton);
51540
51744
  this.ButtonTooltip=CloneData(g_JSChartResource.Buttons.Tooltip);
51541
51745
  }
51542
51746
 
@@ -51694,9 +51898,11 @@ function StockChip()
51694
51898
 
51695
51899
  var aryButton=
51696
51900
  [
51901
+ {ID:JSCHART_BUTTON_ID.CHIP_CLOSE, Style:this.CloseButton },
51697
51902
  {ID:JSCHART_BUTTON_ID.CHIP_RECENT, Style: this.RecentButton, ShowType:2 },
51698
51903
  {ID:JSCHART_BUTTON_ID.CHIP_LONG, Style: this.LongButton , ShowType:1},
51699
- {ID:JSCHART_BUTTON_ID.CHIP_DEFULT, Style: this.DefaultButton, ShowType:0 }
51904
+ {ID:JSCHART_BUTTON_ID.CHIP_DEFULT, Style: this.DefaultButton, ShowType:0 },
51905
+
51700
51906
  ];
51701
51907
 
51702
51908
  //右往左绘制
@@ -77641,6 +77847,12 @@ function JSChartResource()
77641
77847
  Text:{ Color:"rgb(105,105,105)", Font:`${12*GetDevicePixelRatio()}px 微软雅黑`}
77642
77848
  };
77643
77849
 
77850
+ this.DaySummaryKLine=
77851
+ {
77852
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
77853
+ TextColor:"rgb(105,105,105)"
77854
+ }
77855
+
77644
77856
  //订单流配置
77645
77857
  this.OrderFlow=
77646
77858
  {
@@ -78335,6 +78547,17 @@ function JSChartResource()
78335
78547
  MerginLeft:4
78336
78548
  },
78337
78549
 
78550
+ CloseButton:
78551
+ {
78552
+ Color:"rgb(128,128,128)",
78553
+ MoveOnColor:'rgb(30,144,255)',
78554
+ SelectedColor:"rgb(0,0,204)",
78555
+ Family:"iconfont",
78556
+ Text:"\ue60c",
78557
+ Size:13*GetDevicePixelRatio(),
78558
+ MerginLeft:4
78559
+ },
78560
+
78338
78561
  //手机端
78339
78562
  PhoneCloseButton:
78340
78563
  {
@@ -79081,6 +79304,14 @@ function JSChartResource()
79081
79304
  }
79082
79305
  }
79083
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
+
79084
79315
  if (style.Index)
79085
79316
  {
79086
79317
  if (style.Index.LineColor) this.Index.LineColor = style.Index.LineColor;
@@ -80622,12 +80853,20 @@ function JSChartLocalization()
80622
80853
  ["Toolbar-"+JSCHART_BUTTON_ID.CHIP_RECENT, {CN:"近期成本分布", EN:"Recent chip", TC:"近期成本分布"}],
80623
80854
  ["Toolbar-"+JSCHART_BUTTON_ID.CHIP_LONG, {CN:"远期成本分布", EN:"Long chip", TC:"远期成本分布"}],
80624
80855
  ["Toolbar-"+JSCHART_BUTTON_ID.CHIP_DEFULT, {CN:"默认筹码分布", EN:"Default chip", TC:"默认筹码分布"}],
80856
+ ["Toolbar-"+JSCHART_BUTTON_ID.CHIP_CLOSE, {CN:"关闭筹码图", EN:"Close chip", TC:"关闭筹码图"}],
80625
80857
  ["Toolbar-"+JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE, {CN:"删除", EN:"Delete", TC:"删除"}],
80626
80858
  ["Toolbar-"+JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING, {CN:"设置", EN:"Setting", TC:"设置"}],
80627
80859
 
80628
80860
  //日盘|夜盘
80629
80861
  ["日盘",{CN:'日盘', EN:'Day', TC:'日盤'}],
80630
- ["夜盘",{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
+
80631
80870
  ]);
80632
80871
 
80633
80872
  this.GetText=function(key,language)
@@ -82812,6 +83051,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
82812
83051
  kline.Name="Main-KLine";
82813
83052
  kline.DrawType=this.KLineDrawType;
82814
83053
  kline.Identify="Main-KLine";
83054
+ kline.HQChart=this;
82815
83055
  kline.GetEventCallback=(id)=>{ return this.GetEventCallback(id); };
82816
83056
 
82817
83057
  this.ChartPaint[0]=kline;
@@ -87371,6 +87611,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87371
87611
  var klineType=klineChart.DrawType;
87372
87612
  var bThinAKBar=klineChart.IsThinAKBar;
87373
87613
  var priceGap=klineChart.PriceGap; //缺口配置信息
87614
+ var bDaySummary=klineChart.DaySummary.Enable;
87374
87615
  var infoPosition=klineChart.InfoPosition;
87375
87616
  var coordinateType=null, yCoordinateType=null; //坐标类型
87376
87617
  var mainFrame=null;
@@ -87618,6 +87859,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87618
87859
 
87619
87860
  { Name:"双击弹分时图", Data:{ ID:JSCHART_MENU_ID.CMD_ENABLE_POP_MINUTE_CHART_ID, Args:[!bPopMinuteChart]}, Checked:bPopMinuteChart},
87620
87861
 
87862
+ { Name:"显示走完剩余时间", Data:{ ID:JSCHART_MENU_ID.CMD_ENABLE_KLINE_DAY_SUMMARY_ID, Args:[!bDaySummary]}, Checked:bDaySummary},
87863
+
87621
87864
  { Name:JSPopMenu.SEPARATOR_LINE_NAME },
87622
87865
  {
87623
87866
  Name:"鼠标形状",
@@ -131468,6 +131711,13 @@ function GetBlackStyle()
131468
131711
  Text:{ Color:"rgb(219,220,220)", Font:`${12*GetDevicePixelRatio()}px 微软雅黑` }
131469
131712
  },
131470
131713
 
131714
+ DaySummaryKLine:
131715
+ {
131716
+ //Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
131717
+ TextColor:"rgb(255,165,0)"
131718
+ },
131719
+
131720
+
131471
131721
  //指标锁
131472
131722
  IndexLock:
131473
131723
  {
@@ -135734,6 +135984,16 @@ function JSReportChartContainer(uielement)
135734
135984
  if (!reportChart) return;
135735
135985
 
135736
135986
  var keyID = e.keyCode ? e.keyCode :e.which;
135987
+
135988
+ //回调事件
135989
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);
135990
+ if (event && event.Callback)
135991
+ {
135992
+ var sendData={ e:e, KeyID:keyID, PreventDefault:false, ReportChart:reportChart };
135993
+ event.Callback(event, sendData, this);
135994
+ if (sendData.PreventDefault) return;
135995
+ }
135996
+
135737
135997
  if (keyID==116) return; //F15刷新不处理
135738
135998
 
135739
135999
  this.HideAllTooltip();
@@ -146800,7 +147060,7 @@ function ScrollBarBGChart()
146800
147060
 
146801
147061
 
146802
147062
 
146803
- var HQCHART_VERSION="1.1.14652";
147063
+ var HQCHART_VERSION="1.1.14662";
146804
147064
 
146805
147065
  function PrintHQChartVersion()
146806
147066
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14652";
8
+ var HQCHART_VERSION="1.1.14662";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {