hqchart 1.1.13595 → 1.1.13606

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.
@@ -11026,6 +11026,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11026
11026
  if (!subItem || !subItem.Frame) continue;
11027
11027
 
11028
11028
  var frame=subItem.Frame;
11029
+
11030
+ //自定义刻度每次都调用
11031
+ frame.YCustomSplit=true;
11032
+
11029
11033
  var key=frame.Identify;
11030
11034
  var item=
11031
11035
  {
@@ -14197,6 +14201,7 @@ function IChartFramePainting()
14197
14201
  this.SizeChange=true; //大小是否改变
14198
14202
  this.XYSplit=true; //XY轴坐标信息改变
14199
14203
  this.XSplit=true; //X轴变化
14204
+ this.YCustomSplit=true; //自定义Y轴分割线
14200
14205
 
14201
14206
  this.HorizontalMax; //Y轴最大值
14202
14207
  this.HorizontalMin; //Y轴最小值
@@ -14278,6 +14283,7 @@ function IChartFramePainting()
14278
14283
  this.SizeChange=false;
14279
14284
  this.XYSplit=false;
14280
14285
  this.XSplit=false;
14286
+ this.YCustomSplit=false; //自定义Y轴分割线
14281
14287
  }
14282
14288
 
14283
14289
  this.DrawFrame=function() { }
@@ -17433,7 +17439,18 @@ function MinuteFrame()
17433
17439
  //分割x,y轴坐标信息
17434
17440
  this.SplitXYCoordinate=function()
17435
17441
  {
17436
- if (this.XYSplit==false) return;
17442
+ if (this.XYSplit==false)
17443
+ {
17444
+ //计算自定义刻度
17445
+ if (this.YCustomSplit)
17446
+ {
17447
+ if (this.YSplitOperator && this.YSplitOperator.CustomCoordinate)
17448
+ this.YSplitOperator.CustomCoordinate();
17449
+ }
17450
+
17451
+ return;
17452
+ }
17453
+
17437
17454
  if (this.XSplitOperator!=null) this.XSplitOperator.Operator();
17438
17455
  if (this.YSplitOperator!=null) this.YSplitOperator.Operator();
17439
17456
  }
@@ -18891,6 +18908,8 @@ function OverlayMinuteFrame()
18891
18908
 
18892
18909
  this.SizeChange=false;
18893
18910
  this.XYSplit=false;
18911
+ this.XSplit=false;
18912
+ this.YCustomSplit=false; //自定义Y轴分割线
18894
18913
  }
18895
18914
 
18896
18915
  this.DrawToolbar=function()
@@ -18947,6 +18966,8 @@ function OverlayMinuteHScreenFrame()
18947
18966
 
18948
18967
  this.SizeChange=false;
18949
18968
  this.XYSplit=false;
18969
+ this.XSplit=false;
18970
+ this.YCustomSplit=false; //自定义Y轴分割线
18950
18971
  }
18951
18972
 
18952
18973
  //分割x,y轴坐标信息
@@ -19555,7 +19576,13 @@ function KLineFrame()
19555
19576
  if (this.XSplit)
19556
19577
  {
19557
19578
  if (this.XSplitOperator) this.XSplitOperator.Operator();
19558
- if (this.YSplitOperator && this.YSplitOperator.CustomCoordinate) this.YSplitOperator.CustomCoordinate();
19579
+ }
19580
+
19581
+ if (this.YCustomSplit)
19582
+ {
19583
+ //计算自定义刻度
19584
+ if (this.YSplitOperator && this.YSplitOperator.CustomCoordinate)
19585
+ this.YSplitOperator.CustomCoordinate();
19559
19586
  }
19560
19587
 
19561
19588
  return;
@@ -20327,6 +20354,7 @@ function OverlayKLineFrame()
20327
20354
  this.SizeChange=false;
20328
20355
  this.XYSplit=false;
20329
20356
  this.XSplit=false;
20357
+ this.YCustomSplit=false; //自定义Y轴分割线
20330
20358
  }
20331
20359
 
20332
20360
 
@@ -21614,6 +21642,8 @@ function OverlayKLineHScreenFrame()
21614
21642
 
21615
21643
  this.SizeChange=false;
21616
21644
  this.XYSplit=false;
21645
+ this.XSplit=false;
21646
+ this.YCustomSplit=false; //自定义Y轴分割线
21617
21647
  }
21618
21648
 
21619
21649
  this.DrawTitle=function() //画标题
@@ -52058,6 +52088,8 @@ function FrameSplitMinutePriceY()
52058
52088
 
52059
52089
  this.CustomCoordinate=function() //自定义刻度
52060
52090
  {
52091
+ this.Frame.CustomHorizontalInfo=[];
52092
+
52061
52093
  var data=this.InvokeCustomYCoordinateCallback();
52062
52094
  if (data && data.PreventDefault==true) return;
52063
52095
 
@@ -60338,6 +60370,7 @@ IChartDrawPicture.ArrayDrawPricture=
60338
60370
  { Name:"FibSpeedResistanceFan", ClassName:"ChartFibSpeedResistanceFan", Create:function() { return new ChartFibSpeedResistanceFan(); }}, //斐波那契扇形
60339
60371
  { Name:"PriceRange", ClassName:"ChartPriceRange", Create:function() { return new ChartPriceRange(); }},
60340
60372
  { Name:"DateRange", ClassName:"ChartDateRange", Create:function() { return new ChartDateRange(); }},
60373
+ { Name:"DatePriceRange", ClassName:"ChartDatePriceRange", Create:function() { return new ChartDatePriceRange(); }},
60341
60374
  { Name:"InfoLine", ClassName:"ChartInfoLine", Create:function() { return new ChartInfoLine(); }},
60342
60375
  { Name:"TrendAngle", ClassName:"ChartTrendAngle", Create:function() { return new ChartTrendAngle(); }},
60343
60376
  { Name:"ArrowMarker", ClassName:"ChartArrowMarker", Create:function() { return new ChartArrowMarker(); } },
@@ -60874,10 +60907,10 @@ function ChartArrowMarker()
60874
60907
  this.ClassName='ChartArrowMarker';
60875
60908
  this.IsPointIn=this.IsPointIn_XYValue_Line;
60876
60909
 
60877
- this.InsideAngle=25;
60910
+ this.InsideLineConfig={ Angle:25, MaxWidth:70, WidthRate:0.3 };
60878
60911
  this.InsideWidth=70;
60879
-
60880
- this.OutAngle=35;
60912
+
60913
+ this.OutLineConfig={ Angle:35, MaxWidth:100, WidthRate:0.4 };
60881
60914
  this.OutWidth=100;
60882
60915
 
60883
60916
  this.GetXYCoordinate=this.GetXYCoordinate_default;
@@ -60910,6 +60943,19 @@ function ChartArrowMarker()
60910
60943
  return { Top:{X:topX+ptEnd.X, Y:topY+ptEnd.Y}, Bottom:{X:botX+ptEnd.X, Y:botY+ptEnd.Y} };
60911
60944
  }
60912
60945
 
60946
+ this.CalculateLineWidth=function(ptStart, ptEnd)
60947
+ {
60948
+ var a=ptStart.X-ptEnd.X;
60949
+ var b=ptStart.Y-ptEnd.Y;
60950
+ var c=Math.sqrt(a*a+b*b);
60951
+
60952
+ this.InsideWidth=c*this.InsideLineConfig.WidthRate;
60953
+ this.OutWidth=c*this.OutLineConfig.WidthRate;
60954
+
60955
+ if (this.InsideWidth>this.InsideLineConfig.MaxWidth) this.InsideWidth=this.InsideLineConfig.MaxWidth;
60956
+ if (this.OutWidth>this.OutLineConfig.MaxWidth) this.OutWidth=this.OutLineConfig.MaxWidth;
60957
+ }
60958
+
60913
60959
  this.Draw=function()
60914
60960
  {
60915
60961
  this.LinePoint=[];
@@ -60925,9 +60971,11 @@ function ChartArrowMarker()
60925
60971
  var ptStart=drawPoint[0];
60926
60972
  var ptEnd=drawPoint[1];
60927
60973
 
60974
+ this.CalculateLineWidth(ptStart, ptEnd);
60975
+
60928
60976
  //计算箭头 的两条边线坐标
60929
- var outArrow=this.CalculatePoint(this.OutAngle, ptStart, ptEnd, this.OutWidth);
60930
- var insideArrow=this.CalculatePoint(this.InsideAngle, ptStart, ptEnd, this.InsideWidth);
60977
+ var outArrow=this.CalculatePoint(this.OutLineConfig.Angle, ptStart, ptEnd, this.OutWidth);
60978
+ var insideArrow=this.CalculatePoint(this.InsideLineConfig.Angle, ptStart, ptEnd, this.InsideWidth);
60931
60979
 
60932
60980
  this.Canvas.beginPath();
60933
60981
  this.Canvas.moveTo(ptStart.X,ptStart.Y);
@@ -69875,8 +69923,12 @@ function ChartDateRange()
69875
69923
 
69876
69924
  //文字输出
69877
69925
  var bottom=this.Frame.ChartBorder.GetBottomEx();
69926
+ var top=this.Frame.ChartBorder.GetTopEx();
69878
69927
  var startIndex=this.Frame.GetXData(ptStart.X,false);
69879
69928
  var endIndex=this.Frame.GetXData(ptEnd.X,false);
69929
+ var startValue=this.Frame.GetYData(ptStart.Y,false);
69930
+ var endValue=this.Frame.GetYData(ptEnd.Y,false);
69931
+ var diffValue=endValue-startValue;
69880
69932
  var barCount=endIndex-startIndex+1;
69881
69933
  var text=`${barCount} bars`;
69882
69934
 
@@ -69884,13 +69936,27 @@ function ChartDateRange()
69884
69936
  var textHeight=this.GetFontHeight();
69885
69937
  var textWidth=this.Canvas.measureText(text).width+4+(this.Label.LeftMargin+this.Label.RightMargin);
69886
69938
  var rtTextBG={ Left:xCenter-textWidth/2, Top:ptEnd.Y+4, Width:textWidth, Height:textHeight+2 };
69939
+ if (diffValue>0) rtTextBG.Top=ptEnd.Y-rtTextBG.Height-4;
69940
+ else rtTextBG.Top=ptEnd.Y+4;
69887
69941
  rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
69888
69942
 
69889
- if (rtTextBG.Bottom>=bottom)
69943
+ if (diffValue>0)
69944
+ {
69945
+ if (rtTextBG.Top<=top)
69946
+ {
69947
+ rtTextBG.Top=top;
69948
+ rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
69949
+ }
69950
+ }
69951
+ else
69890
69952
  {
69891
- rtTextBG.Bottom=bottom;
69892
- rtTextBG.Top=rtTextBG.Bottom-rtTextBG.Height;
69953
+ if (rtTextBG.Bottom>=bottom)
69954
+ {
69955
+ rtTextBG.Bottom=bottom;
69956
+ rtTextBG.Top=rtTextBG.Bottom-rtTextBG.Height;
69957
+ }
69893
69958
  }
69959
+
69894
69960
 
69895
69961
  if (this.Label.EnableBGColor)
69896
69962
  {
@@ -69908,6 +69974,169 @@ function ChartDateRange()
69908
69974
  }
69909
69975
  }
69910
69976
 
69977
+ function ChartDatePriceRange()
69978
+ {
69979
+ this.newMethod=IChartDrawPicture; //派生
69980
+ this.newMethod();
69981
+ delete this.newMethod;
69982
+
69983
+ this.ClassName='ChartDatePriceRange';
69984
+ this.PointCount=2;
69985
+ this.Font=12*GetDevicePixelRatio() +"px 微软雅黑";
69986
+ this.TextColor=this.LineColor;
69987
+ this.IsPointIn=this.IsPointIn_XYValue_Line;
69988
+ this.GetXYCoordinate=this.GetXYCoordinate_default;
69989
+ this.PointToValue_Default=this.PointToValue;
69990
+ this.OnlyMoveXIndex=true;
69991
+ this.IsSupportMagnet=true;
69992
+ this.LineWidth=1;
69993
+ this.EnableBGColor=true;
69994
+ this.BGColor=IChartDrawPicture.ColorToRGBA(this.LineColor,0.15);
69995
+ this.ExtendLine={ Top:false, Bottom: false }; //延长线
69996
+
69997
+ this.Label={ TextColor:"rgb(0,0,0)", BGColor:"rgb(211,211,211)", EnableBGColor:true, LeftMargin:5, RightMargin:5 };
69998
+
69999
+ this.Draw=function()
70000
+ {
70001
+ this.LinePoint=[];
70002
+ if (this.IsFrameMinSize()) return;
70003
+ if (!this.IsShow) return;
70004
+
70005
+ var bCheckXY=true;
70006
+ var drawPoint=this.CalculateDrawPoint( {IsCheckX:bCheckXY, IsCheckY:bCheckXY} );
70007
+ if (!drawPoint) return;
70008
+ if (drawPoint.length!=2) return;
70009
+
70010
+ this.ClipFrame();
70011
+
70012
+ var ptStart=drawPoint[0];
70013
+ var ptEnd=drawPoint[1];
70014
+
70015
+ this.SetLineWidth();
70016
+ this.DrawRange(ptStart,ptEnd);
70017
+ this.RestoreLineWidth();
70018
+
70019
+ this.DrawPoint(drawPoint); //画点
70020
+ this.Canvas.restore();
70021
+ }
70022
+
70023
+ this.DrawRange=function(ptStart, ptEnd)
70024
+ {
70025
+ var yTop=Math.min(ptStart.Y, ptEnd.Y);
70026
+ var yBottom=Math.max(ptStart.Y, ptEnd.Y);
70027
+ var xLeft=Math.min(ptStart.X, ptEnd.X);
70028
+ var xRight=Math.max(ptStart.X, ptEnd.X);
70029
+ var height=yBottom-yTop;
70030
+ var width=xRight-xLeft;
70031
+ var yCenter=ptStart.Y+(ptEnd.Y-ptStart.Y)/2;
70032
+ var xCenter=ptStart.X+(ptEnd.X-ptStart.X)/2;
70033
+
70034
+ if (this.ExtendLine.Top) yTop=this.Frame.ChartBorder.GetTopEx();
70035
+ if (this.ExtendLine.Bottom) yBottom=this.Frame.ChartBorder.GetBottomEx();
70036
+
70037
+ if (this.EnableBGColor)
70038
+ {
70039
+ var rtBG={ Left:xLeft, Top:yTop, Right:xRight, Bottom:yBottom };
70040
+ rtBG.Width=rtBG.Right-rtBG.Left;
70041
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
70042
+ this.Canvas.fillStyle=this.BGColor;
70043
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
70044
+ }
70045
+
70046
+ this.Canvas.strokeStyle=this.LineColor;
70047
+ this.Canvas.beginPath();
70048
+ this.Canvas.moveTo(ToFixedPoint(xLeft),yTop);
70049
+ this.Canvas.lineTo(ToFixedPoint(xLeft),yBottom);
70050
+
70051
+ this.Canvas.moveTo(ToFixedPoint(xRight),yTop);
70052
+ this.Canvas.lineTo(ToFixedPoint(xRight),yBottom);
70053
+
70054
+ this.Canvas.moveTo(ToFixedPoint(xLeft),ToFixedPoint(yCenter));
70055
+ this.Canvas.lineTo(ToFixedPoint(xRight),ToFixedPoint(yCenter));
70056
+
70057
+ this.Canvas.moveTo(ToFixedPoint(xCenter),ToFixedPoint(yTop));
70058
+ this.Canvas.lineTo(ToFixedPoint(xCenter),ToFixedPoint(yBottom));
70059
+
70060
+ this.Canvas.stroke();
70061
+
70062
+ this.LinePoint.push({ Start:{X:xLeft, Y:yTop}, End:{X:xLeft, Y:yBottom} });
70063
+ this.LinePoint.push({ Start:{X:xRight, Y:yTop}, End:{X:xRight, Y:yBottom} });
70064
+ this.LinePoint.push({ Start:{X:xLeft, Y:yCenter}, End:{X:xRight, Y:yCenter} });
70065
+
70066
+ this.DrawArrow({X:ptStart.X, Y:ToFixedPoint(yCenter)}, {X:ptEnd.X, Y:ToFixedPoint(yCenter)});
70067
+ this.DrawArrow({X:ToFixedPoint(xCenter), Y:ptStart.Y}, {X:ToFixedPoint(xCenter), Y:ptEnd.Y});
70068
+
70069
+ //文字输出
70070
+ var bottom=this.Frame.ChartBorder.GetBottomEx();
70071
+ var top=this.Frame.ChartBorder.GetTopEx();
70072
+ var startIndex=this.Frame.GetXData(ptStart.X,false);
70073
+ var endIndex=this.Frame.GetXData(ptEnd.X,false);
70074
+ var barCount=endIndex-startIndex+1;
70075
+ var startValue=this.Frame.GetYData(ptStart.Y,false);
70076
+ var endValue=this.Frame.GetYData(ptEnd.Y,false);
70077
+ var diffValue=endValue-startValue;
70078
+
70079
+ var rate=(diffValue/startValue)*100;
70080
+ var aryText=
70081
+ [
70082
+ `${diffValue.toFixed(2)} (${rate.toFixed(2)}%)`,
70083
+ `${barCount} bars`
70084
+ ];
70085
+
70086
+ this.Canvas.font=this.Font;
70087
+ var textHeight=this.GetFontHeight();
70088
+ var textWidth=0;
70089
+ for(var i=0;i<aryText.length;++i)
70090
+ {
70091
+ var text=aryText[i];
70092
+ var value=this.Canvas.measureText(text).width;
70093
+ if (textWidth<value) textWidth=value;
70094
+ }
70095
+ textWidth+=(this.Label.LeftMargin+this.Label.RightMargin);
70096
+
70097
+ var rtTextBG={ Left:xCenter-textWidth/2, Top:ptEnd.Y+4, Width:textWidth, Height:aryText.length*textHeight+2 };
70098
+ if (diffValue>0) rtTextBG.Top=ptEnd.Y-rtTextBG.Height-4;
70099
+ else rtTextBG.Top=ptEnd.Y+4;
70100
+ rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
70101
+
70102
+ if (diffValue>0)
70103
+ {
70104
+ if (rtTextBG.Top<=top)
70105
+ {
70106
+ rtTextBG.Top=top;
70107
+ rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
70108
+ }
70109
+ }
70110
+ else
70111
+ {
70112
+ if (rtTextBG.Bottom>=bottom)
70113
+ {
70114
+ rtTextBG.Bottom=bottom;
70115
+ rtTextBG.Top=rtTextBG.Bottom-rtTextBG.Height;
70116
+ }
70117
+ }
70118
+
70119
+ if (this.Label.EnableBGColor)
70120
+ {
70121
+ var path=new Path2D();
70122
+ path.roundRect(ToFixedPoint(rtTextBG.Left), ToFixedPoint(rtTextBG.Top), ToFixedRect(rtTextBG.Width), ToFixedRect(rtTextBG.Height), [3]);
70123
+ this.Canvas.fillStyle=this.Label.BGColor;
70124
+ this.Canvas.fill(path);
70125
+ }
70126
+
70127
+ this.Canvas.fillStyle=this.Label.TextColor;
70128
+ this.Canvas.textAlign="left";
70129
+ this.Canvas.textBaseline="bottom";
70130
+ var yText=rtTextBG.Bottom-2;
70131
+ for(var i=0;i<aryText.length;++i)
70132
+ {
70133
+ var text=aryText[i];
70134
+ this.Canvas.fillText(text,rtTextBG.Left+2+this.Label.LeftMargin,yText);
70135
+ yText-=textHeight;
70136
+ }
70137
+ }
70138
+ }
70139
+
69911
70140
  //线段信息统计
69912
70141
  function ChartInfoLine()
69913
70142
  {
@@ -132682,7 +132911,14 @@ function ChartReport()
132682
132911
 
132683
132912
  if (buttonData.Type===0) //checkbox
132684
132913
  {
132685
- var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, Data:buttonData.Data, PreventDefault: false };
132914
+ var sendData=
132915
+ {
132916
+ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, ColumnIndex:buttonData.ColumnIndex,
132917
+ Data:buttonData.Data, Value:true,
132918
+ PreventDefault: false
132919
+ };
132920
+ if (IFrameSplitOperator.IsBool(buttonData.Data.Checked)) sendData.Value=!buttonData.Data.Checked;
132921
+
132686
132922
  this.SendClickEvent(JSCHART_EVENT_ID.ON_CLICK_REPORT_CHECKBOX, sendData)
132687
132923
 
132688
132924
  if (!sendData.PreventDefault)
@@ -132698,7 +132934,7 @@ function ChartReport()
132698
132934
  }
132699
132935
  else if (buttonData.Type===1) //button
132700
132936
  {
132701
- var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, Data:buttonData.Data };
132937
+ var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, ColumnIndex:buttonData.ColumnIndex, Data:buttonData.Data };
132702
132938
  this.SendClickEvent(JSCHART_EVENT_ID.ON_CLICK_REPORT_BUTTON, sendData)
132703
132939
 
132704
132940
  status.Redraw=true;
@@ -132706,7 +132942,7 @@ function ChartReport()
132706
132942
  }
132707
132943
  else if (buttonData.Type===2) //link
132708
132944
  {
132709
- var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, Data:buttonData.Data };
132945
+ var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, ColumnIndex:buttonData.ColumnIndex, Data:buttonData.Data };
132710
132946
  this.SendClickEvent(JSCHART_EVENT_ID.ON_CLICK_REPORT_LINK, sendData)
132711
132947
 
132712
132948
  status.Redraw=true;
@@ -136860,7 +137096,7 @@ function ScrollBarBGChart()
136860
137096
 
136861
137097
 
136862
137098
 
136863
- var HQCHART_VERSION="1.1.13594";
137099
+ var HQCHART_VERSION="1.1.13605";
136864
137100
 
136865
137101
  function PrintHQChartVersion()
136866
137102
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13594";
8
+ var HQCHART_VERSION="1.1.13605";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {