hqchart 1.1.13754 → 1.1.13760

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.
@@ -62476,7 +62476,7 @@ function ChartDrawHLine()
62476
62476
  this.ButtonBGColor='rgb(190,190,190)';
62477
62477
  this.ButtonSpace=3;
62478
62478
 
62479
- this.TextMargin={ Left:0, Right:0 };
62479
+ this.TextMargin={ Left:0, Right:0, Top:0, Bottom:0, YOffset:4*GetDevicePixelRatio() };
62480
62480
 
62481
62481
  this.AlwaysShowLab=false; //总是显示标签
62482
62482
 
@@ -62500,7 +62500,9 @@ function ChartDrawHLine()
62500
62500
  `${12*GetDevicePixelRatio()}px 微软雅黑`,
62501
62501
  `${12*GetDevicePixelRatio()}px 微软雅黑`,
62502
62502
  ],
62503
- };
62503
+ };
62504
+
62505
+ this.LableInfo; //{ Position:2=右侧外部 }
62504
62506
 
62505
62507
  //内部变量
62506
62508
  this.ColseButtonSize=0;
@@ -62508,7 +62510,7 @@ function ChartDrawHLine()
62508
62510
  this.ButtonBGWidth=0;
62509
62511
  this.VerticalButtonInfo={ Width:0, Height:0 }; //垂直按钮信息
62510
62512
 
62511
-
62513
+ this.IsPointIn=this.IsPointIn_XYValue_Line;
62512
62514
 
62513
62515
  this.SetOption=function(option)
62514
62516
  {
@@ -62569,6 +62571,9 @@ function ChartDrawHLine()
62569
62571
  var item=option.TextMargin;
62570
62572
  if (IFrameSplitOperator.IsNumber(item.Left)) this.TextMargin.Left=item.Left;
62571
62573
  if (IFrameSplitOperator.IsNumber(item.Right)) this.TextMargin.Right=item.Right;
62574
+ if (IFrameSplitOperator.IsNumber(item.Top)) this.TextMargin.Top=item.Top;
62575
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) this.TextMargin.Bottom=item.Bottom;
62576
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) this.TextMargin.YOffset=item.YOffset;
62572
62577
  }
62573
62578
  }
62574
62579
  }
@@ -62585,10 +62590,6 @@ function ChartDrawHLine()
62585
62590
  return storageData;
62586
62591
  }
62587
62592
 
62588
-
62589
- this.IsPointIn=this.IsPointIn_XYValue_Line;
62590
-
62591
-
62592
62593
  /*
62593
62594
  this.GetXYCoordinate=function()
62594
62595
  {
@@ -62645,7 +62646,7 @@ function ChartDrawHLine()
62645
62646
  this.ColseButtonSize=0;
62646
62647
  this.SettingButtonSize=0;
62647
62648
  this.ButtonBGWidth=0;
62648
-
62649
+ this.LableInfo=null;
62649
62650
  this.VerticalButtonInfo.Width=0;
62650
62651
  this.VerticalButtonInfo.Height=0;
62651
62652
 
@@ -62708,7 +62709,7 @@ function ChartDrawHLine()
62708
62709
  }
62709
62710
  this.LinePoint.push(line);
62710
62711
 
62711
- if (bVisibleRange)
62712
+ if (bVisibleRange) //在可视范围内
62712
62713
  {
62713
62714
  var yValue=this.Frame.GetYData(drawPoint[0].Y, false);
62714
62715
  var strPrice=yValue.toFixed(this.Precision);
@@ -62722,15 +62723,11 @@ function ChartDrawHLine()
62722
62723
  this.DrawPriceText(strPrice, line.Start, line.End, 1);
62723
62724
  }
62724
62725
  }
62725
-
62726
- var labInfo;
62727
- if (this.GetLabelCallback) labInfo=this.GetLabelCallback(this);
62726
+
62727
+ if (this.GetLabelCallback) this.LableInfo=this.GetLabelCallback(this);
62728
62728
 
62729
62729
  this.AryShowButton=this.GetShowButton(); //获取按钮
62730
-
62731
- //框架内的描述信息
62732
- if (labInfo && bVisibleRange)
62733
- this.DrawLab(labInfo, drawPoint[0].Y);
62730
+ if (bVisibleRange) this.DrawInternalLabel(drawPoint[0].Y); //内部价格标签
62734
62731
 
62735
62732
  //画中心点
62736
62733
  if (bVisibleRange)
@@ -62747,11 +62744,11 @@ function ChartDrawHLine()
62747
62744
  {
62748
62745
  var rtDraw={ };
62749
62746
  this.CalculateButtonSize();
62750
- this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
62751
- if (labInfo) this.DrawRightLab(labInfo, rtDraw);
62752
- if (labInfo && bVisibleRange) this.DrawCustomHLine(labInfo, drawPoint[0].Y);
62747
+ this.DrawRightLabel(drawPoint[0].Y);
62748
+ if (bVisibleRange) this.DrawCustomHLine(drawPoint[0].Y);
62753
62749
  }
62754
62750
 
62751
+
62755
62752
  //鼠标是否在按钮上
62756
62753
  if (moveonPoint && mouseStatus)
62757
62754
  {
@@ -62799,113 +62796,141 @@ function ChartDrawHLine()
62799
62796
  ++lineCount;
62800
62797
  }
62801
62798
 
62802
- var size={ Width:maxWidth, Height: lineCount*(lineHeight+lineSpace)+lineSpace, NameWidth:maxNameWidth, TextWidth:maxTextWidth, LineHeight:lineHeight };
62799
+ var size={ Width:maxWidth, Height:lineCount*lineHeight+(lineCount-1)*lineSpace, NameWidth:maxNameWidth, TextWidth:maxTextWidth, LineHeight:lineHeight };
62800
+ if (labInfo.LabelMargin)
62801
+ {
62802
+ var item=labInfo.LabelMargin;
62803
+ if (IFrameSplitOperator.IsNumber(item.Left)) size.Width+=item.Left;
62804
+ if (IFrameSplitOperator.IsNumber(item.Right)) size.Width+=item.Right;
62805
+ if (IFrameSplitOperator.IsNumber(item.Top)) size.Height+=item.Top;
62806
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) size.Height+=item.Bottom;
62807
+ }
62803
62808
 
62804
62809
  return size;
62805
62810
  }
62806
62811
 
62807
- this.DrawLab=function(labInfo, y)
62812
+ //绘制窗口内部标签
62813
+ this.DrawInternalLabel=function(y)
62808
62814
  {
62809
- if (!labInfo) return;
62810
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText)) return;
62811
- if (labInfo.Position===2) return;
62815
+ if (!this.LableInfo || !IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryText)) return;
62816
+ if (this.LableInfo.Position==2) return;
62812
62817
 
62813
- var left=this.Frame.ChartBorder.GetLeft();
62814
- var right=this.Frame.ChartBorder.GetRight();
62815
- var labSize=this.CalculateLabSize(labInfo);
62818
+ var border=this.Frame.GetBorder();
62819
+ var left=border.Left;
62820
+ var right=border.Right;
62821
+ var labSize=this.CalculateLabSize(this.LableInfo);
62816
62822
  var drawLeft=right-labSize.Width;
62823
+ var drawRight=drawLeft+labSize.Width;
62817
62824
  var drawTop=y-labSize.Height-1;
62825
+ if (drawTop<=border.TopEx) drawTop=y+1;
62818
62826
 
62819
- //背景色
62820
- if (labInfo.BGColor)
62821
- {
62822
- this.Canvas.fillStyle=labInfo.BGColor;
62823
- var rtTop=y-labSize.Height-4;
62824
- this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(right+drawLeft),ToFixedRect(y-rtTop));
62825
- }
62827
+ var rtLabel={ Left:drawLeft, Right:drawRight, Top:drawTop, Width:labSize.Width, Height:labSize.Height };
62828
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
62826
62829
 
62827
- var yText=drawTop;
62828
- for(var i=0;i<labInfo.AryText.length;++i)
62829
- {
62830
- var item=labInfo.AryText[i];
62831
- if (item.Name)
62832
- {
62833
- this.Canvas.fillStyle=item.NameColor;
62834
- this.Canvas.fillText(item.Name,drawLeft+1,yText+1);
62835
- }
62836
-
62837
- if (item.Text)
62838
- {
62839
- this.Canvas.fillStyle=item.TextColor;
62840
- this.Canvas.fillText(item.Text,drawLeft+labSize.NameWidth+1,yText+1);
62841
- }
62842
-
62843
- yText+=labSize.LineHeight;
62844
- }
62830
+ this.DrawLabel(this.LableInfo, labSize, rtLabel);
62845
62831
  }
62846
62832
 
62847
- this.DrawRightLab=function(labInfo, rtLeftDraw)
62833
+ //绘制标签页
62834
+ this.DrawLabel=function(labelInfo, labelSize, rtLabel)
62848
62835
  {
62849
- if (!labInfo) return;
62850
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText)) return;
62851
- if (labInfo.Position!=2) return;
62852
- var labSize=this.CalculateLabSize(labInfo);
62836
+ //背景色
62837
+ if (labelInfo.BGColor)
62838
+ {
62839
+ this.Canvas.fillStyle=labelInfo.BGColor;
62840
+ this.Canvas.fillRect(ToFixedRect(rtLabel.Left),ToFixedRect(rtLabel.Top),ToFixedRect(rtLabel.Width),ToFixedRect(rtLabel.Height));
62841
+ }
62853
62842
 
62854
- var drawLeft=rtLeftDraw.Right-labSize.Width;
62855
- if (drawLeft<rtLeftDraw.Left) drawLeft=rtLeftDraw.Left;
62856
- var drawRight=drawLeft+labSize.Width;
62857
- var drawTop=rtLeftDraw.Bottom;
62843
+ var labelMargin=labelInfo.LabelMargin;
62858
62844
  var lineSpace=0;
62859
- if (IFrameSplitOperator.IsNumber(labInfo.LineSpace)) lineSpace=labInfo.LineSpace;
62845
+ if (IFrameSplitOperator.IsNumber(labelInfo.LineSpace)) lineSpace=labelInfo.LineSpace;
62846
+
62847
+ var yText=rtLabel.Top;
62848
+ var xText=rtLabel.Left;
62849
+ var yRightText=rtLabel.Right;
62860
62850
 
62861
- //背景色
62862
- var rtLab={ Left:drawLeft, Top:drawTop, Width:labSize.Width, Height:labSize.Height }
62863
- rtLab.Right=rtLab.Left+rtLab.Width;
62864
- rtLab.Bottom=rtLab.Top+rtLab.Height;
62865
- if (labInfo.BGColor)
62851
+ if (labelMargin)
62866
62852
  {
62867
- this.Canvas.fillStyle=labInfo.BGColor;
62868
- this.Canvas.fillRect(ToFixedRect(rtLab.Left),ToFixedRect(rtLab.Top),ToFixedRect(rtLab.Width),ToFixedRect(rtLab.Height));
62853
+ if (IFrameSplitOperator.IsNumber(labelMargin.Left)) xText+=labelMargin.Left;
62854
+ if (IFrameSplitOperator.IsNumber(labelMargin.Right)) yRightText-=labelMargin.Right;
62855
+ if (IFrameSplitOperator.IsNumber(labelMargin.Top)) yText+=labelMargin.Top;
62856
+
62869
62857
  }
62870
62858
 
62871
- var yText=drawTop+1+lineSpace;
62859
+ this.Canvas.font=this.TextFont;
62872
62860
  this.Canvas.textBaseline="top";
62873
- for(var i=0;i<labInfo.AryText.length;++i)
62861
+ for(var i=0;i<labelInfo.AryText.length;++i)
62874
62862
  {
62875
- var item=labInfo.AryText[i];
62863
+ if (i>0) yText+=lineSpace;
62864
+ var item=labelInfo.AryText[i];
62876
62865
  if (item.Name)
62877
62866
  {
62878
62867
  this.Canvas.textAlign="left";
62879
62868
  this.Canvas.fillStyle=item.NameColor;
62880
- this.Canvas.fillText(item.Name,drawLeft+1,yText+1);
62869
+ this.Canvas.fillText(item.Name,xText,yText);
62881
62870
  }
62882
62871
 
62883
62872
  if (item.Text)
62884
62873
  {
62885
62874
  this.Canvas.textAlign="right";
62886
62875
  this.Canvas.fillStyle=item.TextColor;
62887
- this.Canvas.fillText(item.Text,drawRight-1,yText+1);
62876
+ this.Canvas.fillText(item.Text,yRightText,yText);
62888
62877
  }
62889
62878
 
62890
- yText+=labSize.LineHeight+lineSpace;
62879
+ yText+=labelSize.LineHeight;
62891
62880
  }
62881
+ }
62892
62882
 
62893
- this.DrawVerticalButton(rtLab);
62883
+ this.DrawRightLabel=function(y)
62884
+ {
62885
+ var rtDraw={ };
62886
+ if (!this.LableInfo || !IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryText) || this.LableInfo.Position!=2)
62887
+ {
62888
+ this.DrawValueText(y, rtDraw);
62889
+ return;
62890
+ }
62891
+
62892
+ var priceSize=this.CalculateValueText(y);
62893
+ var labSize=this.CalculateLabSize(this.LableInfo);
62894
+ var border=this.Frame.GetBorder();
62895
+ var yTop=y-priceSize.Height/2;
62896
+ var totalHeight=priceSize.Height+labSize.Height;
62897
+ var yBottom=yTop+totalHeight;
62898
+ var option={ };
62899
+ if (yBottom>border.Bottom) //超过窗口底部, 标签位置不动
62900
+ {
62901
+ yBottom=border.Bottom;
62902
+ yTop=yBottom-totalHeight;
62903
+ option.Top=yTop;
62904
+ }
62905
+
62906
+ this.DrawValueText(y, rtDraw, option);
62907
+
62908
+ var drawLeft=rtDraw.Right-labSize.Width;
62909
+ if (drawLeft<rtDraw.Left) drawLeft=rtDraw.Left;
62910
+ var drawRight=drawLeft+labSize.Width;
62911
+ var drawTop=rtDraw.Bottom;
62912
+
62913
+ var rtLabel={ Left:drawLeft, Right:drawRight, Top:drawTop, Width:labSize.Width, Height:labSize.Height };
62914
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
62915
+
62916
+ this.DrawLabel(this.LableInfo, labSize, rtLabel);
62917
+
62918
+ this.DrawVerticalButton(rtLabel);
62894
62919
  }
62895
62920
 
62896
- this.DrawCustomHLine=function(labInfo, yLine)
62921
+ this.DrawCustomHLine=function(yLine)
62897
62922
  {
62898
- if (!labInfo) return;
62899
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryLine)) return;
62923
+ if (!this.LableInfo) return;
62924
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryLine)) return;
62900
62925
 
62901
62926
  var left=this.Frame.ChartBorder.GetLeft();
62902
62927
  var right=this.Frame.ChartBorder.GetRight();
62903
62928
  var pixelRatio=GetDevicePixelRatio();
62904
62929
 
62905
62930
  var yMax=yLine, yMin=yLine;
62906
- for(var i=0;i<labInfo.AryLine.length;++i)
62931
+ for(var i=0;i<this.LableInfo.AryLine.length;++i)
62907
62932
  {
62908
- var item=labInfo.AryLine[i];
62933
+ var item=this.LableInfo.AryLine[i];
62909
62934
  if (!IFrameSplitOperator.IsNumber(item.Value)) continue;
62910
62935
  if (item.Width<0) continue;
62911
62936
 
@@ -62930,9 +62955,9 @@ function ChartDrawHLine()
62930
62955
  if (yMin>yFixed) yMin=yFixed;
62931
62956
  }
62932
62957
 
62933
- if (yMax!=yMin && labInfo.VLine)
62958
+ if (yMax!=yMin && this.LableInfo.VLine)
62934
62959
  {
62935
- var item=labInfo.VLine;
62960
+ var item=this.LableInfo.VLine;
62936
62961
  var x=left+20*pixelRatio;
62937
62962
  if (IFrameSplitOperator.IsNumber(item.XOffset)) x=left+item.XOffset*pixelRatio;
62938
62963
  x=ToFixedPoint(x);
@@ -62946,14 +62971,14 @@ function ChartDrawHLine()
62946
62971
  }
62947
62972
  }
62948
62973
 
62949
- this.DrawValueText=function(y, rtDraw, labInfo)
62974
+ this.DrawValueText=function(y, rtDraw, option)
62950
62975
  {
62951
62976
  var left=this.Frame.ChartBorder.GetLeft();
62952
62977
  var right=this.Frame.ChartBorder.GetRight();
62953
62978
  var top=this.Frame.ChartBorder.GetTopEx();
62954
62979
  var bottom=this.Frame.ChartBorder.GetBottomEx();
62955
62980
  var pixelTatio = GetDevicePixelRatio();
62956
-
62981
+ var labInfo=this.LabelInfo;
62957
62982
  if (labInfo && IFrameSplitOperator.IsNumber(labInfo.TopOffset)) top-=labInfo.TopOffset;
62958
62983
  if (labInfo && IFrameSplitOperator.IsNumber(labInfo.BottomOffset)) bottom+=labInfo.BottomOffset;
62959
62984
 
@@ -62988,12 +63013,21 @@ function ChartDrawHLine()
62988
63013
  this.Canvas.font=this.Font;
62989
63014
  var textWidth=this.Canvas.measureText(strValue).width;
62990
63015
  var lineHeight=this.GetFontHeight();
62991
- var rtBG={ Left:right+this.RightSpaceWidth, Top:y- lineHeight/2, Width:textWidth+4, Height:lineHeight };
62992
- //rtBG.Right=rtBG.Left+rtBG.Width;
62993
- rtBG.Bottom=rtBG.Top+rtBG.Height;
63016
+ var rtBG={ Left:right+this.RightSpaceWidth, YCenter:y, Width:textWidth, Height:lineHeight };
63017
+ rtBG.Height+=(this.TextMargin.Top+this.TextMargin.Bottom);
62994
63018
  rtBG.Width+=(this.TextMargin.Left+this.TextMargin.Right);
62995
63019
  rtBG.Right=rtBG.Left+rtBG.Width;
62996
- var xText=rtBG.Left+this.TextMargin.Left+2;
63020
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
63021
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
63022
+
63023
+ if (option && IFrameSplitOperator.IsNumber(option.Top))
63024
+ {
63025
+ rtBG.Top=option.Top;
63026
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
63027
+ }
63028
+
63029
+ var xText=rtBG.Left+this.TextMargin.Left;
63030
+ var yText=rtBG.Top+this.TextMargin.Top+this.TextMargin.YOffset;
62997
63031
 
62998
63032
  if (this.ButtonPosition==1)
62999
63033
  {
@@ -63006,8 +63040,8 @@ function ChartDrawHLine()
63006
63040
 
63007
63041
  this.Canvas.fillStyle=this.ValueTextColor
63008
63042
  this.Canvas.textAlign="left";
63009
- this.Canvas.textBaseline="middle";
63010
- this.Canvas.fillText(strValue,xText,y);
63043
+ this.Canvas.textBaseline="top";
63044
+ this.Canvas.fillText(strValue,xText,yText);
63011
63045
 
63012
63046
  rtDraw.Left=rtBG.Left;
63013
63047
  rtDraw.Top=rtBG.Top;
@@ -63017,6 +63051,24 @@ function ChartDrawHLine()
63017
63051
  this.DrawButton(rtBG.Top, rtBG.Right, lineHeight, rtDraw);
63018
63052
  }
63019
63053
 
63054
+ //计算右侧价格标签大小
63055
+ this.CalculateValueText=function(y)
63056
+ {
63057
+ var yValue=this.Frame.GetYData(y,false);
63058
+ var strValue=yValue.toFixed(this.Precision);
63059
+ if (this.LableInfo &&this.LableInfo.PriceSuffixText) strValue+=this.LableInfo.PriceSuffixText;
63060
+
63061
+ this.Canvas.font=this.Font;
63062
+ var textWidth=this.Canvas.measureText(strValue).width;
63063
+ var lineHeight=this.GetFontHeight();
63064
+
63065
+ var size={ Width:textWidth, Height:lineHeight };
63066
+ size.Height+=(this.TextMargin.Top+this.TextMargin.Bottom);
63067
+ size.Width+=(this.TextMargin.Left+this.TextMargin.Right);
63068
+
63069
+ return size;
63070
+ }
63071
+
63020
63072
  this.DrawPriceText=function(text, ptStart, ptEnd, position)
63021
63073
  {
63022
63074
  if (position!=1 && position!=0) return;
@@ -138614,7 +138666,7 @@ function ScrollBarBGChart()
138614
138666
 
138615
138667
 
138616
138668
 
138617
- var HQCHART_VERSION="1.1.13753";
138669
+ var HQCHART_VERSION="1.1.13759";
138618
138670
 
138619
138671
  function PrintHQChartVersion()
138620
138672
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13753";
8
+ var HQCHART_VERSION="1.1.13759";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {