hqchart 1.1.14962 → 1.1.14971

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.
@@ -4569,6 +4569,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4569
4569
  {
4570
4570
  var item=option.KeyboardMove;
4571
4571
  if (IFrameSplitOperator.IsPlusNumber(item.Delay)) chart.KeyboardMove.Delay=item.Delay;
4572
+ if (IFrameSplitOperator.IsPlusNumber(item.PressTime)) chart.KeyboardMove.PressTime=item.PressTime;
4572
4573
  }
4573
4574
 
4574
4575
  if (IFrameSplitOperator.IsNumber(option.StepPixel)) chart.StepPixel=option.StepPixel;
@@ -6971,7 +6972,9 @@ var JSCHART_EVENT_ID=
6971
6972
  ON_RELOAD_RESOURCE:173,
6972
6973
 
6973
6974
  ON_REPORT_DATA_FILTER:174, //数据筛选
6974
- ON_REPORT_SHOW_TOOLTIP:175, //报价列表 提示信息
6975
+ ON_REPORT_SHOW_TOOLTIP:175, //报价列表 提示信息\
6976
+
6977
+ ON_FORMAT_TVLONGPOSITION_LABEL:176,
6975
6978
  }
6976
6979
 
6977
6980
  var JSCHART_OPERATOR_ID=
@@ -7462,7 +7465,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7462
7465
  this.AryHotKey=[]; //热键 { KeyID:87, SecondKeyID:1, CMD:JSCHART_MENU_ID.CMD_FULLSCREEN_SUMMARY_ID, Args:null, Description:"Alt+W 全屏区间统计" },
7463
7466
 
7464
7467
  this.FastSlideConfig={ MinDistance:500, MinSpeed:3, MaxTime:250, Enable:false }; //快速滑动配置 MinDistance=最小的距离 MinSpeed=最小速度 MaxTime=最大间隔时间(ms)
7465
- this.KeyboardMove={ Timer:null, Delay:100 , Enable:false, Event:null }; //键盘左右移动
7468
+ this.KeyboardMove={ Timer:null, Delay:100 , PressTime:500, Enable:false, Event:null }; //键盘左右移动 PressTime=长按时间
7466
7469
 
7467
7470
  this.MapEventListenerCache=new Map(); //addEventListener 监听事件 key=type:"keydown|keyup ....", value:{ Callback:, Option: }
7468
7471
 
@@ -9134,9 +9137,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9134
9137
  {
9135
9138
  drawPicture.PointStatus=drawPicture.Status;
9136
9139
  if (this.FinishChartDrawPicturePoint())
9140
+ {
9141
+ if (drawPicture.IsDrawMain) this.Draw();
9137
9142
  this.DrawDynamicInfo();
9143
+ }
9138
9144
  else
9145
+ {
9139
9146
  bClearDrawPicture=false;
9147
+ }
9140
9148
  }
9141
9149
  else if (drawPicture.Status==20)
9142
9150
  {
@@ -10691,7 +10699,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10691
10699
  {
10692
10700
  var item=this.ChartDrawPicture[i];
10693
10701
  if (item.IsDrawFirst) continue;
10694
- if (item.IsDrawMain && item.IsDrawMain()) continue;
10702
+ if (item.IsDrawMain && item.IsDrawMain())
10703
+ {
10704
+ if (item.MainPartDraw) item.MainPartDraw();
10705
+ continue;
10706
+ }
10707
+
10695
10708
  if (this.SelectChartDrawPicture && this.SelectChartDrawPicture.Guid==item.Guid) continue; //当前选中在最后画
10696
10709
 
10697
10710
  item.Draw();
@@ -11255,7 +11268,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11255
11268
  {
11256
11269
  var item=this.ChartDrawPicture[i];
11257
11270
  if (item.IsDrawFirst) continue;
11258
- if (item.IsDrawMain && item.IsDrawMain()) continue;
11271
+ if (item.IsDrawMain && item.IsDrawMain())
11272
+ {
11273
+ if (item.MainPartDraw) item.MainPartDraw();
11274
+ continue;
11275
+ }
11259
11276
  if (this.SelectChartDrawPicture &&item.Guid==this.SelectChartDrawPicture.Guid) continue; //选中画图最后画 确保显示在最外面
11260
11277
 
11261
11278
  item.Draw(moveonPoint, this.LastMouseStatus);
@@ -12005,19 +12022,22 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12005
12022
 
12006
12023
  JSConsole.Chart.Log(`[JSChartContainer::StartKeyboardMoveTimer] Start` );
12007
12024
 
12008
- this.AutoKeyboardMove();
12025
+ this.AutoKeyboardMove({ Delay:this.KeyboardMove.PressTime });
12009
12026
  }
12010
12027
 
12011
- this.AutoKeyboardMove=function()
12028
+ this.AutoKeyboardMove=function(option)
12012
12029
  {
12013
12030
  if (!this.KeyboardMove) return false;
12014
12031
  if (!this.KeyboardMove.Enable) return false;
12015
12032
  if (!this.KeyboardMove.Event) return false;
12016
12033
 
12034
+ var delay=this.KeyboardMove.Delay;
12035
+ if (option && IFrameSplitOperator.IsNumber(option.Delay)) delay=option.Delay;
12036
+
12017
12037
  this.KeyboardMove.Timer=setTimeout(()=>
12018
12038
  {
12019
12039
  this.OnKeyboardMoveTimerProc();
12020
- },this.KeyboardMove.Delay);
12040
+ },delay);
12021
12041
  }
12022
12042
 
12023
12043
 
@@ -65906,13 +65926,24 @@ function DynamicChartTitlePainting()
65906
65926
 
65907
65927
 
65908
65928
  //动态标题
65909
- //动态标题
65929
+ //叠加指标动态标题
65910
65930
  this.DynamicTitle={ OutName:null, OutValue:null };
65911
65931
  this.OverlayDynamicTitle=new Map(); //key , value={ OutName, OutValue }
65912
65932
 
65913
65933
  this.IsShowMainIndexTitle=true; //是否显示主图指标标题
65914
65934
  this.MainTitlePaint=null; //主标题
65915
65935
 
65936
+ //option={ DynamicTitle:true/false }
65937
+ this.Clear=function(option)
65938
+ {
65939
+ this.Data=[];
65940
+ this.Title=null;
65941
+ if (option)
65942
+ {
65943
+ if (option.DynamicTitle===true) this.DynamicTitle={ OutName:null, OutValue:null }; //主图胴动态标题
65944
+ }
65945
+ }
65946
+
65916
65947
  //十字线是否显示
65917
65948
  this.IsShowCorssLine=function()
65918
65949
  {
@@ -69260,6 +69291,17 @@ function IChartDrawPicture()
69260
69291
  yText+=labelInfo.LineHeight;
69261
69292
  }
69262
69293
  }
69294
+
69295
+ this.IsActive=function()
69296
+ {
69297
+ if (!this.GetActiveDrawPicture) return false;
69298
+
69299
+ var active=this.GetActiveDrawPicture();
69300
+ if (active.Move.Guid!=this.Guid && active.Select.Guid!=this.Guid && active.MoveOn.Guid!=this.Guid)
69301
+ return false;
69302
+
69303
+ return true;
69304
+ }
69263
69305
  }
69264
69306
 
69265
69307
  IChartDrawPicture.ColorToRGBA=function(color,opacity)
@@ -69407,6 +69449,8 @@ IChartDrawPicture.ArrayDrawPricture=
69407
69449
  { Name:"TrendAngle", ClassName:"ChartTrendAngle", Create:function() { return new ChartTrendAngle(); }},
69408
69450
  { Name:"ArrowMarker", ClassName:"ChartArrowMarker", Create:function() { return new ChartArrowMarker(); } },
69409
69451
  { Name:"BarsPattern", ClassName:"ChartBarsPattern", Create:function() { return new ChartBarsPattern(); } },
69452
+ { Name:"TVLongPosition", ClassName:"ChartDrawTVLongPosition", Create:function() { return new ChartDrawTVLongPosition(); } },
69453
+ { Name:"TVShortPosition", ClassName:"ChartDrawTVShortPositionn", Create:function() { return new ChartDrawTVShortPosition(); } },
69410
69454
  ];
69411
69455
 
69412
69456
  IChartDrawPicture.MapIonFont=new Map(
@@ -79377,6 +79421,483 @@ function ChartBarsPattern()
79377
79421
  }
79378
79422
  }
79379
79423
 
79424
+ function ChartDrawTVLongPosition()
79425
+ {
79426
+ this.newMethod=IChartDrawPicture; //派生
79427
+ this.newMethod();
79428
+ delete this.newMethod;
79429
+
79430
+ this.ClassName='ChartDrawTVLongPosition';
79431
+ this.PointCount=2; //起始2个点 画完4个点
79432
+
79433
+ this.TopAreaConfig=CloneData(g_JSChartResource.ChartDrawTVLongPosition.TopArea);
79434
+ this.BottomAreaConfig=CloneData(g_JSChartResource.ChartDrawTVLongPosition.BottomArea);
79435
+ this.LabelConfig=CloneData(g_JSChartResource.ChartDrawTVLongPosition.Label);
79436
+
79437
+ //内部变量
79438
+ this.AryRectArea=[];
79439
+
79440
+ this.GetXYCoordinate=this.GetXYCoordinate_default;
79441
+ this.SetOption_Backup=this.SetOption;
79442
+ this.PointToValue_Backup=this.PointToValue;
79443
+
79444
+ this.SetOption=function(option)
79445
+ {
79446
+ this.SetOption_Backup();
79447
+
79448
+ if (option)
79449
+ {
79450
+
79451
+ }
79452
+ }
79453
+
79454
+ this.PointToValue=function()
79455
+ {
79456
+ //拖拽完成 把点移动到线段头尾
79457
+ if (this.Frame.IsHScreen)
79458
+ {
79459
+ this.Point[1].X=this.Point[0].X;
79460
+ }
79461
+ else
79462
+ {
79463
+ this.Point[1].Y=this.Point[0].Y;
79464
+ }
79465
+
79466
+ this.PointToValue_Backup();
79467
+ }
79468
+
79469
+ //0-10 鼠标对应的点索引 100=鼠标在正个图形上 -1 鼠标不在图形上
79470
+ this.IsPointIn=function(x,y, option)
79471
+ {
79472
+ if (this.Status!=10) return -1;
79473
+
79474
+ var value=this.IsPointInXYValue(x,y,option);
79475
+ if (value>=0) return value;
79476
+
79477
+ for(var i=0;i<this.AryRectArea.length;++i)
79478
+ {
79479
+ var item=this.AryRectArea[i];
79480
+ if (!item) continue;
79481
+
79482
+ if (Path2DHelper.PtInRect(x, y, item.Rect))
79483
+ {
79484
+ return item.ID;
79485
+ }
79486
+ }
79487
+
79488
+ return -1;
79489
+ }
79490
+
79491
+ this.OnFinish=function()
79492
+ {
79493
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Value)) return false;
79494
+
79495
+ if (!this.Frame) return false;
79496
+ var data=this.Frame.Data;
79497
+ if (!data) return false;
79498
+
79499
+ var firstPoint=this.Point[0];
79500
+ var firstValue=this.Value[0];
79501
+ var entryPrice=firstValue.YValue;
79502
+
79503
+ var topPrice=entryPrice*(1+0.05);
79504
+ var bottomPrice=entryPrice*(1-0.05);
79505
+
79506
+ this.Value[2]={ XValue:firstValue.XValue, YValue:topPrice };
79507
+ this.Value[3]={ XValue:firstValue.XValue, YValue:bottomPrice };
79508
+ if (firstValue.DateTime)
79509
+ {
79510
+ var item=firstValue.DateTime;
79511
+ this.Value[2].DateTime={ Date:item.Date, Time:item.Time };
79512
+ this.Value[3].DateTime={ Date:item.Date, Time:item.Time };
79513
+ }
79514
+
79515
+ this.Point[2]={ X:firstPoint.X, Y:this.Frame.GetYFromData(topPrice,false)};
79516
+ this.Point[3]={ X:firstPoint.X, Y:this.Frame.GetYFromData(bottomPrice,false)};
79517
+
79518
+ this.PointCount=4;
79519
+ }
79520
+
79521
+ this.IsDrawMain=function() //选中绘制在动态绘图上, 没有选中绘制在背景上
79522
+ {
79523
+ if (!this.GetActiveDrawPicture) return true;
79524
+
79525
+ var active=this.GetActiveDrawPicture();
79526
+ if (active.Select.Guid==this.Guid) return false;
79527
+
79528
+ return true;
79529
+ }
79530
+
79531
+ this.IsSelected=function()
79532
+ {
79533
+ if (!this.GetActiveDrawPicture) return false;
79534
+
79535
+ var active=this.GetActiveDrawPicture();
79536
+ if (active.Select.Guid==this.Guid) return true;
79537
+
79538
+ return false;
79539
+ }
79540
+
79541
+ this.MainDraw=function()
79542
+ {
79543
+ this.Draw();
79544
+ }
79545
+
79546
+
79547
+ this.MainPartDraw=function()
79548
+ {
79549
+ if (this.IsFrameMinSize()) return;
79550
+
79551
+ var drawPoint=this.CalculateDrawPoint( {IsCheckX:true, IsCheckY:true} );
79552
+ if (!drawPoint) return;
79553
+ if (drawPoint.length<2) return;
79554
+ this.IsHScreen=this.Frame.IsHScreen;
79555
+ if (this.IsHScreen) return;
79556
+
79557
+ this.ClipFrame();
79558
+ this.ChartBorder=this.Frame.ChartBorder;
79559
+
79560
+ if (this.Status==10 || this.Status==20)
79561
+ {
79562
+ this.DrawLabel(drawPoint);
79563
+ this.DrawPoint(drawPoint);
79564
+ }
79565
+
79566
+ this.Canvas.restore();
79567
+ }
79568
+
79569
+ this.Draw=function()
79570
+ {
79571
+ this.AryRectArea=[]
79572
+ if (this.IsFrameMinSize()) return;
79573
+
79574
+ var drawPoint=this.CalculateDrawPoint( {IsCheckX:true, IsCheckY:true} );
79575
+ if (!drawPoint) return;
79576
+ if (drawPoint.length<2) return;
79577
+ this.IsHScreen=this.Frame.IsHScreen;
79578
+ if (this.IsHScreen) return;
79579
+
79580
+ this.ClipFrame();
79581
+ this.ChartBorder=this.Frame.ChartBorder;
79582
+
79583
+ if (this.Status==10 || this.Status==20) //0=开始画 1=完成第1个点 2=完成第2个点 3=完成第3个点 10=完成 20=移动)
79584
+ {
79585
+ this.DrawArea(drawPoint);
79586
+ this.DrawLabel(drawPoint);
79587
+ this.DrawPoint(drawPoint);
79588
+ }
79589
+ else
79590
+ {
79591
+ var ptStart=drawPoint[0];
79592
+ var ptEnd=drawPoint[1];
79593
+ this.Canvas.strokeStyle=this.LineColor;
79594
+ this.DrawVerticalLine(ptStart,ptEnd);
79595
+ }
79596
+
79597
+ this.Canvas.restore();
79598
+ }
79599
+
79600
+ this.DrawVerticalLine=function(ptStart, ptEnd)
79601
+ {
79602
+ var data=this.Frame.Data;
79603
+ if (this.IsHScreen)
79604
+ {
79605
+ var left=this.ChartBorder.GetLeft();
79606
+ var right=this.ChartBorder.GetRight();
79607
+ var xValue=Math.round(this.Frame.GetXData(ptStart.Y,false))+data.DataOffset;
79608
+ if (xValue<0) xValue=0;
79609
+ else if (xValue>=data.Data.length) xValue=data.Data.length-1;
79610
+ var yStart=this.Frame.GetXFromIndex(xValue-data.DataOffset,false);
79611
+
79612
+ xValue=Math.round(this.Frame.GetXData(ptEnd.Y,false))+data.DataOffset;
79613
+ if (xValue<0) xValue=0;
79614
+ else if (xValue>=data.Data.length) xValue=data.Data.length-1;
79615
+ var yEnd=this.Frame.GetXFromIndex(xValue-data.DataOffset,false);
79616
+
79617
+ this.Canvas.beginPath();
79618
+ this.Canvas.moveTo(left,yStart);
79619
+ this.Canvas.lineTo(right,yStart);
79620
+
79621
+ this.Canvas.moveTo(left,yEnd);
79622
+ this.Canvas.lineTo(right,yEnd);
79623
+ this.Canvas.stroke();
79624
+
79625
+ this.Canvas.beginPath();
79626
+ this.Canvas.moveTo(ptStart.X,yStart);
79627
+ this.Canvas.lineTo(ptStart.X,yEnd);
79628
+ this.Canvas.stroke();
79629
+ }
79630
+ else
79631
+ {
79632
+ var top=this.ChartBorder.GetTopEx();
79633
+ var bottom=this.ChartBorder.GetBottomEx();
79634
+
79635
+ var xValue=Math.round(this.Frame.GetXData(ptStart.X,false))+data.DataOffset;
79636
+ if (xValue<0) xValue=0;
79637
+ else if (xValue>=data.Data.length) xValue=data.Data.length-1;
79638
+ var xStart=this.Frame.GetXFromIndex(xValue-data.DataOffset,false);
79639
+
79640
+ xValue=Math.round(this.Frame.GetXData(ptEnd.X,false))+data.DataOffset;
79641
+ if (xValue<0) xValue=0;
79642
+ else if (xValue>=data.Data.length) xValue=data.Data.length-1;
79643
+ var xEnd=this.Frame.GetXFromIndex(xValue-data.DataOffset,false);
79644
+
79645
+ this.Canvas.beginPath();
79646
+ this.Canvas.moveTo(xStart,top);
79647
+ this.Canvas.lineTo(xStart,bottom);
79648
+
79649
+ this.Canvas.moveTo(xEnd,top);
79650
+ this.Canvas.lineTo(xEnd,bottom);
79651
+ this.Canvas.stroke();
79652
+
79653
+ this.Canvas.beginPath();
79654
+ this.Canvas.moveTo(xStart,ptStart.Y);
79655
+ this.Canvas.lineTo(xEnd,ptStart.Y);
79656
+ this.Canvas.stroke();
79657
+ }
79658
+ }
79659
+
79660
+ this.GetCursorType=function(ptIndex)
79661
+ {
79662
+ if (ptIndex==100) return "pointer";
79663
+ else if (ptIndex==0) return "move";
79664
+ else if (ptIndex==1) return "ew-resize";
79665
+ else if (ptIndex==2 || ptIndex==3) return "ns-resize";
79666
+
79667
+ return null;
79668
+ }
79669
+
79670
+ this.DrawArea=function(drawPoint)
79671
+ {
79672
+ var ptCenter=drawPoint[0];
79673
+ var ptRight=drawPoint[1]
79674
+ var ptTop=drawPoint[2];
79675
+ var ptBottom=drawPoint[3];
79676
+ var bSelected=this.IsSelected();
79677
+
79678
+ var rtTopArea={ Left:ptCenter.X, Top: ptTop.Y, Right:ptRight.X, Bottom:ptCenter.Y};
79679
+ rtTopArea.Width=rtTopArea.Right-rtTopArea.Left;
79680
+ rtTopArea.Height=rtTopArea.Bottom-rtTopArea.Top;
79681
+
79682
+ this.Canvas.fillStyle=bSelected ? this.TopAreaConfig.SelectedAreaColor: this.TopAreaConfig.AreaColor;
79683
+ this.Canvas.beginPath();
79684
+ this.Canvas.fillRect(rtTopArea.Left,rtTopArea.Top,rtTopArea.Width,rtTopArea.Height);
79685
+ this.AryRectArea[0]={ ID:100, Rect:rtTopArea };
79686
+
79687
+ var rtBottomArea={Left:ptCenter.X, Top: ptCenter.Y, Right:ptRight.X, Bottom:ptBottom.Y};
79688
+ rtBottomArea.Width=rtBottomArea.Right-rtBottomArea.Left;
79689
+ rtBottomArea.Height=rtBottomArea.Bottom-rtBottomArea.Top;
79690
+ this.Canvas.fillStyle=bSelected? this.BottomAreaConfig.SelectedAreaColor:this.BottomAreaConfig.AreaColor;
79691
+ this.Canvas.beginPath();
79692
+ this.Canvas.fillRect(rtBottomArea.Left,rtBottomArea.Top,rtBottomArea.Width,rtBottomArea.Height);
79693
+ this.AryRectArea[1]={ ID:100, Rect:rtBottomArea };
79694
+
79695
+ //线段
79696
+ this.Canvas.strokeStyle=this.LineColor;
79697
+ this.Canvas.beginPath();
79698
+ this.Canvas.moveTo(ptCenter.X,ToFixedPoint(ptCenter.Y));
79699
+ this.Canvas.lineTo(ptRight.X,ToFixedPoint(ptRight.Y));
79700
+ this.Canvas.stroke();
79701
+ }
79702
+
79703
+ this.DrawLabel=function(drawPoint)
79704
+ {
79705
+ if (!this.IsActive()) return; //激活状态下才显示
79706
+
79707
+ var aryLabel=this.FormatLabelText(drawPoint);
79708
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryLabel)) return;
79709
+
79710
+ this.TextFontHeight=this.GetFontHeight(this.LabelConfig.Font,"擎");
79711
+
79712
+ for(var i=0;i<aryLabel.length;++i)
79713
+ {
79714
+ var item=aryLabel[i];
79715
+ if (!IFrameSplitOperator.IsNonEmptyArray(item.AryText)) continue;
79716
+
79717
+ this.CalculateLabelSize(item);
79718
+ this.DrawLabelItem(item, drawPoint);
79719
+ }
79720
+ }
79721
+
79722
+ this.DrawLabelItem=function(lableItem, drawPoint)
79723
+ {
79724
+ var ptCenter=drawPoint[0];
79725
+ var ptRight=drawPoint[1];
79726
+ var ptTop=drawPoint[2];
79727
+ var ptBottom=drawPoint[3];
79728
+ var clientWidth=ptRight.X-ptCenter.X;
79729
+ var config=this.LabelConfig;
79730
+ var margin=config.Margin;
79731
+
79732
+ var rtText={ Width:lableItem.Width+margin.Left+margin.Right, Height:lableItem.Height+margin.Top+margin.Bottom };
79733
+ if (lableItem.Type==0) //中间
79734
+ {
79735
+ rtText.Left=ptCenter.X+clientWidth/2-rtText.Width/2;
79736
+ rtText.Right=rtText.Left+rtText.Width;
79737
+ rtText.Top=ptCenter.Y-rtText.Height/2;
79738
+ rtText.Bottom=rtText.Top+rtText.Height;
79739
+ }
79740
+ else if (lableItem.Type==1) //顶部
79741
+ {
79742
+ rtText.Left=ptCenter.X+clientWidth/2-rtText.Width/2;
79743
+ rtText.Right=rtText.Left+rtText.Width;
79744
+ rtText.Top=ptTop.Y-rtText.Height;
79745
+ rtText.Bottom=rtText.Top+rtText.Height;
79746
+ }
79747
+ else if (lableItem.Type==2)
79748
+ {
79749
+ rtText.Left=ptCenter.X+clientWidth/2-rtText.Width/2;
79750
+ rtText.Right=rtText.Left+rtText.Width;
79751
+ rtText.Top=ptBottom.Y;
79752
+ rtText.Bottom=rtText.Top+rtText.Height;
79753
+ }
79754
+ else
79755
+ {
79756
+ return;
79757
+ }
79758
+
79759
+ this.Canvas.fillStyle=lableItem.BGColor;
79760
+ this.Canvas.fillRect(rtText.Left, rtText.Top, rtText.Width, rtText.Height);
79761
+
79762
+ this.Canvas.textAlign = 'left';
79763
+ this.Canvas.textBaseline = 'bottom';
79764
+ this.Canvas.fillStyle=lableItem.TextColor;
79765
+ var x=rtText.Left+margin.Left;
79766
+ var y=rtText.Top+margin.Top+this.TextFontHeight;
79767
+ for(var i=0;i<lableItem.AryText.length;++i)
79768
+ {
79769
+ var item=lableItem.AryText[i];
79770
+ var xText=x;
79771
+ var yText=y;
79772
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) yText+=item.YOffset;
79773
+
79774
+ this.Canvas.fillText(item.Text, xText, yText);
79775
+
79776
+ y+=this.TextFontHeight;
79777
+ }
79778
+ }
79779
+
79780
+ this.FormatLabelText=function(drawPoint)
79781
+ {
79782
+ if (this.HQChart)
79783
+ {
79784
+ var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_TVLONGPOSITION_LABEL);
79785
+ if (event && event.Callback)
79786
+ {
79787
+ var sendData={ Frame:this.Frame, AryLabel:null, AryPoint:drawPoint, PreventDefault:false };
79788
+ event.Callback(event, sendData, this);
79789
+ if (sendData.PreventDefault) return sendData.AryLabel;
79790
+ }
79791
+ }
79792
+
79793
+ var ptCenter=drawPoint[0];
79794
+ var ptTop=drawPoint[2];
79795
+ var ptBottom=drawPoint[3];
79796
+ var aryData=[];
79797
+ var yValue=this.Frame.GetYData(ptCenter.Y,false);
79798
+ aryData.push(
79799
+ {
79800
+ Type:0,
79801
+ AryText:
79802
+ [
79803
+ { Text:`Open: ${yValue.toFixed(2)}`},
79804
+ //{ Text:"第2行:xxx"}
79805
+ ],
79806
+ BGColor:"rgb(112,128,144)", TextColor:"rgb(255,255,255)"
79807
+ });
79808
+
79809
+ var yValue=this.Frame.GetYData(ptTop.Y,false);
79810
+ aryData.push({ Type:1, AryText:[{ Text:`Target: ${yValue.toFixed(2)}`, YOffset:-1 } ], BGColor:this.TopAreaConfig.TextBGColor, TextColor:this.TopAreaConfig.TextColor });
79811
+
79812
+ var yValue=this.Frame.GetYData(ptBottom.Y,false);
79813
+ aryData.push({ Type:2, AryText:[{ Text:`Stop: ${yValue.toFixed(2)}`, YOffset:-1 } ], BGColor:this.BottomAreaConfig.TextBGColor, TextColor:this.BottomAreaConfig.TextColor });
79814
+
79815
+ return aryData;
79816
+ }
79817
+
79818
+ this.CalculateLabelSize=function(lableItem)
79819
+ {
79820
+ lableItem.Width=0;
79821
+ lableItem.Height=0;
79822
+ for(var i=0;i<lableItem.AryText.length;++i)
79823
+ {
79824
+ var item=lableItem.AryText[i];
79825
+ var textWidth=this.Canvas.measureText(item.Text).width;
79826
+
79827
+ item.TextWidth=textWidth;
79828
+ if (lableItem.Width<textWidth) lableItem.Width=textWidth;
79829
+ lableItem.Height+=this.TextFontHeight;
79830
+ }
79831
+ }
79832
+
79833
+ this.Move=function(xStep,yStep)
79834
+ {
79835
+ if (this.Status!=20) return false;
79836
+ if (!this.Frame) return false;
79837
+ var data=this.Frame.Data;
79838
+ if (!data) return false;
79839
+
79840
+ if (this.MovePointIndex==100) //整体移动
79841
+ {
79842
+ for(var i=0; i<this.Point.length;++i)
79843
+ {
79844
+ var item= this.Point[i];
79845
+ item.X+=xStep;
79846
+ item.Y+=yStep;
79847
+ }
79848
+ }
79849
+ else if (this.MovePointIndex===0)
79850
+ {
79851
+ for(var i=0;i<this.Point.length;++i)
79852
+ {
79853
+ var item=this.Point[i];
79854
+ if (i==0)
79855
+ {
79856
+ item.X+=xStep;
79857
+ item.Y+=yStep;
79858
+ }
79859
+ else if (i==1)
79860
+ {
79861
+ item.Y+=yStep;
79862
+ }
79863
+ else if (i==2 || i==3)
79864
+ {
79865
+ item.X+=xStep;
79866
+ }
79867
+ }
79868
+ }
79869
+ else if (this.MovePointIndex==1)
79870
+ {
79871
+ this.Point[1].X+=xStep;
79872
+ }
79873
+ else if (this.MovePointIndex==2)
79874
+ {
79875
+ var ptCenter=this.Point[0];
79876
+ var item=this.Point[2];
79877
+ if (item.Y+yStep<ptCenter.Y) item.Y+=yStep;
79878
+ }
79879
+ else if (this.MovePointIndex==3)
79880
+ {
79881
+ var ptCenter=this.Point[0];
79882
+ var item=this.Point[3];
79883
+ if (item.Y+yStep>ptCenter.Y) item.Y+=yStep;
79884
+ }
79885
+
79886
+ }
79887
+ }
79888
+
79889
+
79890
+ function ChartDrawTVShortPosition()
79891
+ {
79892
+ this.newMethod=ChartDrawTVLongPosition; //派生
79893
+ this.newMethod();
79894
+ delete this.newMethod;
79895
+
79896
+ this.ClassName='ChartDrawTVShortPosition';
79897
+ this.TopAreaConfig=CloneData(g_JSChartResource.ChartDrawTVLongPosition.BottomArea);
79898
+ this.BottomAreaConfig=CloneData(g_JSChartResource.ChartDrawTVLongPosition.TopArea);
79899
+ }
79900
+
79380
79901
 
79381
79902
  function ChartDrawStorage()
79382
79903
  {
@@ -80446,6 +80967,31 @@ function JSChartResource()
80446
80967
  DownColor:"rgb(25,158,0)"
80447
80968
  }
80448
80969
 
80970
+ this.ChartDrawTVLongPosition=
80971
+ {
80972
+ TopArea:
80973
+ {
80974
+ AreaColor:"rgba(214, 234, 230,0.8)",
80975
+ SelectedAreaColor:"rgba(214, 234, 230,0.55)",
80976
+ TextBGColor:"rgb(80, 150, 130)",
80977
+ TextColor:"rgb(255,255,255)"
80978
+ },
80979
+
80980
+ BottomArea:
80981
+ {
80982
+ AreaColor:"rgb(243, 217, 218,0.8)",
80983
+ SelectedAreaColor:"rgba(243, 217, 218,0.55)",
80984
+ TextBGColor:"rgb(214, 75, 75)",
80985
+ TextColor:"rgb(255,255,255)"
80986
+ },
80987
+
80988
+ Label:
80989
+ {
80990
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
80991
+ Margin:{ Left:2, Top:2, Bottom:2, Right:2 },
80992
+ }
80993
+ }
80994
+
80449
80995
  //手机端tooltip
80450
80996
  this.TooltipPaint = {
80451
80997
  BGColor:'rgba(250,250,250,0.8)', //背景色
@@ -82273,6 +82819,42 @@ function JSChartResource()
82273
82819
 
82274
82820
  if (style.IndexLock) this.SetIndexLock(style.IndexLock);
82275
82821
  if (style.ChartScatterPlotV2) this.SetChartScatterPlotV2(style.ChartScatterPlotV2);
82822
+
82823
+ if (style.ChartDrawTVLongPosition) this.SetChartDrawTVLongPosition(style.ChartDrawTVLongPosition);
82824
+ }
82825
+
82826
+
82827
+ this.SetChartDrawTVLongPosition=function(style)
82828
+ {
82829
+ if (style.TopArea)
82830
+ {
82831
+ var item=style.TopArea;
82832
+ var dest=this.ChartDrawTVLongPosition.TopArea;
82833
+
82834
+ if (item.AreaColor) dest.AreaColor=item.AreaColor;
82835
+ if (item.SelectedAreaColor) dest.SelectedAreaColor=item.SelectedAreaColor;
82836
+ if (item.TextBGColor) dest.TextBGColor=item.TextBGColor;
82837
+ if (item.TextColor) dest.BorderColor=item.TextColor;
82838
+ }
82839
+
82840
+ if (style.BottomArea)
82841
+ {
82842
+ var item=style.BottomArea;
82843
+ var dest=this.ChartDrawTVLongPosition.BottomArea;
82844
+
82845
+ if (item.AreaColor) dest.AreaColor=item.AreaColor;
82846
+ if (item.SelectedAreaColor) dest.SelectedAreaColor=item.SelectedAreaColor;
82847
+ if (item.TextBGColor) dest.TextBGColor=item.TextBGColor;
82848
+ if (item.TextColor) dest.BorderColor=item.TextColor;
82849
+ }
82850
+
82851
+ if (style.Label)
82852
+ {
82853
+ var item=style.Label;
82854
+ var dest=this.ChartDrawTVLongPosition.Label;
82855
+ if (item.Font) dest.Font=item.Font;
82856
+ CopyMarginConfig(dest.Margin, item.Margin);
82857
+ }
82276
82858
  }
