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.
@@ -59995,7 +59995,7 @@ function ChartCorssCursor()
59995
59995
  Enable:false, Rect:null,
59996
59996
  BGColor:g_JSChartResource.CorssCursor.RightButton.BGColor ,
59997
59997
  PenColor:g_JSChartResource.CorssCursor.RightButton.PenColor,
59998
- Icon:g_JSChartResource.CorssCursor.RightButton.Icon
59998
+ Icon:CloneData(g_JSChartResource.CorssCursor.RightButton.Icon)
59999
59999
  };
60000
60000
 
60001
60001
  //底部按钮
@@ -60004,9 +60004,11 @@ function ChartCorssCursor()
60004
60004
  Enable:false, Rect:null,
60005
60005
  }
60006
60006
 
60007
- this.RightMargin=CloneData(g_JSChartResource.CorssCursor.RightMargin);
60008
- this.BottomConfig=CloneData(g_JSChartResource.CorssCursor.BottomText); //底部输出配置
60009
- this.LeftConfig=CloneData(g_JSChartResource.CorssCursor.LeftText);
60007
+ this.BottomConfig=CloneData(g_JSChartResource.CorssCursor.BottomText); //底部输出配置
60008
+ this.LeftConfig=CloneData(g_JSChartResource.CorssCursor.LeftText); //左侧输出配置
60009
+ this.RightConfig=CloneData(g_JSChartResource.CorssCursor.RightText); //右侧输出配置
60010
+ this.RightOverlayConfig=CloneData(g_JSChartResource.CorssCursor.RightOverlayText); //右侧叠加指标输出配置
60011
+
60010
60012
 
60011
60013
  //内部使用
60012
60014
  this.Close=null; //收盘价格
@@ -60024,6 +60026,10 @@ function ChartCorssCursor()
60024
60026
  this.XRangeBGColor=g_JSChartResource.CorssCursorXRangeBGColor;
60025
60027
  this.LineDash=g_JSChartResource.CorssCursorLineDash.slice(); //虚线
60026
60028
 
60029
+ this.RightButton.BGColor=g_JSChartResource.CorssCursor.RightButton.BGColor;
60030
+ this.RightButton.PenColor=g_JSChartResource.CorssCursor.RightButton.PenColor;
60031
+ this.RightButton.Icon=CloneData(g_JSChartResource.CorssCursor.RightButton.Icon);
60032
+ this.RightOverlayConfig=CloneData(g_JSChartResource.CorssCursor.RightOverlayText);
60027
60033
 
60028
60034
  this.CorssPointConfig.Center=CloneData(g_JSChartResource.CorssCursor.CorssPoint.Center);
60029
60035
  this.CorssPointConfig.Border=CloneData(g_JSChartResource.CorssCursor.CorssPoint.Border);
@@ -60429,7 +60435,7 @@ function ChartCorssCursor()
60429
60435
  {
60430
60436
  ShowType:0, //0=单行(默认) 1=多行
60431
60437
  Font:this.Font, Color:this.TextColor,
60432
- Text:[ { Text:text, Margin:this.RightMargin } ],
60438
+ Text:[ { Text:text, Margin:this.RightConfig.Margin, TextOffset:this.RightConfig.TextOffset } ],
60433
60439
  };
60434
60440
 
60435
60441
  var yTop=y-this.TextHeight/2;
@@ -60488,74 +60494,73 @@ function ChartCorssCursor()
60488
60494
  //叠加坐标
60489
60495
  if (isOverlayIndex && textSize.Width>overlayIndexInterval && overlayIndexInterval>0) //大于子坐标宽度
60490
60496
  {
60497
+ var rtBG={ Right:right+overlayIndexInterval, Width:textSize.Width, YCenter:y, Height:textSize.Height };
60498
+ rtBG.Left=rtBG.Right-rtBG.Width;
60499
+ if (complexText.ShowType==1)
60500
+ {
60501
+ rtBG.Top=rtBG.YCenter-this.TextHeight/2;
60502
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60503
+ }
60504
+ else
60505
+ {
60506
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60507
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60508
+ }
60509
+
60510
+ if (rtBG.Right>chartRight)
60511
+ {
60512
+ rtBG.Right=chartRight;
60513
+ rtBG.Left=rtBG.Right-rtBG.Width;
60514
+ }
60515
+
60491
60516
  var drawRight=right+overlayIndexInterval;
60492
60517
  if (drawRight>chartRight) drawRight=chartRight;
60493
60518
 
60494
- var itemLeft=drawRight-2-textSize.Width;
60495
- this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
60496
- this.DrawComplexTextV2(itemLeft, yTop, complexText, textSize);
60519
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
60520
+ this.DrawComplexRightText(rtBG,complexText,textSize);
60497
60521
 
60498
- if (this.RightButton.Enable) this.DrawRightButton(yTop, itemLeft,this.TextHeight,this.TextHeight,buttonData);
60499
- }
60500
- else if (rightWidth<textSize.Width) //右边空白显示不下,
60501
- {
60502
- var itemLeft=chartRight-2-textSize.Width;
60503
- this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
60504
- this.DrawComplexTextV2(itemLeft, yTop ,complexText, textSize);
60505
-
60506
- if (this.RightButton.Enable) this.DrawRightButton(yTop, chartRight-2-textSize.Width,this.TextHeight,this.TextHeight,buttonData);
60522
+ if (this.RightButton.Enable) this.DrawRightButtonV2(rtBG, complexText, textSize, buttonData);
60507
60523
  }
60508
60524
  else
60509
60525
  {
60510
- var itemLeft=right+2;
60511
- this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
60512
- this.DrawComplexTextV2(itemLeft,yTop,complexText,textSize);
60513
-
60514
- if (this.RightButton.Enable) this.DrawRightButton(yTop, right+2,this.TextHeight,this.TextHeight,buttonData);
60515
- }
60516
-
60517
- /*
60518
- if (this.StringFormatY.RExtendText && this.StringFormatY.RExtendText.length>0)
60519
- {
60520
- var yOffset=0;
60521
- for(var i in this.StringFormatY.RExtendText)
60526
+ var rtBG={ Left:right+1, Width:textSize.Width, YCenter:y, Height:textSize.Height };
60527
+ rtBG.Right=rtBG.Left+rtBG.Width;
60528
+ if (complexText.ShowType==1)
60522
60529
  {
60523
- var item=this.StringFormatY.RExtendText[i];
60524
- var rText='--.--'
60525
- if (item.YText) rText=item.YText;
60526
- else if (IFrameSplitOperator.IsNumber(item.Y)) rText=item.Y.toFixed(0);
60527
- var rTextWidth=this.Canvas.measureText(rText).width+4; //前后各空2个像素
60528
-
60529
- if (rightWidth<rTextWidth)
60530
- {
60531
- this.DrawTextBGRect(chartRight-2-rTextWidth,y+yOffset+this.TextHeight/2,rTextWidth,this.TextHeight);
60532
- this.Canvas.textAlign="right";
60533
- this.Canvas.textBaseline="middle";
60534
- this.Canvas.fillStyle=item.TextColor;
60535
- this.Canvas.fillText(rText,chartRight-4,y+yOffset+this.TextHeight,rTextWidth);
60536
- }
60537
- else
60538
- {
60539
- this.DrawTextBGRect(right+2,y+yOffset+this.TextHeight/2,rTextWidth,this.TextHeight);
60540
- this.Canvas.textAlign="left";
60541
- this.Canvas.textBaseline="middle";
60542
- this.Canvas.fillStyle=item.TextColor;
60543
- this.Canvas.fillText(rText,right+4,y+yOffset+this.TextHeight,rTextWidth);
60544
- }
60545
-
60546
- yOffset+=this.TextHeight;
60530
+ rtBG.Top=rtBG.YCenter-this.TextHeight/2;
60531
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60547
60532
  }
60533
+ else
60534
+ {
60535
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60536
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60537
+ }
60538
+
60539
+ if (rtBG.Right>chartRight)
60540
+ {
60541
+ rtBG.Right=chartRight;
60542
+ rtBG.Left=rtBG.Right-rtBG.Width;
60543
+ }
60544
+
60545
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
60546
+ this.DrawComplexRightText(rtBG,complexText,textSize);
60547
+
60548
+ if (this.RightButton.Enable) this.DrawRightButtonV2(rtBG, complexText, textSize, buttonData);
60548
60549
  }
60549
- */
60550
60550
  }
60551
- else if (this.ShowTextMode.Right==2)
60551
+ else if (this.ShowTextMode.Right==2) //框架内侧显示
60552
60552
  {
60553
+ var rtBG={ Right:right, Width:textSize.Width, YCenter:y, Height:textSize.Height };
60554
+ rtBG.Left=rtBG.Right-rtBG.Width;
60555
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60556
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60557
+
60553
60558
  this.Canvas.fillStyle=this.TextBGColor;
60554
60559
  var showLeft=right-textSize.Width;
60555
- this.DrawTextBGRect(showLeft,yTop,textSize.Width,textSize.Height);
60556
- this.DrawComplexTextV2(showLeft,yTop,complexText,textSize);
60560
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
60561
+ this.DrawComplexRightText(rtBG,complexText,textSize);
60557
60562
 
60558
- if (this.RightButton.Enable) this.DrawRightButton(yTop, showLeft,this.TextHeight,this.TextHeight,buttonData);
60563
+ if (this.RightButton.Enable) this.DrawRightButtonV2(rtBG, complexText, textSize, buttonData);
60559
60564
  }
60560
60565
  }
60561
60566
 
@@ -60638,8 +60643,19 @@ function ChartCorssCursor()
60638
60643
  //if (overlayLeft+30>chartRight) break;
60639
60644
  var yValue=item.Frame.GetYData(y);
60640
60645
  var text=IFrameSplitOperator.FormatValueString(yValue,2);
60641
- var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
60646
+ var textWidth=this.Canvas.measureText(text).width; //前后各空2个像素
60647
+
60648
+
60649
+ var margin=this.RightOverlayConfig.Margin;
60650
+ var textOffset=this.RightOverlayConfig.TextOffset;
60651
+
60652
+ var rtBG={ Left:overlayLeft+1, Width:textWidth+margin.Left+margin.Right, YCenter:y, Height:textHeight+margin.Top+margin.Bottom };
60653
+ rtBG.Right=rtBG.Left-rtBG.Width;
60654
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60655
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60642
60656
 
60657
+ this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
60658
+
60643
60659
  /*
60644
60660
  for(var j=2;j>=0;--j)
60645
60661
  {
@@ -60649,19 +60665,17 @@ function ChartCorssCursor()
60649
60665
  }
60650
60666
  */
60651
60667
 
60652
- this.Canvas.fillStyle=this.TextBGColor;
60653
- this.Canvas.fillRect(overlayLeft+1,y-this.TextHeight/2,textWidth,this.TextHeight);
60654
60668
  this.Canvas.textAlign="left";
60655
- this.Canvas.textBaseline="middle";
60669
+ this.Canvas.textBaseline="bottom";
60656
60670
  this.Canvas.fillStyle=this.TextColor;
60657
- this.Canvas.fillText(text,overlayLeft+4,y,textWidth);
60671
+ this.Canvas.fillText(text,rtBG.Left+textOffset.X, rtBG.Bottom+textOffset.Y);
60658
60672
  }
60659
60673
  }
60660
60674
 
60661
60675
  this.Status=1;
60662
60676
  }
60663
60677
 
60664
- this.DrawComplexTextV2=function(left, yTop, complexText, size)
60678
+ this.DrawComplexRightText=function(rtBG, complexText, size)
60665
60679
  {
60666
60680
  this.Canvas.textAlign="left";
60667
60681
  this.Canvas.textBaseline="bottom";
@@ -60669,8 +60683,8 @@ function ChartCorssCursor()
60669
60683
  if (complexText.ShowType==1) showType=complexText.ShowType;
60670
60684
  if (showType==1) //多行
60671
60685
  {
60672
- var xLeft=left;
60673
- var yText=yTop; //顶
60686
+ var xLeft=rtBG.Left;
60687
+ var yTop=rtBG.Top; //顶
60674
60688
  for(var i=0; i<complexText.Text.length; ++i)
60675
60689
  {
60676
60690
  var item=complexText.Text[i];
@@ -60682,24 +60696,25 @@ function ChartCorssCursor()
60682
60696
  if (item.Color) this.Canvas.fillStyle=item.Color;
60683
60697
  else this.Canvas.fillStyle=complexText.Color;
60684
60698
 
60685
- var y=yText+itemSize.Height;
60699
+ var y=yTop+itemSize.Height;
60686
60700
  var x=xLeft;
60687
- if (item.Margin)
60701
+
60702
+ if (item.TextOffset)
60688
60703
  {
60689
- var margin=item.Margin;
60690
- if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
60691
- if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
60704
+ var textOffset=item.TextOffset;
60705
+ if (IFrameSplitOperator.IsNumber(textOffset.X)) x+=textOffset.X;
60706
+ if (IFrameSplitOperator.IsNumber(textOffset.Y)) y+=textOffset.Y;
60692
60707
  }
60693
60708
 
60694
60709
  this.Canvas.fillText(item.Text,x,y,itemSize.Width);
60695
60710
 
60696
- yText+=itemSize.Height;
60711
+ yTop+=itemSize.Height;
60697
60712
  }
60698
60713
  }
60699
60714
  else //水平 单行
60700
60715
  {
60701
- var xText=left;
60702
- var yBottom=yTop+size.Height;
60716
+ var xText=rtBG.Left;
60717
+ var yBottom=rtBG.Bottom;
60703
60718
  for(var i=0; i<complexText.Text.length; ++i)
60704
60719
  {
60705
60720
  var item=complexText.Text[i];
@@ -60711,15 +60726,16 @@ function ChartCorssCursor()
60711
60726
  if (item.Color) this.Canvas.fillStyle=item.Color;
60712
60727
  else this.Canvas.fillStyle=complexText.Color;
60713
60728
 
60714
- var y=yBottom;
60715
60729
  var x=xText;
60716
- if (item.Margin)
60730
+ var y=yBottom;
60731
+
60732
+ if (item.TextOffset)
60717
60733
  {
60718
- var margin=item.Margin;
60719
- if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
60720
- if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
60734
+ var textOffset=item.TextOffset;
60735
+ if (IFrameSplitOperator.IsNumber(textOffset.X)) x+=textOffset.X;
60736
+ if (IFrameSplitOperator.IsNumber(textOffset.Y)) y+=textOffset.Y;
60721
60737
  }
60722
-
60738
+
60723
60739
  this.Canvas.fillText(item.Text,x,y,itemSize.Width);
60724
60740
 
60725
60741
  xText+=itemSize.Width;
@@ -60742,7 +60758,7 @@ function ChartCorssCursor()
60742
60758
  if (item.Font) this.Canvas.font=item.Font;
60743
60759
  else this.Canvas.font=complexText.Font;
60744
60760
  var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
60745
- var itemHeight=this.Canvas.measureText("擎").width;
60761
+ var itemHeight=this.GetFontHeight();
60746
60762
  if (item.Margin)
60747
60763
  {
60748
60764
  var margin=item.Margin;
@@ -60763,7 +60779,7 @@ function ChartCorssCursor()
60763
60779
  }
60764
60780
  else //水平 单行
60765
60781
  {
60766
- var textWidth=0, textHeight=0;
60782
+ var textWidth=0, textHeight=this.GetFontHeight();
60767
60783
  for(var i=0; i<complexText.Text.length; ++i)
60768
60784
  {
60769
60785
  var item=complexText.Text[i];
@@ -60792,6 +60808,61 @@ function ChartCorssCursor()
60792
60808
  }
60793
60809
  }
60794
60810
 
60811
+
60812
+ this.DrawRightButtonV2=function(rtTextBG, complexText, textSize, data)
60813
+ {
60814
+ this.Canvas.fillStyle=this.RightButton.BGColor;
60815
+ var drawHeight=rtTextBG.Height;
60816
+ var drawWidth=rtTextBG.Height;
60817
+
60818
+ if (complexText.ShowType==1) //多行 取第1行高度
60819
+ {
60820
+ var itemSize=textSize.Text[0];
60821
+ drawHeight=itemSize.Height;
60822
+ drawWidth=itemSize.Height;
60823
+ }
60824
+
60825
+ var rtButton={Left:rtTextBG.Left-drawHeight, Top:rtTextBG.Top, Width:drawWidth, Height:drawHeight };
60826
+ rtButton.Right=rtButton.Left+rtButton.Width;
60827
+ rtButton.Bottom=rtButton.Top+rtButton.Height;
60828
+ this.RightButton.Rect=rtButton;
60829
+ this.RightButton.Data=data;
60830
+ this.Canvas.fillRect(ToFixedPoint(rtButton.Left+1),ToFixedPoint(rtButton.Top),ToFixedRect(rtButton.Width),ToFixedRect(rtButton.Height));
60831
+
60832
+ var pixelRatio=GetDevicePixelRatio();
60833
+ var spaceWidth=3;
60834
+ var yCenter=(rtButton.Top+spaceWidth)+(rtButton.Height-spaceWidth*2)/2;
60835
+ var xCenter=(rtButton.Left+spaceWidth)+(rtButton.Width-spaceWidth*2)/2;
60836
+
60837
+ if (this.RightButton.Icon)
60838
+ {
60839
+ var icon=this.RightButton.Icon;
60840
+ this.Canvas.font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60841
+ this.Canvas.textAlign="center";
60842
+ this.Canvas.textBaseline="middle";
60843
+ this.Canvas.fillStyle=icon.Color;
60844
+ this.Canvas.fillText("\ue6a3",xCenter,yCenter);
60845
+ }
60846
+ else
60847
+ {
60848
+ //画加号
60849
+ this.Canvas.strokeStyle=this.RightButton.PenColor;
60850
+ var x=rtButtom.Left+spaceWidth;
60851
+ var y=rtButtom.Top+spaceWidth;
60852
+ this.Canvas.save();
60853
+ this.Canvas.linewidth=1*pixelRatio;
60854
+ this.Canvas.beginPath();
60855
+ this.Canvas.moveTo(ToFixedPoint(x), ToFixedPoint(yCenter));
60856
+ this.Canvas.lineTo(ToFixedPoint(x+rtButton.Width-spaceWidth*2), ToFixedPoint(yCenter));
60857
+
60858
+ this.Canvas.moveTo(ToFixedPoint(xCenter),ToFixedPoint(y));
60859
+ this.Canvas.lineTo(ToFixedPoint(xCenter), ToFixedPoint(y+rtButton.Height-spaceWidth*2));
60860
+
60861
+ this.Canvas.stroke();
60862
+ this.Canvas.restore();
60863
+ }
60864
+ }
60865
+
60795
60866
  this.DrawRightButton=function(drawTop, drawRight, drawWidth, drawHeight, data)
60796
60867
  {
60797
60868
  this.Canvas.fillStyle=this.RightButton.BGColor;
@@ -78280,13 +78351,13 @@ function JSChartResource()
78280
78351
  {
78281
78352
  BGColor:'rgb(43,54,69)',
78282
78353
  PenColor:'rgb(255,255,255)',
78283
- Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
78354
+ Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:14 }
78284
78355
  },
78285
78356
 
78286
- RightMargin: { Left:2, Right:2, Top:5, Bottom:3 },
78287
-
78288
78357
  BottomText:{ Margin: { Left:4, Right:4, Top:0, Bottom:0 }, TextOffset:{X:4, Y:-1 } },
78289
78358
  LeftText:{ Margin: { Left:4, Right:4, Top:0, Bottom:0 }, TextOffset:{X:4, Y:-1 } },
78359
+ RightText:{ Margin: { Left:4, Right:4, Top:0, Bottom:0 }, TextOffset:{X:4, Y:-1 } },
78360
+ RightOverlayText:{ Margin: { Left:2, Right:2, Top:0, Bottom:0 }, TextOffset:{X:2, Y:-1 } }, //右侧叠加坐标
78290
78361
 
78291
78362
  CorssPoint:{ Center:{ Radius:5*GetDevicePixelRatio(), Color:"rgb(50,171,205)"}, Border:{ Color:'rgb(255,255,255)', Width:1*GetDevicePixelRatio() } }
78292
78363
  };
@@ -132464,7 +132535,7 @@ function GetBlackStyle()
132464
132535
  {
132465
132536
  BGColor:'rgb(43,54,69)',
132466
132537
  PenColor:'rgb(255,255,255)',
132467
- Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
132538
+ Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:12 }
132468
132539
  },
132469
132540
 
132470
132541
  CorssPoint:{ Center:{ Color:"rgb(50,171,205)" }, Border:{ Color:'rgba(0,0,0,0.8)', Width:1*GetDevicePixelRatio() } }
@@ -147923,7 +147994,7 @@ function ScrollBarBGChart()
147923
147994
 
147924
147995
 
147925
147996
 
147926
- var HQCHART_VERSION="1.1.14717";
147997
+ var HQCHART_VERSION="1.1.14721";
147927
147998
 
147928
147999
  function PrintHQChartVersion()
147929
148000
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14717";
8
+ var HQCHART_VERSION="1.1.14721";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {