hqchart 1.1.13746 → 1.1.13758

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.
@@ -30665,6 +30665,7 @@ function ChartLine()
30665
30665
  this.LineWidth; //线段宽度
30666
30666
  this.DrawType=0; //画图方式 0=无效数平滑 1=无效数不画断开
30667
30667
  this.IsDotLine=false; //虚线
30668
+ this.LineDash=g_JSChartResource.DOTLINE.LineDash;
30668
30669
  this.BreakPoint; //断开的点索引 Set();
30669
30670
 
30670
30671
 
@@ -30710,7 +30711,7 @@ function ChartLine()
30710
30711
 
30711
30712
  this.Canvas.save();
30712
30713
  if (this.LineWidth>0) this.Canvas.lineWidth=this.LineWidth * GetDevicePixelRatio();
30713
- if (this.IsDotLine) this.Canvas.setLineDash(g_JSChartResource.DOTLINE.LineDash); //画虚线
30714
+ if (this.IsDotLine) this.Canvas.setLineDash(this.LineDash); //画虚线
30714
30715
  var bFirstPoint=true;
30715
30716
  var drawCount=0;
30716
30717
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
@@ -30777,7 +30778,7 @@ function ChartLine()
30777
30778
  this.ClipClient(bHScreen);
30778
30779
  if (this.LineWidth>0) this.Canvas.lineWidth=this.LineWidth * GetDevicePixelRatio();
30779
30780
  this.Canvas.strokeStyle=this.Color;
30780
- if (this.IsDotLine) this.Canvas.setLineDash(g_JSChartResource.DOTLINE.LineDash); //画虚线
30781
+ if (this.IsDotLine) this.Canvas.setLineDash(this.LineDash); //画虚线
30781
30782
 
30782
30783
  var bFirstPoint=true;
30783
30784
  var ptFirst=null;; //第1个点
@@ -30874,7 +30875,7 @@ function ChartLine()
30874
30875
  this.ClipClient(bHScreen);
30875
30876
  if (this.LineWidth>0) this.Canvas.lineWidth=this.LineWidth * GetDevicePixelRatio();
30876
30877
  this.Canvas.strokeStyle=this.Color;
30877
- if (this.IsDotLine) this.Canvas.setLineDash(g_JSChartResource.DOTLINE.LineDash); //画虚线
30878
+ if (this.IsDotLine) this.Canvas.setLineDash(this.LineDash); //画虚线
30878
30879
 
30879
30880
  var bFirstPoint=true;
30880
30881
  var ptFirst=null;; //第1个点
@@ -36184,7 +36185,9 @@ function ChartClipColorStick()
36184
36185
  var yBottom=this.ChartFrame.GetYFromData(this.BaseValue);
36185
36186
  var aryBar=[], aryDiffBar=[], aryText=[];
36186
36187
  var preValue=null;
36187
- for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
36188
+ var start=this.Data.DataOffset;
36189
+ if (start-1>0) preValue=this.Data.Data[start-1]; //上一个数值
36190
+ for(var i=start,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
36188
36191
  {
36189
36192
  var value=this.Data.Data[i];
36190
36193
  if (value==null) continue;
@@ -58548,7 +58551,7 @@ function ChartDrawHLine()
58548
58551
  this.ButtonBGColor='rgb(190,190,190)';
58549
58552
  this.ButtonSpace=3;
58550
58553
 
58551
- this.TextMargin={ Left:0, Right:0 };
58554
+ this.TextMargin={ Left:0, Right:0, Top:0, Bottom:0, YOffset:4*GetDevicePixelRatio() };
58552
58555
 
58553
58556
  this.AlwaysShowLab=false; //总是显示标签
58554
58557
 
@@ -58572,7 +58575,9 @@ function ChartDrawHLine()
58572
58575
  `${12*GetDevicePixelRatio()}px 微软雅黑`,
58573
58576
  `${12*GetDevicePixelRatio()}px 微软雅黑`,
58574
58577
  ],
58575
- };
58578
+ };
58579
+
58580
+ this.LableInfo; //{ Position:2=右侧外部 }
58576
58581
 
58577
58582
  //内部变量
58578
58583
  this.ColseButtonSize=0;
@@ -58580,7 +58585,7 @@ function ChartDrawHLine()
58580
58585
  this.ButtonBGWidth=0;
58581
58586
  this.VerticalButtonInfo={ Width:0, Height:0 }; //垂直按钮信息
58582
58587
 
58583
-
58588
+ this.IsPointIn=this.IsPointIn_XYValue_Line;
58584
58589
 
58585
58590
  this.SetOption=function(option)
58586
58591
  {
@@ -58641,6 +58646,9 @@ function ChartDrawHLine()
58641
58646
  var item=option.TextMargin;
58642
58647
  if (IFrameSplitOperator.IsNumber(item.Left)) this.TextMargin.Left=item.Left;
58643
58648
  if (IFrameSplitOperator.IsNumber(item.Right)) this.TextMargin.Right=item.Right;
58649
+ if (IFrameSplitOperator.IsNumber(item.Top)) this.TextMargin.Top=item.Top;
58650
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) this.TextMargin.Bottom=item.Bottom;
58651
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) this.TextMargin.YOffset=item.YOffset;
58644
58652
  }
58645
58653
  }
58646
58654
  }
@@ -58657,10 +58665,6 @@ function ChartDrawHLine()
58657
58665
  return storageData;
58658
58666
  }
58659
58667
 
58660
-
58661
- this.IsPointIn=this.IsPointIn_XYValue_Line;
58662
-
58663
-
58664
58668
  /*
58665
58669
  this.GetXYCoordinate=function()
58666
58670
  {
@@ -58717,7 +58721,7 @@ function ChartDrawHLine()
58717
58721
  this.ColseButtonSize=0;
58718
58722
  this.SettingButtonSize=0;
58719
58723
  this.ButtonBGWidth=0;
58720
-
58724
+ this.LableInfo=null;
58721
58725
  this.VerticalButtonInfo.Width=0;
58722
58726
  this.VerticalButtonInfo.Height=0;
58723
58727
 
@@ -58780,7 +58784,7 @@ function ChartDrawHLine()
58780
58784
  }
58781
58785
  this.LinePoint.push(line);
58782
58786
 
58783
- if (bVisibleRange)
58787
+ if (bVisibleRange) //在可视范围内
58784
58788
  {
58785
58789
  var yValue=this.Frame.GetYData(drawPoint[0].Y, false);
58786
58790
  var strPrice=yValue.toFixed(this.Precision);
@@ -58794,15 +58798,11 @@ function ChartDrawHLine()
58794
58798
  this.DrawPriceText(strPrice, line.Start, line.End, 1);
58795
58799
  }
58796
58800
  }
58797
-
58798
- var labInfo;
58799
- if (this.GetLabelCallback) labInfo=this.GetLabelCallback(this);
58801
+
58802
+ if (this.GetLabelCallback) this.LableInfo=this.GetLabelCallback(this);
58800
58803
 
58801
58804
  this.AryShowButton=this.GetShowButton(); //获取按钮
58802
-
58803
- //框架内的描述信息
58804
- if (labInfo && bVisibleRange)
58805
- this.DrawLab(labInfo, drawPoint[0].Y);
58805
+ if (bVisibleRange) this.DrawInternalLabel(drawPoint[0].Y); //内部价格标签
58806
58806
 
58807
58807
  //画中心点
58808
58808
  if (bVisibleRange)
@@ -58819,11 +58819,12 @@ function ChartDrawHLine()
58819
58819
  {
58820
58820
  var rtDraw={ };
58821
58821
  this.CalculateButtonSize();
58822
- this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
58823
- if (labInfo) this.DrawRightLab(labInfo, rtDraw);
58824
- if (labInfo && bVisibleRange) this.DrawCustomHLine(labInfo, drawPoint[0].Y);
58822
+ this.DrawValueText(drawPoint[0].Y, rtDraw);
58823
+ this.DrawRightLabel(rtDraw);
58824
+ if (bVisibleRange) this.DrawCustomHLine(drawPoint[0].Y);
58825
58825
  }
58826
58826
 
58827
+
58827
58828
  //鼠标是否在按钮上
58828
58829
  if (moveonPoint && mouseStatus)
58829
58830
  {
@@ -58871,113 +58872,130 @@ function ChartDrawHLine()
58871
58872
  ++lineCount;
58872
58873
  }
58873
58874
 
58874
- var size={ Width:maxWidth, Height: lineCount*(lineHeight+lineSpace)+lineSpace, NameWidth:maxNameWidth, TextWidth:maxTextWidth, LineHeight:lineHeight };
58875
+ var size={ Width:maxWidth, Height:lineCount*lineHeight+(lineCount-1)*lineSpace, NameWidth:maxNameWidth, TextWidth:maxTextWidth, LineHeight:lineHeight };
58876
+ if (labInfo.LabelMargin)
58877
+ {
58878
+ var item=labInfo.LabelMargin;
58879
+ if (IFrameSplitOperator.IsNumber(item.Left)) size.Width+=item.Left;
58880
+ if (IFrameSplitOperator.IsNumber(item.Right)) size.Width+=item.Right;
58881
+ if (IFrameSplitOperator.IsNumber(item.Top)) size.Height+=item.Top;
58882
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) size.Height+=item.Bottom;
58883
+ }
58875
58884
 
58876
58885
  return size;
58877
58886
  }
58878
58887
 
58879
- this.DrawLab=function(labInfo, y)
58888
+ //绘制窗口内部标签
58889
+ this.DrawInternalLabel=function(y)
58880
58890
  {
58881
- if (!labInfo) return;
58882
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText)) return;
58883
- if (labInfo.Position===2) return;
58891
+ if (!this.LableInfo || !IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryText)) return;
58892
+ if (this.LableInfo.Position==2) return;
58884
58893
 
58885
- var left=this.Frame.ChartBorder.GetLeft();
58886
- var right=this.Frame.ChartBorder.GetRight();
58887
- var labSize=this.CalculateLabSize(labInfo);
58894
+ var border=this.Frame.GetBorder();
58895
+ var left=border.Left;
58896
+ var right=border.Right;
58897
+ var labSize=this.CalculateLabSize(this.LableInfo);
58888
58898
  var drawLeft=right-labSize.Width;
58899
+ var drawRight=drawLeft+labSize.Width;
58889
58900
  var drawTop=y-labSize.Height-1;
58901
+ if (drawTop<=border.TopEx) drawTop=y+1;
58902
+
58903
+ var rtLabel={ Left:drawLeft, Right:drawRight, Top:drawTop, Width:labSize.Width, Height:labSize.Height };
58904
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
58905
+
58906
+ this.DrawLabel(this.LableInfo, labSize, rtLabel);
58907
+ }
58890
58908
 
58909
+ //绘制标签页
58910
+ this.DrawLabel=function(labelInfo, labelSize, rtLabel)
58911
+ {
58891
58912
  //背景色
58892
- if (labInfo.BGColor)
58913
+ if (labelInfo.BGColor)
58893
58914
  {
58894
- this.Canvas.fillStyle=labInfo.BGColor;
58895
- var rtTop=y-labSize.Height-4;
58896
- this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(right+drawLeft),ToFixedRect(y-rtTop));
58915
+ this.Canvas.fillStyle=labelInfo.BGColor;
58916
+ this.Canvas.fillRect(ToFixedRect(rtLabel.Left),ToFixedRect(rtLabel.Top),ToFixedRect(rtLabel.Width),ToFixedRect(rtLabel.Height));
58897
58917
  }
58898
58918
 
58899
- var yText=drawTop;
58900
- for(var i=0;i<labInfo.AryText.length;++i)
58919
+ var labelMargin=labelInfo.LabelMargin;
58920
+ var lineSpace=0;
58921
+ if (IFrameSplitOperator.IsNumber(labelInfo.LineSpace)) lineSpace=labelInfo.LineSpace;
58922
+
58923
+ var yText=rtLabel.Top;
58924
+ var xText=rtLabel.Left;
58925
+ var yRightText=rtLabel.Right;
58926
+
58927
+ if (labelMargin)
58901
58928
  {
58902
- var item=labInfo.AryText[i];
58929
+ if (IFrameSplitOperator.IsNumber(labelMargin.Left)) xText+=labelMargin.Left;
58930
+ if (IFrameSplitOperator.IsNumber(labelMargin.Right)) yRightText-=labelMargin.Right;
58931
+ if (IFrameSplitOperator.IsNumber(labelMargin.Top)) yText+=labelMargin.Top;
58932
+
58933
+ }
58934
+
58935
+ this.Canvas.font=this.TextFont;
58936
+ this.Canvas.textBaseline="top";
58937
+ for(var i=0;i<labelInfo.AryText.length;++i)
58938
+ {
58939
+ if (i>0) yText+=lineSpace;
58940
+ var item=labelInfo.AryText[i];
58903
58941
  if (item.Name)
58904
58942
  {
58943
+ this.Canvas.textAlign="left";
58905
58944
  this.Canvas.fillStyle=item.NameColor;
58906
- this.Canvas.fillText(item.Name,drawLeft+1,yText+1);
58945
+ this.Canvas.fillText(item.Name,xText,yText);
58907
58946
  }
58908
58947
 
58909
58948
  if (item.Text)
58910
58949
  {
58950
+ this.Canvas.textAlign="right";
58911
58951
  this.Canvas.fillStyle=item.TextColor;
58912
- this.Canvas.fillText(item.Text,drawLeft+labSize.NameWidth+1,yText+1);
58952
+ this.Canvas.fillText(item.Text,yRightText,yText);
58913
58953
  }
58914
58954
 
58915
- yText+=labSize.LineHeight;
58955
+ yText+=labelSize.LineHeight;
58916
58956
  }
58917
58957
  }
58918
58958
 
58919
- this.DrawRightLab=function(labInfo, rtLeftDraw)
58959
+ this.DrawRightLabel=function(rtLeftDraw)
58920
58960
  {
58921
- if (!labInfo) return;
58922
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText)) return;
58923
- if (labInfo.Position!=2) return;
58924
- var labSize=this.CalculateLabSize(labInfo);
58961
+ if (!this.LableInfo || !IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryText)) return;
58962
+ if (this.LableInfo.Position!=2) return;
58963
+
58964
+ var labSize=this.CalculateLabSize(this.LableInfo);
58965
+ var border=this.Frame.GetBorder();
58925
58966
 
58926
58967
  var drawLeft=rtLeftDraw.Right-labSize.Width;
58927
58968
  if (drawLeft<rtLeftDraw.Left) drawLeft=rtLeftDraw.Left;
58928
58969
  var drawRight=drawLeft+labSize.Width;
58929
- var drawTop=rtLeftDraw.Bottom;
58930
- var lineSpace=0;
58931
- if (IFrameSplitOperator.IsNumber(labInfo.LineSpace)) lineSpace=labInfo.LineSpace;
58932
58970
 
58933
- //背景色
58934
- var rtLab={ Left:drawLeft, Top:drawTop, Width:labSize.Width, Height:labSize.Height }
58935
- rtLab.Right=rtLab.Left+rtLab.Width;
58936
- rtLab.Bottom=rtLab.Top+rtLab.Height;
58937
- if (labInfo.BGColor)
58938
- {
58939
- this.Canvas.fillStyle=labInfo.BGColor;
58940
- this.Canvas.fillRect(ToFixedRect(rtLab.Left),ToFixedRect(rtLab.Top),ToFixedRect(rtLab.Width),ToFixedRect(rtLab.Height));
58941
- }
58971
+ var drawTop=rtLeftDraw.Bottom;
58942
58972
 
58943
- var yText=drawTop+1+lineSpace;
58944
- this.Canvas.textBaseline="top";
58945
- for(var i=0;i<labInfo.AryText.length;++i)
58973
+ var rtLabel={ Left:drawLeft, Right:drawRight, Top:drawTop, Width:labSize.Width, Height:labSize.Height };
58974
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
58975
+ if (rtLabel.Bottom>border.Bottom) //标签页超过窗口底部 绘制到价格标签上面
58946
58976
  {
58947
- var item=labInfo.AryText[i];
58948
- if (item.Name)
58949
- {
58950
- this.Canvas.textAlign="left";
58951
- this.Canvas.fillStyle=item.NameColor;
58952
- this.Canvas.fillText(item.Name,drawLeft+1,yText+1);
58953
- }
58954
-
58955
- if (item.Text)
58956
- {
58957
- this.Canvas.textAlign="right";
58958
- this.Canvas.fillStyle=item.TextColor;
58959
- this.Canvas.fillText(item.Text,drawRight-1,yText+1);
58960
- }
58961
-
58962
- yText+=labSize.LineHeight+lineSpace;
58977
+ rtLabel.Bottom=rtLeftDraw.Top;
58978
+ rtLabel.Top=rtLabel.Bottom-rtLabel.Height;
58963
58979
  }
58964
58980
 
58965
- this.DrawVerticalButton(rtLab);
58981
+ this.DrawLabel(this.LableInfo, labSize, rtLabel);
58982
+
58983
+ this.DrawVerticalButton(rtLabel);
58966
58984
  }
58967
58985
 
58968
- this.DrawCustomHLine=function(labInfo, yLine)
58986
+ this.DrawCustomHLine=function(yLine)
58969
58987
  {
58970
- if (!labInfo) return;
58971
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryLine)) return;
58988
+ if (!this.LableInfo) return;
58989
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryLine)) return;
58972
58990
 
58973
58991
  var left=this.Frame.ChartBorder.GetLeft();
58974
58992
  var right=this.Frame.ChartBorder.GetRight();
58975
58993
  var pixelRatio=GetDevicePixelRatio();
58976
58994
 
58977
58995
  var yMax=yLine, yMin=yLine;
58978
- for(var i=0;i<labInfo.AryLine.length;++i)
58996
+ for(var i=0;i<this.LableInfo.AryLine.length;++i)
58979
58997
  {
58980
- var item=labInfo.AryLine[i];
58998
+ var item=this.LableInfo.AryLine[i];
58981
58999
  if (!IFrameSplitOperator.IsNumber(item.Value)) continue;
58982
59000
  if (item.Width<0) continue;
58983
59001
 
@@ -59002,9 +59020,9 @@ function ChartDrawHLine()
59002
59020
  if (yMin>yFixed) yMin=yFixed;
59003
59021
  }
59004
59022
 
59005
- if (yMax!=yMin && labInfo.VLine)
59023
+ if (yMax!=yMin && this.LableInfo.VLine)
59006
59024
  {
59007
- var item=labInfo.VLine;
59025
+ var item=this.LableInfo.VLine;
59008
59026
  var x=left+20*pixelRatio;
59009
59027
  if (IFrameSplitOperator.IsNumber(item.XOffset)) x=left+item.XOffset*pixelRatio;
59010
59028
  x=ToFixedPoint(x);
@@ -59018,14 +59036,14 @@ function ChartDrawHLine()
59018
59036
  }
59019
59037
  }
59020
59038
 
59021
- this.DrawValueText=function(y, rtDraw, labInfo)
59039
+ this.DrawValueText=function(y, rtDraw)
59022
59040
  {
59023
59041
  var left=this.Frame.ChartBorder.GetLeft();
59024
59042
  var right=this.Frame.ChartBorder.GetRight();
59025
59043
  var top=this.Frame.ChartBorder.GetTopEx();
59026
59044
  var bottom=this.Frame.ChartBorder.GetBottomEx();
59027
59045
  var pixelTatio = GetDevicePixelRatio();
59028
-
59046
+ var labInfo=this.LabelInfo;
59029
59047
  if (labInfo && IFrameSplitOperator.IsNumber(labInfo.TopOffset)) top-=labInfo.TopOffset;
59030
59048
  if (labInfo && IFrameSplitOperator.IsNumber(labInfo.BottomOffset)) bottom+=labInfo.BottomOffset;
59031
59049
 
@@ -59060,12 +59078,15 @@ function ChartDrawHLine()
59060
59078
  this.Canvas.font=this.Font;
59061
59079
  var textWidth=this.Canvas.measureText(strValue).width;
59062
59080
  var lineHeight=this.GetFontHeight();
59063
- var rtBG={ Left:right+this.RightSpaceWidth, Top:y- lineHeight/2, Width:textWidth+4, Height:lineHeight };
59064
- //rtBG.Right=rtBG.Left+rtBG.Width;
59065
- rtBG.Bottom=rtBG.Top+rtBG.Height;
59081
+ var rtBG={ Left:right+this.RightSpaceWidth, YCenter:y, Width:textWidth, Height:lineHeight };
59082
+ rtBG.Height+=(this.TextMargin.Top+this.TextMargin.Bottom);
59066
59083
  rtBG.Width+=(this.TextMargin.Left+this.TextMargin.Right);
59067
59084
  rtBG.Right=rtBG.Left+rtBG.Width;
59068
- var xText=rtBG.Left+this.TextMargin.Left+2;
59085
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
59086
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
59087
+
59088
+ var xText=rtBG.Left+this.TextMargin.Left;
59089
+ var yText=rtBG.Top+this.TextMargin.Top+this.TextMargin.YOffset;
59069
59090
 
59070
59091
  if (this.ButtonPosition==1)
59071
59092
  {
@@ -59078,8 +59099,8 @@ function ChartDrawHLine()
59078
59099
 
59079
59100
  this.Canvas.fillStyle=this.ValueTextColor
59080
59101
  this.Canvas.textAlign="left";
59081
- this.Canvas.textBaseline="middle";
59082
- this.Canvas.fillText(strValue,xText,y);
59102
+ this.Canvas.textBaseline="top";
59103
+ this.Canvas.fillText(strValue,xText,yText);
59083
59104
 
59084
59105
  rtDraw.Left=rtBG.Left;
59085
59106
  rtDraw.Top=rtBG.Top;