hqchart 1.1.14718 → 1.1.14722

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.
@@ -60039,7 +60039,7 @@ function ChartCorssCursor()
60039
60039
  Enable:false, Rect:null,
60040
60040
  BGColor:g_JSChartResource.CorssCursor.RightButton.BGColor ,
60041
60041
  PenColor:g_JSChartResource.CorssCursor.RightButton.PenColor,
60042
- Icon:g_JSChartResource.CorssCursor.RightButton.Icon
60042
+ Icon:CloneData(g_JSChartResource.CorssCursor.RightButton.Icon)
60043
60043
  };
60044
60044
 
60045
60045
  //底部按钮
@@ -60048,9 +60048,11 @@ function ChartCorssCursor()
60048
60048
  Enable:false, Rect:null,
60049
60049
  }
60050
60050
 
60051
- this.RightMargin=CloneData(g_JSChartResource.CorssCursor.RightMargin);
60052
- this.BottomConfig=CloneData(g_JSChartResource.CorssCursor.BottomText); //底部输出配置
60053
- this.LeftConfig=CloneData(g_JSChartResource.CorssCursor.LeftText);
60051
+ this.BottomConfig=CloneData(g_JSChartResource.CorssCursor.BottomText); //底部输出配置
60052
+ this.LeftConfig=CloneData(g_JSChartResource.CorssCursor.LeftText); //左侧输出配置
60053
+ this.RightConfig=CloneData(g_JSChartResource.CorssCursor.RightText); //右侧输出配置
60054
+ this.RightOverlayConfig=CloneData(g_JSChartResource.CorssCursor.RightOverlayText); //右侧叠加指标输出配置
60055
+
60054
60056
 
60055
60057
  //内部使用
60056
60058
  this.Close=null; //收盘价格
@@ -60068,6 +60070,10 @@ function ChartCorssCursor()
60068
60070
  this.XRangeBGColor=g_JSChartResource.CorssCursorXRangeBGColor;
60069
60071
  this.LineDash=g_JSChartResource.CorssCursorLineDash.slice(); //虚线
60070
60072
 
60073
+ this.RightButton.BGColor=g_JSChartResource.CorssCursor.RightButton.BGColor;
60074
+ this.RightButton.PenColor=g_JSChartResource.CorssCursor.RightButton.PenColor;
60075
+ this.RightButton.Icon=CloneData(g_JSChartResource.CorssCursor.RightButton.Icon);
60076
+ this.RightOverlayConfig=CloneData(g_JSChartResource.CorssCursor.RightOverlayText);
60071
60077
 
60072
60078
  this.CorssPointConfig.Center=CloneData(g_JSChartResource.CorssCursor.CorssPoint.Center);
60073
60079
  this.CorssPointConfig.Border=CloneData(g_JSChartResource.CorssCursor.CorssPoint.Border);
@@ -60473,7 +60479,7 @@ function ChartCorssCursor()
60473
60479
  {
60474
60480
  ShowType:0, //0=单行(默认) 1=多行
60475
60481
  Font:this.Font, Color:this.TextColor,
60476
- Text:[ { Text:text, Margin:this.RightMargin } ],
60482
+ Text:[ { Text:text, Margin:this.RightConfig.Margin, TextOffset:this.RightConfig.TextOffset } ],
60477
60483
  };
60478
60484
 
60479
60485
  var yTop=y-this.TextHeight/2;
@@ -60532,74 +60538,73 @@ function ChartCorssCursor()
60532
60538
  //叠加坐标
60533
60539
  if (isOverlayIndex && textSize.Width>overlayIndexInterval && overlayIndexInterval>0) //大于子坐标宽度
60534
60540
  {
60541
+ var rtBG={ Right:right+overlayIndexInterval, Width:textSize.Width, YCenter:y, Height:textSize.Height };
60542
+ rtBG.Left=rtBG.Right-rtBG.Width;
60543
+ if (complexText.ShowType==1)
60544
+ {
60545
+ rtBG.Top=rtBG.YCenter-this.TextHeight/2;
60546
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60547
+ }
60548
+ else
60549
+ {
60550
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60551
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60552
+ }
60553
+
60554
+ if (rtBG.Right>chartRight)
60555
+ {
60556
+ rtBG.Right=chartRight;
60557
+ rtBG.Left=rtBG.Right-rtBG.Width;
60558
+ }
60559
+
60535
60560
  var drawRight=right+overlayIndexInterval;
60536
60561
  if (drawRight>chartRight) drawRight=chartRight;
60537
60562
 
60538
- var itemLeft=drawRight-2-textSize.Width;
60539
- this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
60540
- this.DrawComplexTextV2(itemLeft, yTop, complexText, textSize);
60563
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
60564
+ this.DrawComplexRightText(rtBG,complexText,textSize);
60541
60565
 
60542
- if (this.RightButton.Enable) this.DrawRightButton(yTop, itemLeft,this.TextHeight,this.TextHeight,buttonData);
60543
- }
60544
- else if (rightWidth<textSize.Width) //右边空白显示不下,
60545
- {
60546
- var itemLeft=chartRight-2-textSize.Width;
60547
- this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
60548
- this.DrawComplexTextV2(itemLeft, yTop ,complexText, textSize);
60549
-
60550
- if (this.RightButton.Enable) this.DrawRightButton(yTop, chartRight-2-textSize.Width,this.TextHeight,this.TextHeight,buttonData);
60566
+ if (this.RightButton.Enable) this.DrawRightButtonV2(rtBG, complexText, textSize, buttonData);
60551
60567
  }
60552
60568
  else
60553
60569
  {
60554
- var itemLeft=right+2;
60555
- this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
60556
- this.DrawComplexTextV2(itemLeft,yTop,complexText,textSize);
60557
-
60558
- if (this.RightButton.Enable) this.DrawRightButton(yTop, right+2,this.TextHeight,this.TextHeight,buttonData);
60559
- }
60560
-
60561
- /*
60562
- if (this.StringFormatY.RExtendText && this.StringFormatY.RExtendText.length>0)
60563
- {
60564
- var yOffset=0;
60565
- for(var i in this.StringFormatY.RExtendText)
60570
+ var rtBG={ Left:right+1, Width:textSize.Width, YCenter:y, Height:textSize.Height };
60571
+ rtBG.Right=rtBG.Left+rtBG.Width;
60572
+ if (complexText.ShowType==1)
60566
60573
  {
60567
- var item=this.StringFormatY.RExtendText[i];
60568
- var rText='--.--'
60569
- if (item.YText) rText=item.YText;
60570
- else if (IFrameSplitOperator.IsNumber(item.Y)) rText=item.Y.toFixed(0);
60571
- var rTextWidth=this.Canvas.measureText(rText).width+4; //前后各空2个像素
60572
-
60573
- if (rightWidth<rTextWidth)
60574
- {
60575
- this.DrawTextBGRect(chartRight-2-rTextWidth,y+yOffset+this.TextHeight/2,rTextWidth,this.TextHeight);
60576
- this.Canvas.textAlign="right";
60577
- this.Canvas.textBaseline="middle";
60578
- this.Canvas.fillStyle=item.TextColor;
60579
- this.Canvas.fillText(rText,chartRight-4,y+yOffset+this.TextHeight,rTextWidth);
60580
- }
60581
- else
60582
- {
60583
- this.DrawTextBGRect(right+2,y+yOffset+this.TextHeight/2,rTextWidth,this.TextHeight);
60584
- this.Canvas.textAlign="left";
60585
- this.Canvas.textBaseline="middle";
60586
- this.Canvas.fillStyle=item.TextColor;
60587
- this.Canvas.fillText(rText,right+4,y+yOffset+this.TextHeight,rTextWidth);
60588
- }
60589
-
60590
- yOffset+=this.TextHeight;
60574
+ rtBG.Top=rtBG.YCenter-this.TextHeight/2;
60575
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60591
60576
  }
60577
+ else
60578
+ {
60579
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60580
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60581
+ }
60582
+
60583
+ if (rtBG.Right>chartRight)
60584
+ {
60585
+ rtBG.Right=chartRight;
60586
+ rtBG.Left=rtBG.Right-rtBG.Width;
60587
+ }
60588
+
60589
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
60590
+ this.DrawComplexRightText(rtBG,complexText,textSize);
60591
+
60592
+ if (this.RightButton.Enable) this.DrawRightButtonV2(rtBG, complexText, textSize, buttonData);
60592
60593
  }
60593
- */
60594
60594
  }
60595
- else if (this.ShowTextMode.Right==2)
60595
+ else if (this.ShowTextMode.Right==2) //框架内侧显示
60596
60596
  {
60597
+ var rtBG={ Right:right, Width:textSize.Width, YCenter:y, Height:textSize.Height };
60598
+ rtBG.Left=rtBG.Right-rtBG.Width;
60599
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60600
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60601
+
60597
60602
  this.Canvas.fillStyle=this.TextBGColor;
60598
60603
  var showLeft=right-textSize.Width;
60599
- this.DrawTextBGRect(showLeft,yTop,textSize.Width,textSize.Height);
60600
- this.DrawComplexTextV2(showLeft,yTop,complexText,textSize);
60604
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
60605
+ this.DrawComplexRightText(rtBG,complexText,textSize);
60601
60606
 
60602
- if (this.RightButton.Enable) this.DrawRightButton(yTop, showLeft,this.TextHeight,this.TextHeight,buttonData);
60607
+ if (this.RightButton.Enable) this.DrawRightButtonV2(rtBG, complexText, textSize, buttonData);
60603
60608
  }
60604
60609
  }
60605
60610
 
@@ -60682,8 +60687,19 @@ function ChartCorssCursor()
60682
60687
  //if (overlayLeft+30>chartRight) break;
60683
60688
  var yValue=item.Frame.GetYData(y);
60684
60689
  var text=IFrameSplitOperator.FormatValueString(yValue,2);
60685
- var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
60690
+ var textWidth=this.Canvas.measureText(text).width; //前后各空2个像素
60691
+
60692
+
60693
+ var margin=this.RightOverlayConfig.Margin;
60694
+ var textOffset=this.RightOverlayConfig.TextOffset;
60695
+
60696
+ var rtBG={ Left:overlayLeft+1, Width:textWidth+margin.Left+margin.Right, YCenter:y, Height:textHeight+margin.Top+margin.Bottom };
60697
+ rtBG.Right=rtBG.Left-rtBG.Width;
60698
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60699
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60686
60700
 
60701
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
60702
+
60687
60703
  /*
60688
60704
  for(var j=2;j>=0;--j)
60689
60705
  {
@@ -60693,19 +60709,17 @@ function ChartCorssCursor()
60693
60709
  }
60694
60710
  */
60695
60711
 
60696
- this.Canvas.fillStyle=this.TextBGColor;
60697
- this.Canvas.fillRect(overlayLeft+1,y-this.TextHeight/2,textWidth,this.TextHeight);
60698
60712
  this.Canvas.textAlign="left";
60699
- this.Canvas.textBaseline="middle";
60713
+ this.Canvas.textBaseline="bottom";
60700
60714
  this.Canvas.fillStyle=this.TextColor;
60701
- this.Canvas.fillText(text,overlayLeft+4,y,textWidth);
60715
+ this.Canvas.fillText(text,rtBG.Left+textOffset.X, rtBG.Bottom+textOffset.Y);
60702
60716
  }
60703
60717
  }
60704
60718
 
60705
60719
  this.Status=1;
60706
60720
  }
60707
60721
 
60708
- this.DrawComplexTextV2=function(left, yTop, complexText, size)
60722
+ this.DrawComplexRightText=function(rtBG, complexText, size)
60709
60723
  {
60710
60724
  this.Canvas.textAlign="left";
60711
60725
  this.Canvas.textBaseline="bottom";
@@ -60713,8 +60727,8 @@ function ChartCorssCursor()
60713
60727
  if (complexText.ShowType==1) showType=complexText.ShowType;
60714
60728
  if (showType==1) //多行
60715
60729
  {
60716
- var xLeft=left;
60717
- var yText=yTop; //顶
60730
+ var xLeft=rtBG.Left;
60731
+ var yTop=rtBG.Top; //顶
60718
60732
  for(var i=0; i<complexText.Text.length; ++i)
60719
60733
  {
60720
60734
  var item=complexText.Text[i];
@@ -60726,24 +60740,25 @@ function ChartCorssCursor()
60726
60740
  if (item.Color) this.Canvas.fillStyle=item.Color;
60727
60741
  else this.Canvas.fillStyle=complexText.Color;
60728
60742
 
60729
- var y=yText+itemSize.Height;
60743
+ var y=yTop+itemSize.Height;
60730
60744
  var x=xLeft;
60731
- if (item.Margin)
60745
+
60746
+ if (item.TextOffset)
60732
60747
  {
60733
- var margin=item.Margin;
60734
- if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
60735
- if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
60748
+ var textOffset=item.TextOffset;
60749
+ if (IFrameSplitOperator.IsNumber(textOffset.X)) x+=textOffset.X;
60750
+ if (IFrameSplitOperator.IsNumber(textOffset.Y)) y+=textOffset.Y;
60736
60751
  }
60737
60752
 
60738
60753
  this.Canvas.fillText(item.Text,x,y,itemSize.Width);
60739
60754
 
60740
- yText+=itemSize.Height;
60755
+ yTop+=itemSize.Height;
60741
60756
  }
60742
60757
  }
60743
60758
  else //水平 单行
60744
60759
  {
60745
- var xText=left;
60746
- var yBottom=yTop+size.Height;
60760
+ var xText=rtBG.Left;
60761
+ var yBottom=rtBG.Bottom;
60747
60762
  for(var i=0; i<complexText.Text.length; ++i)
60748
60763
  {
60749
60764
  var item=complexText.Text[i];
@@ -60755,15 +60770,16 @@ function ChartCorssCursor()
60755
60770
  if (item.Color) this.Canvas.fillStyle=item.Color;
60756
60771
  else this.Canvas.fillStyle=complexText.Color;
60757
60772
 
60758
- var y=yBottom;
60759
60773
  var x=xText;
60760
- if (item.Margin)
60774
+ var y=yBottom;
60775
+
60776
+ if (item.TextOffset)
60761
60777
  {
60762
- var margin=item.Margin;
60763
- if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
60764
- if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
60778
+ var textOffset=item.TextOffset;
60779
+ if (IFrameSplitOperator.IsNumber(textOffset.X)) x+=textOffset.X;
60780
+ if (IFrameSplitOperator.IsNumber(textOffset.Y)) y+=textOffset.Y;
60765
60781
  }
60766
-
60782
+
60767
60783
  this.Canvas.fillText(item.Text,x,y,itemSize.Width);
60768
60784
 
60769
60785
  xText+=itemSize.Width;
@@ -60786,7 +60802,7 @@ function ChartCorssCursor()
60786
60802
  if (item.Font) this.Canvas.font=item.Font;
60787
60803
  else this.Canvas.font=complexText.Font;
60788
60804
  var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
60789
- var itemHeight=this.Canvas.measureText("擎").width;
60805
+ var itemHeight=this.GetFontHeight();
60790
60806
  if (item.Margin)
60791
60807
  {
60792
60808
  var margin=item.Margin;
@@ -60807,7 +60823,7 @@ function ChartCorssCursor()
60807
60823
  }
60808
60824
  else //水平 单行
60809
60825
  {
60810
- var textWidth=0, textHeight=0;
60826
+ var textWidth=0, textHeight=this.GetFontHeight();
60811
60827
  for(var i=0; i<complexText.Text.length; ++i)
60812
60828
  {
60813
60829
  var item=complexText.Text[i];
@@ -60836,6 +60852,61 @@ function ChartCorssCursor()
60836
60852
  }
60837
60853
  }
60838
60854
 
60855
+
60856
+ this.DrawRightButtonV2=function(rtTextBG, complexText, textSize, data)
60857
+ {
60858
+ this.Canvas.fillStyle=this.RightButton.BGColor;
60859
+ var drawHeight=rtTextBG.Height;
60860
+ var drawWidth=rtTextBG.Height;
60861
+
60862
+ if (complexText.ShowType==1) //多行 取第1行高度
60863
+ {
60864
+ var itemSize=textSize.Text[0];
60865
+ drawHeight=itemSize.Height;
60866
+ drawWidth=itemSize.Height;
60867
+ }
60868
+
60869
+ var rtButton={Left:rtTextBG.Left-drawHeight, Top:rtTextBG.Top, Width:drawWidth, Height:drawHeight };
60870
+ rtButton.Right=rtButton.Left+rtButton.Width;
60871
+ rtButton.Bottom=rtButton.Top+rtButton.Height;
60872
+ this.RightButton.Rect=rtButton;
60873
+ this.RightButton.Data=data;
60874
+ this.Canvas.fillRect(ToFixedPoint(rtButton.Left+1),ToFixedPoint(rtButton.Top),ToFixedRect(rtButton.Width),ToFixedRect(rtButton.Height));
60875
+
60876
+ var pixelRatio=GetDevicePixelRatio();
60877
+ var spaceWidth=3;
60878
+ var yCenter=(rtButton.Top+spaceWidth)+(rtButton.Height-spaceWidth*2)/2;
60879
+ var xCenter=(rtButton.Left+spaceWidth)+(rtButton.Width-spaceWidth*2)/2;
60880
+
60881
+ if (this.RightButton.Icon)
60882
+ {
60883
+ var icon=this.RightButton.Icon;
60884
+ this.Canvas.font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60885
+ this.Canvas.textAlign="center";
60886
+ this.Canvas.textBaseline="middle";
60887
+ this.Canvas.fillStyle=icon.Color;
60888
+ this.Canvas.fillText("\ue6a3",xCenter,yCenter);
60889
+ }
60890
+ else
60891
+ {
60892
+ //画加号
60893
+ this.Canvas.strokeStyle=this.RightButton.PenColor;
60894
+ var x=rtButtom.Left+spaceWidth;
60895
+ var y=rtButtom.Top+spaceWidth;
60896
+ this.Canvas.save();
60897
+ this.Canvas.linewidth=1*pixelRatio;
60898
+ this.Canvas.beginPath();
60899
+ this.Canvas.moveTo(ToFixedPoint(x), ToFixedPoint(yCenter));
60900
+ this.Canvas.lineTo(ToFixedPoint(x+rtButton.Width-spaceWidth*2), ToFixedPoint(yCenter));
60901
+
60902
+ this.Canvas.moveTo(ToFixedPoint(xCenter),ToFixedPoint(y));
60903
+ this.Canvas.lineTo(ToFixedPoint(xCenter), ToFixedPoint(y+rtButton.Height-spaceWidth*2));
60904
+
60905
+ this.Canvas.stroke();
60906
+ this.Canvas.restore();
60907
+ }
60908
+ }
60909
+
60839
60910
  this.DrawRightButton=function(drawTop, drawRight, drawWidth, drawHeight, data)
60840
60911
  {
60841
60912
  this.Canvas.fillStyle=this.RightButton.BGColor;
@@ -78324,13 +78395,13 @@ function JSChartResource()
78324
78395
  {
78325
78396
  BGColor:'rgb(43,54,69)',
78326
78397
  PenColor:'rgb(255,255,255)',
78327
- Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
78398
+ Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:14 }
78328
78399
  },
78329
78400
 
78330
- RightMargin: { Left:2, Right:2, Top:5, Bottom:3 },
78331
-
78332
78401
  BottomText:{ Margin: { Left:4, Right:4, Top:0, Bottom:0 }, TextOffset:{X:4, Y:-1 } },
78333
78402
  LeftText:{ Margin: { Left:4, Right:4, Top:0, Bottom:0 }, TextOffset:{X:4, Y:-1 } },
78403
+ RightText:{ Margin: { Left:4, Right:4, Top:0, Bottom:0 }, TextOffset:{X:4, Y:-1 } },
78404
+ RightOverlayText:{ Margin: { Left:2, Right:2, Top:0, Bottom:0 }, TextOffset:{X:2, Y:-1 } }, //右侧叠加坐标
78334
78405
 
78335
78406
  CorssPoint:{ Center:{ Radius:5*GetDevicePixelRatio(), Color:"rgb(50,171,205)"}, Border:{ Color:'rgb(255,255,255)', Width:1*GetDevicePixelRatio() } }
78336
78407
  };
@@ -132508,7 +132579,7 @@ function GetBlackStyle()
132508
132579
  {
132509
132580
  BGColor:'rgb(43,54,69)',
132510
132581
  PenColor:'rgb(255,255,255)',
132511
- Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
132582
+ Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:12 }
132512
132583
  },
132513
132584
 
132514
132585
  CorssPoint:{ Center:{ Color:"rgb(50,171,205)" }, Border:{ Color:'rgba(0,0,0,0.8)', Width:1*GetDevicePixelRatio() } }
@@ -158738,7 +158809,7 @@ function HQChartScriptWorker()
158738
158809
 
158739
158810
 
158740
158811
 
158741
- var HQCHART_VERSION="1.1.14717";
158812
+ var HQCHART_VERSION="1.1.14721";
158742
158813
 
158743
158814
  function PrintHQChartVersion()
158744
158815
  {