82277
82859
 
82278
82860
 
@@ -88077,8 +88659,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
88077
88659
 
88078
88660
  //清空东条标题
88079
88661
  var titleIndex=windowIndex+1;
88080
- this.TitlePaint[titleIndex].Data=[];
88081
- this.TitlePaint[titleIndex].Title=null;
88662
+ var chartTitle=this.TitlePaint[titleIndex];
88663
+ if (chartTitle) chartTitle.Clear({ DynamicTitle:true });
88082
88664
  }
88083
88665
 
88084
88666
  //显示隐藏主图K线
@@ -88341,6 +88923,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
88341
88923
  if (windowIndex == 0) windowIndex = 1; //幅图指标,不能再主图显示
88342
88924
  }
88343
88925
 
88926
+ if (this.Frame.SubFrame.length<=windowIndex) return;
88927
+
88344
88928
  JSIndexScript.ModifyAttribute(indexInfo, option);
88345
88929
  return this.ChangeScriptIndex(windowIndex, indexInfo, option);
88346
88930
  }
@@ -88373,8 +88957,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
88373
88957
 
88374
88958
  //清空东条标题
88375
88959
  var titleIndex=windowIndex+1;
88376
- this.TitlePaint[titleIndex].Data=[];
88377
- this.TitlePaint[titleIndex].Title=null;
88960
+ var chartTitle=this.TitlePaint[titleIndex];
88961
+ chartTitle.Clear({ DynamicTitle:true });
88378
88962
 
88379
88963
  this.WindowIndex[windowIndex]=indexItem.Create(option);
88380
88964
  this.CreateWindowIndex(windowIndex);
@@ -90027,7 +90611,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
90027
90611
  if (item)
90028
90612
  {
90029
90613
  drawPicture=item.Create();
90030
- if (drawPicture.ClassName=='ChartDrawPictureText' || drawPicture.ClassName=="ChartDrawVolProfile") drawPicture.HQChart=this;
90614
+ drawPicture.HQChart=this;
90031
90615
  }
90032
90616
 
90033
90617
  if (!drawPicture) //iconfont图标
@@ -107990,6 +108574,15 @@ Path2DHelper.FormatRadian=function(angle)
107990
108574
  }
107991
108575
 
107992
108576
 
108577
+ Path2DHelper.PtInRect=function(x, y, rect)
108578
+ {
108579
+ if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom) return true;
108580
+
108581
+ return false;
108582
+ }
108583
+
108584
+
108585
+
107993
108586
 
107994
108587
 
107995
108588
 
@@ -135377,6 +135970,31 @@ function GetBlackStyle()
135377
135970
 
135378
135971
  Text:{ Color: "rgb(0,0,0)" , Family:'Arial', FontMaxSize:18, FontMinSize:6 }, //文字
135379
135972
  },
135973
+
135974
+ ChartDrawTVLongPosition:
135975
+ {
135976
+ TopArea:
135977
+ {
135978
+ AreaColor:"rgba(34, 52, 48,0.8)",
135979
+ SelectedAreaColor:"rgba(34, 52, 48,0.55)",
135980
+ TextBGColor:"rgb(80, 150, 130)",
135981
+ TextColor:"rgb(255,255,255)"
135982
+ },
135983
+
135984
+ BottomArea:
135985
+ {
135986
+ AreaColor:"rgb(63, 35, 37,0.8)",
135987
+ SelectedAreaColor:"rgba(63, 35, 37,0.55)",
135988
+ TextBGColor:"rgb(214, 75, 75)",
135989
+ TextColor:"rgb(255,255,255)"
135990
+ },
135991
+
135992
+ Label:
135993
+ {
135994
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
135995
+ Margin:{ Left:2, Top:2, Bottom:2, Right:2 },
135996
+ }
135997
+ },
135380
135998
 
135381
135999
  //区间选择
135382
136000
  RectSelect:
@@ -155303,6 +155921,9 @@ function JSDialogDrawTool()
155303
155921
  { Title: "线形回归线", ClassName:'hqchart_drawtool icon-linear_3', Type:0, Data:{ ID:"线形回归线" } },
155304
155922
  { Title: "线形回归带", ClassName:'hqchart_drawtool icon-linear_1', Type:0, Data:{ ID:"线形回归带" } },
155305
155923
  { Title: "延长线形回归带", ClassName:'hqchart_drawtool icon-linear_2', Type:0, Data:{ ID:"延长线形回归带" } },
155924
+
155925
+ { Title: "Long Position", ClassName:'hqchart_drawtool icon-chart-long-position', Type:0, Data:{ ID:"TVLongPosition" } },
155926
+ { Title: "Short Position", ClassName:'hqchart_drawtool icon-chart-short-position', Type:0, Data:{ ID:"TVShortPosition" } },
155306
155927
  ]
155307
155928
  },
155308
155929
  {
@@ -162901,7 +163522,7 @@ function HQChartScriptWorker()
162901
163522
 
162902
163523
 
162903
163524
 
162904
- var HQCHART_VERSION="1.1.14961";
163525
+ var HQCHART_VERSION="1.1.14970";
162905
163526
 
162906
163527
  function PrintHQChartVersion()
162907
163528
  {