hqchart 1.1.15912 → 1.1.15921

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.
@@ -11250,7 +11250,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11250
11250
 
11251
11251
  if (item.IsCallbackDraw)
11252
11252
  {
11253
- if (["KLineYAxisBGPaint","DepthMapPaint","BackgroundPaint","MinuteBackgroundPaint", "SessionBreaksPaint"].includes(item.ClassName))
11253
+ if (["KLineYAxisBGPaint","DepthMapPaint","BackgroundPaint","MinuteBackgroundPaint", "SessionBreaksPaint", "KLineSelectedPaint"].includes(item.ClassName))
11254
11254
  {
11255
11255
  if (item.FrameID==frame.Identify) item.Draw();
11256
11256
  }
@@ -55814,7 +55814,8 @@ function ExtendChartPaintFactory()
55814
55814
  ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}],
55815
55815
  ["FrameButtomToolbarPaint", {Create:function() { return new FrameButtomToolbarPaint(); }}],
55816
55816
  ["LatestPointFlashPaint", {Create:function() { return new LatestPointFlashPaint(); }}],
55817
- ["KLineCountDownPaint", { Create:function(){ return new KLineCountDownPaint(); }}]
55817
+ ["KLineCountDownPaint", { Create:function(){ return new KLineCountDownPaint(); }}],
55818
+ ["KLineSelectedPaint", { Create:function(){ return new KLineSelectedPaint(); }}],
55818
55819
  ]
55819
55820
  );
55820
55821
 
@@ -61340,6 +61341,159 @@ function SessionBreaksPaint()
61340
61341
  }
61341
61342
  }
61342
61343
 
61344
+ function KLineSelectedPaint()
61345
+ {
61346
+ this.newMethod=IExtendChartPainting; //派生
61347
+ this.newMethod();
61348
+ delete this.newMethod;
61349
+
61350
+ this.ClassName='KLineSelectedPaint';
61351
+ this.IsDynamic=false;
61352
+ this.IsCallbackDraw=true; //在回调函数里绘制, 不在Draw()中绘制
61353
+ this.FrameID=0;
61354
+ this.MapSelectedData=new Map(); //选中数据 { Period:, DateTime:[{ Date:, Time:}, .....] }
61355
+
61356
+ this.BGColor=g_JSChartResource.KLineSelectedPaint.BGColor;
61357
+ this.AryColor=g_JSChartResource.KLineSelectedPaint.AryColor.slice();
61358
+
61359
+ this.ReloadResource=function(resource)
61360
+ {
61361
+ this.BGColor=g_JSChartResource.KLineSelectedPaint.BGColor;
61362
+ this.AryColor=g_JSChartResource.KLineSelectedPaint.AryColor.slice();
61363
+ }
61364
+
61365
+ this.SetOption=function(option)
61366
+ {
61367
+ if (option)
61368
+ {
61369
+ if (option.BGColor) this.BGColor=option.BGColor;
61370
+ if (IFrameSplitOperator.IsNonEmptyArray(option.ArySelected))
61371
+ {
61372
+ for(var i=0;i<option.ArySelected.length;++i)
61373
+ {
61374
+ var item=option.ArySelected[i];
61375
+ this.AddSelected(item, item);
61376
+ }
61377
+ }
61378
+ }
61379
+ }
61380
+
61381
+ this.AddSelected=function(dateTime, option)
61382
+ {
61383
+ if (!dateTime) return false;
61384
+ var key=this.BuildKey(dateTime);
61385
+ if (!key) return false;
61386
+
61387
+ var item={ Date:dateTime.Date, Time:dateTime.Time};
61388
+ if (option && option.BGColor) item.BGColor=option.BGColor;
61389
+ if (option && IFrameSplitOperator.IsNumber(option.ColorID)) item.ColorID=option.ColorID;
61390
+
61391
+ this.MapSelectedData.set(key, item);
61392
+
61393
+ return true;
61394
+ }
61395
+
61396
+ this.RemoveSelected=function(dateTime)
61397
+ {
61398
+ if (!dateTime) return false;
61399
+ var key=this.BuildKey(dateTime);
61400
+ if (!key) return false;
61401
+ return this.MapSelectedData.delete(key);
61402
+ }
61403
+
61404
+ this.ClearAll=function()
61405
+ {
61406
+ this.MapSelectedData.clear();
61407
+ }
61408
+
61409
+ this.BuildKey=function(item)
61410
+ {
61411
+ if (IFrameSplitOperator.IsNumber(item.Time)) return `${item.Date}-${item.Time}`;
61412
+ else if (IFrameSplitOperator.IsNumber(item.Date)) return `${item.Date}`;
61413
+ else return null;
61414
+ }
61415
+
61416
+ this.Draw=function()
61417
+ {
61418
+ if (this.MapSelectedData.size<=0) return;
61419
+ if (!this.HQChart) return;
61420
+ var hisData=this.HQChart.GetKData();
61421
+ if (!hisData || !IFrameSplitOperator.IsNonEmptyArray(hisData.Data)) return; //数据还没有到达
61422
+
61423
+ var mainFrame=this.HQChart.Frame.SubFrame[0].Frame;
61424
+ var bHScreen=(this.ChartFrame.IsHScreen===true);
61425
+ var dataWidth=mainFrame.DataWidth;
61426
+ var distanceWidth=mainFrame.DistanceWidth;
61427
+ var xPointCount=mainFrame.XPointCount;
61428
+
61429
+ if (bHScreen)
61430
+ {
61431
+ var border=this.ChartBorder.GetHScreenBorder();
61432
+ var chartright=border.BottomEx;
61433
+ var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
61434
+ var top=border.RightEx;
61435
+ var bottom=border.LeftEx;
61436
+ }
61437
+ else
61438
+ {
61439
+ var border=this.ChartBorder.GetBorder();
61440
+ var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
61441
+ var chartright=border.RightEx;
61442
+ var top=border.TopEx;
61443
+ var bottom=border.BottomEx;
61444
+ }
61445
+
61446
+ var aryData=[];
61447
+ this.Canvas.fillStyle="rgb(40,30,100)";
61448
+ for(var i=hisData.DataOffset,j=0;i<hisData.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
61449
+ {
61450
+ var item=hisData.Data[i];
61451
+ if (!item) continue;
61452
+
61453
+ var key=this.BuildKey(item);
61454
+ if (!key || !this.MapSelectedData.has(key)) continue;
61455
+
61456
+ var left=xOffset;
61457
+ var right=xOffset+dataWidth;
61458
+ if (right>chartright) break;
61459
+ var xCenter=left+(right-left)/2;
61460
+
61461
+ var xStart=left-distanceWidth/2;
61462
+ var xEnd=right+distanceWidth/2;
61463
+
61464
+ var selectedItem=this.MapSelectedData.get(key);
61465
+ var drawItem={ Data:selectedItem, Left:xStart, Right:xEnd, XCenter:xCenter };
61466
+
61467
+ if (bHScreen)
61468
+ {
61469
+ var rtItem={ Left:top, Right:bottom, Top:drawItem.Left, Bottom:drawItem.Right };
61470
+ rtItem.Width=rtItem.Right-rtItem.Left;
61471
+ rtItem.Height=rtItem.Bottom-rtItem.Top;
61472
+ if (rtItem.Heigh<1) rtItem.Height=1;
61473
+ }
61474
+ else
61475
+ {
61476
+ var rtItem={ Left:drawItem.Left, Right:drawItem.Right, Top:top, Bottom:bottom };
61477
+ rtItem.Width=rtItem.Right-rtItem.Left;
61478
+ rtItem.Height=rtItem.Bottom-rtItem.Top;
61479
+ if (rtItem.Width<1) rtItem.Width=1;
61480
+ }
61481
+
61482
+ var color=this.BGColor;
61483
+ if (selectedItem.BGColor) color=selectedItem.BGColor;
61484
+ else if (IFrameSplitOperator.IsNumber(selectedItem.ColorID))
61485
+ {
61486
+ if (selectedItem.ColorID>=0 && selectedItem.ColorID<this.AryColor.length)
61487
+ color=this.AryColor[selectedItem.ColorID];
61488
+ }
61489
+
61490
+ this.Canvas.fillStyle=color;
61491
+
61492
+ this.Canvas.fillRect(ToFixedRect(rtItem.Left), ToFixedRect(rtItem.Top), ToFixedRect(rtItem.Width), ToFixedRect(rtItem.Height));
61493
+ }
61494
+ }
61495
+ }
61496
+
61343
61497
  //窗口底部工具栏
61344
61498
  function FrameButtomToolbarPaint()
61345
61499
  {
@@ -86511,6 +86665,12 @@ function JSChartResource()
86511
86665
  Down:{ BGColor:"rgb(25,158,0)", PriceColor:"rgb(250,250,250)", TimeColor:"rgb(190,190,190)" },
86512
86666
  }
86513
86667
 
86668
+ this.KLineSelectedPaint=
86669
+ {
86670
+ BGColor:"rgb(255,222,173)",
86671
+ AryColor:["rgb(255,182,193)", "rgb(255,222,173)", "rgb(255,255,224)", "rgb(173,216,230)", "rgb(221,160,221)"],
86672
+ }
86673
+
86514
86674
 
86515
86675
  //成交明细
86516
86676
  this.DealList=
@@ -88076,6 +88236,7 @@ function JSChartResource()
88076
88236
 
88077
88237
  if (style.ChartDrawTVLongPosition) this.SetChartDrawTVLongPosition(style.ChartDrawTVLongPosition);
88078
88238
  if (style.KLineCountDownPaint) this.SetKLineCountDownPaint(style.KLineCountDownPaint);
88239
+ if (style.KLineSelectedPaint) this.SetKLineSelectedPaint(style.KLineSelectedPaint);
88079
88240
 
88080
88241
  if (style.SmallFloatTooltipV2) this.SetSmallFloatTooltipV2(style.SmallFloatTooltipV2);
88081
88242
  if (style.StockInfo) this.SetStockInfo(style.StockInfo);
@@ -88087,6 +88248,13 @@ function JSChartResource()
88087
88248
 
88088
88249
  }
88089
88250
 
88251
+ this.SetKLineSelectedPaint=function(style)
88252
+ {
88253
+ var dest=this.KLineSelectedPaint;
88254
+ if (style.BGColor) dest.BGColor=style.BGColor;
88255
+ if (IFrameSplitOperator.IsNonEmptyArray(style.AryColor)) dest.AryColor=style.AryColor.slice();
88256
+ }
88257
+
88090
88258
  this.SetCalendar=function(style)
88091
88259
  {
88092
88260
  var dest=this.Calendar;
@@ -144471,6 +144639,12 @@ function GetBlackStyle()
144471
144639
  Up:{ BGColor:"rgb(238,21,21)", PriceColor:"rgb(250,250,250)", TimeColor:"rgb(190,190,190)" },
144472
144640
  Down:{ BGColor:"rgb(25,158,0)", PriceColor:"rgb(250,250,250)", TimeColor:"rgb(190,190,190)" },
144473
144641
  },
144642
+
144643
+ KLineSelectedPaint:
144644
+ {
144645
+ BGColor:"rgb(100,149,237)",
144646
+ AryColor:["rgb(205,92,92)", "rgb(188,143,143)", "rgb(255,127,80)", "rgb(255,99,71)", "rgb(255,69,0)"],
144647
+ },
144474
144648
 
144475
144649
  //成交明细
144476
144650
  DealList:
@@ -170673,12 +170847,12 @@ function JSFloatTooltip()
170673
170847
 
170674
170848
  if (outItem.IsMergeCell) //合并单元格
170675
170849
  {
170676
- item.TitleTd.colspan=2;
170850
+ item.TitleTd.colSpan="2";
170677
170851
  item.TextTd.style.display="none";
170678
170852
  }
170679
170853
  else
170680
170854
  {
170681
- if (item.TitleTd.colspan!=1) item.TitleTd.colspan=1;
170855
+ if (item.TitleTd.colSpan!=1) item.TitleTd.colSpan=1;
170682
170856
  item.TextTd.style.display="";
170683
170857
  }
170684
170858
 
@@ -170885,7 +171059,7 @@ function JSFloatTooltip()
170885
171059
  //大宗交易
170886
171060
  this.FormatBlockTradingText=function(data, floatPrecision, aryOut)
170887
171061
  {
170888
- var item={ Title:"", Text:"大宗交易", Color:this.TextColor, ClassName:this.ValueAlign.Left };
171062
+ var item={ Title:"大宗交易", TitleColor:this.TextColor, IsMergeCell:true, TitleClassName:this.TitleAlign.Center };
170889
171063
  aryOut.push(item);
170890
171064
 
170891
171065
  var item={ Title:"日期",Text:IFrameSplitOperator.FormatDateString(data.Date,"YYYY-MM-DD"), Color:this.ValueColor };
@@ -170925,7 +171099,7 @@ function JSFloatTooltip()
170925
171099
  //龙虎榜
170926
171100
  this.FormatDragonTigerText=function(data, floatPrecision, aryOut)
170927
171101
  {
170928
- var item={ Title:"", Text:"龙虎榜", Color:this.TextColor, ClassName:this.ValueAlign.Left };
171102
+ var item={ Title:"龙虎榜", TitleColor:this.TextColor, IsMergeCell:true, TitleClassName:this.TitleAlign.Center };
170929
171103
  aryOut.push(item);
170930
171104
 
170931
171105
  var item={ Title:"日期",Text:IFrameSplitOperator.FormatDateString(data.Date,"YYYY-MM-DD"), Color:this.ValueColor};
@@ -170969,7 +171143,7 @@ function JSFloatTooltip()
170969
171143
  }
170970
171144
  else if (item.Type==2) //单行
170971
171145
  {
170972
- var outItem={ Title:"", Text:item.Name, Color:this.TextColor, ClassName:this.ValueAlign.Left };
171146
+ var outItem={ Title:item.Name, TitleColor:this.TextColor, IsMergeCell:true, TitleClassName:this.TitleAlign.Center };
170973
171147
  }
170974
171148
  else
170975
171149
  {
@@ -170983,7 +171157,7 @@ function JSFloatTooltip()
170983
171157
  //调研
170984
171158
  this.FormatResearchText=function(data,aryOut)
170985
171159
  {
170986
- var item={ Title:"", Text:"机构调研", Color:this.TextColor, ClassName:this.ValueAlign.Left };
171160
+ var item={ Title:"机构调研", TitleColor:this.TextColor, IsMergeCell:true, TitleClassName:this.TitleAlign.Center };
170987
171161
  aryOut.push(item);
170988
171162
 
170989
171163
  var item={ Title:"公告日期",Text:IFrameSplitOperator.FormatDateString(data.Date,"YYYY-MM-DD"), Color:this.ValueColor };
@@ -171584,12 +171758,12 @@ function JSSmallFloatTooltipV2()
171584
171758
 
171585
171759
  if (outItem.IsMergeCell) //合并单元格
171586
171760
  {
171587
- item.TitleTd.colspan=2;
171761
+ item.TitleTd.colSpan='2';
171588
171762
  item.TextTd.style.display="none";
171589
171763
  }
171590
171764
  else
171591
171765
  {
171592
- if (item.TitleTd.colspan!=1) item.TitleTd.colspan=1;
171766
+ if (item.TitleTd.colSpan!='1') item.TitleTd.colSpan='1';
171593
171767
  item.TextTd.style.display="";
171594
171768
  }
171595
171769
 
@@ -171790,12 +171964,23 @@ function JSDialogSelectRect()
171790
171964
 
171791
171965
  this.RestoreFocusDelay=800;
171792
171966
 
171967
+ //计算公式配置
171968
+ // Increase=涨幅 0=(收-昨收)/昨收 1=(收-今开)/今开 2=(区间末尾收盘价 − 区间起始收盘价) ÷ 区间起始收盘价
171969
+ // Amplitude=振幅 0= (当日最高价 − 当日最低价) ÷ 昨日收盘价 1=(当日最高价 − 当日最低价) ÷ 今开价 2=(区间内最高价 − 区间内最低价) ÷ 区间起始 K 收盘价
171970
+ this.FormualConfig={ Increase:0, Amplitude:0 };
171971
+
171972
+
171793
171973
  this.Inital=function(hqchart, option)
171794
171974
  {
171795
171975
  this.HQChart=hqchart;
171796
171976
  if (option)
171797
171977
  {
171798
-
171978
+ if (option.Formual)
171979
+ {
171980
+ var item=option.Formual;
171981
+ if (IFrameSplitOperator.IsNumber(item.Increase)) this.FormualConfig.Increase=item.Increase;
171982
+ if (IFrameSplitOperator.IsNumber(item.Amplitude)) this.FormualConfig.Amplitude=item.Amplitude;
171983
+ }
171799
171984
  }
171800
171985
  }
171801
171986
 
@@ -172281,7 +172466,9 @@ function JSDialogSelectRect()
172281
172466
  {
172282
172467
  var showData=
172283
172468
  {
172284
- Open:null,Close:null,High:null,Low:null, YClose:null,
172469
+ Open:null, Close:null, High:null, Low:null,
172470
+ YClose:null, //起始K昨价
172471
+ StartClose:null, //起始K收盘价
172285
172472
  Vol:0, Amount:0,
172286
172473
  Date:
172287
172474
  {
@@ -172350,11 +172537,55 @@ function JSDialogSelectRect()
172350
172537
  showData.Date.End.Time=item.Time;
172351
172538
  if (!IFrameSplitOperator.IsNumber(showData.Date.Start.Time)) showData.Date.Start.Time=item.Time;
172352
172539
  }
172540
+
172541
+ if (i==start)
172542
+ {
172543
+ if (IFrameSplitOperator.IsNumber(item.YClose)) showData.YClose=item.YClose;
172544
+ if (IFrameSplitOperator.IsNumber(item.Close)) showData.StartClose=item.Close;
172545
+ }
172353
172546
  }
172354
172547
 
172355
172548
  return showData;
172356
172549
  }
172357
172550
 
172551
+ this.FormatKLineIncrease=function(showData)
172552
+ {
172553
+ var value=null;
172554
+ switch(this.FormualConfig.Increase)
172555
+ {
172556
+ case 1:
172557
+ value=showData.Open;
172558
+ break;
172559
+ case 2:
172560
+ value=showData.StartClose;
172561
+ break;
172562
+ default:
172563
+ value=showData.YClose;
172564
+ break;
172565
+ }
172566
+
172567
+ return this.FormatIncrease(showData.Close, value, 'DialogSelectRect-Increase')
172568
+ }
172569
+
172570
+ this.FormatKLineAmplitude=function(showData)
172571
+ {
172572
+ var value=null;
172573
+ switch(this.FormualConfig.Increase)
172574
+ {
172575
+ case 1:
172576
+ value=showData.Open;
172577
+ break;
172578
+ case 2:
172579
+ value=showData.StartClose;
172580
+ break;
172581
+ default:
172582
+ value=showData.YClose;
172583
+ break;
172584
+ }
172585
+
172586
+ return this.FormatAmplitude(showData.High, showData.Low, value, 'DialogSelectRect-Amplitude')
172587
+ }
172588
+
172358
172589
  //格式化K线数据
172359
172590
  this.FormatKLineText=function(showData)
172360
172591
  {
@@ -172380,11 +172611,11 @@ function JSDialogSelectRect()
172380
172611
 
172381
172612
  showData.AryText.push(this.ForamtPrice(showData.Open, showData.Open,defaultfloatPrecision, 'DialogSelectRect-StartPrice'));
172382
172613
  showData.AryText.push(this.ForamtPrice(showData.Close, showData.Open,defaultfloatPrecision, 'DialogSelectRect-EndPrice'));
172383
- showData.AryText.push(this.FormatIncrease(showData.Close, showData.Open, 'DialogSelectRect-Increase'));
172614
+ showData.AryText.push(this.FormatKLineIncrease(showData));
172384
172615
 
172385
172616
  showData.AryText.push(this.ForamtPrice(showData.High, showData.Open,defaultfloatPrecision, 'DialogSelectRect-High'));
172386
172617
  showData.AryText.push(this.ForamtPrice(showData.Low, showData.Open,defaultfloatPrecision, 'DialogSelectRect-Low'));
172387
- showData.AryText.push(this.FormatAmplitude(showData.High, showData.Low, showData.Open, 'DialogSelectRect-Amplitude'));
172618
+ showData.AryText.push(this.FormatKLineAmplitude(showData));
172388
172619
 
172389
172620
  showData.AryText.push(this.FormatVol(showData.Vol, 'DialogSelectRect-Vol'));
172390
172621
  showData.AryText.push(this.FormatAmount(showData.Amount, 'DialogSelectRect-Amount'));
@@ -182919,7 +183150,7 @@ class ChartCalendar
182919
183150
 
182920
183151
 
182921
183152
 
182922
- var HQCHART_VERSION="1.1.15911";
183153
+ var HQCHART_VERSION="1.1.15920";
182923
183154
 
182924
183155
  function PrintHQChartVersion()
182925
183156
  {